]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/drivers/amd64/reset-amd64.cpp
5ab684e01e0b10432237f8626218c802d0fdf0fa
[l4.git] / kernel / fiasco / src / drivers / amd64 / reset-amd64.cpp
1 IMPLEMENTATION[amd64]:
2
3 #include "io.h"
4 #include "processor.h"
5
6 // reset PC
7 void __attribute__ ((noreturn))
8 pc_reset()
9 {
10   // i8042: store the next byte at port 0x60 as command byte
11   while (Io::in8 (0x64) & 0x2)
12     ;
13   Io::out8_p (0x60, 0x64);
14
15   // i8042 command byte (PS/2-compatible mode):
16   //   b0=0 ... no IRQ 1 is generated when data available in input buffer
17   //   b1=0 ... no IRQ 1 is generated when mouse data available in input buffer
18   //   b2=1 ... set SYS flag in status register -- tells POST to perform
19   //            "warm boot" tests/initiailization
20   //   b3=0 ... reserved
21   //   b4=0 ... keyboard interface enabled
22   //   b5=0 ... auxillary PS/2 device (mouse) interface enabled
23   //   b6=0 ... translation disabled -- data appears at input buffer exactly
24   //            as read from keyboard
25   //   b7=0 ... reserved
26   while (Io::in8 (0x64) & 0x2)
27     ;
28   Io::out8_p (0x4, 0x60);
29
30   // i8042: pulse output port with 1110b
31   //   b0=0 ... reset computer
32   //   b1=1 ... set gate A20
33   //   b2=1 ... pull mouse data low
34   //   b3=1 ... pull mouse clock low
35   while (Io::in8 (0x64) & 0x2)
36     ;
37   Io::out8_p (0xfe,0x64);
38
39   for (;;)
40     Proc::pause();
41 }