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 static int found = 0, _bus, _dev, _fn;
24 pci_write16(_bus, _dev, _fn, 0x04, 0x00);
25 for (bar = 0; bar < 6; bar++)
26 pci_write32(_bus, _dev, _fn, 0x10 + bar*4, 0x1FFFFFFF);
29 int bother_3c905(pci_dev_t *dev)
31 if (dev->vid == 0x10B7 || dev->did == 0x9200)
33 outputf("Found a 3c905 to bother");
47 void __firstrun_start() {
51 smram = smram_save_state();
52 smram_tseg_set_state(SMRAM_TSEG_OPEN);
54 for (bp = (void *)&_bss; (void *)bp < (void *)&_bssend; bp++)
57 outputf("NetWatch running");
59 /* Try really hard to shut up USB_LEGKEY. */
60 pci_write16(0, 31, 2, 0xC0, pci_read16(0, 31, 2, 0xC0));
61 pci_write16(0, 31, 2, 0xC0, 0);
62 pci_write16(0, 31, 4, 0xC0, pci_read16(0, 31, 4, 0xC0));
63 pci_write16(0, 31, 4, 0xC0, 0);
65 /* Turn on the SMIs we want */
68 pci_probe(bother_3c905);
70 smi_register_handler(SMI_EVENT_FAST_TIMER, timer_handler);
71 smi_enable_event(SMI_EVENT_FAST_TIMER);
73 smi_register_handler(SMI_EVENT_DEVTRAP_KBC, kbc_handler);
74 smi_enable_event(SMI_EVENT_DEVTRAP_KBC);
76 smi_register_handler(SMI_EVENT_GBL_RLS, gbl_rls_handler);
77 smi_enable_event(SMI_EVENT_GBL_RLS);
81 smram_restore_state(smram);