OvmfPkg/PlatformPei: Query Host Bridge DID only once

Make HostBridgeDevId global so MemMapInitialization() can also use it to
conditionally add RCRB MMIO address to HOB.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17600 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Paulo Alcantara 2015-06-09 15:28:09 +00:00 committed by jljusten
parent 071586ee47
commit 589756c7a6
1 changed files with 11 additions and 6 deletions

View File

@ -61,6 +61,8 @@ EFI_PEI_PPI_DESCRIPTOR mPpiBootMode[] = {
};
UINT16 mHostBridgeDevId;
EFI_BOOT_MODE mBootMode = BOOT_WITH_FULL_CONFIGURATION;
BOOLEAN mS3Supported = FALSE;
@ -229,7 +231,6 @@ MiscInitialization (
VOID
)
{
UINT16 HostBridgeDevId;
UINTN PmCmd;
UINTN Pmba;
UINTN AcpiCtlReg;
@ -246,10 +247,9 @@ MiscInitialization (
BuildCpuHob (36, 16);
//
// Query Host Bridge DID to determine platform type and save to PCD
// Determine platform type and save Host Bridge DID to PCD
//
HostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID);
switch (HostBridgeDevId) {
switch (mHostBridgeDevId) {
case INTEL_82441_DEVICE_ID:
PmCmd = POWER_MGMT_REGISTER_PIIX4 (PCI_COMMAND_OFFSET);
Pmba = POWER_MGMT_REGISTER_PIIX4 (PIIX4_PMBA);
@ -264,11 +264,11 @@ MiscInitialization (
break;
default:
DEBUG ((EFI_D_ERROR, "%a: Unknown Host Bridge Device ID: 0x%04x\n",
__FUNCTION__, HostBridgeDevId));
__FUNCTION__, mHostBridgeDevId));
ASSERT (FALSE);
return;
}
PcdSet16 (PcdOvmfHostBridgePciDevId, HostBridgeDevId);
PcdSet16 (PcdOvmfHostBridgePciDevId, mHostBridgeDevId);
//
// If the appropriate IOspace enable bit is set, assume the ACPI PMBA
@ -400,6 +400,11 @@ InitializePlatform (
InitializeXen ();
}
//
// Query Host Bridge DID
//
mHostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID);
if (mBootMode != BOOT_ON_S3_RESUME) {
ReserveEmuVariableNvStore ();