]> Joshua Wise's Git repositories - netwatch.git/blame - 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
CommitLineData
9e2a82e4
JP
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>
113df320 7#include <serial.h>
9e2a82e4
JP
8#include "../net/net.h"
9#include "vga-overlay.h"
10
9e2a82e4 11unsigned int counter = 0;
9e2a82e4
JP
12unsigned long pcisave = 0;
13unsigned char vgasave = 0;
14
9e2a82e4
JP
15void 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);
722e5aea 27 sprintf(statstr, "NetWatch! %08x %08x", smi_status(), counter);
9e2a82e4
JP
28 outb(0x80, 0x3B);
29 strblit(statstr, 0, 0);
30 outb(0x80, 0x4B);
31
113df320 32 serial_init();
722e5aea
JP
33/* dolog("wee!");
34 */
113df320 35
9e2a82e4
JP
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
113df320 49
9e2a82e4 50 smi_poll();
113df320 51/*
9e2a82e4
JP
52 pci_bother_all();
53 */
54 outl(0xCF8, pcisave);
55 outb(0x3D4, vgasave);
56}
57
722e5aea
JP
58extern void timer_handler(smi_event_t ev);
59extern void kbc_handler(smi_event_t ev);
60extern void gbl_rls_handler(smi_event_t ev);
9e2a82e4 61
722e5aea 62void __firstrun_stub() {
9e2a82e4 63
722e5aea
JP
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);
9e2a82e4 69
722e5aea
JP
70 /* Turn on the SMIs we want */
71 smi_disable();
9e2a82e4
JP
72
73 smi_register_handler(SMI_EVENT_FAST_TIMER, timer_handler);
74 smi_enable_event(SMI_EVENT_FAST_TIMER);
75
722e5aea
JP
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
9e2a82e4
JP
82 smi_enable();
83}
This page took 0.031229 seconds and 4 git commands to generate.