From gabriel@minime.maquina.com Sun Feb 4 14:46:13 2001 Return-Path: Received: from minime.maquina.com (unknown [213.228.128.104]) by hub.freebsd.org (Postfix) with ESMTP id CB53B37B401 for ; Sun, 4 Feb 2001 14:46:11 -0800 (PST) Received: (from gabriel@localhost) by minime.maquina.com (8.11.2/8.11.2) id f14MkaJ01308; Sun, 4 Feb 2001 22:46:36 GMT (envelope-from gabriel) Message-Id: <200102042246.f14MkaJ01308@minime.maquina.com> Date: Sun, 4 Feb 2001 22:46:36 GMT From: gabriel@maquina.com Reply-To: gabriel@maquina.com To: FreeBSD-gnats-submit@freebsd.org Cc: Subject: NEWCARD support for Aironet driver an(4) X-Send-Pr-Version: 3.113 X-GNATS-Notify: >Number: 24854 >Category: kern >Synopsis: NEWCARD support for Aironet driver an(4) >Confidential: no >Severity: serious >Priority: medium >Responsible: imp >State: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Feb 04 14:50:00 PST 2001 >Closed-Date: Wed Nov 14 23:19:04 MST 2001 >Last-Modified: Wed Nov 14 23:19:19 MST 2001 >Originator: Jose Gabriel Marcelino >Release: FreeBSD 5.0-CURRENT i386 >Organization: Maquina de Estados Lda >Environment: System: FreeBSD minime.maquina.com 5.0-CURRENT FreeBSD 5.0-CURRENT #4: Sun Feb 4 20:05:49 WET 2001 root@minime.maquina.com:/usr/src/sys/compile/MINIME i386 running under an Asus MP8300 Pentium III notebook. Verbose boot messages available at: http://devils.maquina.com/~gabriel/boot.newcard >Description: The Aironet driver is somewhat broken under OLDCARD on recent -current (detaching the card causes a panic) but I feel it's better to have it correctly supported under NEWCARD right now, as most of the other wireless drivers have been already converted (wi(4) and ray(4)) >How-To-Repeat: Use the Aironet card in any NEWCARD system >Fix: I'm submitting a patch, very similar to the one made to wi(4). I'm using it right now to send this PR so it works OK most of the time. I'm still getting panics after I reinsert the card (removal works fine), but I'm not sure if that's due to some NEWCARD brokeness. Verbose card insert messages are available here: http://devils.maquina.com/~gabriel/boot.an The patch is at: http://devils.maquina.com/~gabriel/patch.an But I will also include it here for examination: *** dev/an/if_an_pccard.c Fri Oct 20 08:57:56 2000 --- /root/newcard/if_an_pccard.c Sun Feb 4 22:32:35 2001 *************** *** 64,69 **** --- 64,74 ---- #include #include + #include + #include + + #include "card_if.h" + #ifndef lint static const char rcsid[] = "$FreeBSD: src/sys/dev/an/if_an_pccard.c,v 1.6 2000/10/20 07:57:56 jhb Exp $"; *************** *** 75,91 **** /* * Support for PCMCIA cards. */ static int an_pccard_probe(device_t); static int an_pccard_attach(device_t); static int an_pccard_detach(device_t); static device_method_t an_pccard_methods[] = { /* Device interface */ ! DEVMETHOD(device_probe, an_pccard_probe), ! DEVMETHOD(device_attach, an_pccard_attach), DEVMETHOD(device_detach, an_pccard_detach), DEVMETHOD(device_shutdown, an_shutdown), { 0, 0 } }; --- 80,101 ---- /* * Support for PCMCIA cards. */ + static int an_pccard_match(device_t); static int an_pccard_probe(device_t); static int an_pccard_attach(device_t); static int an_pccard_detach(device_t); static device_method_t an_pccard_methods[] = { /* Device interface */ ! DEVMETHOD(device_probe, pccard_compat_probe), ! DEVMETHOD(device_attach, pccard_compat_attach), DEVMETHOD(device_detach, an_pccard_detach), DEVMETHOD(device_shutdown, an_shutdown), + /* Card interface */ + DEVMETHOD(card_compat_match, an_pccard_match), + DEVMETHOD(card_compat_probe, an_pccard_probe), + DEVMETHOD(card_compat_attach, an_pccard_attach), { 0, 0 } }; *************** *** 98,103 **** --- 108,132 ---- static devclass_t an_pccard_devclass; DRIVER_MODULE(if_an, pccard, an_pccard_driver, an_pccard_devclass, 0, 0); + + static const struct pccard_product an_pccard_products[] = { + { PCCARD_STR_AIRONET_PC4800, PCCARD_VENDOR_AIRONET, + PCCARD_PRODUCT_AIRONET_PC4800, 0, + PCCARD_CIS_AIRONET_PC4800 }, + }; + + static int + an_pccard_match(device_t dev) + { + const struct pccard_product *pp; + + if ((pp = pccard_product_lookup(dev, an_pccard_products, + sizeof(an_pccard_products[0]), NULL)) != NULL) { + device_set_desc(dev, pp->pp_name); + return 0; + } + return ENXIO; + } static int an_pccard_detach(device_t dev) *** conf/files Sun Feb 4 19:23:34 2001 --- /root/newcard/files Sun Feb 4 22:32:19 2001 *************** *** 236,242 **** dev/an/if_an.c optional an dev/an/if_an_isa.c optional an isa dev/an/if_an_pccard.c optional an card ! #dev/an/if_an_pccard.c optional an pccard dev/an/if_an_pci.c optional an pci dev/ar/if_ar.c optional ar dev/ar/if_ar_pci.c optional ar pci --- 236,242 ---- dev/an/if_an.c optional an dev/an/if_an_isa.c optional an isa dev/an/if_an_pccard.c optional an card ! dev/an/if_an_pccard.c optional an pccard dev/an/if_an_pci.c optional an pci dev/ar/if_ar.c optional ar dev/ar/if_ar_pci.c optional ar pci *** modules/an/Makefile Sat Jan 6 13:59:40 2001 --- /root/newcard/Makefile Sun Feb 4 22:32:50 2001 *************** *** 4,10 **** KMOD= if_an SRCS= if_an.c if_an_pccard.c if_an_pci.c if_an_isa.c ! SRCS+= opt_inet.h device_if.h bus_if.h pci_if.h isa_if.h opt_inet.h: echo "#define INET 1" > opt_inet.h --- 4,10 ---- KMOD= if_an SRCS= if_an.c if_an_pccard.c if_an_pci.c if_an_isa.c ! SRCS+= opt_inet.h device_if.h bus_if.h pci_if.h isa_if.h card_if.h opt_inet.h: echo "#define INET 1" > opt_inet.h >Release-Note: >Audit-Trail: From: Sam Habash To: freebsd-gnats-submit@freebsd.org, gabriel@maquina.com Cc: Subject: Re: kern/24854: NEWCARD support for Aironet driver an(4) Date: Fri, 17 Aug 2001 13:03:55 -0700 For whatever reason, the calls to pccard_compat_probe|attach don't succeed in detecting my Aironet 350 series card. However, hacking if_an_pccard.c in the following way to change DEVMETHOD(device_[probe|attach] from 'pccard_compat' to 'an_pccard' works for me: --- 82,103 ---- /* * Support for PCMCIA cards. */ + static int an_pccard_match(device_t); static int an_pccard_probe(device_t); static int an_pccard_attach(device_t); static int an_pccard_detach(device_t); static device_method_t an_pccard_methods[] = { /* Device interface */ ! DEVMETHOD(device_probe, an_pccard_probe), ! DEVMETHOD(device_attach, an_pccard_attach), DEVMETHOD(device_detach, an_pccard_detach), DEVMETHOD(device_shutdown, an_shutdown), + /* Card interface */ + DEVMETHOD(card_compat_match, an_pccard_match), + DEVMETHOD(card_compat_probe, an_pccard_probe), + DEVMETHOD(card_compat_attach, an_pccard_attach), { 0, 0 } }; The updated patch is availabe at: http://www.bestII.com/freebsd/patch.an.new Take care, --Sam Responsible-Changed-From-To: freebsd-bugs->imp Responsible-Changed-By: imp Responsible-Changed-When: Sat Aug 18 11:42:42 MDT 2001 Responsible-Changed-Why: I'll look into this. http://www.FreeBSD.org/cgi/query-pr.cgi?pr=24854 From: Jonathan Chen To: Sam Habash Cc: freebsd-gnats-submit@FreeBSD.ORG, mobile@FreeBSD.ORG, hackers@FreeBSD.ORG Subject: Re: kern/24854: NEWCARD support for aironet driver an(4) Date: Sun, 19 Aug 2001 09:14:52 -0400 [summary of past events for the benefit of gnats] - original PR filed for Cisco aironet not working under newcard - My LMC342 works just fine, and I though this might be a bug in newcard (as opposed to the an driver as suggested in the pr), suggested Sam to try the updated newcard (http://people.freebsd.org/~jon/newcard.diff.3) - this patch makes an work under newcard without the proposed changes in the pr. > I believe I already tried just uncommenting 'optional ata pccard' > with the -current source, without any luck. Sam, I'm not sure what you mean here. > The first time I tried it (not in X) removal and reinsertion of the > Aironet card was fine. > > The second time (while in X), removal was ok, but card reinsertion caused > a reboot (no panic)... > > Let me know what you want me to do exactly, in terms of what kind of > debugging you need...once I hear back I'll build a debug kernel. Are you sure there is no panic while in X? Your X server might have futzed with the video card so you might not actually see the panic. If you can try to reproduce this in text mode, then the panic message as well as a traceback would be a very good start. But before you do that, I believe I may have found a fix for a possible panic situation. This panic occurs in witness_destroy as a supervisor read page not present error (I presume while trying to dereference lock). This panic can be easily reproduced by running dhclient an0, removing and reinserting the card, then killing dhclient. The fix appears to be shockingly simple: diff -u -r1.8 if_an_pccard.c --- sys/dev/an/if_an_pccard.c 2001/05/26 09:26:58 1.8 +++ sys/dev/an/if_an_pccard.c 2001/08/19 12:57:14 @@ -118,6 +118,7 @@ sc->an_gone = 1; bus_teardown_intr(dev, sc->irq_res, sc->irq_handle); an_release_resources(dev); + mtx_destroy(&sc->an_mtx); return (0); } Here's where I require some guidance from someone in the know. While this patch appears to avoid the problem on my system, does it in fact work? How does the panic occur and how does this fix the problem, if indeed it does? I'm quite clueless as to the implementation of mutex locking on freebsd, and I suppose it's just plain luck that the first thing I tried turned out to have done the trick... -Jon From: Sam Habash To: Jonathan Chen Cc: freebsd-gnats-submit@FreeBSD.ORG, mobile@FreeBSD.ORG, hackers@FreeBSD.ORG Subject: Re: kern/24854: NEWCARD support for aironet driver an(4) Date: Sun, 19 Aug 2001 10:39:55 -0700 On Sun, Aug 19, 2001 at 09:14:52AM -0400, Jonathan Chen wrote: > > [summary of past events for the benefit of gnats] > - original PR filed for Cisco aironet not working under newcard > - My LMC342 works just fine, and I though this might be a bug in newcard > (as opposed to the an driver as suggested in the pr), suggested Sam to > try the updated newcard (http://people.freebsd.org/~jon/newcard.diff.3) > - this patch makes an work under newcard without the proposed changes in > the pr. > > > I believe I already tried just uncommenting 'optional ata pccard' > > with the -current source, without any luck. > > Sam, I'm not sure what you mean here. What I mean here is that an unpatched -current (as of mid-August) was not resulting in detection of my LMC352. In the current sources, the following in src/sys/conf/files has been commented out: #dev/an/if_an_pccard.c optional an pccard Commenting this out and recompiling did NOT result in a successful attach, at least when I tested this in early August. I'm testing again by backing out of your patch and recompiling, and it turns out that it -does- work now, most likely this was operator error in not uncommenting the the conf/files entry, since I don't see any likely commits that would have changed anything...sigh, sorry for the waste of time. http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/conf/files.diff?r1=1.483&r2=1.484&f=h documents when the line was commented out...it's been that way for a while... > > The first time I tried it (not in X) removal and reinsertion of the > > Aironet card was fine. > > > > The second time (while in X), removal was ok, but card reinsertion caused > > a reboot (no panic)... > > > > Let me know what you want me to do exactly, in terms of what kind of > > debugging you need...once I hear back I'll build a debug kernel. > > Are you sure there is no panic while in X? Your X server might have > futzed with the video card so you might not actually see the panic. If you > can try to reproduce this in text mode, then the panic message as well as a > traceback would be a very good start. -nod- > But before you do that, I believe I may have found a fix for a possible > panic situation. This panic occurs in witness_destroy as a supervisor read > page not present error (I presume while trying to dereference lock). This > panic can be easily reproduced by running dhclient an0, removing and > reinserting the card, then killing dhclient. The fix appears to be > shockingly simple: I'll see if I can reproduce the problem in CLI mode with your patch to if_an_pccard.c > > diff -u -r1.8 if_an_pccard.c > --- sys/dev/an/if_an_pccard.c 2001/05/26 09:26:58 1.8 > +++ sys/dev/an/if_an_pccard.c 2001/08/19 12:57:14 > @@ -118,6 +118,7 @@ > sc->an_gone = 1; > bus_teardown_intr(dev, sc->irq_res, sc->irq_handle); > an_release_resources(dev); > + mtx_destroy(&sc->an_mtx); > return (0); > } Take care, --Sam From: "Sam Habash" To: , Cc: Subject: Re: kern/24854: NEWCARD support for Aironet driver an(4) Date: Fri, 17 Aug 2001 01:02:07 -0700 Curious as to why the fix hasn't yet been commited to -current, as it worked fine for me, and simply represents an extension of what was done for the wi driver. State-Changed-From-To: open->closed State-Changed-By: imp State-Changed-When: Wed Nov 14 23:19:04 MST 2001 State-Changed-Why: Fixed. http://www.FreeBSD.org/cgi/query-pr.cgi?pr=24854 >Unformatted: