Subject: Re: About to back out some past changes to wi driver
To: Michael Graff <explorer@flame.org>
From: Andrew Cagney <cagney@mac.com>
List: current-users
Date: 01/16/2002 22:11:40
This is a multi-part message in MIME format.
--------------050803080904010801040708
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

> The unfortunate thing is that I no longer have my local reverted files, I did a CVS update before seeing this e-mail thread (doh!).


Hopefully recovered.  Attached is a diff between my reverted / 
apparently working wi0 and what is at the head of the trunk.

It might be useful.

enjoy,
Andrew



--------------050803080904010801040708
Content-Type: text/plain;
 name="wi.diffsH"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="wi.diffsH"

Index: wi.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/ic/wi.c,v
retrieving revision 1.31
diff -u -r1.31 wi.c
--- wi.c	2002/01/09 19:37:02	1.31
+++ wi.c	2002/01/17 03:04:38
@@ -1,4 +1,4 @@
-/*	$NetBSD: wi.c,v 1.31 2002/01/09 19:37:02 drochner Exp $	*/
+/*	$NetBSD: wi.c,v 1.29 2001/11/13 13:14:46 lukem Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998, 1999
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.31 2002/01/09 19:37:02 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.29 2001/11/13 13:14:46 lukem Exp $");
 
 #define WI_HERMES_AUTOINC_WAR	/* Work around data write autoinc bug. */
 #define WI_HERMES_STATS_WAR	/* Work around stats counter bug. */
@@ -298,9 +298,6 @@
 		return;
 	}
 
-	/*
-	 * Drop undecryptable or packets with receive errors here
-	 */
 	if (le16toh(rx_frame.wi_status) & WI_STAT_ERRSTAT) {
 		ifp->if_ierrors++;
 		return;
@@ -424,6 +421,8 @@
 		return;
 
 	wi_cmd(sc, WI_CMD_INQUIRE, WI_INFO_COUNTERS);
+
+	return;
 }
 
 void wi_update_stats(sc)
@@ -442,65 +441,28 @@
 
 	wi_read_data(sc, id, 0, (char *)&gen, 4);
 
-	switch (gen.wi_type) {
-	case WI_INFO_COUNTERS:
-		/* some card versions have a larger stats structure */
-		len = (gen.wi_len - 1 < sizeof(sc->wi_stats) / 4) ?
-			gen.wi_len - 1 : sizeof(sc->wi_stats) / 4;
-		ptr = (u_int32_t *)&sc->wi_stats;
+	if (gen.wi_type != WI_INFO_COUNTERS)
+		return;
 
-		for (i = 0; i < len; i++) {
-			t = CSR_READ_2(sc, WI_DATA1);
-#ifdef WI_HERMES_STATS_WAR
-			if (t > 0xF000)
-				t = ~t & 0xFFFF;
-#endif
-			ptr[i] += t;
-		}
+	/* some card versions have a larger stats structure */
+	len = (gen.wi_len - 1 < sizeof(sc->wi_stats) / 4) ?
+		gen.wi_len - 1 : sizeof(sc->wi_stats) / 4;
+	ptr = (u_int32_t *)&sc->wi_stats;
 
-		ifp->if_collisions = sc->wi_stats.wi_tx_single_retries +
-			sc->wi_stats.wi_tx_multi_retries +
-			sc->wi_stats.wi_tx_retry_limit;
-		break;
-
-	case WI_INFO_LINK_STAT: {
-		static char *msg[] = {
-			"connected",
-			"disconnected",
-			"AP change",
-			"AP out of range",
-			"AP in range"
-		};
-
-		if (gen.wi_len != 2) {
-#ifdef WI_DEBUG
-			printf("WI_INFO_LINK_STAT: len=%d\n", gen.wi_len);
-#endif
-			break;
-		}
+	for (i = 0; i < len; i++) {
 		t = CSR_READ_2(sc, WI_DATA1);
-		if ((t < 1) || (t > 5)) {
-#ifdef WI_DEBUG
-			printf("WI_INFO_LINK_STAT: status %d\n", t);
-#endif
-			break;
-		}
-		printf("%s: %s\n", sc->sc_dev.dv_xname, msg[t - 1]);
-		break;
-		}
-
-	default:
-#if 0
-		printf("Got info type: %04x\n", gen.wi_type);
-#endif
-		for (i = 0; i < gen.wi_len; i++) {
-			t = CSR_READ_2(sc, WI_DATA1);
-#if 0
-			printf("[0x%02x] = 0x%04x\n", i, t);
+#ifdef WI_HERMES_STATS_WAR
+		if (t > 0xF000)
+			t = ~t & 0xFFFF;
 #endif
-		}
-		break;
+		ptr[i] += t;
 	}
+
+	ifp->if_collisions = sc->wi_stats.wi_tx_single_retries +
+	    sc->wi_stats.wi_tx_multi_retries +
+	    sc->wi_stats.wi_tx_retry_limit;
+
+	return;
 }
 
 int wi_intr(arg)
