]> Joshua Wise's Git repositories - netwatch.git/blame - aseg-paging/firstrun.c
Wait for completion before we pull the trigger on the pbuf
[netwatch.git] / aseg-paging / firstrun.c
CommitLineData
9e2a82e4
JP
1#include <io.h>
2#include <smi.h>
3#include <pci.h>
4#include <reg-82801b.h>
5#include <output.h>
6#include "vga-overlay.h"
7#include <smram.h>
8#include "../net/net.h"
9
10extern int _bss, _bssend;
11
12extern void timer_handler(smi_event_t ev);
13extern void kbc_handler(smi_event_t ev);
14extern void gbl_rls_handler(smi_event_t ev);
15
34a7d0d2
JW
16extern pci_driver_t *drivers[];
17
722e5aea 18void smi_init() {
9e2a82e4 19 smram_state_t smram;
34a7d0d2 20 pci_driver_t **driver;
9e2a82e4
JP
21
22 smram = smram_save_state();
23 smram_tseg_set_state(SMRAM_TSEG_OPEN);
722e5aea 24
9e2a82e4
JP
25 outputf("NetWatch running");
26
27 /* Try really hard to shut up USB_LEGKEY. */
28 pci_write16(0, 31, 2, 0xC0, pci_read16(0, 31, 2, 0xC0));
29 pci_write16(0, 31, 2, 0xC0, 0);
30 pci_write16(0, 31, 4, 0xC0, pci_read16(0, 31, 4, 0xC0));
31 pci_write16(0, 31, 4, 0xC0, 0);
32
33 /* Turn on the SMIs we want */
34 smi_disable();
9e2a82e4
JP
35
36 eth_init();
34a7d0d2
JW
37
38 /* After everything is initialized, load drivers. */
39 for (driver = drivers; *driver; driver++)
40 {
41 outputf("Probing driver: %s", (*driver)->name);
42 if (pci_probe_driver(*driver))
43 output("Found a card");
44 }
45 outputf("Driver probe complete");
722e5aea 46
9e2a82e4
JP
47 smi_register_handler(SMI_EVENT_FAST_TIMER, timer_handler);
48 smi_enable_event(SMI_EVENT_FAST_TIMER);
722e5aea 49
9e2a82e4
JP
50 smi_register_handler(SMI_EVENT_DEVTRAP_KBC, kbc_handler);
51 smi_enable_event(SMI_EVENT_DEVTRAP_KBC);
52
53 smi_register_handler(SMI_EVENT_GBL_RLS, gbl_rls_handler);
54 smi_enable_event(SMI_EVENT_GBL_RLS);
722e5aea 55
9e2a82e4
JP
56 smi_enable();
57
58 vga_flush_imm(1);
59
60 smram_restore_state(smram);
61}
62
This page took 0.032582 seconds and 4 git commands to generate.