]> Joshua Wise's Git repositories - netwatch.git/blame - aseg/firstrun.c
Merge branch 'master' of /storage/git/netwatch
[netwatch.git] / aseg / firstrun.c
CommitLineData
e5d94488 1#include <io.h>
85bc8ca6 2#include <smi.h>
36ce375d 3#include <pci.h>
4fb81ad0 4#include <reg-82801b.h>
d71d9872 5#include "vga-overlay.h"
f2b87dd6
JW
6#include <smram.h>
7
8extern int _bss, _bssend;
e5d94488 9
07d1dd26 10extern void timer_handler(smi_event_t ev);
8a677ebb 11extern void kbc_handler(smi_event_t ev);
07d1dd26 12
e5d94488 13void __firstrun_start() {
f2b87dd6
JW
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
d71d9872 23 dologf("NetWatch running");
e5d94488
JP
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 */
07d1dd26 32 smi_disable();
8a677ebb 33
07d1dd26
JW
34 smi_register_handler(SMI_EVENT_FAST_TIMER, timer_handler);
35 smi_enable_event(SMI_EVENT_FAST_TIMER);
8a677ebb
JW
36
37 smi_register_handler(SMI_EVENT_DEVTRAP_KBC, kbc_handler);
38 smi_enable_event(SMI_EVENT_DEVTRAP_KBC);
39
85bc8ca6 40 smi_enable();
f2b87dd6
JW
41
42 smram_restore_state(smram);
e5d94488
JP
43}
44
This page took 0.030716 seconds and 4 git commands to generate.