Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

2 patches for NEWCARD

0 views
Skip to first unread message

YAMAMOTO Shigeru

unread,
Nov 19, 2001, 3:11:49 AM11/19/01
to

Hi all,

I make 2 patches for NEWCARD.
one is to supoort to suspend/resume PC Card devices on NEWCARD.
other is to ignore ghost interrupt at ed driver when removing PC Card.

It is a quick hack and I only tested on my NotePC, Sony VAIO 818.
So I don't know my patches work fine on other NotePC.

Please try if you have interest to my patches.
Thanks,

-------
YAMAMOTO Shigeru <shi...@iij.ad.jp>

cb.diff
ed.diff

Warner Losh

unread,
Nov 19, 2001, 11:54:47 PM11/19/01
to
In message <20011119.171129....@iij.ad.jp> YAMAMOTO
Shigeru writes:
: I make 2 patches for NEWCARD.

Wonderful!

: one is to supoort to suspend/resume PC Card devices on NEWCARD.

Hmmm. Something about this patch looks incorrect. Wouldn't it delete
the actual bus (eg pccard/cardbus)? I'd think that we'd want to
delete the children's children. I will have to look at the code more
closely to see if I might be mistaken.

: other is to ignore ghost interrupt at ed driver when removing PC Card.

This looks good. I'll commit it.

: So I don't know my patches work fine on other NotePC.

I'll have to test it on my machine.

Thank you yamamoto-san.

Warner

To Unsubscribe: send mail to majo...@FreeBSD.org
with "unsubscribe freebsd-mobile" in the body of the message

Warner Losh

unread,
Nov 20, 2001, 12:14:17 AM11/20/01
to
: : other is to ignore ghost interrupt at ed driver when removing PC Card.

:
: This looks good. I'll commit it.

Actually, it looks like a little more protection is needed for an edge
case. The loop to reset the isr bits on the AX88190 needs to be
bounded, or we run the risk of locking up there. What do you think of
the following patch instead?

Warner

Index: if_ed.c
===================================================================
RCS file: /home/imp/FreeBSD/CVS/src/sys/dev/ed/if_ed.c,v
retrieving revision 1.206
diff -u -r1.206 if_ed.c
--- if_ed.c 2001/11/04 22:56:20 1.206
+++ if_ed.c 2001/11/20 05:05:23
@@ -2285,6 +2285,7 @@
struct ed_softc *sc = (struct ed_softc*) arg;
struct ifnet *ifp = (struct ifnet *)sc;
u_char isr;
+ int count;

if (sc->gone)
return;
@@ -2294,9 +2295,12 @@
ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_STA);

/*
- * loop until there are no more new interrupts
+ * loop until there are no more new interrupts. When the card
+ * goes away, the hardware will read back 0xff. Looking at
+ * the interrupts, it would appear that 0xff is impossible,
+ * or at least extremely unlikely.
*/
- while ((isr = ed_nic_inb(sc, ED_P0_ISR)) != 0) {
+ while ((isr = ed_nic_inb(sc, ED_P0_ISR)) != 0 && isr != 0xff) {

/*
* reset all the bits that we are 'acknowledging' by writing a
@@ -2305,12 +2309,21 @@
*/
ed_nic_outb(sc, ED_P0_ISR, isr);

- /* XXX workaround for AX88190 */
+ /*
+ * XXX workaround for AX88190
+ * We limit this to 5000 iterations. At 1us per inb/outb,
+ * this translates to about 15ms, which should be plenty
+ * of time, and also gives protection in the card eject
+ * case.
+ */
if (sc->chip_type == ED_CHIP_TYPE_AX88190) {
- while (ed_nic_inb(sc, ED_P0_ISR) & isr) {
+ count = 5000; /* 15ms */
+ while (count-- && (ed_nic_inb(sc, ED_P0_ISR) & isr)) {
ed_nic_outb(sc, ED_P0_ISR,0);
ed_nic_outb(sc, ED_P0_ISR,isr);
}
+ if (count == 0)
+ break;
}

/*

0 new messages