ACPI/sleep: Convert acpi_wakeup_address into a function
authorSean Christopherson <sean.j.christopherson@intel.com>
Tue, 26 Nov 2019 16:54:16 +0000 (08:54 -0800)
committerIngo Molnar <mingo@kernel.org>
Tue, 10 Dec 2019 09:15:48 +0000 (10:15 +0100)
Convert acpi_wakeup_address from a raw variable into a function so that
x86 can wrap its dereference of the real mode boot header in a function
instead of broadcasting it to the world via a #define.  This sets the
stage for a future patch to move x86's definition of the new function,
acpi_get_wakeup_address(), out of asm/acpi.h and thus break acpi.h's
dependency on asm/realmode.h.

No functional change intended.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Link: https://lkml.kernel.org/r/20191126165417.22423-12-sean.j.christopherson@intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/ia64/include/asm/acpi.h
arch/ia64/kernel/acpi.c
arch/x86/include/asm/acpi.h
drivers/acpi/sleep.c

index f886d4dc9d55297f6548ae45f53dc4d48c42ef01..b66ba907019ce11d6304b041650a968bc5c8d69d 100644 (file)
@@ -38,7 +38,10 @@ int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
 /* Low-level suspend routine. */
 extern int acpi_suspend_lowlevel(void);
 
-extern unsigned long acpi_wakeup_address;
+static inline unsigned long acpi_get_wakeup_address(void)
+{
+       return 0;
+}
 
 /*
  * Record the cpei override flag and current logical cpu. This is
index 70d1587ddcd4676030bc3ce8d5cf51cc01a2cc71..a5636524af7693a5f7900c3e92f87a31d9e0323c 100644 (file)
@@ -42,8 +42,6 @@ int acpi_lapic;
 unsigned int acpi_cpei_override;
 unsigned int acpi_cpei_phys_cpuid;
 
-unsigned long acpi_wakeup_address = 0;
-
 #define ACPI_MAX_PLATFORM_INTERRUPTS   256
 
 /* Array to record platform interrupt vectors for generic interrupt routing. */
index bc9693c9107e8163cb67d95e680c755601344a84..23ffafd927a1a7a44115d59b90ec0dae1c83ea45 100644 (file)
@@ -62,7 +62,10 @@ static inline void acpi_disable_pci(void)
 extern int (*acpi_suspend_lowlevel)(void);
 
 /* Physical address to resume after wakeup */
-#define acpi_wakeup_address ((unsigned long)(real_mode_header->wakeup_start))
+static inline unsigned long acpi_get_wakeup_address(void)
+{
+       return ((unsigned long)(real_mode_header->wakeup_start));
+}
 
 /*
  * Check if the CPU can handle C2 and deeper
index 6747a279621bf3eb7b494b18e856fb8185a65965..4398806298398a78a3160ea13d212a2627a3f9c3 100644 (file)
@@ -61,8 +61,11 @@ static struct notifier_block tts_notifier = {
 static int acpi_sleep_prepare(u32 acpi_state)
 {
 #ifdef CONFIG_ACPI_SLEEP
+       unsigned long acpi_wakeup_address;
+
        /* do we have a wakeup address for S2 and S3? */
        if (acpi_state == ACPI_STATE_S3) {
+               acpi_wakeup_address = acpi_get_wakeup_address();
                if (!acpi_wakeup_address)
                        return -EFAULT;
                acpi_set_waking_vector(acpi_wakeup_address);