summaryrefslogtreecommitdiff
path: root/sys/dev/pci/pci_subr.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2001-01-27 01:19:12 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2001-01-27 01:19:12 +0000
commit84138674dfeb14cd80dbfc31378f3e5072618c9c (patch)
tree95c38ee1addcb4a5c9169f50357d05d1fe9c94b7 /sys/dev/pci/pci_subr.c
parent10774b5e033bb15b70f7cdacf2af5d47e0cea611 (diff)
split vendor & product lists into 2 tables, saving 12K
Diffstat (limited to 'sys/dev/pci/pci_subr.c')
-rw-r--r--sys/dev/pci/pci_subr.c50
1 files changed, 28 insertions, 22 deletions
diff --git a/sys/dev/pci/pci_subr.c b/sys/dev/pci/pci_subr.c
index 96fa2babaef..849dd3219a6 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.10 2001/01/26 22:27:36 mickey Exp $ */
+/* $OpenBSD: pci_subr.c,v 1.11 2001/01/27 01:19:10 deraadt Exp $ */
/* $NetBSD: pci_subr.c,v 1.19 1996/10/13 01:38:29 christos Exp $ */
/*
@@ -201,13 +201,16 @@ const struct pci_class pci_class[] = {
/*
* Descriptions of of known vendors and devices ("products").
*/
-struct pci_knowndev {
+struct pci_known_vendor {
+ pci_vendor_id_t vendor;
+ const char *vendorname;
+};
+
+struct pci_known_product {
pci_vendor_id_t vendor;
pci_product_id_t product;
- int flags;
- const char *vendorname, *productname;
+ const char *productname;
};
-#define PCI_KNOWNDEV_NOPROD 0x01 /* match on vendor only */
#include <dev/pci/pcidevs_data.h>
#endif /* PCIVERBOSE */
@@ -224,10 +227,11 @@ pci_devinfo(id_reg, class_reg, showclass, cp)
pci_subclass_t subclass;
pci_interface_t interface;
pci_revision_t revision;
- const char *vendor_namep, *product_namep;
+ const char *vendor_namep = NULL, *product_namep = NULL;
const struct pci_class *classp, *subclassp;
#ifdef PCIVERBOSE
- const struct pci_knowndev *kdp;
+ const struct pci_known_vendor *pkv;
+ const struct pci_known_product *pkp;
const char *unmatched = "unknown ";
#else
const char *unmatched = "";
@@ -242,22 +246,24 @@ pci_devinfo(id_reg, class_reg, showclass, cp)
revision = PCI_REVISION(class_reg);
#ifdef PCIVERBOSE
- kdp = pci_knowndevs;
- while (kdp->vendorname != NULL) { /* all have vendor name */
- if (kdp->vendor == vendor && (kdp->product == product ||
- (kdp->flags & PCI_KNOWNDEV_NOPROD) != 0))
- break;
- kdp++;
+ pkv = pci_known_vendors;
+ while (pkv->vendorname != NULL) { /* all have vendor name */
+ if (pkv->vendor == vendor) {
+ vendor_namep = pkv->vendorname;
+ break;
+ }
+ pkv++;
+ }
+ if (vendor_namep) {
+ pkp = pci_known_products;
+ while (pkp->productname != NULL) { /* all have product name */
+ if (pkp->vendor == vendor && pkp->product == product) {
+ product_namep = pkp->productname;
+ break;
+ }
+ pkp++;
+ }
}
- if (kdp->vendorname == NULL)
- vendor_namep = product_namep = NULL;
- else {
- vendor_namep = kdp->vendorname;
- product_namep = (kdp->flags & PCI_KNOWNDEV_NOPROD) == 0 ?
- kdp->productname : NULL;
- }
-#else /* PCIVERBOSE */
- vendor_namep = product_namep = NULL;
#endif /* PCIVERBOSE */
classp = pci_class;