aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLi, Aubrey <aubrey.li@linux.intel.com>2014-03-02 05:39:02 -0500
committerH. Peter Anvin <hpa@linux.intel.com>2014-03-05 18:27:07 -0500
commita4f1987e4c5489a3877eaa7451a68d28c5a3f664 (patch)
tree2b070852d455b9efe3de06a9340009f0c62232fa
parent0414855fdc4a40da05221fc6062cccbc0c30f169 (diff)
x86, reboot: Add EFI and CF9 reboot methods into the default list
Reboot is the last service linux OS provides to the end user. We are supposed to make this function more robust than today. This patch adds all of the known reboot methods into the default attempt list. The machines requiring reboot=efi or reboot=p or reboot=bios get a chance to reboot automatically now. If there is a new reboot method emerged, we are supposed to add it to the default list as well, instead of adding the endless dmidecode entry. If one method required is in the default list in this patch but the machine reboot still hangs, that means some methods ahead of the required method cause the system hangs, then reboot the machine by passing reboot= arguments and submit the reboot dmidecode table quirk. We are supposed to remove the reboot dmidecode table from the kernel, but to be safe, we keep it. This patch prevents us from adding more. If you happened to have a machine listed in the reboot dmidecode table and this patch makes reboot work on your machine, please submit a patch to remove the quirk. The default reboot order with this patch is now: ACPI > KBD > ACPI > KBD > EFI > CF9_COND > BIOS Because BIOS and TRIPLE are mutually exclusive (either will either work or hang the machine) that method is not included. [ hpa: as with any changes to the reboot order, this patch will have to be monitored carefully for regressions. ] Signed-off-by: Aubrey Li <aubrey.li@intel.com> Acked-by: Matthew Garrett <mjg59@srcf.ucam.org> Link: http://lkml.kernel.org/r/53130A46.1010801@linux.intel.com Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r--arch/x86/kernel/reboot.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index c752cb43e52f..f6012953e0d8 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -464,9 +464,12 @@ void __attribute__((weak)) mach_reboot_fixups(void)
464 * 2) If still alive, write to the keyboard controller 464 * 2) If still alive, write to the keyboard controller
465 * 3) If still alive, write to the ACPI reboot register again 465 * 3) If still alive, write to the ACPI reboot register again
466 * 4) If still alive, write to the keyboard controller again 466 * 4) If still alive, write to the keyboard controller again
467 * 5) If still alive, call the EFI runtime service to reboot
468 * 6) If still alive, write to the PCI IO port 0xCF9 to reboot
469 * 7) If still alive, inform BIOS to do a proper reboot
467 * 470 *
468 * If the machine is still alive at this stage, it gives up. We default to 471 * If the machine is still alive at this stage, it gives up. We default to
469 * following the same pattern, except that if we're still alive after (4) we'll 472 * following the same pattern, except that if we're still alive after (7) we'll
470 * try to force a triple fault and then cycle between hitting the keyboard 473 * try to force a triple fault and then cycle between hitting the keyboard
471 * controller and doing that 474 * controller and doing that
472 */ 475 */
@@ -502,7 +505,7 @@ static void native_machine_emergency_restart(void)
502 attempt = 1; 505 attempt = 1;
503 reboot_type = BOOT_ACPI; 506 reboot_type = BOOT_ACPI;
504 } else { 507 } else {
505 reboot_type = BOOT_TRIPLE; 508 reboot_type = BOOT_EFI;
506 } 509 }
507 break; 510 break;
508 511
@@ -510,13 +513,15 @@ static void native_machine_emergency_restart(void)
510 load_idt(&no_idt); 513 load_idt(&no_idt);
511 __asm__ __volatile__("int3"); 514 __asm__ __volatile__("int3");
512 515
516 /* We're probably dead after this, but... */
513 reboot_type = BOOT_KBD; 517 reboot_type = BOOT_KBD;
514 break; 518 break;
515 519
516 case BOOT_BIOS: 520 case BOOT_BIOS:
517 machine_real_restart(MRR_BIOS); 521 machine_real_restart(MRR_BIOS);
518 522
519 reboot_type = BOOT_KBD; 523 /* We're probably dead after this, but... */
524 reboot_type = BOOT_TRIPLE;
520 break; 525 break;
521 526
522 case BOOT_ACPI: 527 case BOOT_ACPI:
@@ -530,7 +535,7 @@ static void native_machine_emergency_restart(void)
530 EFI_RESET_WARM : 535 EFI_RESET_WARM :
531 EFI_RESET_COLD, 536 EFI_RESET_COLD,
532 EFI_SUCCESS, 0, NULL); 537 EFI_SUCCESS, 0, NULL);
533 reboot_type = BOOT_KBD; 538 reboot_type = BOOT_CF9;
534 break; 539 break;
535 540
536 case BOOT_CF9: 541 case BOOT_CF9:
@@ -548,7 +553,7 @@ static void native_machine_emergency_restart(void)
548 outb(cf9|reboot_code, 0xcf9); 553 outb(cf9|reboot_code, 0xcf9);
549 udelay(50); 554 udelay(50);
550 } 555 }
551 reboot_type = BOOT_KBD; 556 reboot_type = BOOT_BIOS;
552 break; 557 break;
553 } 558 }
554 } 559 }