]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/hwinfo/src/int10/i10_pci.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.
27 #include <sys/types.h>
30 #if defined (__alpha__) || defined (__ia64__)
33 #include "AsmMacros.h"
41 * I'm rather simple mindend - therefore I do a poor man's
42 * pci scan without all the fancy stuff that is done in
43 * scanpci. However that's all we need.
46 PciStructPtr PciStruct
= NULL
;
47 PciBusPtr PciBuses
= NULL
;
48 PciStructPtr CurrentPci
= NULL
;
49 PciStructPtr PciList
= NULL
;
52 static CARD32 PciCfg1Addr
;
54 static void readConfigSpaceCfg1(CARD32 bus
, CARD32 dev
, CARD32 func
,
56 static int checkSlotCfg1(CARD32 bus
, CARD32 dev
, CARD32 func
);
57 static int checkSlotCfg2(CARD32 bus
, int dev
);
58 static void readConfigSpaceCfg2(CARD32 bus
, int dev
, CARD32
*reg
);
59 static CARD8
interpretConfigSpace(CARD32
*reg
, int busidx
,
60 CARD8 dev
, CARD8 func
);
61 static CARD32
findBIOSMap(PciStructPtr pciP
, CARD32
*biosSize
);
62 static void restoreMem(PciStructPtr pciP
);
66 #define PCI_BUS_FROM_TAG(tag) (((tag) & 0x00ff0000) >> 16)
67 #define PCI_DFN_FROM_TAG(tag) (((tag) & 0x0000ff00) >> 8)
69 #include <asm/unistd.h>
72 axpPciCfgRead(CARD32 tag
)
75 CARD32 val
= 0xffffffff;
77 bus
= PCI_BUS_FROM_TAG(tag
);
78 dfn
= PCI_DFN_FROM_TAG(tag
);
80 syscall(__NR_pciconfig_read
, bus
, dfn
, tag
& 0xff, 4, &val
);
85 axpPciCfgWrite(CARD32 tag
, CARD32 val
)
89 bus
= PCI_BUS_FROM_TAG(tag
);
90 dfn
= PCI_DFN_FROM_TAG(tag
);
92 syscall(__NR_pciconfig_write
, bus
, dfn
, tag
& 0xff, 4, &val
);
95 static CARD32 (*readPci
)(CARD32 reg
) = axpPciCfgRead
;
96 static void (*writePci
)(CARD32 reg
, CARD32 val
) = axpPciCfgWrite
;
98 static CARD32
readPciCfg1(CARD32 reg
);
99 static void writePciCfg1(CARD32 reg
, CARD32 val
);
101 static CARD32
readPciCfg2(CARD32 reg
);
102 static void writePciCfg2(CARD32 reg
, CARD32 val
);
105 static CARD32 (*readPci
)(CARD32 reg
) = readPciCfg1
;
106 static void (*writePci
)(CARD32 reg
, CARD32 val
) = writePciCfg1
;
109 #if defined(__alpha__) || defined(__sparc__)
110 #define PCI_EN 0x00000000
112 #define PCI_EN 0x80000000
117 static int hostbridges
= 1;
118 static unsigned long pciMinMemReg
= ~0;
123 scan_pci(int pci_cfg_method
)
125 unsigned short configtype
;
134 PciBusPtr pci_b1
,pci_b2
;
137 configtype
= pci_cfg_method
;
140 #if defined(__alpha__) || defined(__powerpc__) || defined(__sparc__) || defined(__ia64__)
144 CARD32 tmp32_1
, tmp32_2
;
145 outb(PCI_MODE2_ENABLE_REG
, 0x00);
146 outb(PCI_MODE2_FORWARD_REG
, 0x00);
147 tmp1
= inb(PCI_MODE2_ENABLE_REG
);
148 tmp2
= inb(PCI_MODE2_FORWARD_REG
);
149 if ((tmp1
== 0x00) && (tmp2
== 0x00)) {
151 readPci
= readPciCfg2
;
152 writePci
= writePciCfg2
;
154 tmp32_1
= inl(PCI_MODE1_ADDRESS_REG
);
155 outl(PCI_MODE1_ADDRESS_REG
, PCI_EN
);
156 tmp32_2
= inl(PCI_MODE1_ADDRESS_REG
);
157 outl(PCI_MODE1_ADDRESS_REG
, tmp32_1
);
158 if (tmp32_2
== PCI_EN
) {
167 if (configtype
== 1) {
172 for (cardnum
= 0; cardnum
< MAX_DEV_PER_VENDOR_CFG1
; cardnum
++) {
175 /* loop over the different functions, if present */
176 if (!checkSlotCfg1(busidx
,cardnum
,func
)) {
184 readConfigSpaceCfg1(busidx
,cardnum
,func
,reg
);
186 func
= interpretConfigSpace(reg
,busidx
,
189 if (++idx
>= MAX_PCI_DEVICES
)
192 if (idx
>= MAX_PCI_DEVICES
)
195 if (idx
>= MAX_PCI_DEVICES
)
197 } while (++busidx
< PCI_MAXBUS
);
198 #if defined(__alpha__) || defined(__powerpc__) || defined(__sparc__) || defined(__ia64__)
199 /* don't use outl() ;-) */
201 outl(PCI_MODE1_ADDRESS_REG
, 0);
210 for (slot
=0xc0; slot
<0xd0; slot
++) {
211 if (!checkSlotCfg2(busidx
,slot
))
213 readConfigSpaceCfg2(busidx
,slot
,reg
);
215 interpretConfigSpace(reg
,busidx
,
217 if (++idx
>= MAX_PCI_DEVICES
)
220 if (idx
>= MAX_PCI_DEVICES
)
222 } while (++busidx
< PCI_MAXBUS
);
226 pciMaxBus
= numbus
- 1;
234 if (pci_b1
->primary
== pci_b2
->secondary
)
235 pci_b1
->pBus
= pci_b2
;
236 pci_b2
= pci_b2
->next
;
238 pci_b1
= pci_b1
->next
;
245 if (pci1
->bus
== pci_b2
->secondary
)
247 pci_b2
= pci_b2
->next
;
252 PciStructPtr tmp
= PciStruct
, tmp1
;
256 tmp
->next
= PciStruct
;
261 PciList
= CurrentPci
= PciStruct
;
266 readPciCfg1(CARD32 reg
)
270 outl(PCI_MODE1_ADDRESS_REG
, reg
);
271 val
= inl(PCI_MODE1_DATA_REG
);
272 outl(PCI_MODE1_ADDRESS_REG
, 0);
277 writePciCfg1(CARD32 reg
, CARD32 val
)
279 outl(PCI_MODE1_ADDRESS_REG
, reg
);
280 outl(PCI_MODE1_DATA_REG
,val
);
281 outl(PCI_MODE1_ADDRESS_REG
, 0);
286 readPciCfg2(CARD32 reg
)
289 CARD8 bus
= (reg
>> 16) & 0xff;
290 CARD8 dev
= (reg
>> 11) & 0x1f;
291 CARD8 num
= reg
& 0xff;
293 outb(PCI_MODE2_ENABLE_REG
, 0xF1);
294 outb(PCI_MODE2_FORWARD_REG
, bus
);
295 val
= inl((dev
<< 8) + num
);
296 outb(PCI_MODE2_ENABLE_REG
, 0x00);
301 writePciCfg2(CARD32 reg
, CARD32 val
)
303 CARD8 bus
= (reg
>> 16) & 0xff;
304 CARD8 dev
= (reg
>> 11) & 0x1f;
305 CARD8 num
= reg
& 0xff;
307 outb(PCI_MODE2_ENABLE_REG
, 0xF1);
308 outb(PCI_MODE2_FORWARD_REG
, bus
);
309 outl((dev
<< 8) + num
,val
);
310 outb(PCI_MODE2_ENABLE_REG
, 0x00);
316 pciVideoDisable(void)
318 /* disable VGA routing on bridges */
319 PciBusPtr pbp
= PciBuses
;
320 PciStructPtr pcp
= PciStruct
;
323 writePci(pbp
->Slot
.l
| 0x3c, pbp
->bctl
& ~(CARD32
)(8<<16));
326 /* disable display devices */
328 writePci(pcp
->Slot
.l
| 0x04, pcp
->cmd_st
& ~(CARD32
)3);
329 writePci(pcp
->Slot
.l
| 0x30, pcp
->RomBase
& ~(CARD32
)1);
335 pciVideoRestore(void)
337 /* disable VGA routing on bridges */
338 PciBusPtr pbp
= PciBuses
;
339 PciStructPtr pcp
= PciStruct
;
342 writePci(pbp
->Slot
.l
| 0x3c, pbp
->bctl
);
345 /* disable display devices */
347 writePci(pcp
->Slot
.l
| 0x04, pcp
->cmd_st
);
348 writePci(pcp
->Slot
.l
| 0x30, pcp
->RomBase
);
357 PciStructPtr pcp
= CurrentPci
;
362 while (pbp
) { /* enable bridges */
363 writePci(pbp
->Slot
.l
| 0x3c, pbp
->bctl
| (CARD32
)(8<<16));
366 writePci(pcp
->Slot
.l
| 0x04, pcp
->cmd_st
| (CARD32
)3);
367 writePci(pcp
->Slot
.l
| 0x30, pcp
->RomBase
| (CARD32
)1);
371 PciRead8(int offset
, CARD32 Slot
)
373 int shift
= offset
& 0x3;
374 offset
= offset
& 0xFC;
375 return ((readPci(Slot
| offset
) >> (shift
<< 3)) & 0xff);
379 PciRead16(int offset
, CARD32 Slot
)
381 int shift
= offset
& 0x2;
382 offset
= offset
& 0xFC;
383 return ((readPci(Slot
| offset
) >> (shift
<< 3)) & 0xffff);
387 PciRead32(int offset
, CARD32 Slot
)
389 offset
= offset
& 0xFC;
390 return (readPci(Slot
| offset
));
394 PciWrite8(int offset
, CARD8 byte
, CARD32 Slot
)
397 int shift
= offset
& 0x3;
398 offset
= offset
& 0xFC;
399 val
= readPci(Slot
| offset
);
400 val
&= ~(CARD32
)(0xff << (shift
<< 3));
401 val
|= byte
<< (shift
<< 3);
402 writePci(Slot
| offset
, val
);
406 PciWrite16(int offset
, CARD16 word
, CARD32 Slot
)
409 int shift
= offset
& 0x2;
410 offset
= offset
& 0xFC;
411 val
= readPci(Slot
| offset
);
412 val
&= ~(CARD32
)(0xffff << (shift
<< 3));
413 val
|= word
<< (shift
<< 3);
414 writePci(Slot
| offset
, val
);
418 PciWrite32(int offset
, CARD32 lg
, CARD32 Slot
)
420 offset
= offset
& 0xFC;
421 writePci(Slot
| offset
, lg
);
425 mapPciRom(PciStructPtr pciP
)
427 unsigned long RomBase
= 0;
429 unsigned char *mem
, *ptr
;
430 unsigned char *scratch
= NULL
;
432 CARD32 biosSize
= 0x1000000;
433 CARD32 enablePci
= 0; /* to keep gcc happy */
439 RomBase
= findBIOSMap(pciP
, &biosSize
);
441 RomBase
= pciP
->RomBase
& ~(CARD32
)0xFF;
444 RomBase
= pciP
->RomBase
& ~(CARD32
)0xFF;
445 if (~RomBase
+ 1 < biosSize
|| !RomBase
)
446 RomBase
= findBIOSMap(pciP
, &biosSize
);
449 if ((mem_fd
= open(MEM_FILE
,O_RDONLY
))<0) {
450 perror("opening memory");
455 PciWrite32(0x30,RomBase
| 1,pciP
->Slot
.l
);
458 mem
= ptr
= (unsigned char *)mmap(0, biosSize
, PROT_READ
,
459 MAP_SHARED
, mem_fd
, RomBase
| _bus_base());
461 mem
= ptr
= (unsigned char *)mmap(0, biosSize
, PROT_READ
,
462 MAP_SHARED
, mem_fd
, RomBase
);
464 if (pciP
!= CurrentPci
) {
465 enablePci
= PciRead32(0x4,pciP
->Slot
.l
);
466 PciWrite32(0x4,enablePci
| 0x2,pciP
->Slot
.l
);
469 while ( *ptr
== 0x55 && *(ptr
+1) == 0xAA) {
470 unsigned short data_off
= *(ptr
+0x18) | (*(ptr
+0x19)<< 8);
471 unsigned char *data
= ptr
+ data_off
;
475 if (*data
!='P' || *(data
+1)!='C' || *(data
+2)!='I' || *(data
+3)!='R') {
478 type
= *(data
+ 0x14);
480 if (type
!= 0) { /* not PC-AT image: find next one */
481 unsigned int image_length
;
482 unsigned char indicator
= *(data
+ 0x15);
483 if (indicator
& 0x80) /* last image */
485 image_length
= (*(data
+ 0x10)
486 | (*(data
+ 0x11) << 8)) << 9;
487 ptr
= ptr
+ image_length
;
490 /* OK, we have a PC Image */
491 length
= (*(ptr
+ 2) << 9);
492 scratch
= (unsigned char *)malloc(length
);
493 /* don't use memcpy() here: Reading from bus! */
494 for (i
=0;i
<length
;i
++)
495 *(scratch
+ i
)=*(ptr
+ i
);
499 if (pciP
!= CurrentPci
)
500 PciWrite32(0x4,enablePci
,pciP
->Slot
.l
);
502 /* unmap/close/disable PCI bios mem */
503 munmap(mem
, biosSize
);
505 /* disable and restore mapping */
506 writePci(pciP
->Slot
.l
| 0x30, pciP
->RomBase
& ~(CARD32
)1);
508 if (scratch
&& length
) {
509 memcpy((unsigned char *)V_BIOS
, scratch
, length
);
518 findPci(CARD16 slotBX
)
520 CARD32 slot
= slotBX
<< 8;
522 if (slot
== (CurrentPci
->Slot
.l
& ~PCI_EN
))
523 return (CurrentPci
->Slot
.l
| PCI_EN
);
526 PciBusPtr pBus
= CurrentPci
->pBus
;
528 if (slot
== (pBus
->Slot
.l
& ~PCI_EN
))
529 return pBus
->Slot
.l
| PCI_EN
;
533 PciStructPtr pPci
= PciStruct
;
535 if (slot
== (pPci
->Slot
.l
& ~PCI_EN
))
536 return pPci
->Slot
.l
| PCI_EN
;
545 pciSlotBX(PciStructPtr pPci
)
547 return (CARD16
)((pPci
->Slot
.l
>> 8) & 0xFFFF);
551 findPciDevice(CARD16 vendorID
, CARD16 deviceID
, char n
)
553 PciStructPtr pPci
= CurrentPci
;
557 if ((pPci
->VendorID
== vendorID
) && (pPci
->DeviceID
== deviceID
)) {
566 findPciClass(CARD8 intf
, CARD8 subClass
, CARD16
class, char n
)
568 PciStructPtr pPci
= CurrentPci
;
572 if ((pPci
->Interface
== intf
) && (pPci
->SubClass
== subClass
)
573 && (pPci
->BaseClass
== class)) {
582 readConfigSpaceCfg1(CARD32 bus
, CARD32 dev
, CARD32 func
, CARD32
*reg
)
584 CARD32 config_cmd
= PCI_EN
| (bus
<<16) |
585 (dev
<<11) | (func
<<8);
588 for (i
= 0; i
<64;i
+=4) {
590 reg
[i
] = axpPciCfgRead(config_cmd
| i
);
592 outl(PCI_MODE1_ADDRESS_REG
, config_cmd
| i
);
593 reg
[i
] = inl(PCI_MODE1_DATA_REG
);
600 checkSlotCfg1(CARD32 bus
, CARD32 dev
, CARD32 func
)
602 CARD32 config_cmd
= PCI_EN
| (bus
<<16) |
603 (dev
<<11) | (func
<<8);
606 reg
= axpPciCfgRead(config_cmd
);
608 outl(PCI_MODE1_ADDRESS_REG
, config_cmd
);
609 reg
= inl(PCI_MODE1_DATA_REG
);
611 if (reg
!= 0xFFFFFFFF)
618 checkSlotCfg2(CARD32 bus
, int dev
)
622 outb(PCI_MODE2_ENABLE_REG
, 0xF1);
623 outb(PCI_MODE2_FORWARD_REG
, bus
);
625 outb(PCI_MODE2_FORWARD_REG
, 0x00);
626 outb(PCI_MODE2_ENABLE_REG
, 0x00);
627 if (val
== 0xFFFFFFFF)
629 if (val
== 0xF0F0F0F0)
635 readConfigSpaceCfg2(CARD32 bus
, int dev
, CARD32
*reg
)
639 outb(PCI_MODE2_ENABLE_REG
, 0xF1);
640 outb(PCI_MODE2_FORWARD_REG
, bus
);
641 for (i
= 0; i
<64;i
+=4) {
642 reg
[i
] = inl((dev
<< 8) + i
);
644 outb(PCI_MODE2_ENABLE_REG
, 0x00);
648 interpretConfigSpace(CARD32
*reg
, int busidx
, CARD8 dev
, CARD8 func
)
651 CARD16 vendor
, device
;
652 CARD8 baseclass
, subclass
;
653 CARD8 primary
, secondary
;
654 CARD8 header
, interface
;
657 config_cmd
= PCI_EN
| busidx
<<16 |
658 (dev
<<11) | (func
<<8);
660 for (i
= 0x10; i
< 0x28; i
+=4) {
661 if (IS_MEM32(reg
[i
]))
662 if ((reg
[i
] & 0xFFFFFFF0) < pciMinMemReg
)
663 pciMinMemReg
= (reg
[i
] & 0xFFFFFFF0);
665 if (IS_MEM64(reg
[i
])) {
666 unsigned long addr
= reg
[i
] |
667 (unsigned long)(reg
[i
+4]) << 32;
668 if ((addr
& ~0xfL
) < pciMinMemReg
)
669 pciMinMemReg
= (addr
& ~0xfL
);
674 vendor
= reg
[0] & 0xFFFF;
675 device
= reg
[0] >> 16;
676 baseclass
= reg
[8] >> 24;
677 subclass
= (reg
[8] >> 16) & 0xFF;
678 interface
= (reg
[8] >> 8) & 0xFF;
680 header
= (reg
[0x0c] >> 16) & 0xff;
681 if (BRIDGE_CLASS(baseclass
)) {
682 if (BRIDGE_PCI_CLASS(subclass
)) {
683 PciBusPtr pbp
= malloc(sizeof(PciBusRec
));
684 primary
= reg
[0x18] & 0xFF;
685 secondary
= (reg
[0x18] >> 8) & 0xFF;
686 pbp
->bctl
= reg
[0x3c];
687 pbp
->primary
= primary
;
688 pbp
->secondary
= secondary
;
689 pbp
->Slot
.l
= config_cmd
;
690 pbp
->next
= PciBuses
;
693 } else if (BRIDGE_HOST_CLASS(subclass
)
694 && (hostbridges
++ > 1)) {
697 } else if (VIDEO_CLASS(baseclass
,subclass
)) {
698 PciStructPtr pcp
= malloc(sizeof(PciStructRec
));
699 pcp
->RomBase
= reg
[0x30];
700 pcp
->cmd_st
= reg
[4];
701 pcp
->active
= (reg
[4] & 0x03) == 3 ? 1 : 0;
702 pcp
->VendorID
= vendor
;
703 pcp
->DeviceID
= device
;
704 pcp
->Interface
= interface
;
705 pcp
->BaseClass
= baseclass
;
706 pcp
->SubClass
= subclass
;
707 pcp
->Slot
.l
= config_cmd
;
711 pcp
->next
= PciStruct
;
715 && ((header
& PCI_MULTIFUNC_DEV
) == 0))
722 static CARD32 remapMEM_val
;
723 static int remapMEM_num
;
725 static int /* map it on some other video device */
726 remapMem(PciStructPtr pciP
, int num
, CARD32 size
)
728 PciStructPtr pciPtr
= PciStruct
;
734 org
= PciRead32(num
+ 0x10,pciP
->Slot
.l
);
737 for (i
= 0; i
< 20; i
=i
+4) {
739 val
= PciRead32(i
+ 0x10,pciPtr
->Slot
.l
);
740 /* don't map it on itself */
741 if ((org
& 0xfffffff0) == (val
& 0xfffffff0))
743 if (val
&& !(val
& 1))
744 PciWrite32(i
+ 0x10,0xffffffff,pciPtr
->Slot
.l
);
747 size_n
= PciRead32(i
+ 0x10,pciPtr
->Slot
.l
);
748 PciWrite32(i
+ 0x10,val
,pciPtr
->Slot
.l
);
749 size_n
= ~(CARD32
)(size_n
& 0xfffffff0) + 1;
751 if (size_n
>= size
) {
752 PciWrite32(num
+ 0x10,val
,pciP
->Slot
.l
);
756 pciPtr
= pciPtr
->next
;
758 /* last resort: try to go below lowest PCI mem address */
759 val
= ((pciMinMemReg
& ~(CARD32
)(size
- 1)) - size
);
760 if (val
> 0x7fffffff) {
761 PciWrite32(num
+ 0x10,val
, pciP
->Slot
.l
);
769 restoreMem(PciStructPtr pciP
)
771 if (remapMEM_val
== 0) return;
772 PciWrite32(remapMEM_num
+ 0x10,remapMEM_val
,pciP
->Slot
.l
);
777 findBIOSMap(PciStructPtr pciP
, CARD32
*biosSize
)
779 PciStructPtr pciPtr
= PciStruct
;
782 CARD32 size
= 4*1024; /* should be fixed: size seems _really_ to be undefined below */
784 PciWrite32(0x30,0xffffffff,pciP
->Slot
.l
);
785 *biosSize
= PciRead32(0x30,pciP
->Slot
.l
);
786 PciWrite32(0x30,pciP
->RomBase
,pciP
->Slot
.l
);
787 *biosSize
= ~(*biosSize
& 0xFFFFFF00) + 1;
788 if (*biosSize
> (1024 * 1024 * 16)) {
789 *biosSize
= 1024 * 1024 * 16;
792 if (pciPtr
->bus
!= pciP
->bus
) {
793 pciPtr
= pciPtr
->next
;
796 for (i
= 0; i
< 20; i
=i
+4) {
798 val
= PciRead32(i
+ 0x10,pciPtr
->Slot
.l
);
801 PciWrite32(i
+ 0x10,0xffffffff,pciPtr
->Slot
.l
);
804 size
= PciRead32(i
+ 0x10,pciPtr
->Slot
.l
);
805 PciWrite32(i
+ 0x10,val
,pciPtr
->Slot
.l
);
806 size
= ~(CARD32
)(size
& 0xFFFFFFF0) + 1;
807 if (size
>= *biosSize
) {
808 if (pciP
== pciPtr
) { /* if same device remap ram*/
809 if (!(remapMem(pciP
,i
,size
)))
816 return val
& 0xFFFFFF00;
819 pciPtr
= pciPtr
->next
;
822 /* very last resort */
823 if (pciP
->bus
== 0 && (pciMinMemReg
> *biosSize
))
824 return (pciMinMemReg
- size
) & ~(size
- 1);
830 cfg1out(CARD16 addr
, CARD32 val
)
835 } else if (addr
== 0xCFC) {
836 writePci(PciCfg1Addr
, val
);
843 cfg1in(CARD16 addr
, CARD32
*val
)
848 } else if (addr
== 0xCFC) {
849 *val
= readPci(PciCfg1Addr
);
856 findPciByIDs(int bus
, int dev
, int func
)
858 PciStructPtr pciP
= PciList
;
861 if (pciP
->bus
== (unsigned) bus
&& pciP
->dev
== (unsigned) dev
&& pciP
->func
== (unsigned) func
)