Copyright (c) 1998 Doug Rabson All rights reserved. This program is free software. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in...
NAMEdevice - an abstract representation of a device
SYNOPSISVt typedef struct device *device_t ;
DESCRIPTIONThe device object represents a piece of hardware attached to the system such as an expansion card, the bus which that card is plugged into, disk drives attached to the expansion card etc. The system defines one device, root_bus and all other devices are created dynamically during autoconfiguration. Normally devices representing top-level busses in the system (ISA, PCI etc.) will be attached directly to root_bus and other devices will be added as children of their relevant bus.
The devices in a system form a tree. All devices except root_bus have a parent (see device_get_parent9). In addition, any device can have children attached to it (see device_add_child9, device_add_child_ordered9, device_find_child9, device_get_children9, and device_delete_child9).
A device which has been successfully probed and attached to the system will also have a driver (see device_get_driver9 and driver(9)) and a devclass (see device_get_devclass9 and devclass(9)). Various other attributes of the device include a unit number (see device_get_unit9), verbose description (normally supplied by the driver, see device_set_desc9 and device_get_desc9), a set of bus-specific variables (see device_get_ivars9) and a set of driver-specific variables (see device_get_softc9).
Devices can be in one of several states:
- the device has not been probed for existence or the probe failed
- the device probe succeeded but not yet attached
- the device has been successfully attached
- the device is currently open
The current state of the device can be determined by calling device_get_state9.