1cefd51ecSDoug Rabson.\" -*- nroff -*- 2cefd51ecSDoug Rabson.\" 3cefd51ecSDoug Rabson.\" Copyright (c) 1998 Doug Rabson 4cefd51ecSDoug Rabson.\" 5cefd51ecSDoug Rabson.\" All rights reserved. 6cefd51ecSDoug Rabson.\" 7cefd51ecSDoug Rabson.\" This program is free software. 8cefd51ecSDoug Rabson.\" 9cefd51ecSDoug Rabson.\" Redistribution and use in source and binary forms, with or without 10cefd51ecSDoug Rabson.\" modification, are permitted provided that the following conditions 11cefd51ecSDoug Rabson.\" are met: 12cefd51ecSDoug Rabson.\" 1. Redistributions of source code must retain the above copyright 13cefd51ecSDoug Rabson.\" notice, this list of conditions and the following disclaimer. 14cefd51ecSDoug Rabson.\" 2. Redistributions in binary form must reproduce the above copyright 15cefd51ecSDoug Rabson.\" notice, this list of conditions and the following disclaimer in the 16cefd51ecSDoug Rabson.\" documentation and/or other materials provided with the distribution. 17cefd51ecSDoug Rabson.\" 18cefd51ecSDoug Rabson.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR 19cefd51ecSDoug Rabson.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20cefd51ecSDoug Rabson.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21cefd51ecSDoug Rabson.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, 22cefd51ecSDoug Rabson.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23cefd51ecSDoug Rabson.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24cefd51ecSDoug Rabson.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25cefd51ecSDoug Rabson.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26cefd51ecSDoug Rabson.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27cefd51ecSDoug Rabson.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28cefd51ecSDoug Rabson.\" 29db4fcadfSConrad Meyer.Dd January 15, 2017 30def37e7cSMike Pritchard.Dt DEVICE 9 313d45e180SRuslan Ermilov.Os 32cefd51ecSDoug Rabson.Sh NAME 33cefd51ecSDoug Rabson.Nm device 34cefd51ecSDoug Rabson.Nd an abstract representation of a device 35a04dd748SMike Pritchard.Sh SYNOPSIS 36*dfff3776SMark Johnston.Vt typedef struct _device *device_t ; 37cefd51ecSDoug Rabson.Sh DESCRIPTION 38cefd51ecSDoug RabsonThe device object represents a piece of hardware attached to the 39cefd51ecSDoug Rabsonsystem such as an expansion card, the bus which that card is plugged 40cefd51ecSDoug Rabsoninto, disk drives attached to the expansion card etc. 41cefd51ecSDoug RabsonThe system defines one device, 420640e9e0SHiten Pandya.Va root_bus 43cefd51ecSDoug Rabsonand all other devices are created dynamically during 44a0942a60SHiten Pandyaautoconfiguration. 45db4fcadfSConrad MeyerNormally devices representing top-level buses in 46cefd51ecSDoug Rabsonthe system (ISA, PCI etc.) will be attached directly to 470640e9e0SHiten Pandya.Va root_bus 48a04dd748SMike Pritchardand other devices will be added as children of their relevant bus. 49cefd51ecSDoug Rabson.Pp 501111b49cSSheldon HearnThe devices in a system form a tree. 511111b49cSSheldon HearnAll devices except 520640e9e0SHiten Pandya.Va root_bus 53cefd51ecSDoug Rabsonhave a parent (see 54cefd51ecSDoug Rabson.Xr device_get_parent 9 ) . 55cefd51ecSDoug RabsonIn addition, any device can have children attached to it (see 56cefd51ecSDoug Rabson.Xr device_add_child 9 , 570d28dd1dSAlexey Zelkin.Xr device_add_child_ordered 9 , 58cefd51ecSDoug Rabson.Xr device_find_child 9 , 59fa930a73SNick Hibma.Xr device_get_children 9 , 60cefd51ecSDoug Rabsonand 61cefd51ecSDoug Rabson.Xr device_delete_child 9 ) . 62cefd51ecSDoug Rabson.Pp 631c7d9174SPaul RichardsA device which has been successfully probed and attached to the 64cefd51ecSDoug Rabsonsystem will also have a driver (see 65cefd51ecSDoug Rabson.Xr device_get_driver 9 66cefd51ecSDoug Rabsonand 67cefd51ecSDoug Rabson.Xr driver 9 ) 68cefd51ecSDoug Rabsonand a devclass (see 69cefd51ecSDoug Rabson.Xr device_get_devclass 9 70cefd51ecSDoug Rabsonand 71cefd51ecSDoug Rabson.Xr devclass 9 ) . 72cefd51ecSDoug RabsonVarious other attributes of the device include a unit number (see 73cefd51ecSDoug Rabson.Xr device_get_unit 9 ) , 74cefd51ecSDoug Rabsonverbose description (normally supplied by the driver, see 75cefd51ecSDoug Rabson.Xr device_set_desc 9 76cefd51ecSDoug Rabsonand 77cefd51ecSDoug Rabson.Xr device_get_desc 9 ) , 78cefd51ecSDoug Rabsona set of bus-specific variables (see 79cefd51ecSDoug Rabson.Xr device_get_ivars 9 ) 80cefd51ecSDoug Rabsonand a set of driver-specific variables (see 81cefd51ecSDoug Rabson.Xr device_get_softc 9 ) . 82cefd51ecSDoug Rabson.Pp 83cefd51ecSDoug RabsonDevices can be in one of several states: 84cefd51ecSDoug Rabson.Bl -tag -width DS_NOTPRESENT 850640e9e0SHiten Pandya.It Dv DS_NOTPRESENT 86cefd51ecSDoug Rabsonthe device has not been probed for existence or the probe failed 870640e9e0SHiten Pandya.It Dv DS_ALIVE 88cefd51ecSDoug Rabsonthe device probe succeeded but not yet attached 890640e9e0SHiten Pandya.It Dv DS_ATTACHED 90cefd51ecSDoug Rabsonthe device has been successfully attached 910640e9e0SHiten Pandya.It Dv DS_BUSY 92cefd51ecSDoug Rabsonthe device is currently open 93cefd51ecSDoug Rabson.El 94cefd51ecSDoug Rabson.Pp 95cefd51ecSDoug RabsonThe current state of the device can be determined by calling 96cefd51ecSDoug Rabson.Xr device_get_state 9 . 97cefd51ecSDoug Rabson.Sh SEE ALSO 98def37e7cSMike Pritchard.Xr devclass 9 , 99def37e7cSMike Pritchard.Xr driver 9 100cefd51ecSDoug Rabson.Sh AUTHORS 101571dba6eSHiten PandyaThis manual page was written by 102cefd51ecSDoug Rabson.An Doug Rabson . 103