summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/powerpc/mvme5500/pci/pcifinddevice.c
diff options
context:
space:
mode:
authorJennifer Averett <Jennifer.Averett@OARcorp.com>2005-05-12 18:25:29 +0000
committerJennifer Averett <Jennifer.Averett@OARcorp.com>2005-05-12 18:25:29 +0000
commit54cb48f28bffcc0cbcbd68bd7128f8df6e75445d (patch)
treeb27124f865ce149ba9bfbf17aff8ab86fe2655dc /c/src/lib/libbsp/powerpc/mvme5500/pci/pcifinddevice.c
parent2005-05-12 Ralf Corsepius <ralf.corsepius@rtems.org> (diff)
downloadrtems-54cb48f28bffcc0cbcbd68bd7128f8df6e75445d.tar.bz2
2005-05-12 Jennifer Averett <jennifer.averett@oarcorp.com>
* README.VME, include/bsp.h, irq/irq.h, network/GT64260eth.c, pci/detect_host_bridge.c, pci/gtpcireg.h, pci/pci.c, pci/pci.h, pci/pci_interface.c, pci/pcifinddevice.c: Submitted by Kate Feng <feng1@bnl.gov> as RTEMS-MVME5500 BSP v1.1 release. Modifications made to merge this release with the current tree.
Diffstat (limited to '')
-rw-r--r--c/src/lib/libbsp/powerpc/mvme5500/pci/pcifinddevice.c52
1 files changed, 32 insertions, 20 deletions
diff --git a/c/src/lib/libbsp/powerpc/mvme5500/pci/pcifinddevice.c b/c/src/lib/libbsp/powerpc/mvme5500/pci/pcifinddevice.c
index 67160781a3..c3b677d015 100644
--- a/c/src/lib/libbsp/powerpc/mvme5500/pci/pcifinddevice.c
+++ b/c/src/lib/libbsp/powerpc/mvme5500/pci/pcifinddevice.c
@@ -6,29 +6,42 @@
* (we assume, the firmware configured the PCI bus[es] for us)
*
*
- * Kate Feng <feng1@bnl.gov>, modified it to support
- * the mvme5500 board and provided glues to Till's vmeUniverse.c.
- *
+ * Kate Feng <feng1@bnl.gov>, modified it to support the mvme5500 board.
+ *
*/
#define PCI_INVALID_VENDORDEVICEID 0xffffffff
#define PCI_MULTI_FUNCTION 0x80
-/*#define PCI_DEBUG*/
#include <bsp/pci.h>
#include <rtems/bspIo.h>
+#include <bsp.h>
+
+int BSP_pciDebug=0;
+
+int BSP_pciFindDevicePrint(unsigned short vendorid, unsigned short deviceid,
+ int instance, int *pbus, int *pdev, int *pfun )
+{
+ int x;
+
+ BSP_pciDebug = 1;
+ x=pci_find_device(vendorid, deviceid, instance, pbus, pdev, pfun );
+ BSP_pciDebug = 0;
+
+ return 0;
+}
-int BSP_PCIxFindDevice(unsigned short vendorid, unsigned short deviceid,
- int instance, int pciNum, int *pbus, int *pdev, int *pfun )
+int pci_find_device( unsigned short vendorid, unsigned short deviceid,
+ int instance, int *pbus, int *pdev, int *pfun )
{
unsigned int d;
unsigned short s;
unsigned char bus,dev,fun,hd;
- for (bus=0; bus<2; bus++) {
+ for (bus=0; bus<BSP_MAX_PCI_BUS; bus++) {
for (dev=0; dev<PCI_MAX_DEVICES; dev++) {
- PCIx_read_config_byte(pciNum, bus, dev, 0, PCI0_HEADER_TYPE, &hd);
+ pci_read_config_byte(bus, dev, 0, PCI_HEADER_TYPE, &hd);
hd = (hd & PCI_MULTI_FUNCTION ? PCI_MAX_FUNCTIONS : 1);
for (fun=0; fun<hd; fun++) {
/*
@@ -36,16 +49,21 @@ int BSP_PCIxFindDevice(unsigned short vendorid, unsigned short deviceid,
*/
if (PCI_MAX_DEVICES-1==dev && PCI_MAX_FUNCTIONS-1 == fun)
break;
- (void)PCIx_read_config_dword(pciNum, bus,dev,fun,PCI0_VENDOR_ID,&d);
+ (void)pci_read_config_dword(bus,dev,fun,PCI_VENDOR_ID,&d);
if (PCI_INVALID_VENDORDEVICEID == d)
continue;
-#ifdef PCI_DEBUG
- printk("pci_find_device: found 0x%08x at %d/%d/%d\n",d,bus,dev,fun);
-#endif
- (void)PCIx_read_config_word(pciNum, bus,dev,fun,PCI0_VENDOR_ID,&s);
+ if (BSP_pciDebug) {
+ printk("pci_find_device: found 0x%08x at %2d/%2d/%2d ",d,bus,dev,fun);
+ printk("(Physically: PCI%d %2d/%2d/%2d)\n",
+ (bus>= BSP_MAX_PCI_BUS_ON_PCI0)? 1:0,
+ (bus>= BSP_MAX_PCI_BUS_ON_PCI0)? bus-BSP_MAX_PCI_BUS_ON_PCI0:bus,
+ dev, fun);
+ }
+
+ (void)pci_read_config_word(bus,dev,fun,PCI_VENDOR_ID,&s);
if (vendorid != s)
continue;
- (void)PCIx_read_config_word(pciNum, bus,dev,fun,PCI0_DEVICE_ID,&s);
+ (void)pci_read_config_word(bus,dev,fun,PCI_DEVICE_ID,&s);
if (deviceid == s) {
if (instance--) continue;
*pbus=bus; *pdev=dev; *pfun=fun;
@@ -57,10 +75,4 @@ int BSP_PCIxFindDevice(unsigned short vendorid, unsigned short deviceid,
return -1;
}
-int pci_find_device( unsigned short vendorid, unsigned short deviceid,
- int instance, int *pbus, int *pdev, int *pfun )
-{
- return(BSP_PCIxFindDevice(vendorid,deviceid,instance,0,pbus,pdev,pfun));
-}
-
/* eof */