2005-11-02 straumanatslacdotstanford.edu

* shared/pci/pcibios.c: replaced pci_find_device implementation by a
	pcibios call which already provides the functionality
This commit is contained in:
Till Straumann
2005-11-03 02:59:18 +00:00
parent ebedf31c4e
commit 05a2cc4bd3
2 changed files with 13 additions and 46 deletions

View File

@@ -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,

View File

@@ -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;
int sig, rval;
for (bus=0; bus<pci_bus_count(); bus++) {
for (dev=0; dev<PCI_MAX_DEVICES; dev++) {
sig = PCIB_DEVSIG_MAKE(bus,dev,0);
rval = pcib_find_by_devid(vendorid, deviceid, instance, &sig);
/* pci_read_config_byte(bus,dev,0, PCI_HEADER_TYPE, &hd); */
pcib_conf_read8(sig, 0xe, &hd);
if ( PCIB_ERR_SUCCESS == rval ) {
*pbus = PCIB_DEVSIG_BUS(sig);
*pdev = PCIB_DEVSIG_DEV(sig);
*pfun = PCIB_DEVSIG_FUNC(sig);
}
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;
return rval;
}
/*