diff options
author | dfr <dfr@FreeBSD.org> | 1999-05-14 11:22:47 +0000 |
---|---|---|
committer | dfr <dfr@FreeBSD.org> | 1999-05-14 11:22:47 +0000 |
commit | 8a8a702dc2ad6a84232f0efd1ecb484effb273a1 (patch) | |
tree | 22d0abf17160893d226dcecdfe26c0bd265601db /sys/kern | |
parent | 29cc5794964b10b5c333e8d03f21ca3506b79cad (diff) | |
download | FreeBSD-src-8a8a702dc2ad6a84232f0efd1ecb484effb273a1.zip FreeBSD-src-8a8a702dc2ad6a84232f0efd1ecb484effb273a1.tar.gz |
* Define a new static method DEVICE_IDENTIFY which is called to add device
instances to a parent bus.
* Define a new method BUS_ADD_CHILD which can be called from DEVICE_IDENTIFY
to add new instances.
* Add a generic implementation of DEVICE_PROBE which calls DEVICE_IDENTIFY
for each driver attached to the parent's devclass.
* Move the hint-based isa probe from the isa driver to a new isahint driver
which can be shared between i386 and alpha.
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/bus_if.m | 15 | ||||
-rw-r--r-- | sys/kern/device_if.m | 10 | ||||
-rw-r--r-- | sys/kern/subr_bus.c | 18 |
3 files changed, 40 insertions, 3 deletions
diff --git a/sys/kern/bus_if.m b/sys/kern/bus_if.m index 33383ff..1a142a1 100644 --- a/sys/kern/bus_if.m +++ b/sys/kern/bus_if.m @@ -23,7 +23,7 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # -# $Id: bus_if.m,v 1.8 1999/05/08 21:59:34 dfr Exp $ +# $Id: bus_if.m,v 1.9 1999/05/10 17:06:12 dfr Exp $ # INTERFACE bus; @@ -104,6 +104,19 @@ METHOD void driver_added { } # +# For busses which use use drivers supporting DEVICE_IDENTIFY to +# enumerate their devices, these methods are used to create new +# device instances. If place is non-NULL, the new device will be +# added after place in the list of devices. +# +METHOD device_t add_child { + device_t dev; + device_t place; + const char *name; + int unit; +}; + +# # Allocate a system resource attached to `dev' on behalf of `child'. # The types are defined in <machine/resource.h>; the meaning of the # resource-ID field varies from bus to bus (but *rid == 0 is always diff --git a/sys/kern/device_if.m b/sys/kern/device_if.m index 0d8e8f4..c927e02 100644 --- a/sys/kern/device_if.m +++ b/sys/kern/device_if.m @@ -23,7 +23,7 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # -# $Id: device_if.m,v 1.3 1998/11/14 21:58:51 wollman Exp $ +# $Id: device_if.m,v 1.4 1999/05/10 17:06:13 dfr Exp $ # INTERFACE device; @@ -75,6 +75,14 @@ METHOD int probe { }; # +# Called by a parent bus to add new devices to the bus. +# +STATICMETHOD void identify { + driver_t *driver; + device_t parent; +}; + +# # Attach a device to the system. The probe method will have been # called and will have indicated that the device exists. This routine # should initialise the hardware and allocate other system resources diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index bdfead6..1e70ff1 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: subr_bus.c,v 1.21 1999/05/10 17:06:14 dfr Exp $ + * $Id: subr_bus.c,v 1.22 1999/05/14 09:13:43 dfr Exp $ */ #include <sys/param.h> @@ -1604,6 +1604,22 @@ SYSINIT(cfgload, SI_SUB_KMEM, SI_ORDER_ANY + 50, resource_cfgload, 0) /* * Some useful method implementations to make life easier for bus drivers. */ + +/* + * Call DEVICE_IDENTIFY for each driver. + */ +int +bus_generic_probe(device_t dev) +{ + devclass_t dc = dev->devclass; + driverlink_t dl; + + for (dl = TAILQ_FIRST(&dc->drivers); dl; dl = TAILQ_NEXT(dl, link)) + DEVICE_IDENTIFY(dl->driver, dev); + + return 0; +} + int bus_generic_attach(device_t dev) { |