forked from Imagelibrary/rtems
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:
@@ -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>
|
2005-10-17 Ralf Corsepius <ralf.corsepius@rtems.org>
|
||||||
|
|
||||||
* shared/comm/i386_io.h, shared/comm/tty_drv.c,
|
* shared/comm/i386_io.h, shared/comm/tty_drv.c,
|
||||||
|
|||||||
@@ -273,55 +273,17 @@ int
|
|||||||
BSP_pciFindDevice( unsigned short vendorid, unsigned short deviceid,
|
BSP_pciFindDevice( unsigned short vendorid, unsigned short deviceid,
|
||||||
int instance, int *pbus, int *pdev, int *pfun )
|
int instance, int *pbus, int *pdev, int *pfun )
|
||||||
{
|
{
|
||||||
int sig;
|
int sig, rval;
|
||||||
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++) {
|
rval = pcib_find_by_devid(vendorid, deviceid, instance, &sig);
|
||||||
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); */
|
if ( PCIB_ERR_SUCCESS == rval ) {
|
||||||
pcib_conf_read8(sig, 0xe, &hd);
|
*pbus = PCIB_DEVSIG_BUS(sig);
|
||||||
|
*pdev = PCIB_DEVSIG_DEV(sig);
|
||||||
|
*pfun = PCIB_DEVSIG_FUNC(sig);
|
||||||
|
}
|
||||||
|
|
||||||
hd = (hd & PCI_MULTI_FUNCTION ? PCI_MAX_FUNCTIONS : 1);
|
return rval;
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user