]> xenbits.xensource.com Git - people/gdunlap/xen.git/commitdiff
x86: improve "PCI reset register" rebooting
authorJan Beulich <jbeulich@suse.com>
Fri, 13 Mar 2015 15:33:57 +0000 (16:33 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 13 Mar 2015 15:33:57 +0000 (16:33 +0100)
The way this method works allows for honoring "warm" reboot requested
by the user and additionally has a way to power-cycle the machine.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
docs/misc/xen-command-line.markdown
xen/arch/x86/shutdown.c

index f0a31125fe95e8be2d48c375f6f76b7b92925a70..1dda1f0604b29816635b6edf91d4ff06c2e3bf09 100644 (file)
@@ -1145,7 +1145,7 @@ The following resources are available:
   Technology.
 
 ### reboot
-> `= t[riple] | k[bd] | a[cpi] | p[ci] | e[fi] | n[o] [, [w]arm | [c]old]`
+> `= t[riple] | k[bd] | a[cpi] | p[ci] | P[ower] | e[fi] | n[o] [, [w]arm | [c]old]`
 
 > Default: `0`
 
@@ -1165,6 +1165,8 @@ Specify the host reboot method.
 
 `pci` instructs Xen to reboot the host using PCI reset register (port CF9).
 
+`Power` instructs Xen to power-cycle the host using PCI reset register (port CF9).
+
 'efi' instructs Xen to reboot using the EFI reboot call (in EFI mode by
  default it will use that method first).
 
index 9ec8f9795474cbb9b6b14c88b44cbd4327355996..0e1499d0560052f087d3b65aaa71c976954fd30e 100644 (file)
@@ -33,6 +33,7 @@ enum reboot_type {
         BOOT_KBD = 'k',
         BOOT_ACPI = 'a',
         BOOT_CF9 = 'p',
+        BOOT_CF9_PWR = 'P',
         BOOT_EFI = 'e',
 };
 
@@ -47,6 +48,7 @@ static int reboot_mode;
  * kbd    Use the keyboard controller. cold reset (default)
  * acpi   Use the RESET_REG in the FADT
  * pci    Use the so-called "PCI reset register", CF9
+ * Power  Like 'pci' but for a full power-cyle reset
  * efi    Use the EFI reboot (if running under EFI)
  */
 static enum reboot_type reboot_type = BOOT_INVALID;
@@ -68,8 +70,9 @@ static void __init set_reboot_type(char *str)
         case 'a':
         case 'e':
         case 'k':
-        case 't':
+        case 'P':
         case 'p':
+        case 't':
             reboot_type = *str;
             break;
         }
@@ -571,11 +574,18 @@ void machine_restart(unsigned int delay_millisecs)
             reboot_type = BOOT_KBD;
             break;
         case BOOT_CF9:
+        case BOOT_CF9_PWR:
             {
-                u8 cf9 = inb(0xcf9) & ~6;
-                outb(cf9|2, 0xcf9); /* Request hard reset */
+                u8 cf9 = inb(0xcf9) & ~0x0e;
+
+                /* Request warm, hard, or power-cycle reset. */
+                if ( reboot_type == BOOT_CF9_PWR )
+                    cf9 |= 0x0a;
+                else if ( reboot_mode == 0 )
+                    cf9 |= 0x02;
+                outb(cf9, 0xcf9);
                 udelay(50);
-                outb(cf9|6, 0xcf9); /* Actually do the reset */
+                outb(cf9 | 0x04, 0xcf9); /* Actually do the reset. */
                 udelay(50);
             }
             reboot_type = BOOT_ACPI;