Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86 / ACPI / sleep: Provide registration for acpi_suspend_lowlevel.

Which by default will be x86_acpi_suspend_lowlevel.
This registration allows us to register another callback
if there is a need to use another platform specific callback.

Signed-off-by: Liang Tang <liang.tang@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Tested-by: Ben Guthro <benjamin.guthro@citrix.com>
Acked-by: "H. Peter Anvin" <hpa@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Konrad Rzeszutek Wilk and committed by
Rafael J. Wysocki
d6a77ead 7d132055

+14 -3
+1 -1
arch/x86/include/asm/acpi.h
··· 111 111 } 112 112 113 113 /* Low-level suspend routine. */ 114 - extern int acpi_suspend_lowlevel(void); 114 + extern int (*acpi_suspend_lowlevel)(void); 115 115 116 116 /* Physical address to resume after wakeup */ 117 117 #define acpi_wakeup_address ((unsigned long)(real_mode_header->wakeup_start))
+7
arch/x86/kernel/acpi/boot.c
··· 44 44 #include <asm/mpspec.h> 45 45 #include <asm/smp.h> 46 46 47 + #include "sleep.h" /* To include x86_acpi_suspend_lowlevel */ 47 48 static int __initdata acpi_force = 0; 48 49 u32 acpi_rsdt_forced; 49 50 int acpi_disabled; ··· 559 558 560 559 int (*__acpi_register_gsi)(struct device *dev, u32 gsi, 561 560 int trigger, int polarity) = acpi_register_gsi_pic; 561 + 562 + #ifdef CONFIG_ACPI_SLEEP 563 + int (*acpi_suspend_lowlevel)(void) = x86_acpi_suspend_lowlevel; 564 + #else 565 + int (*acpi_suspend_lowlevel)(void); 566 + #endif 562 567 563 568 /* 564 569 * success: return IRQ number (>=0)
+2 -2
arch/x86/kernel/acpi/sleep.c
··· 26 26 #endif 27 27 28 28 /** 29 - * acpi_suspend_lowlevel - save kernel state 29 + * x86_acpi_suspend_lowlevel - save kernel state 30 30 * 31 31 * Create an identity mapped page table and copy the wakeup routine to 32 32 * low memory. 33 33 */ 34 - int acpi_suspend_lowlevel(void) 34 + int x86_acpi_suspend_lowlevel(void) 35 35 { 36 36 struct wakeup_header *header = 37 37 (struct wakeup_header *) __va(real_mode_header->wakeup_header);
+2
arch/x86/kernel/acpi/sleep.h
··· 15 15 extern void wakeup_long64(void); 16 16 17 17 extern void do_suspend_lowlevel(void); 18 + 19 + extern int x86_acpi_suspend_lowlevel(void);
+2
drivers/acpi/sleep.c
··· 494 494 break; 495 495 496 496 case ACPI_STATE_S3: 497 + if (!acpi_suspend_lowlevel) 498 + return -ENOSYS; 497 499 error = acpi_suspend_lowlevel(); 498 500 if (error) 499 501 return error;