]>
Commit | Line | Data |
---|---|---|
1 | #include <io.h> | |
2 | #include <smi.h> | |
3 | #include <pci.h> | |
4 | #include <reg-82801b.h> | |
5 | #include "vga-overlay.h" | |
6 | #include <smram.h> | |
7 | ||
8 | extern int _bss, _bssend; | |
9 | ||
10 | extern void timer_handler(smi_event_t ev); | |
11 | extern void kbc_handler(smi_event_t ev); | |
12 | ||
13 | void __firstrun_start() { | |
14 | unsigned char *bp; | |
15 | smram_state_t smram; | |
16 | ||
17 | smram = smram_save_state(); | |
18 | smram_tseg_set_state(SMRAM_TSEG_OPEN); | |
19 | ||
20 | for (bp = (void *)&_bss; (void *)bp < (void *)&_bssend; bp++) | |
21 | *bp = 0; | |
22 | ||
23 | dologf("NetWatch running"); | |
24 | ||
25 | /* Try really hard to shut up USB_LEGKEY. */ | |
26 | pci_write16(0, 31, 2, 0xC0, pci_read16(0, 31, 2, 0xC0)); | |
27 | pci_write16(0, 31, 2, 0xC0, 0); | |
28 | pci_write16(0, 31, 4, 0xC0, pci_read16(0, 31, 4, 0xC0)); | |
29 | pci_write16(0, 31, 4, 0xC0, 0); | |
30 | ||
31 | /* Turn on the SMIs we want */ | |
32 | smi_disable(); | |
33 | ||
34 | smi_register_handler(SMI_EVENT_FAST_TIMER, timer_handler); | |
35 | smi_enable_event(SMI_EVENT_FAST_TIMER); | |
36 | ||
37 | smi_register_handler(SMI_EVENT_DEVTRAP_KBC, kbc_handler); | |
38 | smi_enable_event(SMI_EVENT_DEVTRAP_KBC); | |
39 | ||
40 | smi_enable(); | |
41 | ||
42 | smram_restore_state(smram); | |
43 | } | |
44 |