summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci/pci_subr.c
diff options
context:
space:
mode:
authornate <nate@openbsd.org>2002-01-03 20:52:24 +0000
committernate <nate@openbsd.org>2002-01-03 20:52:24 +0000
commit32826475dad20a5078bacb7bb2f97f7f7ed27c05 (patch)
tree30932984453d5b8218370f3d9b1eae002e1b503f /sys/dev/pci/pci_subr.c
parentUse STRIPFLAGS=-g -X -x rather than =-d on all ELF arches. (diff)
downloadwireguard-openbsd-32826475dad20a5078bacb7bb2f97f7f7ed27c05.tar.xz
wireguard-openbsd-32826475dad20a5078bacb7bb2f97f7f7ed27c05.zip
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/dev/pci/pci_subr.c')
-rw-r--r--sys/dev/pci/pci_subr.c21
1 files changed, 20 insertions, 1 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;