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

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



# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1292409068 0
# Node ID 612eb10ba78b5ca72ca9c26fb68f1e003bdba34a
# Parent  13c7c6fade3667279b5ff197ebed90874e328bee
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-unstable changeset:   22482:91e0556f4d46
xen-unstable date:        Fri Dec 10 11:32:19 2010 +0000

x86: acpi: Fix reboot attempt sequence.

Signed-off-by: Keir Fraser <keir@xxxxxxx>
xen-unstable changeset:   22483:901c118b363e
xen-unstable date:        Fri Dec 10 16:40:05 2010 +0000
---
 xen/arch/x86/shutdown.c   |   21 ++++++++++++++++-----
 xen/drivers/acpi/reboot.c |    7 ++++---
 2 files changed, 20 insertions(+), 8 deletions(-)

diff -r 13c7c6fade36 -r 612eb10ba78b xen/arch/x86/shutdown.c
--- a/xen/arch/x86/shutdown.c   Fri Dec 10 11:39:01 2010 +0000
+++ b/xen/arch/x86/shutdown.c   Wed Dec 15 10:31:08 2010 +0000
@@ -301,7 +301,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();
@@ -336,7 +337,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 )
         {
@@ -349,19 +350,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 == 1) && (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 13c7c6fade36 -r 612eb10ba78b xen/drivers/acpi/reboot.c
--- a/xen/drivers/acpi/reboot.c Fri Dec 10 11:39:01 2010 +0000
+++ b/xen/drivers/acpi/reboot.c Wed Dec 15 10:31:08 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®.