[svn-commits] fjoe: freebsd/trunk r8323 - in /freebsd/trunk: freebsd/dahdi/ include/dahdi/c...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Mar 10 10:52:02 CST 2010


Author: fjoe
Date: Wed Mar 10 10:51:58 2010
New Revision: 8323

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8323
Log:
Implement dahdi_pci_device_id_lookup().

Modified:
    freebsd/trunk/freebsd/dahdi/Makefile
    freebsd/trunk/freebsd/dahdi/bsd-compat.c
    freebsd/trunk/include/dahdi/compat/bsd.h

Modified: freebsd/trunk/freebsd/dahdi/Makefile
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/freebsd/dahdi/Makefile?view=diff&rev=8323&r1=8322&r2=8323
==============================================================================
--- freebsd/trunk/freebsd/dahdi/Makefile (original)
+++ freebsd/trunk/freebsd/dahdi/Makefile Wed Mar 10 10:51:58 2010
@@ -4,7 +4,7 @@
 
 KMOD=		dahdi
 SRCS=		dahdi-base.c bsd-compat.c version.h
-SRCS+=		device_if.h bus_if.h
+SRCS+=		device_if.h bus_if.h pci_if.h
 CLEANFILES=	version.h
 INCS=		user.h wctdm_user.h compat/types.h
 

Modified: freebsd/trunk/freebsd/dahdi/bsd-compat.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/freebsd/dahdi/bsd-compat.c?view=diff&rev=8323&r1=8322&r2=8323
==============================================================================
--- freebsd/trunk/freebsd/dahdi/bsd-compat.c (original)
+++ freebsd/trunk/freebsd/dahdi/bsd-compat.c Wed Mar 10 10:51:58 2010
@@ -33,6 +33,8 @@
 #include <sys/systm.h>
 #include <sys/taskqueue.h>
 
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
 #include <machine/stdarg.h>
 
 #include <dahdi/compat/bsd.h>
@@ -369,6 +371,30 @@
 release_firmware(const struct firmware *firmware)
 {
 	firmware_put(firmware, FIRMWARE_UNLOAD);
+}
+
+
+/*
+ * PCI device API
+ */
+struct pci_device_id *
+dahdi_pci_device_id_lookup(device_t dev, struct pci_device_id *tbl)
+{
+	struct pci_device_id *id;
+	uint16_t vendor = pci_get_vendor(dev);
+	uint16_t device = pci_get_device(dev);
+	uint16_t subvendor = pci_get_subvendor(dev);
+	uint16_t subdevice = pci_get_subdevice(dev);
+
+	for (id = tbl; id->vendor != 0; id++) {
+		if ((id->vendor == PCI_ANY_ID || id->vendor == vendor) &&
+		    (id->device == PCI_ANY_ID || id->device == device) &&
+		    (id->subvendor == PCI_ANY_ID || id->subvendor == subvendor) &&
+		    (id->subdevice == PCI_ANY_ID || id->subdevice == subdevice))
+			return id;
+	}
+
+	return NULL;
 }
 
 /*

Modified: freebsd/trunk/include/dahdi/compat/bsd.h
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/include/dahdi/compat/bsd.h?view=diff&rev=8323&r1=8322&r2=8323
==============================================================================
--- freebsd/trunk/include/dahdi/compat/bsd.h (original)
+++ freebsd/trunk/include/dahdi/compat/bsd.h Wed Mar 10 10:51:58 2010
@@ -362,6 +362,8 @@
 #define dahdi_pci_get_slot(pci_dev)	pci_get_slot((pci_dev)->dev)
 #define dahdi_pci_get_irq(pci_dev)	pci_get_irq((pci_dev)->dev)
 
+struct pci_device_id *dahdi_pci_device_id_lookup(device_t dev, struct pci_device_id *tbl);
+
 /*
  * Time API
  */




More information about the svn-commits mailing list