From owner-freebsd-mobile Mon Oct 28 19:30:47 2002 Delivered-To: freebsd-mobile@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BBF9237B401 for ; Mon, 28 Oct 2002 19:30:44 -0800 (PST) Received: from tasogare.imasy.or.jp (tasogare.imasy.or.jp [202.227.24.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6393843E3B for ; Mon, 28 Oct 2002 19:30:43 -0800 (PST) (envelope-from iwasaki@jp.FreeBSD.org) Received: from localhost (iwa@tasogare.imasy.or.jp [202.227.24.5]) by tasogare.imasy.or.jp (8.11.6+3.4W/8.11.6/tasogare) with ESMTP/inet id g9T3TwY01899; Tue, 29 Oct 2002 12:29:59 +0900 (JST) (envelope-from iwasaki@jp.FreeBSD.org) Date: Tue, 29 Oct 2002 12:29:34 +0900 (JST) Message-Id: <20021029.122934.67876690.iwasaki@jp.FreeBSD.org> To: imp@bsdimp.com Cc: iedowse@maths.tcd.ie, freebsd-mobile@FreeBSD.ORG Subject: Re: Patch to fix/shorten "wi" freezes From: Mitsuru IWASAKI In-Reply-To: <200210271800.aa11251@salmon.maths.tcd.ie> References: <200210271800.aa11251@salmon.maths.tcd.ie> X-Mailer: Mew version 2.2 on Emacs 20.7 / Mule 4.0 (HANANOEN) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-mobile@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org > 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 majordomo@FreeBSD.org with "unsubscribe freebsd-mobile" in the body of the message