4 #include <reg-82801b.h>
6 #include "vga-overlay.h"
9 extern int _bss, _bssend;
11 extern void timer_handler(smi_event_t ev);
12 extern void kbc_handler(smi_event_t ev);
13 extern void gbl_rls_handler(smi_event_t ev);
15 int bother_3c905(pci_dev_t *dev)
17 if (dev->vid == 0x10B7 || dev->did == 0x9200)
21 outputf("Found a 3c905 to bother");
22 pci_write16(dev->bus, dev->dev, dev->fn, 0x04, 0x00);
24 for (bar = 0; bar < 6; bar++)
25 if (dev->bars[bar].type != PCI_BAR_NONE)
26 pci_write32(dev->bus, dev->dev, dev->fn, 0x10 + bar*4, 0);
33 void __firstrun_start() {
37 smram = smram_save_state();
38 smram_tseg_set_state(SMRAM_TSEG_OPEN);
40 for (bp = (void *)&_bss; (void *)bp < (void *)&_bssend; bp++)
43 outputf("NetWatch running");
45 /* Try really hard to shut up USB_LEGKEY. */
46 pci_write16(0, 31, 2, 0xC0, pci_read16(0, 31, 2, 0xC0));
47 pci_write16(0, 31, 2, 0xC0, 0);
48 pci_write16(0, 31, 4, 0xC0, pci_read16(0, 31, 4, 0xC0));
49 pci_write16(0, 31, 4, 0xC0, 0);
51 /* Turn on the SMIs we want */
54 pci_probe(bother_3c905);
56 smi_register_handler(SMI_EVENT_FAST_TIMER, timer_handler);
57 smi_enable_event(SMI_EVENT_FAST_TIMER);
59 smi_register_handler(SMI_EVENT_DEVTRAP_KBC, kbc_handler);
60 smi_enable_event(SMI_EVENT_DEVTRAP_KBC);
62 smi_register_handler(SMI_EVENT_GBL_RLS, gbl_rls_handler);
63 smi_enable_event(SMI_EVENT_GBL_RLS);
67 smram_restore_state(smram);