This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / arch / x86_64 / kernel / reboot.c
index ce78914..92fc7e7 100644 (file)
 void (*pm_power_off)(void);
 
 static long no_idt[3];
-static enum { 
-       BOOT_BIOS = 'b',
-       BOOT_TRIPLE = 't',
-       BOOT_KBD = 'k'
-} reboot_type = BOOT_KBD;
 static int reboot_mode = 0;
+enum reboot_types reboot_type = BOOT_KBD;
+EXPORT_SYMBOL(reboot_type);
+int reboot_override;
+EXPORT_SYMBOL(reboot_override);
 
-/* reboot=b[ios] | t[riple] | k[bd] [, [w]arm | [c]old]
+void (*machine_reset)(void);
+EXPORT_SYMBOL(machine_reset);
+
+/* reboot=b[ios] | t[riple] | k[bd] [, [w]arm | [c]old] | [a]cpi
    bios          Use the CPU reboot vector for warm reset
    warm   Don't set the cold reboot flag
    cold   Set the cold reboot flag
    triple Force a triple fault (init)
    kbd    Use the keyboard controller. cold reset (default)
+   acpi   Use the ACPI reset mechanism defined in the FADT
  */ 
 static int __init reboot_setup(char *str)
 {
@@ -50,7 +53,9 @@ static int __init reboot_setup(char *str)
                case 't':
                case 'b':
                case 'k':
+               case 'a':
                        reboot_type = *str;
+                       reboot_override = 1;
                        break;
                }
                if((str = strchr(str,',')) != NULL)
@@ -94,18 +99,18 @@ static void reboot_warm(void)
 static inline void kb_wait(void)
 {
        int i;
-  
+
        for (i=0; i<0x10000; i++)
                if ((inb_p(0x64) & 0x02) == 0)
                        break;
 }
-  
+
 void machine_shutdown(void)
 {
        /* Stop the cpus and apics */
 #ifdef CONFIG_SMP
        int reboot_cpu_id;
-  
+
        /* The boot cpu is always logical cpu 0 */
        reboot_cpu_id = 0;
 
@@ -124,7 +129,7 @@ void machine_shutdown(void)
 #endif
 
        local_irq_disable();
-  
+
 #ifndef CONFIG_SMP
        disable_local_APIC();
 #endif
@@ -139,16 +144,6 @@ void machine_restart(char * __unused)
        int i;
 
        machine_shutdown();
-
-       local_irq_disable();
-       
-#ifndef CONFIG_SMP
-       disable_local_APIC();
-#endif
-
-       disable_IO_APIC();
-       
-       local_irq_enable();
        
        /* Tell the BIOS if we want cold or warm reboot */
        *((unsigned short *)__va(0x472)) = reboot_mode;
@@ -156,6 +151,13 @@ void machine_restart(char * __unused)
        for (;;) {
                /* Could also try the reset bit in the Hammer NB */
                switch (reboot_type) { 
+               case BOOT_ACPI:
+                       if (machine_reset)
+                               (*machine_reset)();
+                       else
+                               reboot_type = BOOT_KBD;
+                       break;
+               
                case BOOT_BIOS:
                        reboot_warm();