summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/i386
diff options
context:
space:
mode:
authorTill Straumann <strauman@slac.stanford.edu>2005-11-03 02:59:18 +0000
committerTill Straumann <strauman@slac.stanford.edu>2005-11-03 02:59:18 +0000
commit05a2cc4bd39bcbc1fb0ca785e64f06457ad8142b (patch)
tree4ba924eba092b1b4fbd30585283baf773b843c5e /c/src/lib/libbsp/i386
parent2005-11-02 straumanatslacdotstanford.edu (diff)
downloadrtems-05a2cc4bd39bcbc1fb0ca785e64f06457ad8142b.tar.bz2
2005-11-02 straumanatslacdotstanford.edu
* shared/pci/pcibios.c: replaced pci_find_device implementation by a pcibios call which already provides the functionality
Diffstat (limited to 'c/src/lib/libbsp/i386')
-rw-r--r--c/src/lib/libbsp/i386/ChangeLog5
-rw-r--r--c/src/lib/libbsp/i386/shared/pci/pcibios.c60
2 files changed, 16 insertions, 49 deletions
diff --git a/c/src/lib/libbsp/i386/ChangeLog b/c/src/lib/libbsp/i386/ChangeLog
index 7162c0d721..6ee02ac87a 100644
--- a/c/src/lib/libbsp/i386/ChangeLog
+++ b/c/src/lib/libbsp/i386/ChangeLog
@@ -1,3 +1,8 @@
+2005-11-02 straumanatslacdotstanford.edu
+
+ * shared/pci/pcibios.c: replaced pci_find_device implementation by a
+ pcibios call which already provides the functionality
+
2005-10-17 Ralf Corsepius <ralf.corsepius@rtems.org>
* shared/comm/i386_io.h, shared/comm/tty_drv.c,
diff --git a/c/src/lib/libbsp/i386/shared/pci/pcibios.c b/c/src/lib/libbsp/i386/shared/pci/pcibios.c
index 88bcc5e7a2..c90ca09d53 100644
--- a/c/src/lib/libbsp/i386/shared/pci/pcibios.c
+++ b/c/src/lib/libbsp/i386/shared/pci/pcibios.c
@@ -273,55 +273,17 @@ int
BSP_pciFindDevice( unsigned short vendorid, unsigned short deviceid,
int instance, int *pbus, int *pdev, int *pfun )
{
- int sig;
- unsigned int d = 0;
- unsigned short s = 0;
- unsigned char bus;
- unsigned char dev;
- unsigned char fun;
- unsigned char hd = 0;
-
- for (bus=0; bus<pci_bus_count(); bus++) {
- for (dev=0; dev<PCI_MAX_DEVICES; dev++) {
- sig = PCIB_DEVSIG_MAKE(bus,dev,0);
-
- /* pci_read_config_byte(bus,dev,0, PCI_HEADER_TYPE, &hd); */
- pcib_conf_read8(sig, 0xe, &hd);
-
- hd = (hd & PCI_MULTI_FUNCTION ? PCI_MAX_FUNCTIONS : 1);
-
- for (fun=0; fun<hd; fun++) {
- /*
- * The last devfn id/slot is special; must skip it
- */
- if ( PCI_MAX_DEVICES-1 == dev && PCI_MAX_FUNCTIONS-1 == fun )
- break;
-
- /*pci_read_config_dword(bus,dev,fun,PCI_VENDOR_ID,&d); */
- pcib_conf_read32(sig, 0, &d);
- if ( d == -1 )
- continue;
-#ifdef PCI_DEBUG
- printk("BSP_pciFindDevice: found 0x%08x at %d/%d/%d\n",d,bus,dev,fun);
-#endif
- /* pci_read_config_word(bus,dev,fun,PCI_VENDOR_ID,&s); */
- pcib_conf_read16(sig, 0, &s);
- if (vendorid != s)
- continue;
-
- /* pci_read_config_word(bus,dev,fun,PCI_DEVICE_ID,&s); */
- pcib_conf_read16(sig, 0x2, &s);
- if (deviceid == s) {
- if (instance--) continue;
- *pbus=bus;
- *pdev=dev;
- *pfun=fun;
- return 0;
- }
- }
- }
- }
- return -1;
+ int sig, rval;
+
+ rval = pcib_find_by_devid(vendorid, deviceid, instance, &sig);
+
+ if ( PCIB_ERR_SUCCESS == rval ) {
+ *pbus = PCIB_DEVSIG_BUS(sig);
+ *pdev = PCIB_DEVSIG_DEV(sig);
+ *pfun = PCIB_DEVSIG_FUNC(sig);
+ }
+
+ return rval;
}
/*