Device enumeration process
M. Warner Losh
imp at bsdimp.com
Fri Oct 6 15:45:21 UTC 2006
In message: <20061006073434.71730.qmail at web8913.mail.in.yahoo.com>
Alok Barsode <namaskar_alok at yahoo.co.in> writes:
: Thanks for ur earliers replies. They helped me a lot
: in understanding the newbus architecture.
: I am involved in a freeBSD port to a freescale board.
Cool! Remind me: is the freescale an arm design or a Power PC one?
: When i/o configuration is in progress during startup,
: are the drivers for specific busses alreay assosciated
: with them or the association happens at run time ?
The drivers are associated with the busses at compile time (as
extended via modules that are loaded). The assignment of specific
device nodes to drivers is done at run time.
: for example :
: when nexus is being attached to root_bus,
: the method devclass_find_internal("nexus", 0, TRUE) is
: invoked(in method make_device).Now does a nexus
: devclass already exist ( it is created through the
: macro DRIVER_MODULE(nexus, root, nexus_driver,
: nexus_devclass, 0, 0);) or it is created at runtime ?
:
: if it is created at runtime how the nexus_driver get
: assciated with nexus?
nexus_driver gets associated with nexus here:
/*
* Determine i/o configuration for a machine.
*/
static void
configure_first(dummy)
void *dummy;
{
/* nexus0 is the top of the i386 device tree */
device_add_child(root_bus, "nexus", 0);
}
at least tenatively associated. configure_first is run via the
SYSINIT at SI_SUB_CONFIGURE as the first thing. In fact, all the
autoconf look similar in this respect. The arm one does the same
thing.
If you look at sys/arm/at91/at91.c, you'll see code:
static void
at91_identify(driver_t *drv, device_t parent)
{
BUS_ADD_CHILD(parent, 0, "atmelarm", 0);
}
which is how the atmelbus gets added to nexus. Again, the atmelbus is
about the best example I can easily find in the tree...
Warner
More information about the freebsd-new-bus
mailing list