Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 05 Mar 2002 23:44:24 -0700 (MST)
From:      "M. Warner Losh" <imp@village.org>
To:        grog@FreeBSD.org
Cc:        mobile@FreeBSD.org
Subject:   Re: cvs commit: src/sys/dev/wi if_wi.c
Message-ID:  <20020305.234424.32118825.imp@village.org>
In-Reply-To: <20020306094643.M64582@wantadilla.lemis.com>
References:  <200203051618.g25GIE797698@freefall.freebsd.org> <20020306094643.M64582@wantadilla.lemis.com>

next in thread | previous in thread | raw e-mail | index | archive | help
[[ redirected to mobile ]]

In message: <20020306094643.M64582@wantadilla.lemis.com>
            Greg Lehey <grog@FreeBSD.org> writes:
: I note that OpenBSD also displays the firmware revision number.  Are
: you planning to add this?

[ imp says we've done this for a while ]

It has been pointed out in private email that while we've done this
this for the Prism 2* chipsets for a while, we don't do this for the
Lucent chipsets.  Please find enclosed a patch that should do this.
However, I don't have any Lucent cards that I can put my hands on that
won't take someone off the air...

It also includes part of the airtools v0.2 patches that I was looking
at, but that shouldn't have any adverse impact on people that want to
test.

Warner


Index: if_wavelan_ieee.h
===================================================================
RCS file: /cache/ncvs/src/sys/dev/wi/if_wavelan_ieee.h,v
retrieving revision 1.6
diff -u -r1.6 if_wavelan_ieee.h
--- if_wavelan_ieee.h	26 May 2001 09:27:06 -0000	1.6
+++ if_wavelan_ieee.h	6 Mar 2002 06:31:11 -0000
@@ -275,7 +275,7 @@
 #define WI_RID_REG_DOMAINS	0xFD11 /* list of intendted regulatory doms */
 #define WI_RID_TEMP_TYPE	0xFD12 /* hw temp range code */
 #define WI_RID_CIS		0xFD13 /* PC card info struct */
-#define WI_RID_STA_IDENEITY	0xFD20 /* station funcs firmware ident */
+#define WI_RID_STA_IDENTITY	0xFD20 /* station funcs firmware ident */
 #define WI_RID_STA_SUP_RANGE	0xFD21 /* station supplier compat */
 #define WI_RID_MFI_ACT_RANGE	0xFD22
 #define WI_RID_CFI_ACT_RANGE	0xFD33
Index: if_wi.c
===================================================================
RCS file: /cache/ncvs/src/sys/dev/wi/if_wi.c,v
retrieving revision 1.79
diff -u -r1.79 if_wi.c
--- if_wi.c	5 Mar 2002 16:18:14 -0000	1.79
+++ if_wi.c	6 Mar 2002 06:28:28 -0000
@@ -124,11 +124,6 @@
 static u_int8_t	wi_mcast_addr[6] = { 0x01, 0x60, 0x1D, 0x00, 0x01, 0x00 };
 #endif
 
-/*
- * The following is for compatibility with NetBSD.
- */
-#define LE16TOH(a)	((a) = le16toh((a)))
-
 static void wi_intr(void *);
 static void wi_reset(struct wi_softc *);
 static int wi_ioctl(struct ifnet *, u_long, caddr_t);
@@ -141,7 +136,7 @@
 static void wi_update_stats(struct wi_softc *);
 static void wi_setmulti(struct wi_softc *);
 
-static int wi_cmd(struct wi_softc *, int, int);
+static int wi_cmd(struct wi_softc *, int, int, int, int);
 static int wi_read_record(struct wi_softc *, struct wi_ltv_gen *);
 static int wi_write_record(struct wi_softc *, struct wi_ltv_gen *);
 static int wi_read_data(struct wi_softc *, int, int, caddr_t, int);
@@ -696,19 +691,22 @@
 		break;
 	}
 
+	/* get firmware version */
+	memset(&ver, 0, sizeof(ver));
+	ver.wi_type = WI_RID_STA_IDENTITY;
+	ver.wi_len = 5;
+	wi_read_record(sc, (struct wi_ltv_gen *)&ver);
+	ver.wi_ver[1] = le16toh(ver.wi_ver[1]);
+	ver.wi_ver[2] = le16toh(ver.wi_ver[2]);
+	ver.wi_ver[3] = le16toh(ver.wi_ver[3]);
 	if (sc->wi_prism2) {
-		/* try to get prism2 firm version */
-		memset(&ver, 0, sizeof(ver));
-		ver.wi_type = WI_RID_IDENT;
-		ver.wi_len = 5;
-		wi_read_record(sc, (struct wi_ltv_gen *)&ver);
-		LE16TOH(ver.wi_ver[1]);
-		LE16TOH(ver.wi_ver[2]);
-		LE16TOH(ver.wi_ver[3]);
-		printf(", Firmware: %d.%d variant %d\n", ver.wi_ver[2],
-		       ver.wi_ver[3], ver.wi_ver[1]);
+		printf(", Firmware: %d.%d variant %d\n", ver.wi_ver[2],
+		    ver.wi_ver[3], ver.wi_ver[1]);
 		sc->wi_prism2_ver = ver.wi_ver[2] * 100 +
-				    ver.wi_ver[3] *  10 + ver.wi_ver[1];
+		    ver.wi_ver[3] *  10 + ver.wi_ver[1];
+	} else {
+		printf(", Firmware %d.%d variant %d, ",
+		    ver.wi_ver[2], ver.wi_ver[3], ver.wi_ver[1]);
 	}
 
 	return;
@@ -862,7 +860,7 @@
 	if (ifp->if_flags & IFF_OACTIVE)
 		return;
 
