From owner-freebsd-hackers Sat Aug 7 1:44:50 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from herring.nlsystems.com (nlsys.demon.co.uk [158.152.125.33]) by hub.freebsd.org (Postfix) with ESMTP id DB64114C95 for ; Sat, 7 Aug 1999 01:44:42 -0700 (PDT) (envelope-from dfr@nlsystems.com) Received: from salmon.nlsystems.com (salmon.nlsystems.com [10.0.0.3]) by herring.nlsystems.com (8.9.3/8.8.8) with ESMTP id JAA70701; Sat, 7 Aug 1999 09:49:58 +0100 (BST) (envelope-from dfr@nlsystems.com) Date: Sat, 7 Aug 1999 09:49:58 +0100 (BST) From: Doug Rabson To: Zhihui Zhang Cc: freebsd-hackers@freebsd.org Subject: Re: Questions on new-bus source code In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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