From owner-freebsd-mobile Mon Jul 29 10:47:50 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 01DC137B400 for ; Mon, 29 Jul 2002 10:47:47 -0700 (PDT) Received: from mail.speakeasy.net (mail16.speakeasy.net [216.254.0.216]) by mx1.FreeBSD.org (Postfix) with ESMTP id 803B943E3B for ; Mon, 29 Jul 2002 10:47:46 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 26284 invoked from network); 29 Jul 2002 17:47:43 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) by mail16.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 29 Jul 2002 17:47:43 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.5/8.12.5) with ESMTP id g6THlRuR050997; Mon, 29 Jul 2002 13:47:31 -0400 (EDT) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.2 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <20020729.091923.98343767.imp@bsdimp.com> Date: Mon, 29 Jul 2002 13:47:31 -0400 (EDT) From: John Baldwin To: "M. Warner Losh" Subject: Re: docs/41104: Stale comment removal from pccardd(8) Cc: mobile@FreeBSD.org 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 [ cc's adjusted to better conform to reality ] On 29-Jul-2002 M. Warner Losh wrote: > In message: > John Baldwin writes: >: >: On 29-Jul-2002 M. Warner Losh wrote: >: > In message: >: > John Baldwin writes: >: >: Unfortunately using KLD's does not fix this problem and it is still an >: >: issue. I can't eject my cardbus rl0 card w/o my laptop locking up for >: >: exactly this reason. This patch should not be committed unless Warner >: >: (imp@, cc'd) approves. >: > >: > Yes, the comments in the pccardd man page are correct (eg, that's why >: > things are they way they are). However, once the underlying problems >: > in the kernel were fixed, pccardd wasn't updated to be less smart >: > about the resources a card uses. Likely it should read: >: > >: > The primary reasons are historical. >: >: Ah, ok. >: >: > What happens in NEWCARD with a rl card aren't relevant to this >: > discussion :-) The reason that you can't eject the rl0 card has to do >: > with something else (likely an ISR that doesn't properly terminate >: > when the card is gone or a detach routine that's minorly bogus). >: >: Well, it's the same behavior. :-P The rl(4) driver doesn't allow for >: devices to go away and gets stuck in a loop spinning forever waiting >: for a card reset to succeed and the reset keeps failing for obvious >: reasons. Completely hangs the machine. *sigh* > > Yes. I've seen it succeed for me. any chance you can get me a > traceback of where it is happening? This patch fixes it: Index: if_rl.c =================================================================== RCS file: /usr/cvs/src/sys/pci/if_rl.c,v retrieving revision 1.71 diff -u -r1.71 if_rl.c --- if_rl.c 30 Jun 2002 22:16:22 -0000 1.71 +++ if_rl.c 29 Jul 2002 17:09:35 -0000 @@ -1380,6 +1380,8 @@ u_int16_t status; status = CSR_READ_2(sc, RL_ISR); + if (status == 0xffff) + goto done; if (status) CSR_WRITE_2(sc, RL_ISR, status); @@ -1426,6 +1428,9 @@ for (;;) { status = CSR_READ_2(sc, RL_ISR); + /* If a cardbus card goes away, the read returns 0xffff. */ + if (status == 0xffff) + break; if (status) CSR_WRITE_2(sc, RL_ISR, status); I think this is hackish, and that 0xffff is too cardbus specific. We probably should be asking our parent if we are still around (device_present()?) before doing the read instead. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-mobile" in the body of the message