ksh: build with __EXTENSIONS__ to expose confstr
[unleashed.git] / share / man / man9f / ddi_get_devstate.9f
blobb0ddec0c67d2b10c13ab5fb528ad3b378d29caf5
1 '\" te
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"
7 .SH NAME
8 ddi_get_devstate \- Check device state
9 .SH SYNOPSIS
10 .LP
11 .nf
12 #include <sys/ddi.h>
13 #include <sys/sunddi.h>
15 \fBddi_devstate_t\fR \fBddi_get_devstate\fR(\fBdev_info_t *\fR\fIdip\fR);
16 .fi
18 .SH INTERFACE LEVEL
19 .sp
20 .LP
21 Solaris DDI specific (Solaris DDI)
22 .SH PARAMETERS
23 .sp
24 .ne 2
25 .na
26 \fB\fIdip\fR \fR
27 .ad
28 .RS 8n
29 Pointer to the device's \fBdev_info\fR structure
30 .RE
32 .SH DESCRIPTION
33 .sp
34 .LP
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.
39 .SH RETURN VALUES
40 .sp
41 .ne 2
42 .na
43 \fB\fBDDI_DEVSTATE_OFFLINE\fR\fR
44 .ad
45 .RS 25n
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
48 brought online.
49 .RE
51 .sp
52 .ne 2
53 .na
54 \fB\fBDDI_DEVSTATE_DOWN\fR\fR
55 .ad
56 .RS 25n
57  The device is online but unusable due to a fault.
58 .RE
60 .sp
61 .ne 2
62 .na
63 \fB\fBDDI_DEVSTATE_QUIESCED\fR\fR
64 .ad
65 .RS 25n
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
68 quiesced.
69 .RE
71 .sp
72 .ne 2
73 .na
74 \fB\fBDDI_DEVSTATE_DEGRADED\fR\fR
75 .ad
76 .RS 25n
77  The device is online but only able to provide a partial or degraded service,
78 due to a fault.
79 .RE
81 .sp
82 .ne 2
83 .na
84 \fB\fBDDI_DEVSTATE_UP\fR\fR
85 .ad
86 .RS 25n
87  The device is online and fully operational.
88 .RE
90 .SH CONTEXT
91 .sp
92 .LP
93 The \fBddi_get_devstate()\fR function may be called from user, kernel, or
94 interrupt context.
95 .SH NOTES
96 .sp
97 .LP
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.
115 .SH SEE ALSO
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)