]> Joshua Wise's Git repositories - netwatch.git/blob - aseg-paging/smi.c
The good news is that I changed something and it worked. The bad news is that I...
[netwatch.git] / aseg-paging / smi.c
1 #include <io.h>
2 #include <smram.h>
3 #include <video_defines.h>
4 #include <minilib.h>
5 #include <smi.h>
6 #include <pci-bother.h>
7 #include <serial.h>
8 #include "../net/net.h"
9 #include "vga-overlay.h"
10
11 unsigned int counter = 0;
12 unsigned long pcisave = 0;
13 unsigned char vgasave = 0;
14
15 void smi_entry(void)
16 {
17         char statstr[512];
18         outb(0x80, 0x0B);
19         pcisave = inl(0xCF8);
20         vgasave = inb(0x3D4);
21         outb(0x80, 0x1B);
22 /*
23         pci_unbother_all();
24  */
25         counter++;
26         outb(0x80, 0x2B);
27         sprintf(statstr, "NetWatch! %08x %08x", smi_status(), counter);
28         outb(0x80, 0x3B);
29         strblit(statstr, 0, 0);
30         outb(0x80, 0x4B);
31         
32         serial_init();
33 /*      dolog("wee!");
34  */
35         
36         /*
37         eth_poll();
38         */
39         
40         if (inl(0x840) & 0x1000)
41         {
42         /*
43                 pci_dump();
44         */
45                 outl(0x840, 0x1100);
46                 outl(0x840, 0x0100);
47         }
48
49
50         smi_poll();
51 /*      
52         pci_bother_all();
53  */
54         outl(0xCF8, pcisave);
55         outb(0x3D4, vgasave);
56 }
57
58 extern void timer_handler(smi_event_t ev);
59 extern void kbc_handler(smi_event_t ev);
60 extern void gbl_rls_handler(smi_event_t ev);
61
62 void __firstrun_stub() {
63
64         /* Try really hard to shut up USB_LEGKEY. */
65         pci_write16(0, 31, 2, 0xC0, pci_read16(0, 31, 2, 0xC0));
66         pci_write16(0, 31, 2, 0xC0, 0);
67         pci_write16(0, 31, 4, 0xC0, pci_read16(0, 31, 4, 0xC0));
68         pci_write16(0, 31, 4, 0xC0, 0);
69
70         /* Turn on the SMIs we want */
71         smi_disable();
72
73         smi_register_handler(SMI_EVENT_FAST_TIMER, timer_handler);
74         smi_enable_event(SMI_EVENT_FAST_TIMER);
75
76         smi_register_handler(SMI_EVENT_DEVTRAP_KBC, kbc_handler);
77         smi_enable_event(SMI_EVENT_DEVTRAP_KBC);
78
79         smi_register_handler(SMI_EVENT_GBL_RLS, gbl_rls_handler);
80         smi_enable_event(SMI_EVENT_GBL_RLS);
81
82         smi_enable();
83 }
This page took 0.0315299999999999 seconds and 4 git commands to generate.