}
void
-qemu_prep_reset(void)
+qemu_reboot(void)
{
if (!CONFIG_QEMU || runningOnXen())
return;
memcpy(hrp + 4, hrp + 4 + BIOS_SRC_OFFSET, cend - (hrp + 4));
barrier();
HaveRunPost = 0;
+ barrier();
+
+ // Request a QEMU system reset. Do the reset in this function as
+ // the BIOS code was overwritten above and not all BIOS
+ // functionality may be available.
+
+ // Attempt PCI style reset
+ outb(0x02, PORT_PCI_REBOOT);
+ outb(0x06, PORT_PCI_REBOOT);
+
+ // Next try triple faulting the CPU to force a reset
+ asm volatile("int3");
}
#include "x86.h" // outl
#define PORT_PCI_CMD 0x0cf8
-#define PORT_PCI_REBOOT 0x0cf9
#define PORT_PCI_DATA 0x0cfc
void pci_config_writel(u16 bdf, u32 addr, u32 val)
#include "types.h" // u32
+#define PORT_PCI_REBOOT 0x0cf9
+
static inline u8 pci_bdf_to_bus(u16 bdf) {
return bdf >> 8;
}
{
dprintf(1, "Attempting a hard reboot\n");
- // Setup for reset on qemu.
- qemu_prep_reset();
+ // Use a QEMU specific reboot on QEMU
+ qemu_reboot();
// Reboot using ACPI RESET_REG
acpi_reboot();
// fw/shadow.c
void make_bios_writable(void);
void make_bios_readonly(void);
-void qemu_prep_reset(void);
+void qemu_reboot(void);
// fw/smbios.c
void smbios_legacy_setup(void);