3 #include <video_defines.h>
6 #include "vga-overlay.h"
9 unsigned int counter = 0;
10 unsigned long pcisave;
11 unsigned char vgasave;
15 static int curdev = 0; /* 0 if kbd, 1 if mouse */
26 b = inb(cts & 0xFFFF);
27 dologf("READ: %08x (%02x)", cts, b);
28 if ((cts & 0xFFFF) == 0x64)
29 curdev = (b & 0x20) ? 1 : 0;
30 if ((curdev == 0) && ((cts & 0xFFFF) == 0x60) && (b == 0x01))
32 *(unsigned char*)0xAFFD0 /* EAX */ = b;
39 b = *(unsigned char*)0xAFFD0 /* EAX */;
40 dologf("WRITE: %08x (%02x)", cts, b);
41 outb(cts & 0xFFFF, b);
45 dolog("Unhandled PCI cycle");
52 void timer_handler(smi_event_t ev)
54 static unsigned int ticks = 0;
56 smi_disable_event(SMI_EVENT_FAST_TIMER);
57 smi_enable_event(SMI_EVENT_FAST_TIMER);
59 outb(0x80, (ticks++) & 0xFF);
64 void kbc_handler(smi_event_t ev)
69 void gbl_rls_handler(smi_event_t ev)
73 ecx = *(unsigned long*)0xAFFD4;
75 packet_t * packet = check_packet(ecx);
78 dologf("WARN: bad packet at %08x", ecx);
82 dologf("Got packet: type %08x", packet->type);
84 if (packet->type == 42) {
85 dump_log((char *)packet->data);
86 *(unsigned long*)0xAFFD4 = 42;
88 *(unsigned long*)0xAFFD4 = 0x2BADD00D;
100 sprintf(statstr, "15-412! %08x %08x", smi_status(), counter);
101 strblit(statstr, 0, 0);
103 if (inl(0x840) & 0x1000)
112 outl(0xCF8, pcisave);
113 outb(0x3D4, vgasave);