From a7ff7e7f9d9869bfe105c68a4ed9710cecbb4401 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 6 Sep 2007 16:33:32 +0000 Subject: [PATCH] 2007-09-06 Daniel Hellstrom * shared/pci/pcifinddevice.c: New file. --- c/src/lib/libbsp/sparc/ChangeLog | 4 ++ .../libbsp/sparc/shared/pci/pcifinddevice.c | 57 +++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 c/src/lib/libbsp/sparc/shared/pci/pcifinddevice.c diff --git a/c/src/lib/libbsp/sparc/ChangeLog b/c/src/lib/libbsp/sparc/ChangeLog index bf0e175e49..8a34e96c68 100644 --- a/c/src/lib/libbsp/sparc/ChangeLog +++ b/c/src/lib/libbsp/sparc/ChangeLog @@ -1,3 +1,7 @@ +2007-09-06 Daniel Hellstrom + + * shared/pci/pcifinddevice.c: New file. + 2007-09-06 Joel Sherrill * shared/uart/apbuart.c: Fix some warnings. diff --git a/c/src/lib/libbsp/sparc/shared/pci/pcifinddevice.c b/c/src/lib/libbsp/sparc/shared/pci/pcifinddevice.c new file mode 100644 index 0000000000..f5a21fc07e --- /dev/null +++ b/c/src/lib/libbsp/sparc/shared/pci/pcifinddevice.c @@ -0,0 +1,57 @@ + +/* Author: Till Straumann , 2001 */ + +/* find a particular PCI device + * (we assume, the firmware configured the PCI bus[es] for us) + * + * pcifinddevice.c,v 1.1.4.2 2003/07/18 15:48:54 joel Exp + */ + +#define PCI_INVALID_VENDORDEVICEID 0xffffffff +#define PCI_MULTI_FUNCTION 0x80 + +#include +#include + +int +BSP_pciFindDevice( 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