Index: wi_ieee.h
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/ic/wi_ieee.h,v
retrieving revision 1.7
diff -u -r1.7 wi_ieee.h
--- wi_ieee.h	2002/01/05 20:10:53	1.7
+++ wi_ieee.h	2002/01/17 03:04:39
@@ -1,4 +1,4 @@
-/*	$NetBSD: wi_ieee.h,v 1.7 2002/01/05 20:10:53 explorer Exp $	*/
+/*	$NetBSD: wi_ieee.h,v 1.3 2001/05/15 09:01:27 ichiro Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998, 1999
@@ -185,14 +185,15 @@
  * from the WaveLAN. Not all of them are temendously useful, but I
  * list as many as I know about here for completeness.
  */
-#define WI_SCAN_RESULTS_MAXLEN	512
-struct wi_scan_results {
-	int			truncated;	/* incomplete data in result */
-	u_int			scanning;	/* in hz units */
-	struct timeval		lastscan;	/* time scan was completed */
-	u_int16_t		len;		/* number of words */
-	u_int16_t		scan_results[WI_SCAN_RESULTS_MAXLEN];
-};
+
+#define WI_RID_DNLD_BUF		0xFD01
+#define WI_RID_MEMSZ		0xFD02
+#define WI_RID_CARDID		0xFD0B
+#define WI_RID_DOMAINS		0xFD11
+#define WI_RID_CIS		0xFD13
+#define WI_RID_COMMQUAL		0xFD43
+#define WI_RID_SCALETHRESH	0xFD46
+#define WI_RID_PCF		0xFD87
 
 /*
  * Network parameters, static configuration entities.
Index: wireg.h
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/ic/wireg.h,v
retrieving revision 1.14
diff -u -r1.14 wireg.h
--- wireg.h	2002/01/05 20:10:53	1.14
+++ wireg.h	2002/01/17 03:04:39
@@ -1,4 +1,4 @@
-/*	$NetBSD: wireg.h,v 1.14 2002/01/05 20:10:53 explorer Exp $	*/
+/*	$NetBSD: wireg.h,v 1.13 2001/11/11 00:16:07 christos Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998, 1999
@@ -487,8 +487,29 @@
 };
 
 /*
+ * Set communications channel (radio frequency).
+ */
+#define WI_RID_OWN_CHNL		0xFC03
+
+/*
+ * Frame data size.
+ */
+#define WI_RID_MAX_DATALEN	0xFC07
+
+/*
+ * ESS power management enable
+ */
+#define WI_RID_PM_ENABLED	0xFC09
+
+/*
+ * ESS max PM sleep internal
+ */
+#define WI_RID_MAX_SLEEP	0xFC0C
+
+/*
  * Set our station name. (0xFC0E)
  */
+#define WI_RID_NODENAME		0xFC0E
 struct wi_ltv_nodename {
 	u_int16_t		wi_len;
 	u_int16_t		wi_type;
Index: wivar.h
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/ic/wivar.h,v
retrieving revision 1.7
diff -u -r1.7 wivar.h
--- wivar.h	2002/01/05 20:10:53	1.7
+++ wivar.h	2002/01/17 03:04:39
@@ -1,4 +1,4 @@
-/*	$NetBSD: wivar.h,v 1.7 2002/01/05 20:10:53 explorer Exp $	*/
+/*	$NetBSD: wivar.h,v 1.6 2001/10/13 15:00:24 ichiro Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998, 1999

--------------050803080904010801040708--