From 09f5525f330b16dcbff63fb00c6a2db99c140ad5 Mon Sep 17 00:00:00 2001 From: Sam DEMEULEMEESTER Date: Tue, 8 Mar 2022 23:24:25 +0100 Subject: [PATCH 1/2] Add additional reset method --- system/hwctrl.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/system/hwctrl.c b/system/hwctrl.c index 1b67517..efcae58 100644 --- a/system/hwctrl.c +++ b/system/hwctrl.c @@ -13,6 +13,7 @@ #include "io.h" #include "hwctrl.h" +#include "unistd.h" //------------------------------------------------------------------------------ // Public Functions @@ -25,6 +26,15 @@ void reboot(void) // Pulse the system reset signal. outb(0xfe, 0x64); + + // If not working, use cf9 method after 100ms delay + usleep(100000); + uint8_t cf9 = inb(0xcf9) & ~6; + outb(cf9|2, 0xcf9); /* Request hard reset */ + usleep(50); + outb(cf9|6, 0xcf9); /* Actually do the reset */ + usleep(50); + } void floppy_off() @@ -42,3 +52,4 @@ void cursor_off() outb(0x0e, 0x3d4); outb(0xff, 0x3d5); } + From 4bc3b6a3c81ac7daf980cb133c68ae3c54fa80d7 Mon Sep 17 00:00:00 2001 From: Sam DEMEULEMEESTER Date: Tue, 8 Mar 2022 23:30:31 +0100 Subject: [PATCH 2/2] Add additional reset method --- system/hwctrl.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/system/hwctrl.c b/system/hwctrl.c index efcae58..e7b9750 100644 --- a/system/hwctrl.c +++ b/system/hwctrl.c @@ -28,12 +28,12 @@ void reboot(void) outb(0xfe, 0x64); // If not working, use cf9 method after 100ms delay - usleep(100000); - uint8_t cf9 = inb(0xcf9) & ~6; - outb(cf9|2, 0xcf9); /* Request hard reset */ - usleep(50); - outb(cf9|6, 0xcf9); /* Actually do the reset */ - usleep(50); + usleep(100000); + uint8_t cf9 = inb(0xcf9) & ~6; + outb(cf9|2, 0xcf9); /* Request hard reset */ + usleep(50); + outb(cf9|6, 0xcf9); /* Actually do the reset */ + usleep(50); } @@ -52,4 +52,3 @@ void cursor_off() outb(0x0e, 0x3d4); outb(0xff, 0x3d5); } -