Merge remote-tracking branch 'origin/dev/sumit-linux-3.10.96' into TOT-merge
[linux-3.10.git] / arch / x86 / kernel / reboot.c
index 4e8ba39..5208e5a 100644 (file)
@@ -36,7 +36,7 @@ void (*pm_power_off)(void);
 EXPORT_SYMBOL(pm_power_off);
 
 static const struct desc_ptr no_idt = {};
-static int reboot_mode;
+static enum reboot_mode reboot_mode;
 enum reboot_type reboot_type = BOOT_ACPI;
 int reboot_force;
 
@@ -88,11 +88,11 @@ static int __init reboot_setup(char *str)
 
                switch (*str) {
                case 'w':
-                       reboot_mode = 0x1234;
+                       reboot_mode = REBOOT_WARM;
                        break;
 
                case 'c':
-                       reboot_mode = 0;
+                       reboot_mode = REBOOT_COLD;
                        break;
 
 #ifdef CONFIG_SMP
@@ -366,6 +366,14 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
                        DMI_MATCH(DMI_BOARD_NAME, "P4S800"),
                },
        },
+       {       /* Handle problems with rebooting on the iMac10,1. */
+               .callback = set_pci_reboot,
+               .ident = "Apple iMac10,1",
+               .matches = {
+                   DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
+                   DMI_MATCH(DMI_PRODUCT_NAME, "iMac10,1"),
+               },
+       },
 
        {       /* Handle reboot issue on Acer Aspire one */
                .callback = set_kbd_reboot,
@@ -447,6 +455,22 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
                        DMI_MATCH(DMI_PRODUCT_NAME, "Precision M6600"),
                },
        },
+       {       /* Handle problems with rebooting on the Dell PowerEdge C6100. */
+               .callback = set_pci_reboot,
+               .ident = "Dell PowerEdge C6100",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "C6100"),
+               },
+       },
+       {       /* Some C6100 machines were shipped with vendor being 'Dell'. */
+               .callback = set_pci_reboot,
+               .ident = "Dell PowerEdge C6100",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Dell"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "C6100"),
+               },
+       },
        { }
 };
 
@@ -536,6 +560,7 @@ static void native_machine_emergency_restart(void)
        int i;
        int attempt = 0;
        int orig_reboot_type = reboot_type;
+       unsigned short mode;
 
        if (reboot_emergency)
                emergency_vmx_disable_all();
@@ -543,7 +568,8 @@ static void native_machine_emergency_restart(void)
        tboot_shutdown(TB_SHUTDOWN_REBOOT);
 
        /* Tell the BIOS if we want cold or warm reboot */
-       *((unsigned short *)__va(0x472)) = reboot_mode;
+       mode = reboot_mode == REBOOT_WARM ? 0x1234 : 0;
+       *((unsigned short *)__va(0x472)) = mode;
 
        for (;;) {
                /* Could also try the reset bit in the Hammer NB */
@@ -584,8 +610,8 @@ static void native_machine_emergency_restart(void)
                        break;
 
                case BOOT_EFI:
-                       if (efi_enabled)
-                               efi.reset_system(reboot_mode ?
+                       if (efi_enabled(EFI_RUNTIME_SERVICES))
+                               efi.reset_system(reboot_mode == REBOOT_WARM ?
                                                 EFI_RESET_WARM :
                                                 EFI_RESET_COLD,
                                                 EFI_SUCCESS, 0, NULL);
@@ -614,26 +640,10 @@ void native_machine_shutdown(void)
 {
        /* Stop the cpus and apics */
 #ifdef CONFIG_SMP
-
-       /* The boot cpu is always logical cpu 0 */
-       int reboot_cpu_id = 0;
-
-       /* 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;
-
-       /* Make certain the cpu I'm about to reboot on is online */
-       if (!cpu_online(reboot_cpu_id))
-               reboot_cpu_id = smp_processor_id();
-
-       /* Make certain I only run on the appropriate processor */
-       set_cpus_allowed_ptr(current, cpumask_of(reboot_cpu_id));
-
        /*
-        * O.K Now that I'm on the appropriate processor, stop all of the
-        * others. Also disable the local irq to not receive the per-cpu
-        * timer interrupt which may trigger scheduler's load balance.
+        * Stop all of the others. Also disable the local irq to
+        * not receive the per-cpu timer interrupt which may trigger
+        * scheduler's load balance.
         */
        local_irq_disable();
        stop_other_cpus();