Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Feb 2011 19:36:14 +0100
From:      "Paul B. Mahol" <onemda@gmail.com>
To:        Bernhard Schmidt <bschmidt@freebsd.org>
Cc:        freebsd-current@freebsd.org
Subject:   Re: cardbus and kldunload issue
Message-ID:  <AANLkTikStZB9SsEorN-ivMC=Z90vgW=pFVykjw81v89y@mail.gmail.com>
In-Reply-To: <201102261625.41522.bschmidt@freebsd.org>
References:  <201102261625.41522.bschmidt@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Feb 26, 2011 at 4:25 PM, Bernhard Schmidt <bschmidt@freebsd.org> wr=
ote:
> Hi,
>
> while working on a wireless driver for a Cardbus card I stumbled over
> an issue which bugs me quite a bit.
>
> The device:
>
> % none3@pci0:22:0:0: =A0 =A0 =A0class=3D0x028000 card=3D0x107f1043 chip=
=3D0x02011814 rev=3D0x01 hdr=3D0x00
>
> Loading the module attaches nicely to the device:
>
> # kldload if_ral
> % ral0: <Ralink Technology RT2560> mem 0xf4800000-0xf4801fff irq 16 at de=
vice 0.0 on cardbus0
> % ral0: MAC/BBP RT2560 (rev 0x04), RF RT2525
> % ral0: [ITHREAD]
> # pciconf -l
> % ral0@pci0:22:0:0: =A0 =A0 =A0 class=3D0x028000 card=3D0x107f1043 chip=
=3D0x02011814 rev=3D0x01 hdr=3D0x00
>
> Though, kldunload doesn't detach the device, it doesn't even call the
> module's detach function.
>
> # kldunload if_ral
> # pciconf -l
> % ral0@pci0:22:0:0: =A0 =A0 =A0 class=3D0x028000 card=3D0x107f1043 chip=
=3D0x02011814 rev=3D0x01 hdr=3D0x00
> # kldstat
> % Id Refs Address =A0 =A0 =A0 =A0 =A0 =A0Size =A0 =A0 Name
> % =A01 =A0 27 0xffffffff80100000 e640a0 =A0 kernel
> # ifconfig ral0
> % ral0: flags=3D8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 2290
> % =A0 =A0 =A0 =A0 ether 00:0e:a6:a6:1b:70
> % =A0 =A0 =A0 =A0 media: IEEE 802.11 Wireless Ethernet autoselect (autose=
lect)
> % =A0 =A0 =A0 =A0 status: no carrier
>
> And of course trying to use the device at that point will result in
> instant panics. Playing around a bit I've noticed that changing the bus
> name in:
>
> % DRIVER_MODULE(ral, pci, ral_pci_driver, ral_devclass, 0, 0);
>
> from pci to cardbus makes a big difference. On module unload the detach
> function is then called as expected. So, question is, are we doing some
> too strict checks on module unload while matching the bus? Or is this
> expected behavior and the drivers are supposed to indiciated that they
> support both pci and cardbus? I don't see the later anywhere in tree.

There is MODULE_DEPEND(), if_ndis depends on pccard, pci and usb
modules and use both MODULE_DEPEND() and DRIVER_MODULE() with them.

If I'm not mistaken pccard depends on cardbus.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTikStZB9SsEorN-ivMC=Z90vgW=pFVykjw81v89y>