2 .\" Copyright (c) 2000, Sun Microsystems, Inc. All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH DDI_GET_DEVSTATE 9F "Aug 13, 1999"
8 ddi_get_devstate \- Check device state
13 #include <sys/sunddi.h>
15 \fBddi_devstate_t\fR \fBddi_get_devstate\fR(\fBdev_info_t *\fR\fIdip\fR);
21 Solaris DDI specific (Solaris DDI)
29 Pointer to the device's \fBdev_info\fR structure
35 The \fBddi_get_devstate()\fR function returns a value indicating the state of
36 the device specified by \fB dip\fR, as derived from the configuration
37 operations that have been performed on it (or on the bus on which it resides)
38 and any fault reports relating to it.
43 \fB\fBDDI_DEVSTATE_OFFLINE\fR\fR
46 The device is offline. In this state, the device driver is not attached, nor
47 will it be attached automatically. The device cannot be used until it is
54 \fB\fBDDI_DEVSTATE_DOWN\fR\fR
57 The device is online but unusable due to a fault.
63 \fB\fBDDI_DEVSTATE_QUIESCED\fR\fR
66 The bus on which the device resides has been quiesced. This is not a fault,
67 but no operations on the device should be performed while the bus remains
74 \fB\fBDDI_DEVSTATE_DEGRADED\fR\fR
77 The device is online but only able to provide a partial or degraded service,
84 \fB\fBDDI_DEVSTATE_UP\fR\fR
87 The device is online and fully operational.
93 The \fBddi_get_devstate()\fR function may be called from user, kernel, or
98 A device driver should call this function to check its own state at each major
99 entry point, and before committing resources to a requested operation. If a
100 driver discovers that its device is already down, it should perform required
101 cleanup actions and return as soon as possible. If appropriate, it should
102 return an error to its caller, indicating that the device has failed (for
103 example, a driver's \fBread\fR(9E) routine would return \fBEIO\fR).
106 Depending on the driver, some non-I/O operations (for example, calls to the
107 driver's \fBioctl\fR(9E) routine) may still succeed; only functions which would
108 require fully accessible and operational hardware will necessarily fail. If the
109 bus on which the device resides is quiesced, the driver may return a value
110 indicating the operation should be retried later (for example, \fBEAGAIN\fR).
111 Alternatively, for some classes of device, it may be appropriate for the driver
112 to enqueue the operation and service it once the bus has been unquiesced. Note
113 that not all busses support the quiesce/unquiesce operations, so this value may
114 never be seen by some drivers.
118 \fBattach\fR(9E), \fBioctl\fR(9E), \fBopen\fR(9E), \fBread\fR(9E),
119 \fBstrategy\fR(9E), \fBwrite\fR(9E), \fBddi_dev_report_fault\fR(9F)