genode/base-okl4/patches/kdb_reboot.patch

55 lines
1.6 KiB
Diff

diff -r ac48ec8ffd86 platform/pc99/pistachio/src/reboot.cc
--- a/platform/pc99/pistachio/src/reboot.cc Tue Aug 03 13:10:36 2010 +0200
+++ b/platform/pc99/pistachio/src/reboot.cc Tue Oct 05 15:30:32 2010 +0200
@@ -58,7 +58,9 @@
/*
* Description: PC99 reset
*/
+
#include <kernel/arch/platform.h>
+#include <kernel/arch/ioport.h>
/*
* Reboot the box
@@ -66,6 +68,39 @@
void Platform::reboot(void)
{
+ asm volatile ("cli \n" :);
- for (;;);
+ /* i8042: store the next byte at port 0x60 as command byte */
+ while (in_u8(0x64) & 0x2) ;
+ out_u8(0x64, 0x60);
+
+ /* i8042 command byte (PS/2-compatible mode):
+ b0=0 ... no IRQ 1 is generated when data available in
+ input buffer
+ b1=0 ... no IRQ 1 is generated when mouse data available
+ in input buffer
+ b2=1 ... set SYS flag in status register -- tells POST
+ to perform "warm boot" tests/initiailization
+ b3=0 ... reserved
+ b4=0 ... keyboard interface enabled
+ b5=0 ... auxillary PS/2 device (mouse) interface
+ enabled
+ b6=0 ... translation disabled -- data appears at
+ input buffer exactly as read from keyboard
+ b7=0 ... reserved
+ */
+ while (in_u8(0x64) & 0x2) ;
+ out_u8(0x60, 0x4);
+
+ /* i8042: pulse output port with 1110b
+ b0=0 ... reset computer
+ b1=1 ... set gate A20
+ b2=1 ... pull mouse data low
+ b3=1 ... pull mouse clock low
+ */
+ while (in_u8(0x64) & 0x2) ;
+ out_u8(0x64, 0xfe);
+
+ for (;;)
+ asm volatile ("hlt \n" :);
}