xen/xen-poweroff.diff

58 lines
2.2 KiB
Diff

diff -uNrp xen-2.0-testing/xen/arch/x86/acpi.c xen-2.0-testing.pwroff/xen/arch/x86/acpi.c
--- xen-2.0-testing/xen/arch/x86/acpi.c 2005-03-01 04:45:17.000000000 +0100
+++ xen-2.0-testing.pwroff/xen/arch/x86/acpi.c 2005-03-01 15:48:13.011511087 +0100
@@ -719,3 +719,13 @@ acpi_sleep_done:
#endif /*CONFIG_ACPI_SLEEP*/
+int acpi_poweroff()
+{
+ if (acpi_enter_sleep_state_prep (ACPI_STATE_S5) == AE_OK) {
+ __asm__ __volatile__ ( "cli" );
+ acpi_enter_sleep_state (ACPI_STATE_S5);
+ __asm__ __volatile__ ( "sti" );
+ acpi_leave_sleep_state (ACPI_STATE_S5);
+ }
+ return 1;
+}
diff -uNrp xen-2.0-testing/xen/arch/x86/domain.c xen-2.0-testing.pwroff/xen/arch/x86/domain.c
--- xen-2.0-testing/xen/arch/x86/domain.c 2005-03-01 04:45:18.000000000 +0100
+++ xen-2.0-testing.pwroff/xen/arch/x86/domain.c 2005-03-01 15:48:26.133212475 +0100
@@ -34,6 +34,7 @@
#include <xen/console.h>
#include <xen/elf.h>
#include <xen/multicall.h>
+#include <xen/acpi.h>
/* opt_noreboot: If true, machine will need manual reset on error. */
static int opt_noreboot = 0;
@@ -186,6 +187,7 @@ void machine_restart(char * __unused)
void __attribute__((noreturn)) __machine_halt(void *unused)
{
+ acpi_poweroff();
for ( ; ; )
__asm__ __volatile__ ( "cli; hlt" );
}
diff -uNrp xen-2.0-testing/xen/drivers/acpi/acpi_ksyms.c xen-2.0-testing.pwroff/xen/drivers/acpi/acpi_ksyms.c
--- xen-2.0-testing/xen/drivers/acpi/acpi_ksyms.c 2005-03-01 04:45:17.000000000 +0100
+++ xen-2.0-testing.pwroff/xen/drivers/acpi/acpi_ksyms.c 2005-03-01 15:36:50.941976570 +0100
@@ -87,6 +87,7 @@ EXPORT_SYMBOL(acpi_get_register);
EXPORT_SYMBOL(acpi_set_register);
EXPORT_SYMBOL(acpi_enter_sleep_state);
EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios);
+EXPORT_SYMBOL(acpi_leave_sleep_state);
EXPORT_SYMBOL(acpi_get_system_info);
EXPORT_SYMBOL(acpi_get_devices);
diff -uNrp xen-2.0-testing/xen/include/asm-x86/acpi.h xen-2.0-testing.pwroff/xen/include/asm-x86/acpi.h
--- xen-2.0-testing/xen/include/asm-x86/acpi.h 2005-03-01 04:45:21.000000000 +0100
+++ xen-2.0-testing.pwroff/xen/include/asm-x86/acpi.h 2005-03-01 15:49:22.719299798 +0100
@@ -163,4 +163,6 @@ extern void acpi_reserve_bootmem(void);
#endif /*CONFIG_ACPI_SLEEP*/
+extern int acpi_poweroff(void);
+
#endif /*_ASM_ACPI_H*/