Module Name: src Committed By: christos Date: Sat Jul 9 23:18:05 UTC 2011
Modified Files: src/sys/dev/cardbus: if_tlp_cardbus.c src/sys/dev/ic: tulip.c tulipvar.h src/sys/dev/pci: if_tlp_pci.c Log Message: - add a routine to get the name of the card. To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/sys/dev/cardbus/if_tlp_cardbus.c cvs rdiff -u -r1.176 -r1.177 src/sys/dev/ic/tulip.c cvs rdiff -u -r1.64 -r1.65 src/sys/dev/ic/tulipvar.h cvs rdiff -u -r1.116 -r1.117 src/sys/dev/pci/if_tlp_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/cardbus/if_tlp_cardbus.c diff -u src/sys/dev/cardbus/if_tlp_cardbus.c:1.67 src/sys/dev/cardbus/if_tlp_cardbus.c:1.68 --- src/sys/dev/cardbus/if_tlp_cardbus.c:1.67 Tue Mar 9 19:21:10 2010 +++ src/sys/dev/cardbus/if_tlp_cardbus.c Sat Jul 9 19:18:05 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: if_tlp_cardbus.c,v 1.67 2010/03/10 00:21:10 dyoung Exp $ */ +/* $NetBSD: if_tlp_cardbus.c,v 1.68 2011/07/09 23:18:05 christos Exp $ */ /*- * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_tlp_cardbus.c,v 1.67 2010/03/10 00:21:10 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_tlp_cardbus.c,v 1.68 2011/07/09 23:18:05 christos Exp $"); #include "opt_inet.h" @@ -187,8 +187,7 @@ { const struct tulip_cardbus_product *tcp; - for (tcp = tlp_cardbus_products; - tlp_chip_names[tcp->tcp_chip] != NULL; + for (tcp = tlp_cardbus_products; tcp->tcp_chip != TULIP_CHIP_INVALID; tcp++) { if (PCI_VENDOR(ca->ca_id) == tcp->tcp_vendor && PCI_PRODUCT(ca->ca_id) == tcp->tcp_product) @@ -297,7 +296,7 @@ } printf(": %s Ethernet, pass %d.%d\n", - tlp_chip_names[sc->sc_chip], + tlp_chip_name(sc->sc_chip), (sc->sc_rev >> 4) & 0xf, sc->sc_rev & 0xf); /* Index: src/sys/dev/ic/tulip.c diff -u src/sys/dev/ic/tulip.c:1.176 src/sys/dev/ic/tulip.c:1.177 --- src/sys/dev/ic/tulip.c:1.176 Sat Nov 13 08:52:02 2010 +++ src/sys/dev/ic/tulip.c Sat Jul 9 19:18:05 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: tulip.c,v 1.176 2010/11/13 13:52:02 uebayasi Exp $ */ +/* $NetBSD: tulip.c,v 1.177 2011/07/09 23:18:05 christos Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.176 2010/11/13 13:52:02 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.177 2011/07/09 23:18:05 christos Exp $"); #include <sys/param.h> @@ -69,7 +69,7 @@ #include <dev/ic/tulipreg.h> #include <dev/ic/tulipvar.h> -const char * const tlp_chip_names[] = TULIP_CHIP_NAMES; +static const char * const tlp_chip_names[] = TULIP_CHIP_NAMES; static const struct tulip_txthresh_tab tlp_10_txthresh_tab[] = TLP_TXTHRESH_TAB_10; @@ -6197,3 +6197,13 @@ ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_AUTO); } } + +const char * +tlp_chip_name(tulip_chip_t t) { + if ((int)t < 0 || (int)t >= __arraycount(tlp_chip_names)) { + static char buf[256]; + (void)snprintf(buf, sizeof(buf), "[unknown 0x%x]", t); + return buf; + } + return tlp_chip_names[t]; +} Index: src/sys/dev/ic/tulipvar.h diff -u src/sys/dev/ic/tulipvar.h:1.64 src/sys/dev/ic/tulipvar.h:1.65 --- src/sys/dev/ic/tulipvar.h:1.64 Fri Apr 17 11:22:35 2009 +++ src/sys/dev/ic/tulipvar.h Sat Jul 9 19:18:05 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: tulipvar.h,v 1.64 2009/04/17 15:22:35 cegger Exp $ */ +/* $NetBSD: tulipvar.h,v 1.65 2011/07/09 23:18:05 christos Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -571,8 +571,6 @@ #define TULIP_SP_FIELD(x, f) TULIP_SP_FIELD_C((x)[f * 2], (x)[f * 2 + 1]) #ifdef _KERNEL -extern const char * const tlp_chip_names[]; - extern const struct tulip_mediasw tlp_21040_mediasw; extern const struct tulip_mediasw tlp_21040_tp_mediasw; extern const struct tulip_mediasw tlp_21040_auibnc_mediasw; @@ -604,6 +602,7 @@ void tlp_21140_gpio_get(struct tulip_softc *sc, struct ifmediareq *ifmr); int tlp_21140_gpio_set(struct tulip_softc *sc); +const char *tlp_chip_name(tulip_chip_t); #endif /* _KERNEL */ Index: src/sys/dev/pci/if_tlp_pci.c diff -u src/sys/dev/pci/if_tlp_pci.c:1.116 src/sys/dev/pci/if_tlp_pci.c:1.117 --- src/sys/dev/pci/if_tlp_pci.c:1.116 Thu Jan 21 11:14:39 2010 +++ src/sys/dev/pci/if_tlp_pci.c Sat Jul 9 19:18:05 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: if_tlp_pci.c,v 1.116 2010/01/21 16:14:39 martin Exp $ */ +/* $NetBSD: if_tlp_pci.c,v 1.117 2011/07/09 23:18:05 christos Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_tlp_pci.c,v 1.116 2010/01/21 16:14:39 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_tlp_pci.c,v 1.117 2011/07/09 23:18:05 christos Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -270,9 +270,8 @@ PCI_SUBSYS_ID_REG)) == PCI_VENDOR_LMC) return NULL; - for (tpp = tlp_pci_products; - tlp_chip_names[tpp->tpp_chip] != NULL; - tpp++) { + for (tpp = tlp_pci_products; tpp->tpp_chip != TULIP_CHIP_INVALID; + tpp++) { if (PCI_VENDOR(pa->pa_id) == tpp->tpp_vendor && PCI_PRODUCT(pa->pa_id) == tpp->tpp_product) return tpp; @@ -461,7 +460,7 @@ } aprint_normal(": %s Ethernet, pass %d.%d\n", - tlp_chip_names[sc->sc_chip], + tlp_chip_name(sc->sc_chip), (sc->sc_rev >> 4) & 0xf, sc->sc_rev & 0xf); switch (sc->sc_chip) {