-	wi_cmd(sc, WI_CMD_INQUIRE, WI_INFO_COUNTERS);
+	wi_cmd(sc, WI_CMD_INQUIRE, WI_INFO_COUNTERS, 0, 0);
 
 	return;
 }
@@ -978,10 +976,12 @@
 }
 
 static int
-wi_cmd(sc, cmd, val)
+wi_cmd(sc, cmd, val0, val1, val2)
 	struct wi_softc		*sc;
 	int			cmd;
-	int			val;
+	int			val0;
+	int			val1;
+	int			val2;
 {
 	int			i, s = 0;
 
@@ -997,9 +997,9 @@
 		return(ETIMEDOUT);
 	}
 
-	CSR_WRITE_2(sc, WI_PARAM0, val);
-	CSR_WRITE_2(sc, WI_PARAM1, 0);
-	CSR_WRITE_2(sc, WI_PARAM2, 0);
+	CSR_WRITE_2(sc, WI_PARAM0, val0);
+	CSR_WRITE_2(sc, WI_PARAM1, val1);
+	CSR_WRITE_2(sc, WI_PARAM2, val2);
 	CSR_WRITE_2(sc, WI_COMMAND, cmd);
 
 	for (i = 0; i < WI_TIMEOUT; i++) {
@@ -1040,7 +1040,7 @@
 	int i;
 	
 	for (i = 0; i < WI_INIT_TRIES; i++) {
-		if (wi_cmd(sc, WI_CMD_INI, 0) == 0)
+		if (wi_cmd(sc, WI_CMD_INI, 0, 0, 0) == 0)
 			break;
 		DELAY(WI_DELAY * 1000);
 	}
@@ -1085,7 +1085,7 @@
 	}
 
 	/* Tell the NIC to enter record read mode. */
-	if (wi_cmd(sc, WI_CMD_ACCESS|WI_ACCESS_READ, ltv->wi_type))
+	if (wi_cmd(sc, WI_CMD_ACCESS|WI_ACCESS_READ, ltv->wi_type, 0, 0))
 		return(EIO);
 
 	/* Seek to the record. */
@@ -1240,7 +1240,7 @@
 	for (i = 0; i < ltv->wi_len - 1; i++)
 		CSR_WRITE_2(sc, WI_DATA1, ptr[i]);
 
-	if (wi_cmd(sc, WI_CMD_ACCESS|WI_ACCESS_WRITE, ltv->wi_type))
+	if (wi_cmd(sc, WI_CMD_ACCESS|WI_ACCESS_WRITE, ltv->wi_type, 0, 0))
 		return(EIO);
 
 	return(0);
@@ -1374,7 +1374,7 @@
 {
 	int			i;
 
-	if (wi_cmd(sc, WI_CMD_ALLOC_MEM, len)) {
+	if (wi_cmd(sc, WI_CMD_ALLOC_MEM, len, 0, 0)) {
 		device_printf(sc->dev,
 		    "failed to allocate %d bytes on NIC\n", len);
 		return(ENOMEM);
@@ -1959,7 +1959,7 @@
 	wi_setmulti(sc);
 
 	/* Enable desired port */
-	wi_cmd(sc, WI_CMD_ENABLE | sc->wi_portnum, 0);
+	wi_cmd(sc, WI_CMD_ENABLE | sc->wi_portnum, 0, 0, 0);
 
 	if (wi_alloc_nicmem(sc, ETHER_MAX_LEN + sizeof(struct wi_frame) + 8, &id))
 		device_printf(sc->dev, "tx buffer allocation failed\n");
@@ -2064,7 +2064,7 @@
 
 	m_freem(m0);
 
-	if (wi_cmd(sc, WI_CMD_TX|WI_RECLAIM, id))
+	if (wi_cmd(sc, WI_CMD_TX|WI_RECLAIM, id, 0, 0))
 		device_printf(sc->dev, "xmit failed\n");
 
 	ifp->if_flags |= IFF_OACTIVE;
@@ -2108,7 +2108,7 @@
 	wi_write_data(sc, id, WI_802_11_OFFSET_RAW, dptr,
 	    (len - sizeof(struct wi_80211_hdr)) + 2);
 
-	if (wi_cmd(sc, WI_CMD_TX|WI_RECLAIM, id)) {
+	if (wi_cmd(sc, WI_CMD_TX|WI_RECLAIM, id, 0, 0)) {
 		device_printf(sc->dev, "xmit failed\n");
 		return(EIO);
 	}
@@ -2138,7 +2138,7 @@
 	 */
 	if (CSR_READ_2(sc, WI_STATUS) != 0xffff) {
 		CSR_WRITE_2(sc, WI_INT_EN, 0);
-		wi_cmd(sc, WI_CMD_DISABLE|sc->wi_portnum, 0);
+		wi_cmd(sc, WI_CMD_DISABLE|sc->wi_portnum, 0, 0, 0);
 	}
 
 	untimeout(wi_inquire, sc, sc->wi_stat_ch);
Index: if_wireg.h
===================================================================
RCS file: /cache/ncvs/src/sys/dev/wi/if_wireg.h,v
retrieving revision 1.19
diff -u -r1.19 if_wireg.h
--- if_wireg.h	5 Mar 2002 16:06:54 -0000	1.19
+++ if_wireg.h	6 Mar 2002 06:32:13 -0000
@@ -481,7 +481,6 @@
  * NIC Identification (0xFD0B)
  */
 #define WI_RID_CARDID		0xFD0B
-#define WI_RID_IDENT		0xFD20
 struct wi_ltv_ver {
 	u_int16_t		wi_len;
 	u_int16_t		wi_type;

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-mobile" in the body of the message




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