]>
git.ipfire.org Git - ipfire-2.x.git/blob - src/hwinfo/src/int10/i10_int.c
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.
22 #if defined(__alpha__) || defined (__ia64__)
27 #include "AsmMacros.h"
30 static int int1A_handler(struct regs86
*regs
);
31 static int int42_handler(int num
, struct regs86
*regs
);
34 int_handler(int num
, struct regs86
*regs
)
39 return (int42_handler(num
,regs
));
41 return (int1A_handler(regs
));
49 int42_handler(int num
,struct regs86
*regs
)
55 * video bios has modified these -
56 * leave it to the video bios to do this
59 val
= getIntVect(num
);
60 if (val
!= 0xF000F065)
63 if ((regs
->ebx
& 0xff) == 0x32) {
64 switch (regs
->eax
& 0xFFFF) {
83 #define SUCCESSFUL 0x00
84 #define DEVICE_NOT_FOUND 0x86
85 #define BAD_REGISTER_NUMBER 0x87
88 int1A_handler(struct regs86
*regs
)
93 if (! CurrentPci
) return 0; /* oops */
95 switch (regs
->eax
& 0xFFFF) {
97 regs
->eax
&= 0xFF00; /* no config space/special cycle support */
98 regs
->edx
= 0x20494350; /* " ICP" */
99 regs
->ebx
= 0x0210; /* Version 2.10 */
101 regs
->ecx
|= (pciMaxBus
& 0xFF); /* Max bus number in system */
102 regs
->eflags
&= ~((unsigned long)0x01); /* clear carry flag */
105 if (((regs
->edx
& 0xFFFF) == CurrentPci
->VendorID
) &&
106 ((regs
->ecx
& 0xFFFF) == CurrentPci
->DeviceID
) &&
108 regs
->eax
= (regs
->eax
& 0x00FF) | (SUCCESSFUL
<< 8);
109 regs
->eflags
&= ~((unsigned long)0x01); /* clear carry flag */
110 regs
->ebx
= pciSlotBX(CurrentPci
);
112 regs
->eax
= (regs
->eax
& 0x00FF) | (DEVICE_NOT_FOUND
<< 8);
113 regs
->eflags
|= ((unsigned long)0x01); /* set carry flag */
117 if (((regs
->ecx
& 0xFF) == CurrentPci
->Interface
) &&
118 (((regs
->ecx
& 0xFF00) >> 8) == CurrentPci
->SubClass
) &&
119 (((regs
->ecx
& 0xFFFF0000) >> 16) == CurrentPci
->BaseClass
) &&
120 ((regs
->esi
& 0xff) == 0)) {
121 regs
->eax
= (regs
->eax
& 0x00FF) | (SUCCESSFUL
<< 8);
122 regs
->ebx
= pciSlotBX(CurrentPci
);
123 regs
->eflags
&= ~((unsigned long)0x01); /* clear carry flag */
125 regs
->eax
= (regs
->eax
& 0x00FF) | (DEVICE_NOT_FOUND
<< 8);
126 regs
->eflags
|= ((unsigned long)0x01); /* set carry flag */
130 if ((Slot
= findPci(regs
->ebx
))) {
131 regs
->ecx
&= 0xFFFFFF00;
132 regs
->ecx
|= PciRead8(regs
->edi
,Slot
);
133 regs
->eax
= (regs
->eax
& 0x00FF) | (SUCCESSFUL
<< 8);
134 regs
->eflags
&= ~((unsigned long)0x01); /* clear carry flag */
136 regs
->eax
= (regs
->eax
& 0x00FF) | (BAD_REGISTER_NUMBER
<< 8);
137 regs
->eflags
|= ((unsigned long)0x01); /* set carry flag */
141 if ((Slot
= findPci(regs
->ebx
))) {
142 regs
->ecx
&= 0xFFFF0000;
143 regs
->ecx
|= PciRead16(regs
->edi
,Slot
);
144 regs
->eax
= (regs
->eax
& 0x00FF) | (SUCCESSFUL
<< 8);
145 regs
->eflags
&= ~((unsigned long)0x01); /* clear carry flag */
147 regs
->eax
= (regs
->eax
& 0x00FF) | (BAD_REGISTER_NUMBER
<< 8);
148 regs
->eflags
|= ((unsigned long)0x01); /* set carry flag */
152 if ((Slot
= findPci(regs
->ebx
))) {
154 regs
->ecx
|= PciRead32(regs
->edi
,Slot
);
155 regs
->eax
= (regs
->eax
& 0x00FF) | (SUCCESSFUL
<< 8);
156 regs
->eflags
&= ~((unsigned long)0x01); /* clear carry flag */
158 regs
->eax
= (regs
->eax
& 0x00FF) | (BAD_REGISTER_NUMBER
<< 8);
159 regs
->eflags
|= ((unsigned long)0x01); /* set carry flag */
163 if ((Slot
= findPci(regs
->ebx
))) {
164 PciWrite8(regs
->edi
,(CARD8
)regs
->ecx
,Slot
);
165 regs
->eax
= (regs
->eax
& 0x00FF) | (SUCCESSFUL
<< 8);
166 regs
->eflags
&= ~((unsigned long)0x01); /* clear carry flag */
168 regs
->eax
= (regs
->eax
& 0x00FF) | (BAD_REGISTER_NUMBER
<< 8);
169 regs
->eflags
|= ((unsigned long)0x01); /* set carry flag */
173 if ((Slot
= findPci(regs
->ebx
))) {
174 PciWrite16(regs
->edi
,(CARD16
)regs
->ecx
,Slot
);
175 regs
->eax
= (regs
->eax
& 0x00FF) | (SUCCESSFUL
<< 8);
176 regs
->eflags
&= ~((unsigned long)0x01); /* clear carry flag */
178 regs
->eax
= (regs
->eax
& 0x00FF) | (BAD_REGISTER_NUMBER
<< 8);
179 regs
->eflags
|= ((unsigned long)0x01); /* set carry flag */
183 if ((Slot
= findPci(regs
->ebx
))) {
184 PciWrite32(regs
->edi
,(CARD32
)regs
->ecx
,Slot
);
185 regs
->eax
= (regs
->eax
& 0x00FF) | (SUCCESSFUL
<< 8);
186 regs
->eflags
&= ~((unsigned long)0x01); /* clear carry flag */
188 regs
->eax
= (regs
->eax
& 0x00FF) | (BAD_REGISTER_NUMBER
<< 8);
189 regs
->eflags
|= ((unsigned long)0x01); /* set carry flag */