From cc5e0aa9caa97d2cf0cac6ed929919f4283b5b98 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Wed, 13 May 2015 09:31:53 +0000 Subject: [PATCH] OvmfPkg: extract some bits and port offsets common to Q35 and I440FX The PMBA_RTE and ACPI_TIMER_OFFSET macros apply equally to both boards, plus they are triplicated between the various AcpiTimerLib instances. Define them centrally in "OvmfPlatforms.h". Cc: Gabriel Somlo Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Acked-by: Gabriel Somlo Tested-by: Gabriel Somlo Reviewed-by: Jordan Justen git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17436 6f19259b-4bc3-4df7-8a09-765794883524 --- OvmfPkg/Include/OvmfPlatforms.h | 10 ++++++++++ OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c | 10 ---------- OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c | 10 ---------- OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c | 10 ---------- 4 files changed, 10 insertions(+), 30 deletions(-) diff --git a/OvmfPkg/Include/OvmfPlatforms.h b/OvmfPkg/Include/OvmfPlatforms.h index 19f0adb897..43ab01d57c 100644 --- a/OvmfPkg/Include/OvmfPlatforms.h +++ b/OvmfPkg/Include/OvmfPlatforms.h @@ -27,4 +27,14 @@ #define OVMF_HOSTBRIDGE_DID \ PCI_LIB_ADDRESS (0, 0, 0, PCI_DEVICE_ID_OFFSET) +// +// Common bits in same-purpose registers +// +#define PMBA_RTE BIT0 + +// +// Common IO ports relative to the Power Management Base Address +// +#define ACPI_TIMER_OFFSET 0x8 + #endif diff --git a/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c b/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c index 490cf803be..c3c50c05d3 100644 --- a/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c +++ b/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c @@ -18,16 +18,6 @@ #include #include -// -// Power Management PCI Configuration Register fields -// -#define PMBA_RTE BIT0 - -// -// Offset in the Power Management Base Address to the ACPI Timer -// -#define ACPI_TIMER_OFFSET 0x8 - // // Cached ACPI Timer IO Address // diff --git a/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c b/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c index 50a3391b75..5164769f60 100644 --- a/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c +++ b/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c @@ -19,16 +19,6 @@ #include #include -// -// Power Management PCI Configuration Register fields -// -#define PMBA_RTE BIT0 - -// -// Offset in the Power Management Base Address to the ACPI Timer -// -#define ACPI_TIMER_OFFSET 0x8 - /** The constructor function enables ACPI IO space. diff --git a/OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c b/OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c index 0c42ed2c5c..e673434ae6 100644 --- a/OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c +++ b/OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c @@ -18,16 +18,6 @@ #include #include -// -// Power Management PCI Configuration Register fields -// -#define PMBA_RTE BIT0 - -// -// Offset in the Power Management Base Address to the ACPI Timer -// -#define ACPI_TIMER_OFFSET 0x8 - // // Cached ACPI Timer IO Address // -- 2.39.2