summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel@rtems.org>2016-03-09 15:45:44 -0600
committerJoel Sherrill <joel@rtems.org>2016-03-10 10:38:52 -0600
commit94300521d908cc8d1c1e7a5aba96ab9434eee57b (patch)
tree25bcfa41e842a93eb637026a33b829f7680ae429
parentmips/malta: Use shared pci_find_device() and removed unused pci_list_devices() (diff)
downloadrtems-94300521d908cc8d1c1e7a5aba96ab9434eee57b.tar.bz2
powerpc/mvme5500: Use shared pci_find_device()
-rw-r--r--c/src/lib/libbsp/powerpc/mvme5500/Makefile.am6
-rw-r--r--c/src/lib/libbsp/powerpc/mvme5500/pci/pcifinddevice.c62
2 files changed, 4 insertions, 64 deletions
diff --git a/c/src/lib/libbsp/powerpc/mvme5500/Makefile.am b/c/src/lib/libbsp/powerpc/mvme5500/Makefile.am
index c8cb2293e1..8794f5fdb2 100644
--- a/c/src/lib/libbsp/powerpc/mvme5500/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/mvme5500/Makefile.am
@@ -49,8 +49,10 @@ libbsp_a_SOURCES += ../../powerpc/shared/console/uart.c \
include_bsp_HEADERS += pci/gtpcireg.h
include_bsp_HEADERS += ../../powerpc/shared/pci/pci.h
# pci
-libbsp_a_SOURCES += pci/pci.c pci/pci_interface.c pci/detect_host_bridge.c \
- pci/pcifinddevice.c
+libbsp_a_SOURCES += pci/pci.c
+libbsp_a_SOURCES += pci/pci_interface.c
+libbsp_a_SOURCES += pci/detect_host_bridge.c
+libbsp_a_SOURCES += ../../shared/pci/pci_find_device.c
include_bsp_HEADERS += irq/irq.h
# irq
diff --git a/c/src/lib/libbsp/powerpc/mvme5500/pci/pcifinddevice.c b/c/src/lib/libbsp/powerpc/mvme5500/pci/pcifinddevice.c
deleted file mode 100644
index 9f3aceec21..0000000000
--- a/c/src/lib/libbsp/powerpc/mvme5500/pci/pcifinddevice.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * find a particular PCI device
- * (we assume, the firmware configured the PCI bus[es] for us)
- */
-
-/*
- * Copyright 2001, Till Straumann <strauman@slac.stanford.edu>
- *
- * Kate Feng <feng1@bnl.gov>, modified it to support the mvme5500 board.
- */
-
-#include <bsp/pci.h>
-#include <rtems/bspIo.h>
-#include <bsp.h>
-
-static int BSP_pciDebug=0;
-
-int pci_find_device( unsigned short vendorid, unsigned short deviceid,
- int instance, int *pbus, int *pdev, int *pfun )
-{
- uint32_t d;
- unsigned short s;
- unsigned char bus,dev,fun,hd;
-
- for (bus=0; bus<BSP_MAX_PCI_BUS; bus++) {
- for (dev=0; dev<PCI_MAX_DEVICES; dev++) {
- pci_read_config_byte(bus, dev, 0, PCI_HEADER_TYPE, &hd);
- hd = (hd & PCI_HEADER_TYPE_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;
- (void)pci_read_config_dword(bus,dev,fun,PCI_VENDOR_ID,&d);
- if (PCI_INVALID_VENDORDEVICEID == d)
- continue;
- 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)pci_read_config_word(bus,dev,fun,PCI_DEVICE_ID,&s);
- if (deviceid == s) {
- if (instance--) continue;
- *pbus=bus; *pdev=dev; *pfun=fun;
- return 0;
- }
- }
- }
- } /* end for bus */
- return -1;
-}
-
-/* eof */