[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86 acpi: Follow Windows behaviour more closely during reset.



# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1291980739 0
# Node ID 91e0556f4d46bddb999c3c29b501b9620d7a5ee8
# Parent  0353037c6b953f755655494ed648e8879e0ff9d0
x86 acpi: Follow Windows behaviour more closely during reset.

This follows some changes proposed for upstream Linux:
 1. Do not check the FADT reset register size/offset
 2. Try ACPI poking twice during our reset attempt sequence

Hopefully this will help us reset reliably on a wider range of
platforms.

Signed-off-by: Keir Fraser <keir@xxxxxxx>
---
 xen/arch/x86/shutdown.c   |   21 ++++++++++++++++-----
 xen/drivers/acpi/reboot.c |    7 ++++---
 2 files changed, 20 insertions(+), 8 deletions(-)

diff -r 0353037c6b95 -r 91e0556f4d46 xen/arch/x86/shutdown.c
--- a/xen/arch/x86/shutdown.c   Fri Dec 10 11:01:19 2010 +0000
+++ b/xen/arch/x86/shutdown.c   Fri Dec 10 11:32:19 2010 +0000
@@ -302,7 +302,8 @@ static void __machine_restart(void *pdel
 
 void machine_restart(unsigned int delay_millisecs)
 {
-    int i;
+    unsigned int i, attempt;
+    enum reboot_type orig_reboot_type = reboot_type;
 
     watchdog_disable();
     console_start_sync();
@@ -337,7 +338,7 @@ void machine_restart(unsigned int delay_
     /* Rebooting needs to touch the page at absolute address 0. */
     *((unsigned short *)__va(0x472)) = reboot_mode;
 
-    for ( ; ; )
+    for ( attempt = 0; ; attempt++ )
     {
         switch ( reboot_type )
         {
@@ -350,19 +351,29 @@ void machine_restart(unsigned int delay_
                 outb(0xfe,0x64); /* pulse reset low */
                 udelay(50);
             }
-            /* fall through */
+            /*
+             * If this platform supports ACPI reset, we follow a Windows-style
+             * reboot attempt sequence:
+             *   ACPI -> KBD -> ACPI -> KBD
+             * After this we revert to our usual sequence:
+             *   KBD -> TRIPLE -> KBD -> TRIPLE -> KBD -> ...
+             */
+            reboot_type = (((attempt == 0) && (orig_reboot_type == BOOT_ACPI))
+                           ? BOOT_ACPI : BOOT_TRIPLE);
+            break;
         case BOOT_TRIPLE:
             asm volatile ( "lidt %0 ; int3" : "=m" (no_idt) );
+            reboot_type = BOOT_KBD;
             break;
         case BOOT_BIOS:
             machine_real_restart(jump_to_bios, sizeof(jump_to_bios));
+            reboot_type = BOOT_KBD;
             break;
         case BOOT_ACPI:
             acpi_reboot();
+            reboot_type = BOOT_KBD;
             break;
         }
-
-        reboot_type = BOOT_KBD;
     }
 }
 
diff -r 0353037c6b95 -r 91e0556f4d46 xen/drivers/acpi/reboot.c
--- a/xen/drivers/acpi/reboot.c Fri Dec 10 11:01:19 2010 +0000
+++ b/xen/drivers/acpi/reboot.c Fri Dec 10 11:32:19 2010 +0000
@@ -10,9 +10,10 @@ void acpi_reboot(void)
 
        rr = &acpi_gbl_FADT.reset_register;
 
-       /* Is the reset register supported? */
-       if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER) ||
-           (rr->bit_width != 8) || (rr->bit_offset != 0))
+       /* Is the reset register supported? The spec says we should be
+        * checking the bit width and bit offset, but Windows ignores
+        * these fields */
+       if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER))
                return;
 
        reset_value = acpi_gbl_FADT.reset_value;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.