1998-09-03 21:52:05 +00:00
|
|
|
.\" -*- nroff -*-
|
|
|
|
.\"
|
|
|
|
.\" 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 the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
.\"
|
1999-08-28 00:22:10 +00:00
|
|
|
.\" $FreeBSD$
|
1998-09-03 21:52:05 +00:00
|
|
|
.\"
|
|
|
|
.Dd June 16, 1998
|
1999-08-15 10:48:36 +00:00
|
|
|
.Dt DEVICE 9
|
2001-07-10 15:31:11 +00:00
|
|
|
.Os
|
1998-09-03 21:52:05 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm device
|
|
|
|
.Nd an abstract representation of a device
|
1999-02-01 22:55:54 +00:00
|
|
|
.Sh SYNOPSIS
|
2001-02-01 16:38:02 +00:00
|
|
|
.Vt typedef struct device *device_t ;
|
1998-09-03 21:52:05 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The 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,
|
2003-05-31 14:07:25 +00:00
|
|
|
.Va root_bus
|
1998-09-03 21:52:05 +00:00
|
|
|
and all other devices are created dynamically during
|
2003-10-23 01:54:06 +00:00
|
|
|
autoconfiguration.
|
|
|
|
Normally devices representing top-level busses in
|
1998-09-03 21:52:05 +00:00
|
|
|
the system (ISA, PCI etc.) will be attached directly to
|
2003-05-31 14:07:25 +00:00
|
|
|
.Va root_bus
|
1999-02-01 22:55:54 +00:00
|
|
|
and other devices will be added as children of their relevant bus.
|
1998-09-03 21:52:05 +00:00
|
|
|
.Pp
|
2000-03-03 14:05:08 +00:00
|
|
|
The devices in a system form a tree.
|
|
|
|
All devices except
|
2003-05-31 14:07:25 +00:00
|
|
|
.Va root_bus
|
1998-09-03 21:52:05 +00:00
|
|
|
have a parent (see
|
2001-01-16 09:32:40 +00:00
|
|
|
.Xr device_get_parent 9 ) .
|
1998-09-03 21:52:05 +00:00
|
|
|
In addition, any device can have children attached to it (see
|
|
|
|
.Xr device_add_child 9 ,
|
1999-09-04 12:37:21 +00:00
|
|
|
.Xr device_add_child_ordered 9 ,
|
1998-09-03 21:52:05 +00:00
|
|
|
.Xr device_find_child 9 ,
|
1999-12-02 16:34:09 +00:00
|
|
|
.Xr device_get_children 9 ,
|
1998-09-03 21:52:05 +00:00
|
|
|
and
|
2001-01-16 09:32:40 +00:00
|
|
|
.Xr device_delete_child 9 ) .
|
1998-09-03 21:52:05 +00:00
|
|
|
.Pp
|
2000-05-12 15:31:54 +00:00
|
|
|
A device which has been successfully probed and attached to the
|
1998-09-03 21:52:05 +00:00
|
|
|
system will also have a driver (see
|
|
|
|
.Xr device_get_driver 9
|
|
|
|
and
|
|
|
|
.Xr driver 9 )
|
|
|
|
and a devclass (see
|
|
|
|
.Xr device_get_devclass 9
|
|
|
|
and
|
2001-01-16 09:32:40 +00:00
|
|
|
.Xr devclass 9 ) .
|
1998-09-03 21:52:05 +00:00
|
|
|
Various other attributes of the device include a unit number (see
|
2001-01-16 09:32:40 +00:00
|
|
|
.Xr device_get_unit 9 ) ,
|
1998-09-03 21:52:05 +00:00
|
|
|
verbose description (normally supplied by the driver, see
|
|
|
|
.Xr device_set_desc 9
|
|
|
|
and
|
2001-01-16 09:32:40 +00:00
|
|
|
.Xr device_get_desc 9 ) ,
|
1998-09-03 21:52:05 +00:00
|
|
|
a set of bus-specific variables (see
|
|
|
|
.Xr device_get_ivars 9 )
|
|
|
|
and a set of driver-specific variables (see
|
2001-01-16 09:32:40 +00:00
|
|
|
.Xr device_get_softc 9 ) .
|
1998-09-03 21:52:05 +00:00
|
|
|
.Pp
|
|
|
|
Devices can be in one of several states:
|
|
|
|
.Bl -tag -width DS_NOTPRESENT
|
2003-05-31 14:07:25 +00:00
|
|
|
.It Dv DS_NOTPRESENT
|
1998-09-03 21:52:05 +00:00
|
|
|
the device has not been probed for existence or the probe failed
|
2003-05-31 14:07:25 +00:00
|
|
|
.It Dv DS_ALIVE
|
1998-09-03 21:52:05 +00:00
|
|
|
the device probe succeeded but not yet attached
|
2003-05-31 14:07:25 +00:00
|
|
|
.It Dv DS_ATTACHED
|
1998-09-03 21:52:05 +00:00
|
|
|
the device has been successfully attached
|
2003-05-31 14:07:25 +00:00
|
|
|
.It Dv DS_BUSY
|
1998-09-03 21:52:05 +00:00
|
|
|
the device is currently open
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The current state of the device can be determined by calling
|
|
|
|
.Xr device_get_state 9 .
|
|
|
|
.Sh SEE ALSO
|
1999-08-15 10:48:36 +00:00
|
|
|
.Xr devclass 9 ,
|
|
|
|
.Xr driver 9
|
1998-09-03 21:52:05 +00:00
|
|
|
.Sh AUTHORS
|
2005-06-28 20:15:19 +00:00
|
|
|
This manual page was written by
|
1998-09-03 21:52:05 +00:00
|
|
|
.An Doug Rabson .
|