From 830067bfa29358963dda22df935fefe7323f60b0 Mon Sep 17 00:00:00 2001 From: jljusten Date: Wed, 12 Sep 2012 07:18:35 +0000 Subject: [PATCH] OvmfPkg: extract the PBMA used in AcpiTimerLib into a PCD Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Reviewed-by: Jordan Justen git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13719 6f19259b-4bc3-4df7-8a09-765794883524 --- OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.c | 5 ++++- OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.inf | 4 ++++ OvmfPkg/OvmfPkg.dec | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.c b/OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.c index 72620ba5fd..027912e0f7 100644 --- a/OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.c +++ b/OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.c @@ -20,11 +20,12 @@ #include #include #include +#include // // PIIX4 Power Management Base Address // -UINT32 mPmba = 0xb000; +STATIC UINT32 mPmba; #define PCI_BAR_IO 0x1 #define ACPI_TIMER_FREQUENCY 3579545 @@ -56,6 +57,8 @@ AcpiTimerLibConstructor ( ASSERT (mPmba & PCI_BAR_IO); mPmba &= ~PCI_BAR_IO; } else { + mPmba = PcdGet16 (PcdAcpiPmBaseAddress); + PciAndThenOr32 (PCI_LIB_ADDRESS (0,Device,3,0x40), (UINT32) ~0xfc0, mPmba); PciOr8 (PCI_LIB_ADDRESS (0,Device,3,0x04), 0x01); diff --git a/OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.inf b/OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.inf index 4fcce6e6d5..da886680bf 100644 --- a/OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.inf +++ b/OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.inf @@ -33,6 +33,10 @@ [Packages] MdePkg/MdePkg.dec + OvmfPkg/OvmfPkg.dec + +[Pcd] + gUefiOvmfPkgTokenSpaceGuid.PcdAcpiPmBaseAddress [LibraryClasses] BaseLib diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec index 45ba8bed1d..26600dcf42 100644 --- a/OvmfPkg/OvmfPkg.dec +++ b/OvmfPkg/OvmfPkg.dec @@ -49,6 +49,10 @@ ## This flag is used to control the destination port for PlatformDebugLibIoPort gUefiOvmfPkgTokenSpaceGuid.PcdDebugIoPort|0x402|UINT16|4 + ## This flag determines the Power Management Base Address of choice, written + # to PIIX4 function 3 offset 0x40-0x43 bits [15:6]. + gUefiOvmfPkgTokenSpaceGuid.PcdAcpiPmBaseAddress|0xB000|UINT16|5 + [PcdsDynamic, PcdsDynamicEx] gUefiOvmfPkgTokenSpaceGuid.PcdEmuVariableEvent|0|UINT64|2