| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- /* Reboot command: ACPI reset register first, then the legacy fallbacks.
- *
- * The 8042 pulse alone does nothing on machines without a legacy keyboard
- * controller (the Chromebook), which used to leave the BSP halted with the
- * BKL held. The FADT RESET_REG/RESET_VALUE pair is the firmware-provided
- * reset path; 0xCF9 is the Intel PCH fallback, and a triple fault is the
- * last resort. */
- #include "acpi.h"
- #include "pci.h"
- #include "timer.h"
- static void wait_ms(unsigned int ms)
- {
- unsigned int t0 = get_ticks_ms();
- while (get_ticks_ms() - t0 < ms)
- __asm__ volatile ("hlt");
- }
- void program_reboot_main(void)
- {
- if (acpi_reset() == 0)
- wait_ms(500);
- /* Intel PCH reset control: SYS_RST, then RST_CPU|SYS_RST. */
- port_outb(0xCF9, 0x02);
- port_outb(0xCF9, 0x06);
- wait_ms(300);
- /* Legacy 8042 reset pulse, for boards where that is the only path. */
- port_outb(0x64, 0xFE);
- wait_ms(300);
- /* Zero IDT + int3: a triple fault forces a CPU reset. */
- {
- struct {
- unsigned short limit;
- unsigned int base;
- } __attribute__((packed)) idt = { 0, 0 };
- __asm__ volatile ("lidt %0" : : "m"(idt));
- __asm__ volatile ("int3");
- }
- for (;;)
- __asm__ volatile ("hlt");
- }
|