Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Jul 2008 17:51:23 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 146135 for review
Message-ID:  <200807281751.m6SHpNoT054435@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=146135

Change 146135 by jhb@jhb_mutex on 2008/07/28 17:50:38

	IFC @146133

Affected files ...

.. //depot/projects/smpng/sys/dev/wi/if_wi.c#89 integrate
.. //depot/projects/smpng/sys/dev/wi/if_wivar.h#27 integrate
.. //depot/projects/smpng/sys/kern/sched_4bsd.c#85 integrate

Differences ...

==== //depot/projects/smpng/sys/dev/wi/if_wi.c#89 (text+ko) ====

@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/wi/if_wi.c,v 1.219 2008/07/26 17:04:30 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/wi/if_wi.c,v 1.220 2008/07/28 17:00:37 imp Exp $");
 
 #define WI_HERMES_STATS_WAR	/* Work around stats counter bug. */
 
@@ -225,6 +225,8 @@
 	{ 0,	NULL,	0 },
 };
 
+static char *wi_firmware_names[] = { "none", "Hermes", "Intersil", "Symbol" };
+
 devclass_t wi_devclass;
 
 int
@@ -237,6 +239,8 @@
 	u_int16_t val;
 	u_int8_t ratebuf[2 + IEEE80211_RATE_SIZE];
 	struct ieee80211_rateset *rs;
+	struct sysctl_ctx_list *sctx;
+	struct sysctl_oid *soid;
 	static const u_int8_t empty_macaddr[IEEE80211_ADDR_LEN] = {
 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 	};
@@ -278,6 +282,25 @@
 		return EOPNOTSUPP; 
 	}
 
+	/* Export info about the device via sysctl */
+	sctx = device_get_sysctl_ctx(dev);
+	soid = device_get_sysctl_tree(dev);
+	SYSCTL_ADD_STRING(sctx, SYSCTL_CHILDREN(soid), OID_AUTO,
+	    "firmware_type", CTLFLAG_RD,
+	    wi_firmware_names[sc->sc_firmware_type], 0,
+	    "Firmware type string");
+	SYSCTL_ADD_INT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "sta_version",
+	    CTLFLAG_RD, &sc->sc_sta_firmware_ver, 0,
+	    "Station Firmware version");
+	if (sc->sc_firmware_type == WI_INTERSIL)
+		SYSCTL_ADD_INT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO,
+		    "pri_version", CTLFLAG_RD, &sc->sc_pri_firmware_ver, 0,
+		    "Primary Firmware version");
+	SYSCTL_ADD_XINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "nic_id",
+	    CTLFLAG_RD, &sc->sc_nic_id, 0, "NIC id");
+	SYSCTL_ADD_STRING(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "nic_name",
+	    CTLFLAG_RD, sc->sc_nic_name, 0, "NIC name");
+
 	mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
 	    MTX_DEF | MTX_RECURSE);
 	callout_init_mtx(&sc->sc_watchdog, &sc->sc_mtx, 0);
@@ -1633,25 +1656,26 @@
 	memset(ver, 0, sizeof(ver));
 	len = sizeof(ver);
 	wi_read_rid(sc, WI_RID_CARD_ID, ver, &len);
-	device_printf(sc->sc_dev, "using ");
 
 	sc->sc_firmware_type = WI_NOTYPE;
+	sc->sc_nic_id = le16toh(ver[0]);
 	for (id = wi_card_ident; id->card_name != NULL; id++) {
-		if (le16toh(ver[0]) == id->card_id) {
-			printf("%s", id->card_name);
+		if (sc->sc_nic_id == id->card_id) {
+			sc->sc_nic_name = id->card_name;
 			sc->sc_firmware_type = id->firm_type;
 			break;
 		}
 	}
 	if (sc->sc_firmware_type == WI_NOTYPE) {
-		if (le16toh(ver[0]) & 0x8000) {
-			printf("Unknown PRISM2 chip");
+		if (sc->sc_nic_id & 0x8000) {
 			sc->sc_firmware_type = WI_INTERSIL;
+			sc->sc_nic_name = "Unknown Prism chip";
 		} else {
-			printf("Unknown Lucent chip");
 			sc->sc_firmware_type = WI_LUCENT;
+			sc->sc_nic_name = "Unknown Lucent chip";
 		}
 	}
+	device_printf(sc->sc_dev, "using %s\n", sc->sc_nic_name);
 
 	/* get primary firmware version (Only Prism chips) */
 	if (sc->sc_firmware_type != WI_LUCENT) {
@@ -1684,19 +1708,19 @@
 			    (p[6] - '0') * 10 + (p[7] - '0');
 		}
 	}
-	printf("\n");
-	device_printf(sc->sc_dev, "%s Firmware: ",
-	     sc->sc_firmware_type == WI_LUCENT ? "Lucent" :
-	    (sc->sc_firmware_type == WI_SYMBOL ? "Symbol" : "Intersil"));
-	if (sc->sc_firmware_type != WI_LUCENT)	/* XXX */
-		printf("Primary (%u.%u.%u), ",
-		    sc->sc_pri_firmware_ver / 10000,
-		    (sc->sc_pri_firmware_ver % 10000) / 100,
-		    sc->sc_pri_firmware_ver % 100);
-	printf("Station (%u.%u.%u)\n",
-	    sc->sc_sta_firmware_ver / 10000,
-	    (sc->sc_sta_firmware_ver % 10000) / 100,
-	    sc->sc_sta_firmware_ver % 100);
+	if (bootverbose) {
+		device_printf(sc->sc_dev, "%s Firmware: ",
+		    wi_firmware_names[sc->sc_firmware_type]);
+		if (sc->sc_firmware_type != WI_LUCENT)	/* XXX */
+			printf("Primary (%u.%u.%u), ",
+			    sc->sc_pri_firmware_ver / 10000,
+			    (sc->sc_pri_firmware_ver % 10000) / 100,
+			    sc->sc_pri_firmware_ver % 100);
+		printf("Station (%u.%u.%u)\n",
+		    sc->sc_sta_firmware_ver / 10000,
+		    (sc->sc_sta_firmware_ver % 10000) / 100,
+		    sc->sc_sta_firmware_ver % 100);
+	}
 }
 
 static int

==== //depot/projects/smpng/sys/dev/wi/if_wivar.h#27 (text+ko) ====

@@ -31,7 +31,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/wi/if_wivar.h,v 1.32 2008/04/20 20:35:38 sam Exp $
+ * $FreeBSD: src/sys/dev/wi/if_wivar.h,v 1.33 2008/07/28 17:00:37 imp Exp $
  */
 
 /*
@@ -87,6 +87,8 @@
 #define	WI_SYMBOL	3
 	int			sc_pri_firmware_ver;	/* Primary firmware */
 	int			sc_sta_firmware_ver;	/* Station firmware */
+	unsigned int		sc_nic_id;		/* Type of NIC */
+	char *			sc_nic_name;
 
 	int			wi_bus_type;	/* Bus attachment type */
 	struct resource *	local;

==== //depot/projects/smpng/sys/kern/sched_4bsd.c#85 (text+ko) ====

@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/sched_4bsd.c,v 1.127 2008/07/28 15:52:02 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/sched_4bsd.c,v 1.128 2008/07/28 17:25:24 jhb Exp $");
 
 #include "opt_hwpmc_hooks.h"
 #include "opt_sched.h"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807281751.m6SHpNoT054435>