]>
Commit | Line | Data |
---|---|---|
e5d94488 | 1 | #include <io.h> |
85bc8ca6 | 2 | #include <smi.h> |
36ce375d | 3 | #include <pci.h> |
4fb81ad0 | 4 | #include <reg-82801b.h> |
ce91287c | 5 | #include <output.h> |
d71d9872 | 6 | #include "vga-overlay.h" |
f2b87dd6 | 7 | #include <smram.h> |
3e6d6106 | 8 | #include "../net/net.h" |
f2b87dd6 JW |
9 | |
10 | extern int _bss, _bssend; | |
e5d94488 | 11 | |
07d1dd26 | 12 | extern void timer_handler(smi_event_t ev); |
8a677ebb | 13 | extern void kbc_handler(smi_event_t ev); |
73fb9b4c | 14 | extern void gbl_rls_handler(smi_event_t ev); |
07d1dd26 | 15 | |
e5d94488 | 16 | void __firstrun_start() { |
f2b87dd6 JW |
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 | ||
6bd08bbc JW |
26 | vga_flush_imm(0); |
27 | ||
ce91287c | 28 | outputf("NetWatch running"); |
e5d94488 JP |
29 | |
30 | /* Try really hard to shut up USB_LEGKEY. */ | |
31 | pci_write16(0, 31, 2, 0xC0, pci_read16(0, 31, 2, 0xC0)); | |
32 | pci_write16(0, 31, 2, 0xC0, 0); | |
33 | pci_write16(0, 31, 4, 0xC0, pci_read16(0, 31, 4, 0xC0)); | |
34 | pci_write16(0, 31, 4, 0xC0, 0); | |
35 | ||
36 | /* Turn on the SMIs we want */ | |
07d1dd26 | 37 | smi_disable(); |
8a677ebb | 38 | |
3b3161a1 | 39 | eth_init(); |
ce91287c | 40 | |
07d1dd26 JW |
41 | smi_register_handler(SMI_EVENT_FAST_TIMER, timer_handler); |
42 | smi_enable_event(SMI_EVENT_FAST_TIMER); | |
8a677ebb JW |
43 | |
44 | smi_register_handler(SMI_EVENT_DEVTRAP_KBC, kbc_handler); | |
45 | smi_enable_event(SMI_EVENT_DEVTRAP_KBC); | |
73fb9b4c JW |
46 | |
47 | smi_register_handler(SMI_EVENT_GBL_RLS, gbl_rls_handler); | |
48 | smi_enable_event(SMI_EVENT_GBL_RLS); | |
8a677ebb | 49 | |
85bc8ca6 | 50 | smi_enable(); |
f2b87dd6 | 51 | |
6bd08bbc JW |
52 | vga_flush_imm(1); |
53 | ||
f2b87dd6 | 54 | smram_restore_state(smram); |
e5d94488 JP |
55 | } |
56 |