]> Joshua Wise's Git repositories - netwatch.git/blob - aseg-paging/firstrun.c
correctness fix to pci_dump
[netwatch.git] / aseg-paging / firstrun.c
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 <text.h>
9 #include "../net/net.h"
10
11 extern int _bss, _bssend;
12
13 extern void timer_handler(smi_event_t ev);
14 extern void kbc_handler(smi_event_t ev);
15 extern void gbl_rls_handler(smi_event_t ev);
16
17 extern pci_driver_t *drivers[];
18
19 void smi_init() {
20         smram_state_t smram;
21         pci_driver_t **driver;
22         
23         smram = smram_save_state();
24         smram_tseg_set_state(SMRAM_TSEG_OPEN);
25
26         outputf("NetWatch running");
27
28         /* Try really hard to shut up USB_LEGKEY. */
29         pci_write16(0, 31, 2, 0xC0, pci_read16(0, 31, 2, 0xC0));
30         pci_write16(0, 31, 2, 0xC0, 0);
31         pci_write16(0, 31, 4, 0xC0, pci_read16(0, 31, 4, 0xC0));
32         pci_write16(0, 31, 4, 0xC0, 0);
33
34         /* Turn on the SMIs we want */
35         smi_disable();
36         
37         eth_init();
38         
39         /* After everything is initialized, load drivers. */
40         for (driver = drivers; *driver; driver++)
41         {
42                 outputf("Probing driver: %s", (*driver)->name);
43                 if (pci_probe_driver(*driver))
44                         output("Found a card");
45         }
46         outputf("Driver probe complete");
47         
48         /* Load in fonts. */
49         text_init();
50
51         smi_register_handler(SMI_EVENT_FAST_TIMER, timer_handler);
52         smi_enable_event(SMI_EVENT_FAST_TIMER);
53
54         smi_register_handler(SMI_EVENT_DEVTRAP_KBC, kbc_handler);
55         smi_enable_event(SMI_EVENT_DEVTRAP_KBC);
56         
57         smi_register_handler(SMI_EVENT_GBL_RLS, gbl_rls_handler);
58         smi_enable_event(SMI_EVENT_GBL_RLS);
59
60         smi_enable();
61         
62         vga_flush_imm(1);
63         
64         smram_restore_state(smram);
65 }
66
This page took 0.024259 seconds and 4 git commands to generate.