Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Add a lookup table with ASIC revision, name, and...



details:   https://anonhg.NetBSD.org/src/rev/20edef97ccf4
branches:  trunk
changeset: 534034:20edef97ccf4
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Jul 13 22:21:20 2002 +0000

description:
Add a lookup table with ASIC revision, name, and any quirks.  Print
ASIC revision at attach time.  Add BCM5703 revisions.

diffstat:

 sys/dev/pci/if_bge.c    |  107 +++++++++++++++++++++++++++++++++++++++++++----
 sys/dev/pci/if_bgereg.h |    6 ++-
 2 files changed, 101 insertions(+), 12 deletions(-)

diffs (177 lines):

diff -r 5b0fc834fcc6 -r 20edef97ccf4 sys/dev/pci/if_bge.c
--- a/sys/dev/pci/if_bge.c      Sat Jul 13 21:04:55 2002 +0000
+++ b/sys/dev/pci/if_bge.c      Sat Jul 13 22:21:20 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bge.c,v 1.15 2002/07/13 01:23:27 thorpej Exp $      */
+/*     $NetBSD: if_bge.c,v 1.16 2002/07/13 22:21:20 thorpej Exp $      */
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -1512,6 +1512,83 @@
        return(0);
 }
 
+static const struct bge_revision {
+       uint32_t                br_asicrev;
+       uint32_t                br_quirks;
+       const char              *br_name;
+} bge_revisions[] = {
+       { BGE_ASICREV_BCM5700_A0,
+         0,
+         "BCM5700 A0" },
+
+       { BGE_ASICREV_BCM5700_A1,
+         0,
+         "BCM5700 A1" },
+
+       { BGE_ASICREV_BCM5700_B0,
+         0,
+         "BCM5700 B0" },
+
+       { BGE_ASICREV_BCM5700_B1,
+         0,
+         "BCM5700 B1" },
+
+       { BGE_ASICREV_BCM5700_B2,
+         0,
+         "BCM5700 B2" },
+
+       { BGE_ASICREV_BCM5700_ALTIMA,
+         0,
+         "BCM5700 Altima" },
+
+       { BGE_ASICREV_BCM5700_C0,
+         0,
+         "BCM5700 C0" },
+
+       { BGE_ASICREV_BCM5701_A0,
+         0,
+         "BCM5701 A0" },
+
+       { BGE_ASICREV_BCM5701_B0,
+         0,
+         "BCM5701 B0" },
+
+       { BGE_ASICREV_BCM5701_B2,
+         0,
+         "BCM5701 B2" },
+
+       { BGE_ASICREV_BCM5701_B5,
+         0,
+         "BCM5701 B5" },
+
+       { BGE_ASICREV_BCM5703_A0,
+         0,
+         "BCM5703 A0" },
+
+       { BGE_ASICREV_BCM5703_A1,
+         0,
+         "BCM5703 A1" },
+
+       { BGE_ASICREV_BCM5703_A2,
+         0,
+         "BCM5703 A2" },
+
+       { 0, 0, NULL }
+};
+
+static const struct bge_revision *
+bge_lookup_rev(uint32_t asicrev)
+{
+       const struct bge_revision *br;
+
+       for (br = bge_revisions; br->br_name != NULL; br++) {
+               if (br->br_asicrev == asicrev)
+                       return (br);
+       }
+
+       return (NULL);
+}
+
 static const struct bge_product {
        pci_vendor_id_t         bp_vendor;
        pci_product_id_t        bp_product;
@@ -1604,6 +1681,7 @@
        struct bge_softc        *sc = (struct bge_softc *)self;
        struct pci_attach_args  *pa = aux;
        const struct bge_product *bp;
+       const struct bge_revision *br;
        pci_chipset_tag_t       pc = pa->pa_pc;
        pci_intr_handle_t       ih;
        const char              *intrstr = NULL;
@@ -1624,7 +1702,7 @@
 
        sc->bge_pa = *pa;
 
-       printf(": %s, rev. 0x%02x\n", bp->bp_name, PCI_REVISION(pa->pa_class));
+       printf(": %s\n", bp->bp_name);
 
        /*
         * Map control/status registers.
@@ -1701,10 +1779,23 @@
        }
 
        /*
-        * A Broadcom chip was detected. Inform the world.
+        * Save ASIC rev.  Look up any quirks associated with this
+        * ASIC.
         */
-       printf("%s: Ethernet address %s\n", sc->bge_dev.dv_xname,
-           ether_sprintf(eaddr));
+       sc->bge_asicrev =
+           pci_conf_read(pa->pa_pc, pa->pa_tag, BGE_PCI_MISC_CTL) &
+           BGE_PCIMISCCTL_ASICREV;
+       br = bge_lookup_rev(sc->bge_asicrev);
+
+       printf("%s: ", sc->bge_dev.dv_xname);
+       if (br == NULL) {
+               printf("unknown ASIC 0x%08x", sc->bge_asicrev);
+               sc->bge_quirks = 0;
+       } else {
+               printf("ASIC %s", br->br_name);
+               sc->bge_quirks = br->br_quirks;
+       }
+       printf(", Ethernet address %s\n", ether_sprintf(eaddr));
 
        /* Allocate the general information block and ring buffers. */
        sc->bge_dmatag = pa->pa_dmat;
@@ -1790,12 +1881,6 @@
        sc->bge_mii.mii_writereg = bge_miibus_writereg;
        sc->bge_mii.mii_statchg = bge_miibus_statchg;
 
-       /* Save ASIC rev. */
-
-       sc->bge_asicrev =
-           pci_conf_read(pa->pa_pc, pa->pa_tag, BGE_PCI_MISC_CTL) &
-           BGE_PCIMISCCTL_ASICREV;
-
        /*
         * Figure out what sort of media we have by checking the
         * hardware config word in the EEPROM. Note: on some BCM5700
diff -r 5b0fc834fcc6 -r 20edef97ccf4 sys/dev/pci/if_bgereg.h
--- a/sys/dev/pci/if_bgereg.h   Sat Jul 13 21:04:55 2002 +0000
+++ b/sys/dev/pci/if_bgereg.h   Sat Jul 13 22:21:20 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bgereg.h,v 1.2 2002/06/24 01:21:39 fvdl Exp $       */
+/*     $NetBSD: if_bgereg.h,v 1.3 2002/07/13 22:21:20 thorpej Exp $    */
 /*
  * Copyright (c) 2001 Wind River Systems
  * Copyright (c) 1997, 1998, 1999, 2001
@@ -230,6 +230,9 @@
 #define BGE_ASICREV_BCM5701_B0         0x01000000
 #define BGE_ASICREV_BCM5701_B2         0x01020000
 #define BGE_ASICREV_BCM5701_B5         0x01050000
+#define BGE_ASICREV_BCM5703_A0         0x10000000
+#define BGE_ASICREV_BCM5703_A1         0x10010000
+#define BGE_ASICREV_BCM5703_A2         0x10020000
 
 /* shorthand one */
 #define BGE_ASICREV_BCM5700_MASK       0x71000000
@@ -2239,6 +2242,7 @@
        u_int8_t                bge_tbi;
        bus_dma_tag_t           bge_dmatag;
        u_int32_t               bge_asicrev;
+       u_int32_t               bge_quirks;
        struct bge_ring_data    *bge_rdata;     /* rings */
        struct bge_chain_data   bge_cdata;      /* mbufs */
        bus_dmamap_t            bge_ring_map;



Home | Main Index | Thread Index | Old Index