2 * Copyright 1999 Egbert Eich
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of the authors not be used in
9 * advertising or publicity pertaining to distribution of the software without
10 * specific, written prior permission. The authors makes no representations
11 * about the suitability of this software for any purpose. It is provided
12 * "as is" without express or implied warranty.
14 * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
23 #if defined(__alpha__) || defined (__ia64__)
28 #include "AsmMacros.h"
31 static int int1A_handler(struct regs86 *regs);
32 static int int42_handler(int num, struct regs86 *regs);
35 int_handler(int num, struct regs86 *regs)
40 return (int42_handler(num,regs));
42 return (int1A_handler(regs));
50 int42_handler(int num,struct regs86 *regs)
55 i_printf("int 0x%x: ax:0x%lx bx:0x%lx cx:0x%lx dx:0x%lx\n",num,
56 regs->eax,regs->ebx, regs->ecx, regs->edx);
59 * video bios has modified these -
60 * leave it to the video bios to do this
63 val = getIntVect(num);
64 if (val != 0xF000F065)
67 if ((regs->ebx & 0xff) == 0x32) {
68 switch (regs->eax & 0xFFFF) {
70 i_printf("enabling video\n");
76 i_printf("disabling video\n");
90 #define SUCCESSFUL 0x00
91 #define DEVICE_NOT_FOUND 0x86
92 #define BAD_REGISTER_NUMBER 0x87
95 int1A_handler(struct regs86 *regs)
100 if (! CurrentPci) return 0; /* oops */
102 i_printf("int 0x1a: ax=0x%lx bx=0x%lx cx=0x%lx dx=0x%lx di=0x%lx"
103 " si=0x%lx\n", regs->eax,regs->ebx,regs->ecx,regs->edx,
104 regs->edi,regs->esi);
105 switch (regs->eax & 0xFFFF) {
107 regs->eax &= 0xFF00; /* no config space/special cycle support */
108 regs->edx = 0x20494350; /* " ICP" */
109 regs->ebx = 0x0210; /* Version 2.10 */
111 regs->ecx |= (pciMaxBus & 0xFF); /* Max bus number in system */
112 regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
113 i_printf("ax=0x%lx dx=0x%lx bx=0x%lx cx=0x%lx flags=0x%lx\n",
114 regs->eax,regs->edx,regs->ebx,regs->ecx,regs->eflags);
117 if (((regs->edx & 0xFFFF) == CurrentPci->VendorID) &&
118 ((regs->ecx & 0xFFFF) == CurrentPci->DeviceID) &&
120 regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
121 regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
122 regs->ebx = pciSlotBX(CurrentPci);
124 else if (Config.ShowAllDev &&
125 (pPci = findPciDevice(regs->edx,regs->ecx,regs->esi)) != NULL) {
126 regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
127 regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
128 regs->ebx = pciSlotBX(pPci);
130 regs->eax = (regs->eax & 0x00FF) | (DEVICE_NOT_FOUND << 8);
131 regs->eflags |= ((unsigned long)0x01); /* set carry flag */
133 i_printf("ax=0x%lx bx=0x%lx flags=0x%lx\n",
134 regs->eax,regs->ebx,regs->eflags);
137 if (((regs->ecx & 0xFF) == CurrentPci->Interface) &&
138 (((regs->ecx & 0xFF00) >> 8) == CurrentPci->SubClass) &&
139 (((regs->ecx & 0xFFFF0000) >> 16) == CurrentPci->BaseClass) &&
140 ((regs->esi & 0xff) == 0)) {
141 regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
142 regs->ebx = pciSlotBX(CurrentPci);
143 regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
145 else if (Config.ShowAllDev
146 && (pPci = findPciClass(regs->ecx & 0xFF, (regs->ecx & 0xff00) >> 8,
147 (regs->ecx & 0xffff0000) >> 16, regs->esi)) != NULL) {
148 regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
149 regs->ebx = pciSlotBX(pPci);
150 regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
152 regs->eax = (regs->eax & 0x00FF) | (DEVICE_NOT_FOUND << 8);
153 regs->eflags |= ((unsigned long)0x01); /* set carry flag */
155 i_printf("ax=0x%lx flags=0x%lx\n",regs->eax,regs->eflags);
158 i_printf("Slot=0x%x\n",CurrentPci->Slot.l);
159 if ((Slot = findPci(regs->ebx))) {
160 regs->ecx &= 0xFFFFFF00;
161 regs->ecx |= PciRead8(regs->edi,Slot);
162 regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
163 regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
165 regs->eax = (regs->eax & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
166 regs->eflags |= ((unsigned long)0x01); /* set carry flag */
168 i_printf("ax=0x%lx cx=0x%lx flags=0x%lx\n",
169 regs->eax,regs->ecx,regs->eflags);
172 i_printf("Slot=0x%x\n",CurrentPci->Slot.l);
173 if ((Slot = findPci(regs->ebx))) {
174 regs->ecx &= 0xFFFF0000;
175 regs->ecx |= PciRead16(regs->edi,Slot);
176 regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
177 regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
179 regs->eax = (regs->eax & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
180 regs->eflags |= ((unsigned long)0x01); /* set carry flag */
182 i_printf("ax=0x%lx cx=0x%lx flags=0x%lx\n",
183 regs->eax,regs->ecx,regs->eflags);
186 i_printf("Slot=0x%x\n",CurrentPci->Slot.l);
187 if ((Slot = findPci(regs->ebx))) {
189 regs->ecx |= PciRead32(regs->edi,Slot);
190 regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
191 regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
193 regs->eax = (regs->eax & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
194 regs->eflags |= ((unsigned long)0x01); /* set carry flag */
196 i_printf("ax=0x%lx cx=0x%lx flags=0x%lx\n",
197 regs->eax,regs->ecx,regs->eflags);
200 i_printf("Slot=0x%x\n",CurrentPci->Slot.l);
201 if ((Slot = findPci(regs->ebx))) {
202 PciWrite8(regs->edi,(CARD8)regs->ecx,Slot);
203 regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
204 regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
206 regs->eax = (regs->eax & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
207 regs->eflags |= ((unsigned long)0x01); /* set carry flag */
209 i_printf("ax=0x%lx flags=0x%lx\n", regs->eax,regs->eflags);
212 i_printf("Slot=0x%x\n",CurrentPci->Slot.l);
213 if ((Slot = findPci(regs->ebx))) {
214 PciWrite16(regs->edi,(CARD16)regs->ecx,Slot);
215 regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
216 regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
218 regs->eax = (regs->eax & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
219 regs->eflags |= ((unsigned long)0x01); /* set carry flag */
221 i_printf("ax=0x%lx flags=0x%lx\n", regs->eax,regs->eflags);
224 i_printf("Slot=0x%x\n",CurrentPci->Slot.l);
225 if ((Slot = findPci(regs->ebx))) {
226 PciWrite32(regs->edi,(CARD32)regs->ecx,Slot);
227 regs->eax = (regs->eax & 0x00FF) | (SUCCESSFUL << 8);
228 regs->eflags &= ~((unsigned long)0x01); /* clear carry flag */
230 regs->eax = (regs->eax & 0x00FF) | (BAD_REGISTER_NUMBER << 8);
231 regs->eflags |= ((unsigned long)0x01); /* set carry flag */
233 i_printf("ax=0x%lx flags=0x%lx\n", regs->eax,regs->eflags);