Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Jul 2002 13:47:31 -0400 (EDT)
From:      John Baldwin <jhb@FreeBSD.org>
To:        "M. Warner Losh" <imp@bsdimp.com>
Cc:        mobile@FreeBSD.org
Subject:   Re: docs/41104: Stale comment removal from pccardd(8)
Message-ID:  <XFMail.20020729134731.jhb@FreeBSD.org>
In-Reply-To: <20020729.091923.98343767.imp@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
[ cc's adjusted to better conform to reality ]

On 29-Jul-2002 M. Warner Losh wrote:
> In message: <XFMail.20020729111003.jhb@FreeBSD.org>
>             John Baldwin <jhb@FreeBSD.org> writes:
>: 
>: On 29-Jul-2002 M. Warner Losh wrote:
>: > In message: <XFMail.20020729081434.jhb@FreeBSD.org>
>: >             John Baldwin <jhb@FreeBSD.org> 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 <jhb@FreeBSD.org>  <><  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




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