]> Joshua Wise's Git repositories - netwatch.git/blob - aseg/firstrun.c
missing packet.[ch]
[netwatch.git] / aseg / firstrun.c
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 extern void gbl_rls_handler(smi_event_t ev);
13
14 void __firstrun_start() {
15         unsigned char *bp;
16         smram_state_t smram;
17         
18         smram = smram_save_state();
19         smram_tseg_set_state(SMRAM_TSEG_OPEN);
20         
21         for (bp = (void *)&_bss; (void *)bp < (void *)&_bssend; bp++)
22                 *bp = 0;
23         
24         dologf("NetWatch running");
25
26         /* Try really hard to shut up USB_LEGKEY. */
27         pci_write16(0, 31, 2, 0xC0, pci_read16(0, 31, 2, 0xC0));
28         pci_write16(0, 31, 2, 0xC0, 0);
29         pci_write16(0, 31, 4, 0xC0, pci_read16(0, 31, 4, 0xC0));
30         pci_write16(0, 31, 4, 0xC0, 0);
31
32         /* Turn on the SMIs we want */
33         smi_disable();
34         
35         smi_register_handler(SMI_EVENT_FAST_TIMER, timer_handler);
36         smi_enable_event(SMI_EVENT_FAST_TIMER);
37         
38         smi_register_handler(SMI_EVENT_DEVTRAP_KBC, kbc_handler);
39         smi_enable_event(SMI_EVENT_DEVTRAP_KBC);
40         
41         smi_register_handler(SMI_EVENT_GBL_RLS, gbl_rls_handler);
42         smi_enable_event(SMI_EVENT_GBL_RLS);
43
44         smi_enable();
45         
46         smram_restore_state(smram);
47 }
48
This page took 0.023712 seconds and 4 git commands to generate.