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