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 <so...@cmu.edu>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <ler...@redhat.com>
---
 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 19f0adb..43ab01d 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 490cf80..c3c50c0 100644
--- a/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c
+++ b/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c
@@ -19,16 +19,6 @@
 #include <OvmfPlatforms.h>
 
 //
-// 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
 //
 STATIC UINT32 mAcpiTimerIoAddr;
diff --git a/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c 
b/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c
index 50a3391..5164769 100644
--- a/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c
+++ b/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c
@@ -19,16 +19,6 @@
 #include <Library/PcdLib.h>
 #include <OvmfPlatforms.h>
 
-//
-// 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 0c42ed2..e673434 100644
--- a/OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c
+++ b/OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c
@@ -19,16 +19,6 @@
 #include <OvmfPlatforms.h>
 
 //
-// 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
 //
 STATIC UINT32 mAcpiTimerIoAddr;
-- 
1.8.3.1



------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to