]> Joshua Wise's Git repositories - netwatch.git/blame_incremental - aseg-paging/smi.c
tnt2 skel
[netwatch.git] / aseg-paging / smi.c
... / ...
CommitLineData
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
11unsigned int counter = 0;
12unsigned long pcisave = 0;
13unsigned char vgasave = 0;
14
15void smi_entry(void)
16{
17 char statstr[512];
18
19 pcisave = inl(0xCF8);
20 vgasave = inb(0x3D4);
21 pci_unbother_all();
22
23 counter++;
24 sprintf(statstr, "NetWatch! %08x %08x", smi_status(), counter);
25 strblit(statstr, 0, 0);
26
27 serial_init();
28 eth_poll();
29
30 if (inl(0x840) & 0x1000)
31 {
32 /*
33 pci_dump();
34 */
35 outl(0x840, 0x1100);
36 outl(0x840, 0x0100);
37 }
38
39
40 smi_poll();
41
42 pci_bother_all();
43 outl(0xCF8, pcisave);
44 outb(0x3D4, vgasave);
45}
46
47extern void timer_handler(smi_event_t ev);
48extern void kbc_handler(smi_event_t ev);
49extern void gbl_rls_handler(smi_event_t ev);
50
51void __firstrun_stub() {
52
53 /* Try really hard to shut up USB_LEGKEY. */
54 pci_write16(0, 31, 2, 0xC0, pci_read16(0, 31, 2, 0xC0));
55 pci_write16(0, 31, 2, 0xC0, 0);
56 pci_write16(0, 31, 4, 0xC0, pci_read16(0, 31, 4, 0xC0));
57 pci_write16(0, 31, 4, 0xC0, 0);
58
59 /* Turn on the SMIs we want */
60 smi_disable();
61
62 smi_register_handler(SMI_EVENT_FAST_TIMER, timer_handler);
63 smi_enable_event(SMI_EVENT_FAST_TIMER);
64
65 smi_register_handler(SMI_EVENT_DEVTRAP_KBC, kbc_handler);
66 smi_enable_event(SMI_EVENT_DEVTRAP_KBC);
67
68 smi_register_handler(SMI_EVENT_GBL_RLS, gbl_rls_handler);
69 smi_enable_event(SMI_EVENT_GBL_RLS);
70
71 smi_enable();
72}
This page took 0.027321 seconds and 4 git commands to generate.