Re: Patch to fix/shorten "wi" freezes

Mitsuru IWASAKI <[email protected]>
Newsgroups gmane.os.freebsd.devel.mobile
Message-ID <[email protected]>
> 	wi0: timeout in wi_cmd 0x0002; event status 0x8080

Here are 2 patches against similar problems related wi.
Please review them.  TIA.

1. The suspend methods problem with NEWARD cardbus and pccard.
   cardbus_suspend() forced cbb into power off via
   cbb_power(CARD_VCC_0V) before pccard_suspend() detach wi properly.

----
Index: cardbus.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/cardbus/cardbus.c,v
retrieving revision 1.24
diff -u -r1.24 cardbus.c
--- cardbus.c	7 Oct 2002 23:00:51 -0000	1.24
+++ cardbus.c	11 Oct 2002 02:22:28 -0000
@@ -148,6 +148,8 @@
 static int	cardbus_write_ivar(device_t cbdev, device_t child, int which,
 		    uintptr_t value);
 
+#define DETACH_NOWARN 0x800
+
 /************************************************************************/
 /* Probe/Attach								*/
 /************************************************************************/
@@ -175,7 +177,7 @@
 static int
 cardbus_suspend(device_t self)
 {
-	cardbus_detach_card(self, DETACH_FORCE);
+	cardbus_detach_card(self, DETACH_NOWARN); /* detach existing cards */
 	return (0);
 }
 
@@ -208,8 +210,6 @@
 	PCIB_WRITE_CONFIG(brdev, b, s, f, PCIR_MAXLAT, 0x14, 1);
 	cfg->maxlat = PCIB_READ_CONFIG(brdev, b, s, f, PCIR_MAXLAT, 1);
 }
-
-#define DETACH_NOWARN 0x800
 
 static int
 cardbus_attach_card(device_t cbdev)

----

2. Even after device had removed and wi_stop() called untimeout(wi_inquire),
   sometimes wi_inquire() is still called and we got kernel panic.
   I think there are some bugs in timeout/untimeout system under heavy
   stresses.  Here's a workaround for sanity checking.

----
Index: if_wi.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/wi/if_wi.c,v
retrieving revision 1.117
diff -u -r1.117 if_wi.c
--- if_wi.c	14 Oct 2002 01:59:57 -0000	1.117
+++ if_wi.c	15 Oct 2002 19:24:13 -0000
@@ -853,6 +853,17 @@
 	int			s;
 
 	sc = xsc;
+
+	if (sc == NULL) {
+		printf("%s: wrong argument\n", __func__);
+		return;
+	}
+
+	if (sc->wi_gone) {
+		printf("%s: already detached\n", __func__);
+		return;
+	}
+
 	ifp = &sc->arpcom.ac_if;
 
 	sc->wi_stat_ch = timeout(wi_inquire, sc, hz * 60);
----

To Unsubscribe: send mail to [email protected]
with "unsubscribe freebsd-mobile" in the body of the message
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.