summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorNathan Binkert <nate@cvs.openbsd.org>2002-01-03 20:52:25 +0000
committerNathan Binkert <nate@cvs.openbsd.org>2002-01-03 20:52:25 +0000
commit1f5af93cdf91726621d22c1348aa6dab7bec7952 (patch)
treed2e5d6214824bc794c24e0b0e7b1842531785948 /sys
parent02100df6fd8aa70cbea383dd8a6cd1f5bb1f1cd4 (diff)
Add the pci_findvendor function
If compiled with PCI_VERBOSE, this function looks up a vendor string based on a vendor id. Otherwise, it returns NULL. From NetBSD
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/pci_subr.c21
-rw-r--r--sys/dev/pci/pcivar.h8
2 files changed, 27 insertions, 2 deletions
diff --git a/sys/dev/pci/pci_subr.c b/sys/dev/pci/pci_subr.c
index b98b917d69a..e68a04aacf8 100644
--- a/sys/dev/pci/pci_subr.c
+++ b/sys/dev/pci/pci_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci_subr.c,v 1.12 2001/05/08 20:13:18 mickey Exp $ */
+/* $OpenBSD: pci_subr.c,v 1.13 2002/01/03 20:52:24 nate Exp $ */
/* $NetBSD: pci_subr.c,v 1.19 1996/10/13 01:38:29 christos Exp $ */
/*
@@ -281,6 +281,25 @@ struct pci_known_product {
#include <dev/pci/pcidevs_data.h>
#endif /* PCIVERBOSE */
+const char *
+pci_findvendor(pcireg_t id_reg)
+{
+#ifdef PCIVERBOSE
+ pci_vendor_id_t vendor = PCI_VENDOR(id_reg);
+ const struct pci_known_vendor *kdp;
+
+ kdp = pci_known_vendors;
+ while (kdp->vendorname != NULL) { /* all have vendor name */
+ if (kdp->vendor == vendor)
+ break;
+ kdp++;
+ }
+ return (kdp->vendorname);
+#else
+ return (NULL);
+#endif
+}
+
void
pci_devinfo(id_reg, class_reg, showclass, cp)
pcireg_t id_reg, class_reg;
diff --git a/sys/dev/pci/pcivar.h b/sys/dev/pci/pcivar.h
index 012210e6b27..7367b63991b 100644
--- a/sys/dev/pci/pcivar.h
+++ b/sys/dev/pci/pcivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcivar.h,v 1.21 2001/08/19 05:17:37 art Exp $ */
+/* $OpenBSD: pcivar.h,v 1.22 2002/01/03 20:52:24 nate Exp $ */
/* $NetBSD: pcivar.h,v 1.23 1997/06/06 23:48:05 thorpej Exp $ */
/*
@@ -189,4 +189,10 @@ void pci_devinfo __P((pcireg_t, pcireg_t, int, char *));
void set_pci_isa_bridge_callback __P((void (*)(void *), void *));
const struct pci_quirkdata *
pci_lookup_quirkdata __P((pci_vendor_id_t, pci_product_id_t));
+
+/*
+ * Misc.
+ */
+const char *pci_findvendor __P((pcireg_t));
+
#endif /* _DEV_PCI_PCIVAR_H_ */