Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Aug 1999 09:49:58 +0100 (BST)
From:      Doug Rabson <dfr@nlsystems.com>
To:        Zhihui Zhang <zzhang@cs.binghamton.edu>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Questions on new-bus source code
Message-ID:  <Pine.BSF.4.10.9908070939190.50383-100000@salmon.nlsystems.com>
In-Reply-To: <Pine.GSO.3.96.990806144109.24194A-100000@sol.cs.binghamton.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
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:  dfr@nlsystems.com
Nonlinear Systems Ltd.			Phone: +44 181 442 9037





To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.9908070939190.50383-100000>