diff options
author | Till Straumann <strauman@slac.stanford.edu> | 2005-11-08 18:53:50 +0000 |
---|---|---|
committer | Till Straumann <strauman@slac.stanford.edu> | 2005-11-08 18:53:50 +0000 |
commit | be1ab03a92765e503686bd26c6555671f279d952 (patch) | |
tree | b5b6685a1938679cb9cfda3716a756defbab2e0c | |
parent | 2005-11-08 Till Straumann <strauman@slac.stanford.edu> (diff) | |
download | rtems-be1ab03a92765e503686bd26c6555671f279d952.tar.bz2 |
2005-11-08 Till Straumann <strauman@slac.stanford.edu>
PR832/bsps
* pci/pcibios.c: replace BSP_pciFindDevice implementation by pcibios
call.
-rw-r--r-- | c/src/lib/libbsp/i386/shared/ChangeLog | 6 | ||||
-rw-r--r-- | c/src/lib/libbsp/i386/shared/pci/pcibios.c | 55 |
2 files changed, 15 insertions, 46 deletions
diff --git a/c/src/lib/libbsp/i386/shared/ChangeLog b/c/src/lib/libbsp/i386/shared/ChangeLog index d41ffa8b33..883982c2e2 100644 --- a/c/src/lib/libbsp/i386/shared/ChangeLog +++ b/c/src/lib/libbsp/i386/shared/ChangeLog @@ -1,3 +1,9 @@ +2005-11-08 Till Straumann <strauman@slac.stanford.edu> + + PR832/bsps + * pci/pcibios.c: replace BSP_pciFindDevice implementation by pcibios + call. + 2004-09-27 Greg Menke <gregory.menke@gsfc.nasa.gov> PR 608/bsps diff --git a/c/src/lib/libbsp/i386/shared/pci/pcibios.c b/c/src/lib/libbsp/i386/shared/pci/pcibios.c index bcf3cb7eaf..cfbf6a7b15 100644 --- a/c/src/lib/libbsp/i386/shared/pci/pcibios.c +++ b/c/src/lib/libbsp/i386/shared/pci/pcibios.c @@ -281,54 +281,17 @@ int BSP_pciFindDevice( unsigned short vendorid, unsigned short deviceid, int instance, int *pbus, int *pdev, int *pfun ) { - int sig; - unsigned int d; - unsigned short s; - unsigned char bus,dev,fun,hd; + int sig, rval; - for (bus=0; bus<BusCountPCI(); 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; - } - } - } + 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 -1; + + return rval; } |