pccard0: Card has no functions! OR PCI memory range allocation problem?

Warner Losh imp at bsdimp.com
Mon Mar 7 14:49:24 PST 2005


> After kldunload:ing if_ath, no pccard is recognised.  For any pccard
> (16-bit - cardbus is not affected!) it just says:
> 
>   pccard0: Card has no functions!

Interesting.

> The system has an Atheros mini-PCI wireless card.  (If my theory is
> right, the particular card is irrelevant.  I got the same symptoms
> with if_ipw earlier when I had an Intel Wireless PRO 2100 in the same
> box.)  I have no device driver for the card compiled into the kernel.
> At boot the kernel says:
> 
>   pcib1: device (null) requested decoded memory range 0xd0200000-0xd020ffff

OK.  That makes sense.  The above message really means nothing, and
isn't a warning or an error.

> When the if_ath driver is kldload:ed:
> 
>   ath0: <Atheros 5212> mem 0xd0200000-0xd020ffff irq 11 at device 2.0 on pci2

Good, addresses match.

> At this point (and also before loading if_ath), inserting a pccard
> works:
> 
>   pcib1: device pccard0 requested decoded memory range 0xd0200000-0xdfffffff
>   cis mem map 0xd63ab000 (resource: 0xd0240000)
>   pccard0: check_cis_quirks
>   pccard0: CIS version PC Card Standard 5.0
>   pccard0: CIS info: Lucent Technologies, WaveLAN/IEEE, Version 01.01, 
>   (and so on...)
> 
> After unloading the if_ath driver, it says the following instead:
> 
>   pcib1: device pccard0 requested decoded memory range 0xd0200000-0xdfffffff
>   cis mem map 0xd63ab000 (resource: 0xd0200000)

Hmmm, looks like you're the first person to hit this bug.  I knew it
was theoretically possible to provoke it, but never could construct a
test case locally that would.

> Now to the bottom line: where is the bug?
> 
> 1) In the if_ath driver module which deallocated a PCI memory range
>    which it didn't allocate (the kernel did at boot).
> 
> 2) In the PCI memory allocation/deallocation routines which allowed
>    the loadable driver to deallocate a PCI memory range that was
>    allocated at boot.
> 
> 3) In cbb/pccard which perhaps shouldn't be allowed to use the memory
>    range?
> 
> 4) Or is the answer that I should not unload drivers for fixed
>    hardware?

5) On kldunload, the resources shouldn't be freed.  Only when then
   child actually goes away should they be freed.  I think this is the
   heart of the bug.  Once this is fixed, all the down stream badness
   should go away.

Warner


More information about the freebsd-mobile mailing list