4 #include <reg-82801b.h>
6 #include "vga-overlay.h"
9 #include "../net/net.h"
12 extern int _bss, _bssend;
14 extern void timer_handler(smi_event_t ev);
15 extern void kbc_handler(smi_event_t ev);
16 extern void gbl_rls_handler(smi_event_t ev);
18 extern pci_driver_t *drivers[];
22 pci_driver_t **driver;
24 smram = smram_save_state();
25 smram_tseg_set_state(SMRAM_TSEG_OPEN);
27 outputf("NetWatch running");
29 /* Try really hard to shut up USB_LEGKEY. */
30 pci_write16(0, 31, 2, 0xC0, pci_read16(0, 31, 2, 0xC0));
31 pci_write16(0, 31, 2, 0xC0, 0);
32 pci_write16(0, 31, 4, 0xC0, pci_read16(0, 31, 4, 0xC0));
33 pci_write16(0, 31, 4, 0xC0, 0);
35 /* Turn on the SMIs we want */
42 /* After everything is initialized, load drivers. */
43 for (driver = drivers; *driver; driver++)
45 outputf("Probing driver: %s", (*driver)->name);
46 if (pci_probe_driver(*driver))
47 output("Found a card");
49 outputf("Driver probe complete");
54 smi_register_handler(SMI_EVENT_FAST_TIMER, timer_handler);
55 smi_enable_event(SMI_EVENT_FAST_TIMER);
57 smi_register_handler(SMI_EVENT_DEVTRAP_KBC, kbc_handler);
58 smi_enable_event(SMI_EVENT_DEVTRAP_KBC);
60 smi_register_handler(SMI_EVENT_GBL_RLS, gbl_rls_handler);
61 smi_enable_event(SMI_EVENT_GBL_RLS);
67 smram_restore_state(smram);