summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorNathan Binkert <nate@cvs.openbsd.org>2002-11-26 05:09:37 +0000
committerNathan Binkert <nate@cvs.openbsd.org>2002-11-26 05:09:37 +0000
commitb2b15e45eca7137f0e7fb63a1de580af95881196 (patch)
treed66c81477a246cef38dd7d887f6b27ce950ccfd1 /sys/dev/pci
parent7a72aeb9f4d9ee89d60ffc03e1e103c056896fac (diff)
use pci_matchbyid
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/if_bge.c67
-rw-r--r--sys/dev/pci/if_em.c49
2 files changed, 44 insertions, 72 deletions
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c
index dc3390693d0..ef382611832 100644
--- a/sys/dev/pci/if_bge.c
+++ b/sys/dev/pci/if_bge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bge.c,v 1.15 2002/11/26 04:38:40 nate Exp $ */
+/* $OpenBSD: if_bge.c,v 1.16 2002/11/26 05:09:36 nate Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
* Copyright (c) 1997, 1998, 1999, 2001
@@ -190,6 +190,31 @@ int bgedebug = 0;
#define DPRINTFN(n,x)
#endif
+/*
+ * Various supported device vendors/types and their names. Note: the
+ * spec seems to indicate that the hardware still has Alteon's vendor
+ * ID burned into it, though it will always be overriden by the vendor
+ * ID in the EEPROM. Just to be safe, we cover all possibilities.
+ */
+const struct pci_matchid bge_devices[] = {
+ { PCI_VENDOR_ALTEON, PCI_PRODUCT_ALTEON_BCM5700 },
+ { PCI_VENDOR_ALTEON, PCI_PRODUCT_ALTEON_BCM5701 },
+
+ { PCI_VENDOR_ALTIMA, PCI_PRODUCT_ALTIMA_AC100X },
+ { PCI_VENDOR_ALTIMA, PCI_PRODUCT_ALTIMA_AC9100 },
+
+ { PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5700 },
+ { PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5701 },
+ { PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5702 },
+ { PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5703 },
+ { PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5702X },
+ { PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5703X },
+
+ { PCI_VENDOR_SCHNEIDERKOCH, PCI_PRODUCT_SCHNEIDERKOCH_SK9D21 },
+
+ { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C996 },
+};
+
u_int32_t
bge_readmem_ind(sc, off)
struct bge_softc *sc;
@@ -1377,44 +1402,8 @@ bge_probe(parent, match, aux)
void *match;
void *aux;
{
- struct pci_attach_args *pa = (struct pci_attach_args *)aux;
-
- /*
- * Various supported device vendors/types and their
- * names. Note: the spec seems to indicate that the hardware
- * still has Alteon's vendor ID burned into it, though it will
- * always be overriden by the vendor ID in the EEPROM. Just to
- * be safe, we cover all possibilities.
- */
-
- if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_ALTEON &&
- (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ALTEON_BCM5700 ||
- PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ALTEON_BCM5701))
- return (1);
-
- if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_ALTIMA &&
- (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ALTIMA_AC100X ||
- PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ALTIMA_AC9100))
- return (1);
-
- if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_BROADCOM &&
- (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM5700 ||
- PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM5701 ||
- PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM5702 ||
- PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM5703 ||
- PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM5702X ||
- PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM5703X))
- return (1);
-
- if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_SCHNEIDERKOCH &&
- PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_SCHNEIDERKOCH_SK9D21)
- return (1);
-
- if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_3COM &&
- PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_3COM_3C996)
- return (1);
-
- return (0);
+ return (pci_matchbyid((struct pci_attach_args *)aux, bge_devices,
+ sizeof(bge_devices)/sizeof(bge_devices[0])));
}
void
diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c
index bb9cce41542..cc0b004fd4b 100644
--- a/sys/dev/pci/if_em.c
+++ b/sys/dev/pci/if_em.c
@@ -98,29 +98,20 @@ char em_driver_version[] = "1.3.14";
/*********************************************************************
* PCI Device ID Table
*********************************************************************/
-struct em_device
-{
- u_int16_t vendor_id;
- u_int16_t device_id;
- int match;
-};
-
-struct em_device em_devs[] =
-{
- /* Intel(R) PRO/1000 Network Connection */
- { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82542, 2},
- { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82543GC_SC, 2},
- { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82543GC, 2},
- { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82544EI, 2},
- { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82544EI_SC, 2},
- { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82544GC, 2},
- { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82544GC_LX, 2},
- { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82540EM, 2},
- { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82545EM, 2},
- { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82546EB, 2},
- { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82545EM_SC, 2},
- { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82546EB_SC, 2},
- { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82545EM_LX, 2},
+const struct pci_matchid em_devices[] = {
+ { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82542 },
+ { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82543GC_SC },
+ { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82543GC },
+ { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82544EI },
+ { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82544EI_SC },
+ { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82544GC },
+ { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82544GC_LX },
+ { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82540EM },
+ { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82545EM },
+ { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82546EB },
+ { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82545EM_SC },
+ { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82546EB_SC },
+ { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82545EM_LX },
};
/*********************************************************************
@@ -208,18 +199,10 @@ struct cfdriver em_cd = {
int
em_probe(struct device *parent, void *match, void *aux)
{
- struct pci_attach_args *pa = (struct pci_attach_args *)aux;
- int i;
-
INIT_DEBUGOUT("em_probe: begin");
- for (i = 0; i < sizeof(em_devs) / sizeof(em_devs[0]); i++) {
- if (PCI_VENDOR(pa->pa_id) == em_devs[i].vendor_id &&
- PCI_PRODUCT(pa->pa_id) == em_devs[i].device_id)
- return (em_devs[i].match);
- }
-
- return (0);
+ return (pci_matchbyid((struct pci_attach_args *)aux, em_devices,
+ sizeof(em_devices)/sizeof(em_devices[0])));
}
/*********************************************************************