1 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
3 #include <linux/module.h>
4 #include <linux/reboot.h>
9 #include <linux/sched.h>
17 #include <asm/pgtable.h>
20 #include <asm/reboot.h>
27 #include <linux/ctype.h>
38 static const struct desc_ptr no_idt = {};
39 static int reboot_mode;
50 static int reboot_default = 1;
53 static int reboot_cpu = -1;
61 static int reboot_emergency;
101 reboot_cpu = (
int) (*(str+1) -
'0');
103 reboot_cpu = reboot_cpu*10 + (
int)(*(str+2) -
'0');
152 pr_info(
"%s series board detected. Selecting %s-method for reboots.\n",
187 asm volatile(
"jmpl *%0" : :
191 asm volatile(
"ljmpl *%0" : :
197 #ifdef CONFIG_APM_MODULE
208 pr_info(
"%s series board detected. Selecting %s-method for reboots.\n",
218 pr_info(
"%s series board detected. Selecting %s-method for reboot.\n",
229 .callback = set_bios_reboot,
230 .ident =
"Dell E520",
237 .callback = set_bios_reboot,
238 .ident =
"Dell PowerEdge 1300",
245 .callback = set_bios_reboot,
246 .ident =
"Dell PowerEdge 300",
253 .callback = set_bios_reboot,
254 .ident =
"Dell OptiPlex 745",
261 .callback = set_bios_reboot,
262 .ident =
"Dell OptiPlex 745",
270 .callback = set_bios_reboot,
271 .ident =
"Dell OptiPlex 745",
279 .callback = set_bios_reboot,
280 .ident =
"Dell OptiPlex 330",
288 .callback = set_bios_reboot,
289 .ident =
"Dell OptiPlex 360",
297 .callback = set_bios_reboot,
298 .ident =
"Dell OptiPlex 760",
306 .callback = set_bios_reboot,
307 .ident =
"Dell PowerEdge 2400",
314 .callback = set_bios_reboot,
315 .ident =
"Dell Precision T5400",
322 .callback = set_bios_reboot,
323 .ident =
"Dell Precision T7400",
330 .callback = set_bios_reboot,
331 .ident =
"HP Compaq Laptop",
338 .callback = set_bios_reboot,
339 .ident =
"Dell XPS710",
346 .callback = set_bios_reboot,
347 .ident =
"Dell DXP061",
354 .callback = set_bios_reboot,
355 .ident =
"Sony VGN-Z540N",
362 .callback = set_bios_reboot,
363 .ident =
"ASUS P4S800",
371 .callback = set_kbd_reboot,
372 .ident =
"Acer Aspire One A110",
379 .callback = set_pci_reboot,
380 .ident =
"Apple MacBook5",
387 .callback = set_pci_reboot,
388 .ident =
"Apple MacBookPro5",
395 .callback = set_pci_reboot,
396 .ident =
"Apple Macmini3,1",
403 .callback = set_pci_reboot,
404 .ident =
"Apple iMac9,1",
411 .callback = set_pci_reboot,
412 .ident =
"Dell Latitude E6320",
419 .callback = set_pci_reboot,
420 .ident =
"Dell Latitude E5420",
427 .callback = set_pci_reboot,
428 .ident =
"Dell Latitude E6420",
435 .callback = set_pci_reboot,
436 .ident =
"Dell OptiPlex 990",
443 .callback = set_pci_reboot,
444 .ident =
"Dell OptiPlex 990",
453 static int __init reboot_init(
void)
465 static inline void kb_wait(
void)
469 for (i = 0; i < 0x10000; i++) {
470 if ((
inb(0x64) & 0x02) == 0)
478 cpu_emergency_vmxoff();
482 static void emergency_vmx_disable_all(
void)
506 if (cpu_has_vmx() && cpu_vmx_enabled()) {
534 static void native_machine_emergency_restart(
void)
540 if (reboot_emergency)
541 emergency_vmx_disable_all();
546 *((
unsigned short *)
__va(0x472)) = reboot_mode;
554 for (i = 0; i < 10; i++) {
560 if (attempt == 0 && orig_reboot_type ==
BOOT_ACPI) {
601 u8 cf9 =
inb(0xcf9) & ~6;
619 int reboot_cpu_id = 0;
622 if ((reboot_cpu != -1) && (reboot_cpu <
nr_cpu_ids) &&
624 reboot_cpu_id = reboot_cpu;
644 #ifdef CONFIG_X86_IO_APIC
648 #ifdef CONFIG_HPET_TIMER
657 static void __machine_emergency_restart(
int emergency)
659 reboot_emergency = emergency;
669 __machine_emergency_restart(0);
696 .emergency_restart = native_machine_emergency_restart,
716 __machine_emergency_restart(1);
737 #if defined(CONFIG_SMP)
743 static atomic_t waiting_for_crash_ipi;
745 static int crash_nmi_callback(
unsigned int val,
struct pt_regs *regs)
756 if (cpu == crashing_cpu)
760 shootdown_callback(cpu, regs);
771 static void smp_send_nmi_allbutself(
void)
804 smp_send_nmi_allbutself();
807 while ((
atomic_read(&waiting_for_crash_ipi) > 0) && msecs) {