x86: apic: Make xAPIC and I/O APIC pointers static
Make the pointers to the xAPIC and I/O APIC static as there are no users
outside of apic.c. Opportunistically use #defines for the default values
instead of open coding magic numbers.
No functional change intended.
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20220121231852.1439917-9-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/lib/x86/apic-defs.h b/lib/x86/apic-defs.h
index dabefe7..4db73da 100644
--- a/lib/x86/apic-defs.h
+++ b/lib/x86/apic-defs.h
@@ -14,8 +14,9 @@
* Alan Cox <Alan.Cox@linux.org>, 1995.
* Ingo Molnar <mingo@redhat.com>, 1999, 2000
*/
+#define IO_APIC_DEFAULT_PHYS_BASE 0xfec00000
+#define APIC_DEFAULT_PHYS_BASE 0xfee00000
-#define APIC_DEFAULT_PHYS_BASE 0xfee00000
#define APIC_BSP (1UL << 8)
#define APIC_EXTD (1UL << 10)
#define APIC_EN (1UL << 11)
diff --git a/lib/x86/apic.c b/lib/x86/apic.c
index d7137b6..5d4c776 100644
--- a/lib/x86/apic.c
+++ b/lib/x86/apic.c
@@ -5,8 +5,10 @@
#include "smp.h"
#include "asm/barrier.h"
-void *g_apic = (void *)0xfee00000;
-void *g_ioapic = (void *)0xfec00000;
+/* xAPIC and I/O APIC are identify mapped, and never relocated. */
+static void *g_apic = (void *)APIC_DEFAULT_PHYS_BASE;
+static void *g_ioapic = (void *)IO_APIC_DEFAULT_PHYS_BASE;
+
u8 id_map[MAX_TEST_CPUS];
struct apic_ops {
diff --git a/lib/x86/apic.h b/lib/x86/apic.h
index 7844324..6d27f04 100644
--- a/lib/x86/apic.h
+++ b/lib/x86/apic.h
@@ -6,9 +6,6 @@
extern u8 id_map[MAX_TEST_CPUS];
-extern void *g_apic;
-extern void *g_ioapic;
-
typedef struct {
uint8_t vector;
uint8_t delivery_mode:3;