1 | Index: c/src/lib/libbsp/i386/shared/pci/pcibios.c |
---|
2 | =================================================================== |
---|
3 | RCS file: /afs/slac/g/spear/cvsrep/rtems/src-20030128/c/src/lib/libbsp/i386/shared/pci/pcibios.c,v |
---|
4 | retrieving revision 1.1.1.3 |
---|
5 | diff -c -r1.1.1.3 pcibios.c |
---|
6 | *** c/src/lib/libbsp/i386/shared/pci/pcibios.c 27 Feb 2004 02:56:18 -0000 1.1.1.3 |
---|
7 | --- c/src/lib/libbsp/i386/shared/pci/pcibios.c 14 May 2004 22:31:28 -0000 |
---|
8 | *************** |
---|
9 | *** 212,276 **** |
---|
10 | } |
---|
11 | |
---|
12 | |
---|
13 | - |
---|
14 | - |
---|
15 | - #define PCI_MULTI_FUNCTION 0x80 |
---|
16 | - #define PCI_MAX_DEVICES 16 |
---|
17 | - #define PCI_MAX_FUNCTIONS 8 |
---|
18 | - |
---|
19 | - |
---|
20 | int |
---|
21 | BSP_pciFindDevice( unsigned short vendorid, unsigned short deviceid, |
---|
22 | int instance, int *pbus, int *pdev, int *pfun ) |
---|
23 | { |
---|
24 | ! int sig; |
---|
25 | ! unsigned int d; |
---|
26 | ! unsigned short s; |
---|
27 | ! unsigned char bus,dev,fun,hd; |
---|
28 | ! |
---|
29 | ! for (bus=0; bus<BusCountPCI(); bus++) |
---|
30 | ! { |
---|
31 | ! for (dev=0; dev<PCI_MAX_DEVICES; dev++) |
---|
32 | ! { |
---|
33 | ! sig = PCIB_DEVSIG_MAKE(bus,dev,0); |
---|
34 | |
---|
35 | ! /* pci_read_config_byte(bus,dev,0, PCI_HEADER_TYPE, &hd); */ |
---|
36 | ! pcib_conf_read8(sig, 0xe, &hd); |
---|
37 | |
---|
38 | ! hd = (hd & PCI_MULTI_FUNCTION ? PCI_MAX_FUNCTIONS : 1); |
---|
39 | ! |
---|
40 | ! for (fun=0; fun<hd; fun++) { |
---|
41 | ! /* |
---|
42 | ! * The last devfn id/slot is special; must skip it |
---|
43 | ! */ |
---|
44 | ! if( PCI_MAX_DEVICES-1 == dev && PCI_MAX_FUNCTIONS-1 == fun ) |
---|
45 | ! break; |
---|
46 | ! |
---|
47 | ! /*pci_read_config_dword(bus,dev,fun,PCI_VENDOR_ID,&d); */ |
---|
48 | ! pcib_conf_read32(sig, 0, &d); |
---|
49 | ! if( d == -1 ) |
---|
50 | ! continue; |
---|
51 | ! #ifdef PCI_DEBUG |
---|
52 | ! printk("BSP_pciFindDevice: found 0x%08x at %d/%d/%d\n",d,bus,dev,fun); |
---|
53 | ! #endif |
---|
54 | ! /* pci_read_config_word(bus,dev,fun,PCI_VENDOR_ID,&s); */ |
---|
55 | ! pcib_conf_read16(sig, 0, &s); |
---|
56 | ! if (vendorid != s) |
---|
57 | ! continue; |
---|
58 | ! |
---|
59 | ! /* pci_read_config_word(bus,dev,fun,PCI_DEVICE_ID,&s); */ |
---|
60 | ! pcib_conf_read16(sig, 0x2, &s); |
---|
61 | ! if (deviceid == s) { |
---|
62 | ! if (instance--) continue; |
---|
63 | ! *pbus=bus; |
---|
64 | ! *pdev=dev; |
---|
65 | ! *pfun=fun; |
---|
66 | ! return 0; |
---|
67 | ! } |
---|
68 | ! } |
---|
69 | ! } |
---|
70 | } |
---|
71 | ! return -1; |
---|
72 | } |
---|
73 | |
---|
74 | |
---|
75 | --- 212,232 ---- |
---|
76 | } |
---|
77 | |
---|
78 | |
---|
79 | int |
---|
80 | BSP_pciFindDevice( unsigned short vendorid, unsigned short deviceid, |
---|
81 | int instance, int *pbus, int *pdev, int *pfun ) |
---|
82 | { |
---|
83 | ! int sig, rval; |
---|
84 | |
---|
85 | ! rval = pcib_find_by_devid(vendorid, deviceid, instance, &sig); |
---|
86 | |
---|
87 | ! if ( PCIB_ERR_SUCCESS == rval ) { |
---|
88 | ! *pbus = PCIB_DEVSIG_BUS(sig); |
---|
89 | ! *pdev = PCIB_DEVSIG_DEV(sig); |
---|
90 | ! *pfun = PCIB_DEVSIG_FUNC(sig); |
---|
91 | } |
---|
92 | ! |
---|
93 | ! return rval; |
---|
94 | } |
---|
95 | |
---|
96 | |
---|