Vlv2TbltDevicePkg: Sync the branch changes to trunk.

Support compatible board, and fixed some bugs. 

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Tim He <tim.he@intel.com>
Reviewed-by: David Wei <david.wei@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18149 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Tim He
2015-08-04 02:55:02 +00:00
committed by timhe
parent c5d5379937
commit 6f2ef18e80
23 changed files with 215 additions and 56 deletions

View File

@@ -192,6 +192,57 @@ PeiSmbusExec (
//
EFI_STATUS
PeiSmbusExec (
UINT16 SmbusBase,
UINT8 SlvAddr,
UINT8 Operation,
UINT8 Offset,
UINT8 *Length,
UINT8 *Buffer
);
/**
Detemine compatible board
@return 0: Not compatible board
1: Compatible board
**/
UINT32
DetermineCompatibleBoard (
void
)
{
UINTN PciD31F0RegBase = 0;
UINT32 GpioValue = 0;
UINT32 TmpVal = 0;
UINT32 MmioConf0 = 0;
UINT32 MmioPadval = 0;
UINT32 PConf0Offset = 0x200; //GPIO_S5_4 pad_conf0 register offset
UINT32 PValueOffset = 0x208; //GPIO_S5_4 pad_value register offset
UINT32 SSUSOffset = 0x2000;
UINT32 IoBase = 0;
DEBUG ((EFI_D_ERROR, "DetermineCompatibleBoard() Entry\n"));
PciD31F0RegBase = MmPciAddress (0,
0,
PCI_DEVICE_NUMBER_PCH_LPC,
PCI_FUNCTION_NUMBER_PCH_LPC,
0
);
IoBase = MmioRead32 (PciD31F0RegBase + R_PCH_LPC_IO_BASE) & B_PCH_LPC_IO_BASE_BAR;
MmioConf0 = IoBase + SSUSOffset + PConf0Offset;
MmioPadval = IoBase + SSUSOffset + PValueOffset;
//0xFED0E200/0xFED0E208 is pad_Conf/pad_val register address of GPIO_S5_4
DEBUG ((EFI_D_ERROR, "MmioConf0[0x%x], MmioPadval[0x%x]\n", MmioConf0, MmioPadval));
MmioWrite32 (MmioConf0, 0x2003CC00);
TmpVal = MmioRead32 (MmioPadval);
TmpVal &= ~0x6; //Clear bit 1:2
TmpVal |= 0x2; // Set the pin as GPI
MmioWrite32 (MmioPadval, TmpVal);
GpioValue = MmioRead32 (MmioPadval);
@@ -854,6 +905,7 @@ ReadPlatformIds (
EFI_STATUS
ReadPlatformIds (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN OUT EFI_PLATFORM_INFO_HOB *PlatformInfoHob
)
{
{
@@ -882,9 +934,15 @@ ReadPlatformIds (
&DataSize,
&TmpHob
);
if (Status == EFI_SUCCESS) {
PlatformInfoHob->BoardId = TmpHob.BoardId;
if (Status == EFI_SUCCESS) {
PlatformInfoHob->BoardId = TmpHob.BoardId;
PlatformInfoHob->MemCfgID = TmpHob.MemCfgID;
PlatformInfoHob->BoardRev = TmpHob.BoardRev;
PlatformInfoHob->PlatformFlavor = TmpHob.PlatformFlavor;
return Status;
}
CompatibleBoard = DetermineCompatibleBoard();
if (1 == CompatibleBoard) {
PlatformInfoHob->BoardId = BOARD_ID_MINNOW2_COMPATIBLE;