the mechanism of USB hotplug

M. Warner Losh imp at bsdimp.com
Fri Dec 2 08:59:52 GMT 2005


In message: <87ab37ab0512020030u2dcdc3ecj69fa27ec6840ca3b at mail.gmail.com>
            kylin <fierykylin at gmail.com> writes:
: thank u,sir :)
:  i have been  reading ur pccbb code for a long time . really
: elegant.here I think my ignorace is partly because the lack of reading
: to the doc about the generic  device architecture .but frankly ,i
: still haven't fount the newbus-draft :(

Your best best is to look at the source and understand it.  I'll be
the first to admit, however, that better docs would help here.  The
FreeBSD handbook has good info on this topic, even if it is a little
dated.

: mention to pccbb ,i wonder the reason why pccard driver is so
: different from the cardbus and still attach to the same pci carbus
: bridge level .

pccard and cardbus are way different.  The interfaces for talking to
them are different, the configuraiton is different, etc.  CardBus
cards are just PCI cards, with a few rare exceptions.  So rare, in
fact, that no one has brought one to my attention as needing special
handling for CardBus vs PCI.  Since we inheret from the pci bus for
cardbus, that makes cardbus very small.  It should be a little smaller
than it is today, but I've not had the time to do that.

pccard has to do it all on its own, as it is nothing like PCI.  Since
it is basically ISA in a hotplug form factor that also allows other
similar cards (memory only), there are a number of warts in the code.
Since ISA has no notion of hot plug or announcing its resource needs
or device activation, the CIS has to be parsed to get these details
(this predates the isapnp go, but even that doesn't support hotplug).

I suspect that if one were to write a hot-plug PCI bus bridge that it
would mostly work similar to cbb, but with some differences due to API
differences.

The USB stuff, btw, is confusingly located in uhub.c.  There are a
number of bugs in the newbus integration of usb, and various people
have tried to fix it.  In usbland uhub is the bus, not the usb device,
which is confusing at first, and poorly documented.  The usb_port.h
obfuscation also doesn't help.

Warner


More information about the freebsd-usb mailing list