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