In the next patches, we'll differentiate the PMBA IO port address that we program on PIIX4 vs. Q35.
Normally we'd just turn PcdAcpiPmBaseAddress into a dynamic PCD. However, because we need this PCD in BaseRomAcpiTimerLib too (which cannot access RAM and dynamic PCDs), it must remain a fixed PCD. We will introduce its Q35 counterpart PCD later. (We only need these PCDs to enable build-time configuration, and symbolic references in the code. Introducing macros under "OvmfPkg/Include/IndustryStandard/" is not a good choice, because the values that the firmware programs are not standardized.) As first step, rename the PCD so it says "Piix4" in the name, plus update all client code to fetch it explicitly with FixedPcdGet16(). Cc: Jordan Justen <[email protected]> Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1333238 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <[email protected]> --- OvmfPkg/OvmfPkg.dec | 2 +- OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf | 4 ++-- OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.inf | 4 ++-- OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf | 4 ++-- OvmfPkg/PlatformPei/PlatformPei.inf | 2 +- OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c | 3 ++- OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c | 3 ++- OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c | 5 +++-- OvmfPkg/PlatformPei/Platform.c | 3 ++- 9 files changed, 17 insertions(+), 13 deletions(-) diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec index 97ffb8749be3..d30a40eb153c 100644 --- a/OvmfPkg/OvmfPkg.dec +++ b/OvmfPkg/OvmfPkg.dec @@ -75,11 +75,11 @@ [PcdsFixedAtBuild] ## 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 + gUefiOvmfPkgTokenSpaceGuid.PcdPiix4AcpiPmBaseAddress|0xB000|UINT16|5 ## When VirtioScsiDxe is instantiated for a HBA, the numbers of targets and # LUNs are retrieved from the host during virtio-scsi setup. # MdeModulePkg/Bus/Scsi/ScsiBusDxe then scans all MaxTarget * MaxLun # possible devices. This can take extremely long, for example with diff --git a/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf b/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf index 4c0e6159554d..d3f2180d61f3 100644 --- a/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf +++ b/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf @@ -29,12 +29,12 @@ [Sources] [Packages] MdePkg/MdePkg.dec OvmfPkg/OvmfPkg.dec -[Pcd] - gUefiOvmfPkgTokenSpaceGuid.PcdAcpiPmBaseAddress +[FixedPcd] + gUefiOvmfPkgTokenSpaceGuid.PcdPiix4AcpiPmBaseAddress [LibraryClasses] BaseLib PciLib IoLib diff --git a/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.inf b/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.inf index d5e50aef618d..7a889155cb16 100644 --- a/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.inf +++ b/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.inf @@ -28,12 +28,12 @@ [Sources] [Packages] MdePkg/MdePkg.dec OvmfPkg/OvmfPkg.dec -[Pcd] - gUefiOvmfPkgTokenSpaceGuid.PcdAcpiPmBaseAddress +[FixedPcd] + gUefiOvmfPkgTokenSpaceGuid.PcdPiix4AcpiPmBaseAddress [LibraryClasses] BaseLib PciLib IoLib diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf index b6a3ffe77254..a09827899c14 100644 --- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf +++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf @@ -36,7 +36,7 @@ [Packages] [LibraryClasses] DebugLib IoLib TimerLib -[Pcd] - gUefiOvmfPkgTokenSpaceGuid.PcdAcpiPmBaseAddress \ No newline at end of file +[FixedPcd] + gUefiOvmfPkgTokenSpaceGuid.PcdPiix4AcpiPmBaseAddress diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/PlatformPei.inf index ed31b1f724b5..981532d95bd3 100644 --- a/OvmfPkg/PlatformPei/PlatformPei.inf +++ b/OvmfPkg/PlatformPei/PlatformPei.inf @@ -63,11 +63,10 @@ [LibraryClasses] [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvBase gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvSize gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvSize - gUefiOvmfPkgTokenSpaceGuid.PcdAcpiPmBaseAddress gUefiOvmfPkgTokenSpaceGuid.PcdS3AcpiReservedMemoryBase gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamSize gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesSize @@ -97,10 +96,11 @@ [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable gUefiCpuPkgTokenSpaceGuid.PcdCpuLocalApicBaseAddress [FixedPcd] gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress + gUefiOvmfPkgTokenSpaceGuid.PcdPiix4AcpiPmBaseAddress [FeaturePcd] gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire [Ppis] diff --git a/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c b/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c index c3c50c05d31e..f722731ca4f6 100644 --- a/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c +++ b/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c @@ -71,11 +71,12 @@ AcpiTimerLibConstructor ( if ((PciRead8 (AcpiCtlReg) & AcpiEnBit) == 0) { // // If the Power Management Base Address is not programmed, // then program the Power Management Base Address from a PCD. // - PciAndThenOr32 (Pmba, (UINT32) ~0xFFC0, PcdGet16 (PcdAcpiPmBaseAddress)); + PciAndThenOr32 (Pmba, (UINT32) ~0xFFC0, + FixedPcdGet16 (PcdPiix4AcpiPmBaseAddress)); // // Enable PMBA I/O port decodes // PciOr8 (AcpiCtlReg, AcpiEnBit); diff --git a/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c b/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c index 5164769f6020..b0ab783843a8 100644 --- a/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c +++ b/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c @@ -67,11 +67,12 @@ AcpiTimerLibConstructor ( if ((PciRead8 (AcpiCtlReg) & AcpiEnBit) == 0) { // // If the Power Management Base Address is not programmed, // then program the Power Management Base Address from a PCD. // - PciAndThenOr32 (Pmba, (UINT32) ~0xFFC0, PcdGet16 (PcdAcpiPmBaseAddress)); + PciAndThenOr32 (Pmba, (UINT32) ~0xFFC0, + FixedPcdGet16 (PcdPiix4AcpiPmBaseAddress)); // // Enable PMBA I/O port decodes // PciOr8 (AcpiCtlReg, AcpiEnBit); diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c index 6d149e84c21e..a61060833e84 100644 --- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c +++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c @@ -25,12 +25,13 @@ AcpiPmControl ( UINTN SuspendType ) { ASSERT (SuspendType < 6); - IoBitFieldWrite16 (PcdGet16 (PcdAcpiPmBaseAddress) + 4, 10, 13, (UINT16) SuspendType); - IoOr16 (PcdGet16 (PcdAcpiPmBaseAddress) + 4, BIT13); + IoBitFieldWrite16 (FixedPcdGet16 (PcdPiix4AcpiPmBaseAddress) + 4, 10, 13, + (UINT16) SuspendType); + IoOr16 (FixedPcdGet16 (PcdPiix4AcpiPmBaseAddress) + 4, BIT13); CpuDeadLoop (); } /** Calling this function causes a system-wide reset. This sets diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c index 4be9922aeb1f..e4e21da5aa9b 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -410,11 +410,12 @@ MiscInitialization ( if ((PciRead8 (AcpiCtlReg) & AcpiEnBit) == 0) { // // The PEI phase should be exited with fully accessibe ACPI PM IO space: // 1. set PMBA // - PciAndThenOr32 (Pmba, (UINT32) ~0xFFC0, PcdGet16 (PcdAcpiPmBaseAddress)); + PciAndThenOr32 (Pmba, (UINT32) ~0xFFC0, + FixedPcdGet16 (PcdPiix4AcpiPmBaseAddress)); // // 2. set PCICMD/IOSE // PciOr8 (PmCmd, EFI_PCI_COMMAND_IO_SPACE); -- 1.8.3.1 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

