]> Pileus Git - ~andy/linux/blobdiff - arch/x86/kernel/reboot.c
Merge branch 'x86-reboot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[~andy/linux] / arch / x86 / kernel / reboot.c
index d0f81d3d388fe3dd20ef72f7e50711bd0aa73548..52190a938b4ac0d26a85704e6db4c131dd938aca 100644 (file)
 #include <asm/virtext.h>
 #include <asm/cpu.h>
 #include <asm/nmi.h>
+#include <asm/smp.h>
 
-#ifdef CONFIG_X86_32
-# include <linux/ctype.h>
-# include <linux/mc146818rtc.h>
-# include <asm/realmode.h>
-#else
-# include <asm/x86_init.h>
-#endif
+#include <linux/ctype.h>
+#include <linux/mc146818rtc.h>
+#include <asm/realmode.h>
+#include <asm/x86_init.h>
 
 /*
  * Power off function, if any
@@ -51,7 +49,7 @@ int reboot_force;
  */
 static int reboot_default = 1;
 
-#if defined(CONFIG_X86_32) && defined(CONFIG_SMP)
+#ifdef CONFIG_SMP
 static int reboot_cpu = -1;
 #endif
 
@@ -69,8 +67,8 @@ bool port_cf9_safe = false;
  * reboot=b[ios] | s[mp] | t[riple] | k[bd] | e[fi] [, [w]arm | [c]old] | p[ci]
  * warm   Don't set the cold reboot flag
  * cold   Set the cold reboot flag
- * bios   Reboot by jumping through the BIOS (only for X86_32)
- * smp    Reboot by executing reset on BSP or other CPU (only for X86_32)
+ * bios   Reboot by jumping through the BIOS
+ * smp    Reboot by executing reset on BSP or other CPU
  * triple Force a triple fault (init)
  * kbd    Use the keyboard controller. cold reset (default)
  * acpi   Use the RESET_REG in the FADT
@@ -97,7 +95,6 @@ static int __init reboot_setup(char *str)
                        reboot_mode = 0;
                        break;
 
-#ifdef CONFIG_X86_32
 #ifdef CONFIG_SMP
                case 's':
                        if (isdigit(*(str+1))) {
@@ -114,7 +111,6 @@ static int __init reboot_setup(char *str)
 #endif /* CONFIG_SMP */
 
                case 'b':
-#endif
                case 'a':
                case 'k':
                case 't':
@@ -140,7 +136,6 @@ static int __init reboot_setup(char *str)
 __setup("reboot=", reboot_setup);
 
 
-#ifdef CONFIG_X86_32
 /*
  * Reboot options and system auto-detection code provided by
  * Dell Inc. so their systems "just work". :-)
@@ -160,11 +155,8 @@ static int __init set_bios_reboot(const struct dmi_system_id *d)
        return 0;
 }
 
-void machine_real_restart(unsigned int type)
+void __noreturn machine_real_restart(unsigned int type)
 {
-       void (*restart_lowmem)(unsigned int) = (void (*)(unsigned int))
-               real_mode_header->machine_real_restart_asm;
-
        local_irq_disable();
 
        /*
@@ -184,25 +176,28 @@ void machine_real_restart(unsigned int type)
        /*
         * Switch back to the initial page table.
         */
+#ifdef CONFIG_X86_32
        load_cr3(initial_page_table);
-
-       /*
-        * Write 0x1234 to absolute memory location 0x472.  The BIOS reads
-        * this on booting to tell it to "Bypass memory test (also warm
-        * boot)".  This seems like a fairly standard thing that gets set by
-        * REBOOT.COM programs, and the previous reset routine did this
-        * too. */
-       *((unsigned short *)0x472) = reboot_mode;
+#else
+       write_cr3(real_mode_header->trampoline_pgd);
+#endif
 
        /* Jump to the identity-mapped low memory code */
-       restart_lowmem(type);
+#ifdef CONFIG_X86_32
+       asm volatile("jmpl *%0" : :
+                    "rm" (real_mode_header->machine_real_restart_asm),
+                    "a" (type));
+#else
+       asm volatile("ljmpl *%0" : :
+                    "m" (real_mode_header->machine_real_restart_asm),
+                    "D" (type));
+#endif
+       unreachable();
 }
 #ifdef CONFIG_APM_MODULE
 EXPORT_SYMBOL(machine_real_restart);
 #endif
 
-#endif /* CONFIG_X86_32 */
-
 /*
  * Some Apple MacBook and MacBookPro's needs reboot=p to be able to reboot
  */
@@ -227,11 +222,9 @@ static int __init set_kbd_reboot(const struct dmi_system_id *d)
 }
 
 /*
- * This is a single dmi_table handling all reboot quirks.  Note that
- * REBOOT_BIOS is only available for 32bit
+ * This is a single dmi_table handling all reboot quirks.
  */
 static struct dmi_system_id __initdata reboot_dmi_table[] = {
-#ifdef CONFIG_X86_32
        {       /* Handle problems with rebooting on Dell E520's */
                .callback = set_bios_reboot,
                .ident = "Dell E520",
@@ -381,7 +374,6 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
                        DMI_MATCH(DMI_BOARD_NAME, "P4S800"),
                },
        },
-#endif /* CONFIG_X86_32 */
 
        {       /* Handle reboot issue on Acer Aspire one */
                .callback = set_kbd_reboot,
@@ -588,13 +580,11 @@ static void native_machine_emergency_restart(void)
                        reboot_type = BOOT_KBD;
                        break;
 
-#ifdef CONFIG_X86_32
                case BOOT_BIOS:
                        machine_real_restart(MRR_BIOS);
 
                        reboot_type = BOOT_KBD;
                        break;
-#endif
 
                case BOOT_ACPI:
                        acpi_reboot();
@@ -636,12 +626,10 @@ void native_machine_shutdown(void)
        /* The boot cpu is always logical cpu 0 */
        int reboot_cpu_id = 0;
 
-#ifdef CONFIG_X86_32
        /* See if there has been given a command line override */
        if ((reboot_cpu != -1) && (reboot_cpu < nr_cpu_ids) &&
                cpu_online(reboot_cpu))
                reboot_cpu_id = reboot_cpu;
-#endif
 
        /* Make certain the cpu I'm about to reboot on is online */
        if (!cpu_online(reboot_cpu_id))