xref: /illumos-gate/usr/src/lib/libdevice/libdevice.h (revision 2f172c55ef76964744bc62b4500ece87f3089b4d)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_LIBDEVICE_H
28 #define	_LIBDEVICE_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/sunddi.h>
33 #include <sys/ddi_impldefs.h>
34 #include <sys/devctl.h>
35 
36 #ifdef	__cplusplus
37 extern "C" {
38 #endif
39 
40 #define	DC_EXCL		0x01
41 #define	DC_RDONLY	0x02
42 
43 typedef struct devctl_dummy_struct *devctl_hdl_t;
44 typedef struct devctl_dummy_ddef *devctl_ddef_t;
45 
46 
47 devctl_hdl_t
48 devctl_device_acquire(char *devfs_path, uint_t flags);
49 
50 devctl_hdl_t
51 devctl_bus_acquire(char *devfs_path, uint_t flags);
52 
53 devctl_hdl_t
54 devctl_ap_acquire(char *devfs_path, uint_t flags);
55 
56 devctl_hdl_t
57 devctl_pm_dev_acquire(char *devfs_path, uint_t flags);
58 
59 devctl_hdl_t
60 devctl_pm_bus_acquire(char *devfs_path, uint_t flags);
61 
62 void
63 devctl_release(devctl_hdl_t hdl);
64 
65 int
66 devctl_device_offline(devctl_hdl_t hdl);
67 
68 int
69 devctl_device_remove(devctl_hdl_t hdl);
70 
71 int
72 devctl_pm_raisepower(devctl_hdl_t hdl);
73 
74 int
75 devctl_pm_changepowerlow(devctl_hdl_t hdl);
76 
77 int
78 devctl_pm_changepowerhigh(devctl_hdl_t hdl);
79 
80 int
81 devctl_pm_idlecomponent(devctl_hdl_t hdl);
82 
83 int
84 devctl_pm_busycomponent(devctl_hdl_t hdl);
85 
86 int
87 devctl_pm_testbusy(devctl_hdl_t hdl, uint_t *busyp);
88 
89 int
90 devctl_pm_failsuspend(devctl_hdl_t hdl);
91 
92 int
93 devctl_pm_bus_teststrict(devctl_hdl_t hdl, uint_t *strict);
94 
95 int
96 devctl_pm_device_changeonresume(devctl_hdl_t hdl);
97 
98 int
99 devctl_pm_device_no_lower_power(devctl_hdl_t hdl);
100 
101 int
102 devctl_pm_bus_no_invol(devctl_hdl_t hdl);
103 
104 int
105 devctl_pm_device_promprintf(devctl_hdl_t hdl);
106 
107 int
108 devctl_device_online(devctl_hdl_t hdl);
109 
110 int
111 devctl_device_reset(devctl_hdl_t hdl);
112 
113 int
114 devctl_device_getstate(devctl_hdl_t hdl, uint_t *statep);
115 
116 int
117 devctl_bus_quiesce(devctl_hdl_t hdl);
118 
119 int
120 devctl_bus_unquiesce(devctl_hdl_t hdl);
121 
122 int
123 devctl_bus_reset(devctl_hdl_t hdl);
124 
125 int
126 devctl_bus_resetall(devctl_hdl_t hdl);
127 
128 int
129 devctl_bus_getstate(devctl_hdl_t hdl, uint_t *statep);
130 
131 int
132 devctl_bus_configure(devctl_hdl_t hdl);
133 
134 int
135 devctl_bus_unconfigure(devctl_hdl_t hdl);
136 
137 int
138 devctl_ap_insert(devctl_hdl_t, nvlist_t *);
139 
140 int
141 devctl_ap_remove(devctl_hdl_t, nvlist_t *);
142 
143 int
144 devctl_ap_connect(devctl_hdl_t, nvlist_t *);
145 
146 int
147 devctl_ap_disconnect(devctl_hdl_t, nvlist_t *);
148 
149 int
150 devctl_ap_configure(devctl_hdl_t, nvlist_t *);
151 
152 int
153 devctl_ap_unconfigure(devctl_hdl_t, nvlist_t *);
154 
155 int
156 devctl_ap_getstate(devctl_hdl_t, nvlist_t *, devctl_ap_state_t *);
157 
158 devctl_ddef_t
159 devctl_ddef_alloc(char *, int);
160 
161 void
162 devctl_ddef_free(devctl_ddef_t);
163 
164 int
165 devctl_ddef_int(devctl_ddef_t, char *, int32_t);
166 
167 int
168 devctl_ddef_int_array(devctl_ddef_t, char *, int, int32_t *);
169 
170 int
171 devctl_ddef_string(devctl_ddef_t ddef_hdl, char *, char *);
172 
173 int
174 devctl_ddef_string_array(devctl_ddef_t, char *, int, char **);
175 
176 int
177 devctl_ddef_byte_array(devctl_ddef_t, char *, int, uchar_t *);
178 
179 int
180 devctl_bus_dev_create(devctl_hdl_t, devctl_ddef_t, uint_t, devctl_hdl_t *);
181 
182 char *
183 devctl_get_pathname(devctl_hdl_t, char *, size_t);
184 
185 #ifdef	__cplusplus
186 }
187 #endif
188 
189 #endif	/* _LIBDEVICE_H */
190