]> Joshua Wise's Git repositories - netwatch.git/blame - aseg-paging/smi.c
who knows if this will work
[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>
c77a83d6
JW
8#include <fb.h>
9#include <output.h>
9e2a82e4
JP
10#include "../net/net.h"
11#include "vga-overlay.h"
12
9e2a82e4 13unsigned int counter = 0;
9e2a82e4
JP
14unsigned long pcisave = 0;
15unsigned char vgasave = 0;
16
9e2a82e4
JP
17void smi_entry(void)
18{
19 char statstr[512];
68beefa8 20
9e2a82e4
JP
21 pcisave = inl(0xCF8);
22 vgasave = inb(0x3D4);
9e2a82e4 23 pci_unbother_all();
c77a83d6
JW
24
25 serial_init();
26
27 if (fb)
28 fb->getvmode(fb->priv);
68beefa8 29
9e2a82e4 30 counter++;
5cb80fe1
JW
31 if (!fb || fb->curmode.text)
32 {
33 sprintf(statstr, "NetWatch! %08x %08x", smi_status(), counter);
34 strblit(statstr, 0, 0, 0);
35 }
9e2a82e4 36
9e2a82e4 37 eth_poll();
9e2a82e4
JP
38
39 if (inl(0x840) & 0x1000)
40 {
41 /*
42 pci_dump();
43 */
44 outl(0x840, 0x1100);
45 outl(0x840, 0x0100);
46 }
47
113df320 48
9e2a82e4 49 smi_poll();
68beefa8 50
9e2a82e4 51 pci_bother_all();
9e2a82e4
JP
52 outl(0xCF8, pcisave);
53 outb(0x3D4, vgasave);
54}
55
722e5aea
JP
56extern void timer_handler(smi_event_t ev);
57extern void kbc_handler(smi_event_t ev);
58extern void gbl_rls_handler(smi_event_t ev);
9e2a82e4 59
722e5aea 60void __firstrun_stub() {
9e2a82e4 61
722e5aea
JP
62 /* Try really hard to shut up USB_LEGKEY. */
63 pci_write16(0, 31, 2, 0xC0, pci_read16(0, 31, 2, 0xC0));
64 pci_write16(0, 31, 2, 0xC0, 0);
65 pci_write16(0, 31, 4, 0xC0, pci_read16(0, 31, 4, 0xC0));
66 pci_write16(0, 31, 4, 0xC0, 0);
9e2a82e4 67
722e5aea
JP
68 /* Turn on the SMIs we want */
69 smi_disable();
9e2a82e4
JP
70
71 smi_register_handler(SMI_EVENT_FAST_TIMER, timer_handler);
72 smi_enable_event(SMI_EVENT_FAST_TIMER);
73
722e5aea
JP
74 smi_register_handler(SMI_EVENT_DEVTRAP_KBC, kbc_handler);
75 smi_enable_event(SMI_EVENT_DEVTRAP_KBC);
76
77 smi_register_handler(SMI_EVENT_GBL_RLS, gbl_rls_handler);
78 smi_enable_event(SMI_EVENT_GBL_RLS);
79
9e2a82e4
JP
80 smi_enable();
81}
This page took 0.035583 seconds and 4 git commands to generate.