From 2aa73c9cf330a9dba49769294f502c4157fedd20 Mon Sep 17 00:00:00 2001 From: Pawel Wieczorkiewicz Date: Sun, 25 Oct 2020 11:42:53 +0100 Subject: [PATCH] apic: add apic_get_mode() function Make apic_mode global variable non-public and expose its value via interface. Signed-off-by: Pawel Wieczorkiewicz --- arch/x86/apic.c | 3 ++- include/arch/x86/apic.h | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/apic.c b/arch/x86/apic.c index 36ddb547..60027286 100644 --- a/arch/x86/apic.c +++ b/arch/x86/apic.c @@ -29,7 +29,7 @@ #include #include -apic_mode_t apic_mode = APIC_MODE_UNKNOWN; +static apic_mode_t apic_mode = APIC_MODE_UNKNOWN; static const char *apic_mode_names[] = { /* clang-format off */ @@ -87,6 +87,7 @@ void apic_icr_write(uint64_t val) { apic_msr_write(MSR_X2APIC_REGS + (APIC_ICR0 >> 4), val); } +apic_mode_t apic_get_mode(void) { return apic_mode; } void init_apic(unsigned int cpu, apic_mode_t mode) { percpu_t *percpu = get_percpu_page(cpu); diff --git a/include/arch/x86/apic.h b/include/arch/x86/apic.h index c33d2fa4..09971cf0 100644 --- a/include/arch/x86/apic.h +++ b/include/arch/x86/apic.h @@ -462,10 +462,9 @@ typedef union apic_self_ipi apic_self_ipi_t; /* External declarations */ -extern apic_mode_t apic_mode; - extern uint64_t apic_read(unsigned int reg); extern void apic_write(unsigned int reg, uint64_t val); +extern apic_mode_t apic_get_mode(void); extern void apic_icr_write(uint64_t val); extern void init_apic(unsigned int cpu, apic_mode_t mode);