3 #include <video_defines.h>
6 #include <pci-bother.h>
7 #include "../net/net.h"
8 #include "vga-overlay.h"
11 unsigned int counter = 0;
12 unsigned long pcisave;
13 unsigned char vgasave;
17 static int curdev = 0; /* 0 if kbd, 1 if mouse */
28 b = inb(cts & 0xFFFF);
29 dologf("READ: %08x (%02x)", cts, b);
30 if ((cts & 0xFFFF) == 0x64)
31 curdev = (b & 0x20) ? 1 : 0;
32 if ((curdev == 0) && ((cts & 0xFFFF) == 0x60) && (b == 0x01))
34 *(unsigned char*)0xAFFD0 /* EAX */ = b;
41 b = *(unsigned char*)0xAFFD0 /* EAX */;
42 dologf("WRITE: %08x (%02x)", cts, b);
43 outb(cts & 0xFFFF, b);
47 dolog("Unhandled PCI cycle");
54 void timer_handler(smi_event_t ev)
56 static unsigned int ticks = 0;
58 smi_disable_event(SMI_EVENT_FAST_TIMER);
59 smi_enable_event(SMI_EVENT_FAST_TIMER);
61 outb(0x80, (ticks++) & 0xFF);
66 void kbc_handler(smi_event_t ev)
71 void gbl_rls_handler(smi_event_t ev)
75 ecx = *(unsigned long*)0xAFFD4;
77 packet_t * packet = check_packet(ecx);
80 dologf("WARN: bad packet at %08x", ecx);
84 dologf("Got packet: type %08x", packet->type);
86 if (packet->type == 42) {
87 dump_log((char *)packet->data);
88 *(unsigned long*)0xAFFD4 = 42;
90 *(unsigned long*)0xAFFD4 = 0x2BADD00D;
103 sprintf(statstr, "15-412! %08x %08x", smi_status(), counter);
104 strblit(statstr, 0, 0);
108 if (inl(0x840) & 0x1000)
118 outl(0xCF8, pcisave);
119 outb(0x3D4, vgasave);