Upload BSD-licensed Vlv2TbltDevicePkg and Vlv2DeviceRefCodePkg to

https://svn.code.sf.net/p/edk2/code/trunk/edk2/, 

which are for MinnowBoard MAX open source project.


Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: David Wei <david.wei@intel.com>
Reviewed-by: Mike Wu <mike.wu@intel.com>
Reviewed-by: Hot Tian <hot.tian@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16599 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
David Wei
2015-01-12 09:37:20 +00:00
committed by zwei4
parent 6f785cfcc3
commit 3cbfba02fe
518 changed files with 118538 additions and 0 deletions

View File

@@ -0,0 +1,349 @@
/** @file
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
LpcDriver.c
Abstract:
EFI Lpc Driver for a Generic PC Platform
--*/
#include "LpcDriver.h"
#include "IndustryStandard/Pci22.h"
//
// This driver is for ACPI(PNP0A03,0)/PCI(0x1f,0)
//
//
// Lpc Driver Global Variables
//
EFI_DRIVER_BINDING_PROTOCOL gLpcDriver = {
LpcDriverSupported,
LpcDriverStart,
LpcDriverStop,
0x10,
NULL,
NULL
};
LPC_DEV mLpc = {
LPC_DEV_SIGNATURE,
NULL,
{
IsaDeviceEnumerate,
IsaDeviceSetPower,
IsaGetCurrentResource,
IsaGetPossibleResource,
IsaSetResource,
IsaEnableDevice,
IsaInitDevice,
LpcInterfaceInit
},
NULL
};
BOOLEAN InitExecuted = FALSE;
/**
the entry point of the Lpc driver
**/
EFI_STATUS
EFIAPI
LpcDriverEntryPoint(
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
return EfiLibInstallDriverBinding (ImageHandle, SystemTable, &gLpcDriver, ImageHandle);
}
/**
ControllerDriver Protocol Method
**/
EFI_STATUS
EFIAPI
LpcDriverSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
EFI_STATUS Status;
EFI_PCI_IO_PROTOCOL *PciIo;
EFI_DEVICE_PATH_PROTOCOL *IsaBridgeDevicePath;
ACPI_HID_DEVICE_PATH *AcpiNode;
PCI_DEVICE_PATH *PciNode;
PCI_TYPE00 Pci;
//
// Get the ISA bridge's Device Path and test it
// the following code is specific
//
Status = gBS->OpenProtocol (
Controller,
&gEfiDevicePathProtocolGuid,
(VOID **)&IsaBridgeDevicePath,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
if (EFI_ERROR (Status)) {
return Status;
}
Status = EFI_SUCCESS;
AcpiNode = (ACPI_HID_DEVICE_PATH *)IsaBridgeDevicePath;
if (AcpiNode->Header.Type != ACPI_DEVICE_PATH ||
AcpiNode->Header.SubType != ACPI_DP ||
DevicePathNodeLength (&AcpiNode->Header) != sizeof(ACPI_HID_DEVICE_PATH) ||
AcpiNode -> HID != EISA_PNP_ID(0x0A03) ||
AcpiNode -> UID != 0 ) {
Status = EFI_UNSUPPORTED;
} else {
//
// Get the next node
//
IsaBridgeDevicePath = NextDevicePathNode (IsaBridgeDevicePath);
PciNode = (PCI_DEVICE_PATH *)IsaBridgeDevicePath;
if (PciNode->Header.Type != HARDWARE_DEVICE_PATH ||
PciNode->Header.SubType != HW_PCI_DP ||
DevicePathNodeLength (&PciNode->Header) != sizeof (PCI_DEVICE_PATH) ||
PciNode -> Function != 0x00 ||
PciNode -> Device != 0x1f ) {
Status = EFI_UNSUPPORTED;
}
}
gBS->CloseProtocol (
Controller,
&gEfiDevicePathProtocolGuid,
This->DriverBindingHandle,
Controller
);
if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED;
}
//
// Get PciIo protocol instance
//
Status = gBS->OpenProtocol (
Controller,
&gEfiPciIoProtocolGuid,
(VOID **)&PciIo,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
if (EFI_ERROR(Status)) {
return Status;
}
Status = PciIo->Pci.Read (
PciIo,
EfiPciIoWidthUint32,
0,
sizeof(Pci) / sizeof(UINT32),
&Pci
);
if (!EFI_ERROR (Status)) {
Status = EFI_SUCCESS; //TODO: force return success as temp solution EFI_UNSUPPORTED;
if ((Pci.Hdr.Command & 0x03) == 0x03) {
if (Pci.Hdr.ClassCode[2] == PCI_CLASS_BRIDGE) {
//
// See if this is a standard PCI to ISA Bridge from the Base Code
// and Class Code
//
if (Pci.Hdr.ClassCode[1] == PCI_CLASS_BRIDGE_ISA) {
Status = EFI_SUCCESS;
} else {
}
//
// See if this is an Intel PCI to ISA bridge in Positive Decode Mode
//
if (Pci.Hdr.ClassCode[1] == PCI_CLASS_BRIDGE_ISA_PDECODE &&
Pci.Hdr.VendorId == 0x8086 &&
Pci.Hdr.DeviceId == 0x7110) {
Status = EFI_SUCCESS;
} else {
}
} else {
}
}
else {
}
}
gBS->CloseProtocol (
Controller,
&gEfiPciIoProtocolGuid,
This->DriverBindingHandle,
Controller
);
return Status;
}
/**
Install EFI_ISA_ACPI_PROTOCOL
**/
EFI_STATUS
EFIAPI
LpcDriverStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
EFI_STATUS Status;
EFI_PCI_IO_PROTOCOL *PciIo;
LPC_DEV *LpcDev;
LpcDev = NULL;
//
// Get Pci IO
//
Status = gBS->OpenProtocol (
Controller,
&gEfiPciIoProtocolGuid,
(VOID **)&PciIo,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
return Status;
}
mLpc.PciIo = PciIo;
//
// Install IsaAcpi interface, the Sio interface is not installed!
//
Status = gBS->InstallMultipleProtocolInterfaces (
&Controller,
&gEfiIsaAcpiProtocolGuid,
&mLpc.IsaAcpi,
NULL
);
return Status;
}
EFI_STATUS
EFIAPI
LpcDriverStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
)
{
EFI_STATUS Status;
EFI_ISA_ACPI_PROTOCOL *IsaAcpi;
LPC_DEV *LpcDev;
//
// Get EFI_ISA_ACPI_PROTOCOL interface
//
Status = gBS->OpenProtocol (
Controller,
&gEfiIsaAcpiProtocolGuid,
(VOID **)&IsaAcpi,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
return Status;
}
LpcDev = LPC_ISA_ACPI_FROM_THIS (IsaAcpi);
//
// Uninstall protocol interface: EFI_ISA_ACPI_PROTOCOL
//
Status = gBS->UninstallProtocolInterface (
Controller,
&gEfiIsaAcpiProtocolGuid,
&LpcDev->IsaAcpi
);
if (EFI_ERROR (Status)) {
return Status;
}
gBS->CloseProtocol (
Controller,
&gEfiPciIoProtocolGuid,
This->DriverBindingHandle,
Controller
);
return EFI_SUCCESS;
}
VOID
LpcIoRead8 (
IN UINT16 Port,
OUT UINT8 *Data
)
{
mLpc.PciIo->Io.Read(
mLpc.PciIo,
EfiPciWidthUint8,
EFI_PCI_IO_PASS_THROUGH_BAR,
Port,
1,
Data
);
}
VOID
LpcIoWrite8 (
IN UINT16 Port,
IN UINT8 Data
)
{
mLpc.PciIo->Io.Write(

View File

@@ -0,0 +1,117 @@
/*++
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
LpcDriver.h
Abstract:
EFI Lpc Driver for a Generic PC Platform
--*/
#ifndef _LPC_DRIVER_H
#define _LPC_DRIVER_H
#include "LpcSio.h"
#include "LpcIsaAcpi.h"
#include "Protocol/IsaAcpi.h"
#include "Protocol/PciIo.h"
#include "Protocol/DriverBinding.h"
#include "Library/UefiBootServicesTableLib.h"
#include "IsaAcpiDxe/PcatIsaAcpi.h"
#include "IndustryStandard/Pci22.h"
#include "Protocol/LpcWpce791Policy.h"
#include <Library/DebugLib.h>
#define ICH_LPC_BRIDGE_BUS_DEV_FUNC 0x1F0000
//
// LPC device private data structure
//
//#define LPC_DEV_SIGNATURE 'W87X'
#define LPC_DEV_SIGNATURE SIGNATURE_32('X', '7', '8', 'W') //'W87X'
#define EFI_WPCE791_PS2_KEYBOARD_ENABLE 0x01
#define EFI_WPCE791_PS2_KEYBOARD_DISABLE 0x00
#define EFI_WPCE791_PS2_MOUSE_ENABLE 0x01
#define EFI_WPCE791_PS2_MOUSE_DISABLE 0x00
typedef struct {
UINTN Signature;
EFI_HANDLE Handle;
EFI_ISA_ACPI_PROTOCOL IsaAcpi;
EFI_PCI_IO_PROTOCOL *PciIo;
} LPC_DEV;
#define LPC_ISA_ACPI_FROM_THIS(a) BASE_CR (a, LPC_DEV, IsaAcpi)
//
// Driver entry point
//
EFI_STATUS
EFIAPI
LpcDriverEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
//
// Prototypes for Driver model protocol interface
//
EFI_STATUS
EFIAPI
LpcDriverSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
EFI_STATUS
EFIAPI
LpcDriverStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
EFI_STATUS
EFIAPI
LpcDriverStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
);
VOID
LpcIoRead8 (
IN UINT16 Port,
OUT UINT8 *Data

View File

@@ -0,0 +1,371 @@
/** @file
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
LpcIsaAcpi.c
Abstract: IsaAcpi implementation
--*/
#include "LpcDriver.h"
//
// PS/2 Keyboard Controller
//
static EFI_ISA_ACPI_RESOURCE mLpcWpce791Ps2KeyboardDeviceResources[] = {
{EfiIsaAcpiResourceIo, 0, 0x60, 0x64},
{EfiIsaAcpiResourceInterrupt, 0, 1, 0},
{EfiIsaAcpiResourceEndOfList, 0, 0, 0}
};
//
// PS/2 Mouse Controller
//
static EFI_ISA_ACPI_RESOURCE mLpcWpce791Ps2MouseDeviceResources[] = {
{EfiIsaAcpiResourceIo, 0, 0x60, 0x64},
{EfiIsaAcpiResourceInterrupt, 0, 12, 0},
{EfiIsaAcpiResourceEndOfList, 0, 0, 0}
};
//
// COM
//
static EFI_ISA_ACPI_RESOURCE mLpcWpce791ComDeviceResources[] = {
{EfiIsaAcpiResourceIo, 0, 0x3f8, 0x3ff},
{EfiIsaAcpiResourceInterrupt, 0, 4, 0},
{EfiIsaAcpiResourceEndOfList, 0, 0, 0}
};
//
// Table of ISA Controllers
//
EFI_ISA_ACPI_RESOURCE_LIST mLpcWpce791DeviceList[] = {
{{EISA_PNP_ID(0x303), 0}, mLpcWpce791Ps2KeyboardDeviceResources }, // PS/2 Keyboard Controller
{{EISA_PNP_ID(0xF03), 0}, mLpcWpce791Ps2MouseDeviceResources }, // PS/2 Mouse Controller
{{EISA_PNP_ID(0x501), 0}, mLpcWpce791ComDeviceResources }, // COM
{{0, 0}, NULL } // End
};
static ICH_DMA_INIT mIchDmaInitTable [] = {
//
//Register OFFSET, Value
//
0x0D8, 0x000, // Reset DMA Controller 2
0x0D0, 0x000, // Enable DMA controller 2
0x00C, 0x000, // Reset DMA Controller 1
0x008, 0x000, // Enable DMA controller 1
//
// Channel 4
//
0x0D6, 0x0c0, // DMA contr. 2 Cascade mode, addr. increment, disable auto init.
0x0D2, 0x000, // Clear write request register
0x0d4, 0x000, // Enable DREQs for channel
//
// Channel 0
//
0x00B, 0x040, // DMA contr. 1 single mode, addr. increment, disable auto init.
0x009, 0x000, // Clear write request register
0x00A, 0x000, // Enable DREQs for channel
//
// Channel 1
//
0x00B, 0x041, // DMA contr. 1 single mode, addr. increment, disable auto init.
0x009, 0x001, // Clear write request register
0x00A, 0x001, // Enable DREQs for channel
//
// Channel 2
//
0x00B, 0x042, // DMA contr. 1 single mode, addr. increment, disable auto init.
0x009, 0x002, // Clear write request register
0x00A, 0x002, // Enable DREQs for channel
//
// Channel 3
//
0x00B, 0x043, // DMA contr. 1 single mode, addr. increment, disable auto init.
0x009, 0x003, // Clear write request register
0x00A, 0x003, // Enable DREQs for channel
//
// Channel 5
//
0x0D6, 0x041, // DMA contr. 2 single mode, addr. increment, disable auto init.
0x0D2, 0x001, // Clear write request register
0x0D4, 0x001, // Enable DREQs for channel
//
// Channel 6
//
0x0D6, 0x042, // DMA contr. 2 single mode, addr. increment, disable auto init.
0x0D2, 0x002, // Clear write request register
0x0D4, 0x002, // Enable DREQs for channel
//
// Channel 7
//
0x0D6, 0x043, // DMA contr. 2 single mode, addr. increment, disable auto init.
0x0D2, 0x003, // Clear write request register
0x0D4, 0x003 // Enable DREQs for channel
};
//
// ISA ACPI Protocol Functions
//
/**
Enumerate the ISA devices on the ISA bus
**/
VOID
IsaDeviceLookup (
IN EFI_ISA_ACPI_DEVICE_ID *Device,
OUT EFI_ISA_ACPI_RESOURCE_LIST **IsaAcpiDevice,
OUT EFI_ISA_ACPI_RESOURCE_LIST **NextIsaAcpiDevice
)
{
UINTN Index;
*IsaAcpiDevice = NULL;
if (NextIsaAcpiDevice != NULL) {
*NextIsaAcpiDevice = NULL;
}
if (Device == NULL) {
Index = 0;
} else {
for(Index = 0; mLpcWpce791DeviceList[Index].Device.HID != 0; Index++) {
if (Device->HID == mLpcWpce791DeviceList[Index].Device.HID &&
Device->UID == mLpcWpce791DeviceList[Index].Device.UID ) {
break;
}
}
if (mLpcWpce791DeviceList[Index].Device.HID == 0) {
return;
}
*IsaAcpiDevice = &(mLpcWpce791DeviceList[Index]);
Index++;
}
if (NextIsaAcpiDevice != NULL && mLpcWpce791DeviceList[Index].Device.HID != 0){
*NextIsaAcpiDevice = &(mLpcWpce791DeviceList[Index]);
}
}
/**
Enumerate the ISA devices on the ISA bus
It is hard code now and future it will get from ACPI table
**/
EFI_STATUS
EFIAPI
IsaDeviceEnumerate (
IN EFI_ISA_ACPI_PROTOCOL *This,
OUT EFI_ISA_ACPI_DEVICE_ID **Device
)
{
EFI_ISA_ACPI_RESOURCE_LIST *IsaAcpiDevice;
EFI_ISA_ACPI_RESOURCE_LIST *NextIsaAcpiDevice;
IsaDeviceLookup (*Device, &IsaAcpiDevice, &NextIsaAcpiDevice);
if (NextIsaAcpiDevice == NULL) {
return EFI_NOT_FOUND;
}
*Device = &(NextIsaAcpiDevice->Device);
return EFI_SUCCESS;
}
/**
Set ISA device power use sio
**/
EFI_STATUS
EFIAPI
IsaDeviceSetPower (
IN EFI_ISA_ACPI_PROTOCOL *This,
IN EFI_ISA_ACPI_DEVICE_ID *Device,
IN BOOLEAN OnOff
)
{
return EFI_UNSUPPORTED;
}
/**
Get current Resource of the specific ISA device
It is hardcode now and future will get from ACPI table
**/
EFI_STATUS
EFIAPI
IsaGetCurrentResource (
IN EFI_ISA_ACPI_PROTOCOL *This,
IN EFI_ISA_ACPI_DEVICE_ID *Device,
OUT EFI_ISA_ACPI_RESOURCE_LIST **ResourceList
)
{
IsaDeviceLookup (Device, ResourceList, NULL);
if (*ResourceList == NULL || (*ResourceList)->ResourceItem == NULL) {
return EFI_NOT_FOUND;
}
return EFI_SUCCESS;
}
EFI_STATUS
EFIAPI
IsaGetPossibleResource (
IN EFI_ISA_ACPI_PROTOCOL *This,
IN EFI_ISA_ACPI_DEVICE_ID *Device,
OUT EFI_ISA_ACPI_RESOURCE_LIST **ResourceList
)
{
//
// Not supported yet
//
return EFI_UNSUPPORTED;
}
EFI_STATUS
EFIAPI
IsaSetResource (
IN EFI_ISA_ACPI_PROTOCOL *This,
IN EFI_ISA_ACPI_DEVICE_ID *Device,
IN EFI_ISA_ACPI_RESOURCE_LIST *ResourceList
)
{
return EFI_UNSUPPORTED;
}
EFI_STATUS
EFIAPI
IsaEnableDevice (
IN EFI_ISA_ACPI_PROTOCOL *This,
IN EFI_ISA_ACPI_DEVICE_ID *Device,
IN BOOLEAN Enable
)
{
return EFI_UNSUPPORTED;
}
/**
Clear out Resource List if device is set to disable by platform policy
**/
VOID
EmptyResourceList (
IN UINT32 DeviceHid
)
{
UINT8 Index;
for (Index = 0; mLpcWpce791DeviceList[Index].Device.HID != 0; Index++) {
if (DeviceHid == mLpcWpce791DeviceList[Index].Device.HID) {
mLpcWpce791DeviceList[Index].ResourceItem = NULL;
}
}
return;
}
/**
Clear out Resource List if device is set to disable by platform policy
**/
VOID
EmptyResourceListHidUid (
IN UINT32 DeviceHid,
IN UINT32 DeviceUid
)
{
UINT8 Index;
for (Index = 0; mLpcWpce791DeviceList[Index].Device.HID != 0; Index++) {
if ((DeviceHid == mLpcWpce791DeviceList[Index].Device.HID) &&
(DeviceUid == mLpcWpce791DeviceList[Index].Device.UID)) {
mLpcWpce791DeviceList[Index].ResourceItem = NULL;
}
}
return;
}
EFI_STATUS
EFIAPI
IsaInitDevice (
IN EFI_ISA_ACPI_PROTOCOL *This,
IN EFI_ISA_ACPI_DEVICE_ID *Device
)
{
EFI_WPCE791_POLICY_PROTOCOL *LpcWpce791Policy;
EFI_STATUS Status;
//
// Disable configuration according to platform protocol
//
Status = gBS->LocateProtocol (
&gEfiLpcWpce791PolicyProtocolGuid,
NULL,
(VOID **) &LpcWpce791Policy
);
if (!EFI_ERROR(Status)) {
if (LpcWpce791Policy->DeviceEnables.Ps2Keyboard == EFI_WPCE791_PS2_KEYBOARD_DISABLE) {
EmptyResourceList(EISA_PNP_ID(0x303));
DisableLogicalDevice (SIO_KEYBOARD);
EmptyResourceList(EISA_PNP_ID(0xF03));
DisableLogicalDevice (SIO_KEYBOARD);
}
if (LpcWpce791Policy->DeviceEnables.Ps2Mouse == EFI_WPCE791_PS2_MOUSE_DISABLE) {
EmptyResourceList(EISA_PNP_ID(0xF03));
DisableLogicalDevice (SIO_MOUSE);
}
}
return EFI_SUCCESS;
}
EFI_STATUS
EFIAPI
LpcInterfaceInit (
IN EFI_ISA_ACPI_PROTOCOL *This
)
{
EFI_PCI_IO_PROTOCOL *PciIo;
UINTN Index;
PciIo = (LPC_ISA_ACPI_FROM_THIS (This))->PciIo;
//
// DMA controller initialize
//
for (Index=0; Index < (sizeof(mIchDmaInitTable)/sizeof(ICH_DMA_INIT)); Index++) {
PciIo->Io.Write (
PciIo,
EfiPciIoWidthUint8,
EFI_PCI_IO_PASS_THROUGH_BAR,

View File

@@ -0,0 +1,108 @@
/*++
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
LpcIsaAcpi.h
Abstract:
Isa Acpi interface
--*/
#ifndef _LPC_ISA_ACPI_H
#define _LPC_ISA_ACPI_H
#include "Protocol/IsaAcpi.h"
#include "Library/DevicePathLib.h"
typedef struct {
UINT8 Register;
UINT8 Value;
} ICH_DMA_INIT;
//
// Prototypes for the ISA ACPI protocol interface
//
EFI_STATUS
EFIAPI
IsaDeviceEnumerate (
IN EFI_ISA_ACPI_PROTOCOL *This,
OUT EFI_ISA_ACPI_DEVICE_ID **Device
);
EFI_STATUS
EFIAPI
IsaDeviceSetPower (
IN EFI_ISA_ACPI_PROTOCOL *This,
IN EFI_ISA_ACPI_DEVICE_ID *Device,
IN BOOLEAN OnOff
);
EFI_STATUS
EFIAPI
IsaGetCurrentResource (
IN EFI_ISA_ACPI_PROTOCOL *This,
IN EFI_ISA_ACPI_DEVICE_ID *Device,
OUT EFI_ISA_ACPI_RESOURCE_LIST **ResourceList
);
EFI_STATUS
EFIAPI
IsaGetPossibleResource (
IN EFI_ISA_ACPI_PROTOCOL *This,
IN EFI_ISA_ACPI_DEVICE_ID *Device,
OUT EFI_ISA_ACPI_RESOURCE_LIST **ResourceList
);
EFI_STATUS
EFIAPI
IsaSetResource (
IN EFI_ISA_ACPI_PROTOCOL *This,
IN EFI_ISA_ACPI_DEVICE_ID *Device,
IN EFI_ISA_ACPI_RESOURCE_LIST *ResourceList
);
EFI_STATUS
EFIAPI
IsaEnableDevice (
IN EFI_ISA_ACPI_PROTOCOL *This,
IN EFI_ISA_ACPI_DEVICE_ID *Device,
IN BOOLEAN Enable
);
EFI_STATUS
EFIAPI
IsaInitDevice (
IN EFI_ISA_ACPI_PROTOCOL *This,
IN EFI_ISA_ACPI_DEVICE_ID *Device
);
EFI_STATUS
EFIAPI
LpcInterfaceInit (

View File

@@ -0,0 +1,131 @@
/** @file
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Module Name:
LpcSio.c
Abstract: Sio implementation
Revision History
--*/
#include "LpcDriver.h"
#include <Library/S3BootScriptLib.h>
VOID
WriteRegister (
IN UINT8 Index,
IN UINT8 Data
);
typedef struct {
UINT8 Register;
UINT8 Value;
} EFI_SIO_TABLE;
EFI_SIO_TABLE mSioTable[] = {
//
// Init keyboard controller
//
{ REG_LOGICAL_DEVICE, SIO_KEYBOARD },
{ BASE_ADDRESS_HIGH, 0x00 },
{ BASE_ADDRESS_LOW, 0x60 },
{ BASE_ADDRESS_HIGH2, 0x00 },
{ BASE_ADDRESS_LOW2, 0x64 },
{ PRIMARY_INTERRUPT_SELECT, 0x01 },
{ ACTIVATE, 0x1 },
//
// Init Mouse controller
//
{ REG_LOGICAL_DEVICE, SIO_MOUSE },
{ BASE_ADDRESS_HIGH, 0x00 },
{ BASE_ADDRESS_LOW, 0x60 },
{ BASE_ADDRESS_HIGH2, 0x00 },
{ BASE_ADDRESS_LOW2, 0x64 },
{ PRIMARY_INTERRUPT_SELECT, 0x0c },
{ ACTIVATE, 0x1 },
{ REG_LOGICAL_DEVICE, SIO_COM },
{ BASE_ADDRESS_HIGH, 0x03 },
{ BASE_ADDRESS_LOW, 0xf8 },
{ PRIMARY_INTERRUPT_SELECT, 0x04 },
{ ACTIVATE, 0x1 },
};
VOID
LPCWPCE791SetDefault ()
{
UINT8 Index;
for (Index = 0; Index < sizeof(mSioTable)/sizeof(EFI_SIO_TABLE); Index++) {
WriteRegisterAndSaveToScript (mSioTable[Index].Register, mSioTable[Index].Value);
}
return;
}
VOID
DisableLogicalDevice (
UINT8 DeviceId
)
{
WriteRegisterAndSaveToScript (REG_LOGICAL_DEVICE, DeviceId);
WriteRegisterAndSaveToScript (ACTIVATE, 0);
WriteRegisterAndSaveToScript (BASE_ADDRESS_HIGH, 0);
WriteRegisterAndSaveToScript (BASE_ADDRESS_LOW, 0);
return;
}
VOID
WriteRegister (
IN UINT8 Index,
IN UINT8 Data
)
{
LpcIoWrite8(CONFIG_PORT, Index);
LpcIoWrite8(DATA_PORT, Data);
return;
}
VOID
WriteRegisterAndSaveToScript (
IN UINT8 Index,
IN UINT8 Data
)
{
UINT8 Buffer[2];
LpcIoWrite8(CONFIG_PORT, Index);
LpcIoWrite8(DATA_PORT, Data);
Buffer[0] = Index;
Buffer[1] = Data;
S3BootScriptSaveIoWrite (

View File

@@ -0,0 +1,106 @@
/*++
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
LpcSio.h
Abstract:
Lpc driver's sio interface
--*/
#ifndef _LPC_SIO_H
#define _LPC_SIO_H
#include "Protocol/PciRootBridgeIo.h"
#define VARSIOINSTALLED L"VarSIOProcotolInstalled"
//
// Port address
//
#define CONFIG_PORT 0x04E
#define INDEX_PORT 0x04E
#define DATA_PORT INDEX_PORT + 1
//
// Logical Device
//
#define SIO_COM 0x3
#define SIO_MSWC 0x4
#define SIO_MOUSE 0x5
#define SIO_KEYBOARD 0x6
#define SIO_SHM 0xF
#define SIO_PM1 0x11
#define SIO_PM2 0x12
#define SIO_PM3 0x17
#define SIO_ESHM 0x1D
//
// Global register
//
#define REG_LOGICAL_DEVICE 0x07
#define REG_DEVICE_ID 0x20
#define SIO_CONFIG_1 0x21
#define REG_CHIP_REV 0x24
#define SIO_CONFIG_5 0x25
#define SIO_CONFIG_6 0x26
#define REG_DEVICE_REV 0x27
#define SIO_CONFIG_9 0x29
#define SIO_CONFIG_D 0x2D
#define ACTIVATE 0x30
#define BASE_ADDRESS_HIGH 0x60
#define BASE_ADDRESS_LOW 0x61
#define BASE_ADDRESS_HIGH2 0x62
#define BASE_ADDRESS_LOW2 0x63
#define PRIMARY_INTERRUPT_SELECT 0x70
#define DMA_CHANNEL_SELECT 0x74
EFI_STATUS
InitializeLpcSio (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *RootBridgeIo
);
//
// Prototypes for the sio internal function
//
//
// Internal function
//
VOID
LPCWPCE791SetDefault (
VOID
);
VOID
WriteRegisterAndSaveToScript (
IN UINT8 Index,
IN UINT8 Data
);
VOID
FloppyWriteProtect (

View File

@@ -0,0 +1,68 @@
#
#
# Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved
#
# This program and the accompanying materials are licensed and made available under
# the terms and conditions of the BSD License that accompanies this distribution.
# The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php.
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
#
#
#
# Module Name:
#
# SiO791.inf
#
# Abstract:
#
# Component description file for SIO791 module.
#
--*/
[defines]
INF_VERSION = 0x00010005
BASE_NAME = SIO791
FILE_GUID = 04A76C80-06B9-445e-B73E-CB8C61A6A964
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
ENTRY_POINT = LpcDriverEntryPoint
[sources.common]
LpcIsaAcpi.h
LpcSio.h
LpcDriver.h
LpcIsaAcpi.c
LpcSio.c
LpcDriver.c
[Packages]
MdePkg/MdePkg.dec
Vlv2TbltDevicePkg/PlatformPkg.dec
IntelFrameworkPkg/IntelFrameworkPkg.dec
IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
PcAtChipsetPkg/PcAtChipsetPkg.dec
[LibraryClasses]
UefiDriverEntryPoint
UefiBootServicesTableLib
DevicePathLib
UefiLib
S3BootScriptLib
DebugLib
[Ppis]