On Fri, 6 Aug 1999, Zhihui Zhang wrote:

> 
> In FreeBSD new-bus architecture, all devices are linked into a device
> tree. The root of the tree is root_bus, it has a child called nexus0 added
> during the device configuration phase.  I have two questions about this
> new-bus code:
> 
> (1) What is the usage of this "nexus0" device?  Its parent (root_bus) does
> not declare the probe method, so probing nexus0 can only return ENXIO for
> us (from error_method()). 

The nexus device is the top of the AT architecture device tree and has
responsibility for resource allocation and interrupt management. When it
is initialised, it attaches suitable child devices for the main busses
which are present (isa, pci etc). The probe method for nexus
(nexus_probe()) is in nexus.c.

The root device, root_bus, doesn't have a probe method itself since it is
always present. The root_bus device is created specially during startup in
root_bus_module_handler().

> 
> (2) I guess that the probe process of all devices on the tree is triggered
> by root_bus_configure() in subr_bus.c.  It is done from top to bottom,
> i.e. the probe process should be propagated down the device tree from
> root_bus. Am I right? How does this tree structure achieve the dynamic
> feature of device configuring (adding/removing devices on the fly)? 
> 
> Having a pig picture often helps to understand the details more readily.

At the time root_bus_configure() is called, the tree only contains
root_bus and its direct children (e.g. nexus0). Each of these children is
probed and attached from root_bus_configure().

The tree grows downwards as each device is probed and attached. The nexus
looks for toplevel bus hardware and adds a device to itself for each bus
which it finds. It then uses a helper function bus_generic_attach() to
probe and attach these and they in turn add new children to themselves as
they find attached hardware.

--
Doug Rabson                             Mail:  [EMAIL PROTECTED]
Nonlinear Systems Ltd.                  Phone: +44 181 442 9037





To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to