[PATCH 15/17] powerpc/mvme5500: Use shared pci_find_device()
Joel Sherrill
joel at rtems.org
Wed Mar 9 22:25:00 UTC 2016
---
c/src/lib/libbsp/powerpc/mvme5500/Makefile.am | 6 ++-
.../libbsp/powerpc/mvme5500/pci/pcifinddevice.c | 62 ----------------------
2 files changed, 4 insertions(+), 64 deletions(-)
delete mode 100644 c/src/lib/libbsp/powerpc/mvme5500/pci/pcifinddevice.c
diff --git a/c/src/lib/libbsp/powerpc/mvme5500/Makefile.am b/c/src/lib/libbsp/powerpc/mvme5500/Makefile.am
index c8cb229..8794f5f 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 9f3acee..0000000
--- 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 at slac.stanford.edu>
- *
- * Kate Feng <feng1 at 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 */
--
1.8.3.1
More information about the devel
mailing list