Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Use a table to match BCM570x products.
details: https://anonhg.NetBSD.org/src/rev/2d5095cf0070
branches: trunk
changeset: 533345:2d5095cf0070
user: thorpej <thorpej%NetBSD.org@localhost>
date: Thu Jun 27 23:56:20 2002 +0000
description:
Use a table to match BCM570x products.
diffstat:
sys/dev/pci/if_bge.c | 99 ++++++++++++++++++++++++++++++++++-----------------
1 files changed, 66 insertions(+), 33 deletions(-)
diffs (139 lines):
diff -r caeca73c8e42 -r 2d5095cf0070 sys/dev/pci/if_bge.c
--- a/sys/dev/pci/if_bge.c Thu Jun 27 23:21:34 2002 +0000
+++ b/sys/dev/pci/if_bge.c Thu Jun 27 23:56:20 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bge.c,v 1.6 2002/06/27 23:21:34 thorpej Exp $ */
+/* $NetBSD: if_bge.c,v 1.7 2002/06/27 23:56:20 thorpej Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
* Copyright (c) 1997, 1998, 1999, 2001
@@ -1512,6 +1512,65 @@
return(0);
}
+static const struct bge_product {
+ pci_vendor_id_t bp_vendor;
+ pci_product_id_t bp_product;
+ const char *bp_name;
+} bge_products[] = {
+ /*
+ * The BCM5700 documentation seems to indicate that the hardware
+ * still has the Alteon vendor ID burned into it, though it
+ * should always be overridden by the value in the EEPROM. We'll
+ * check for it anyway.
+ */
+ { PCI_VENDOR_ALTEON,
+ PCI_PRODUCT_ALTEON_BCM5700,
+ "Broadcom BCM5700 Gigabit Ethernet" },
+ { PCI_VENDOR_ALTEON,
+ PCI_PRODUCT_ALTEON_BCM5701,
+ "Broadcom BCM5701 Gigabit Ethernet" },
+
+ { PCI_VENDOR_ALTIMA,
+ PCI_PRODUCT_ALTIMA_AC1000,
+ "Altima AC1000 Gigabit Ethernet" },
+ { PCI_VENDOR_ALTIMA,
+ PCI_PRODUCT_ALTIMA_AC9100,
+ "Altima AC9100 Gigabit Ethernet" },
+
+ { PCI_VENDOR_BROADCOM,
+ PCI_PRODUCT_BROADCOM_BCM5700,
+ "Broadcom BCM5700 Gigabit Ethernet" },
+ { PCI_VENDOR_BROADCOM,
+ PCI_PRODUCT_BROADCOM_BCM5701,
+ "Broadcom BCM5700 Gigabit Ethernet" },
+
+ { PCI_VENDOR_SCHNEIDERKOCH,
+ PCI_PRODUCT_SCHNEIDERKOCH_SK_9DX1,
+ "SysKonnect SK-9DX1 Gigabit Ethernet" },
+
+ { PCI_VENDOR_3COM,
+ PCI_PRODUCT_3COM_3C996,
+ "3Com 3c996 Gigabit Ethernet" },
+
+ { 0,
+ 0,
+ NULL },
+};
+
+static const struct bge_product *
+bge_lookup(const struct pci_attach_args *pa)
+{
+ const struct bge_product *bp;
+
+ for (bp = bge_products; bp->bp_name != NULL; bp++) {
+ if (PCI_VENDOR(pa->pa_id) == bp->bp_vendor &&
+ PCI_PRODUCT(pa->pa_id) == bp->bp_product)
+ return (bp);
+ }
+
+ return (NULL);
+}
+
/*
* Probe for a Broadcom chip. Check the PCI vendor and device IDs
* against our list and return its name if we find a match. Note
@@ -1528,35 +1587,7 @@
{
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_AC1000) ||
- 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))
- return (1);
-
- if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_SCHNEIDERKOCH &&
- PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_SCHNEIDERKOCH_SK_9DX1)
- return (1);
-
- if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_3COM &&
- PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_3COM_3C996)
+ if (bge_lookup(pa) != NULL)
return (1);
return (0);
@@ -1569,6 +1600,7 @@
{
struct bge_softc *sc = (struct bge_softc *)self;
struct pci_attach_args *pa = aux;
+ const struct bge_product *bp;
pci_chipset_tag_t pc = pa->pa_pc;
pci_intr_handle_t ih;
const char *intrstr = NULL;
@@ -1581,14 +1613,15 @@
caddr_t kva;
u_char eaddr[ETHER_ADDR_LEN];
pcireg_t memtype;
- char devinfo[256];
bus_addr_t memaddr;
bus_size_t memsize;
+ bp = bge_lookup(pa);
+ KASSERT(bp != NULL);
+
sc->bge_pa = *pa;
- pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo);
- printf(": %s (rev. 0x%02x)\n", devinfo, PCI_REVISION(pa->pa_class));
+ printf(": %s, rev. 0x%02x\n", bp->bp_name, PCI_REVISION(pa->pa_class));
/*
* Map control/status registers.
Home |
Main Index |
Thread Index |
Old Index