misc questions about the device&driver arch

Warner Losh imp at bsdimp.com
Sun May 21 10:49:12 PDT 2006


From: "william wallace" <avalonwallace at gmail.com>
Subject: Re: misc questions about the device&driver arch
Date: Sun, 21 May 2006 16:08:00 +0800

> On 5/21/06, Warner Losh <imp at bsdimp.com> wrote:
> > nope.  It may be called once per bus instance per driver, if the bus
> > is not self-identifying.  If the bus is self-idntiying, chances are
> > that it will not be called.  pci never calls its children drivers'
> > identify routine because it already knows all the children on the bus
> > and doesn't need the leaf drivers to go find instances of themselves.
> > the isa bus driver, on the other hand, does call the identify routine
> > so that pre-plug and play standard device enumeration can happen.
> >
> > Warner
> the defination of  self-enumerating
> 1
> what does self-enumerating mean ?

self-enumerating or self-identifying mean the same thing.  The bus
driver is able to know all of its children.  This may be because
there's a method to finding them, or the bus may have perfect
knowledge of what is there by other means.

PCI, CardBus, PC Card, USB, Firewire, and EISA are all examples of
self enumerating busses.  You can know that you have a device, and the
device can provide information about its existance.  ISA is the
odd-man out.  It isn't possible to know when you have an ISA card in a
given slot.  There are some add-on hacks to be able to discover the
devices.  ISAPNP is one such hack.  Really old Realtek adapters have
another.  3Com cards have yet another.  It was for these old, pre-plug
and play enumeration techniques that the identify routine was
invented.

>  2
> does that mean the pci way of   looping through configuration space ?

Yes.

> 3
> does that happen in start time and hotplug time ?

That happens at attach time.  Cardbus right now has a private protocol
between the card bus bridge (cbb) and the bus to know when there's a
new card in a slot and to enumerate that bus.

> 4
> pci doesn't need the leaf drivers to go find instances of themselves.
> does that  mean that   self-enumerating  device  system use the  top down way ,
> and the non- self-enumerating  device system  use the down -top way

Right.  FreeBSD's device enumeration model is top down.

> 5
> i guest pci hot plug need some magic to identify or emulae(loop pci sons )

Yes.  The hot plug bridge would need to tell its child bus about
changes to the bus.  This might mean the child bus does a full
enumeration, or a partial one.  Cardbus does a full enueration, but
each card bus slot is its own bus.

> BTW
> There r so many hot plug specifications ,SHPC hotplug ,PCIE hotplug
> and compaq hotplug and so on , in linux ,they use different driver for
> different pci
> bridge
> so i think for us to implement in freeBSD ,just do 1 by 1:)

Yes.  We'd need todo something similar in FreeBSD.  Chances are that
the best way to approach this would be to add hotplug functionality
directly to the pci bus, and teach cardbus the new protocol.

Warner


More information about the freebsd-hackers mailing list