1
0
mirror of https://github.com/memtest86plus/memtest86plus synced 2025-03-15 02:12:57 +03:00

Reset methods re-ordering (proven more universal for BIOS/UEFI as an attempt to solve )

This commit is contained in:
Sam Demeulemeester 2022-03-20 20:17:44 +01:00
parent bd5e6f3c6b
commit ec1a880288

@ -51,25 +51,27 @@ static void efi_reset(uint8_t reset_type)
void reboot(void) void reboot(void)
{ {
// Use cf9 method as first try
if(saved_efi_info.loader_signature) {
efi_reset(EFI_RESET_COLD);
usleep(1000000);
}
// Tell the BIOS to do a warm reboot.
*((uint16_t *)0x472) = 0x1234;
// Pulse the system reset signal.
outb(0xfe, 0x64);
// If not working, use cf9 method after 100ms delay
usleep(15000);
uint8_t cf9 = inb(0xcf9) & ~6; uint8_t cf9 = inb(0xcf9) & ~6;
outb(cf9|2, 0xcf9); // Request hard reset outb(cf9|2, 0xcf9); // Request hard reset
usleep(50); usleep(50);
outb(cf9|6, 0xcf9); // Actually do the reset outb(cf9|6, 0xcf9); // Actually do the reset
usleep(50); usleep(50);
// If we have UEFI, try EFI reset service
if(saved_efi_info.loader_signature) {
efi_reset(EFI_RESET_COLD);
usleep(1000000);
}
// Still here? try the PORT 0x64 method
outb(0xfe, 0x64);
usleep(150000);
if(!saved_efi_info.loader_signature) {
// In last resort, (very) obsolete reboot method using BIOS
*((uint16_t *)0x472) = 0x1234;
}
} }
void floppy_off() void floppy_off()