]> Joshua Wise's Git repositories - netwatch.git/blame - aseg/counter.c
Move dolog to output
[netwatch.git] / aseg / counter.c
CommitLineData
035d7af7 1#include <io.h>
36ce375d
JP
2#include <smram.h>
3#include <video_defines.h>
4#include <minilib.h>
d71d9872 5#include <smi.h>
035d7af7 6
36ce375d 7char thestr[512];
36ce375d 8
91a6abf7 9#include "vga-overlay.h"
36ce375d 10
91a6abf7
JP
11unsigned int counter = 0;
12unsigned long pcisave;
13unsigned char vgasave;
4bea7daf 14
98765740 15void pci_dump() {
36ce375d 16 char s[40];
98765740
JP
17 unsigned long cts;
18 static int curdev = 0; /* 0 if kbd, 1 if mouse */
19
20 cts = inl(0x84C);
21
22 outl(0x848, 0x0);
85bc8ca6 23 outl(0x840, 0x0);
98765740
JP
24 switch(cts&0xF0000)
25 {
26 case 0x20000:
27 {
28 unsigned char b;
98765740 29 b = inb(cts & 0xFFFF);
d24901e6 30 dologf("READ: %08x (%02x)", cts, b);
98765740
JP
31 if ((cts & 0xFFFF) == 0x64)
32 curdev = (b & 0x20) ? 1 : 0;
33 if ((curdev == 0) && ((cts & 0xFFFF) == 0x60) && (b == 0x01))
34 outb(0xCF9, 0x4);
98765740
JP
35 *(unsigned char*)0xAFFD0 /* EAX */ = b;
36 break;
37 }
38 case 0x30000:
39 {
40 unsigned char b;
41
42 strcpy(s, "WRITxxxxxxxxxxxxxxxx");
43 b = *(unsigned char*)0xAFFD0 /* EAX */;
44 tohex(s+4, cts);
45 tohex(s+12, b);
46 dolog(s);
47 outb(cts & 0xFFFF, b);
48 break;
49 }
50 default:
51 dolog("Unhandled PCI cycle");
52 }
85bc8ca6
JW
53
54 outl(0x848, 0x1000);
55 outl(0x840, 0x0100);
98765740
JP
56}
57
d71d9872 58void smi_entry(void)
015cd976 59{
035d7af7
JW
60 pcisave = inl(0xCF8);
61 vgasave = inb(0x3D4);
31be35cd 62
4bea7daf 63 counter++;
31be35cd 64 outb(0x80, (counter & 0xFF));
035d7af7 65
d71d9872 66 sprintf(thestr, "15-412! %08x %08x", smi_status(), counter);
31be35cd 67 strblit(thestr, 0, 0);
035d7af7 68
4122ee13
JW
69 if (inl(0x834) & 0x1000)
70 {
71 if (inl(0x844) & 0x1000) /* devact_sts */
72 {
98765740 73 pci_dump();
85bc8ca6 74 outl(0x844, 0x1000); /* ack it */
4122ee13
JW
75 }
76 }
98765740
JP
77 if (inl(0x840) & 0x1000)
78 {
98765740
JP
79 pci_dump();
80 outl(0x840, 0x1100);
81 outl(0x840, 0x0100);
82 }
98765740 83
4fb81ad0 84 smi_poll();
31be35cd 85 outlog();
035d7af7
JW
86
87 outl(0xCF8, pcisave);
88 outb(0x3D4, vgasave);
4bea7daf
JW
89}
90
This page took 0.036047 seconds and 4 git commands to generate.