xref: /illumos-gate/usr/src/lib/libdevice/libdevice.h (revision 1da57d55)
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 #include <sys/sunddi.h>
31 #include <sys/ddi_impldefs.h>
32 #include <sys/devctl.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 #define	DC_EXCL		0x01
39 #define	DC_RDONLY	0x02
40 
41 typedef struct devctl_dummy_struct *devctl_hdl_t;
42 typedef struct devctl_dummy_ddef *devctl_ddef_t;
43 
44 
45 devctl_hdl_t
46 devctl_device_acquire(char *devfs_path, uint_t flags);
47 
48 devctl_hdl_t
49 devctl_bus_acquire(char *devfs_path, uint_t flags);
50 
51 devctl_hdl_t
52 devctl_ap_acquire(char *devfs_path, uint_t flags);
53 
54 devctl_hdl_t
55 devctl_pm_dev_acquire(char *devfs_path, uint_t flags);
56 
57 devctl_hdl_t
58 devctl_pm_bus_acquire(char *devfs_path, uint_t flags);
59 
60 void
61 devctl_release(devctl_hdl_t hdl);
62 
63 int
64 devctl_device_offline(devctl_hdl_t hdl);
65 
66 int
67 devctl_device_remove(devctl_hdl_t hdl);
68 
69 int
70 devctl_pm_raisepower(devctl_hdl_t hdl);
71 
72 int
73 devctl_pm_changepowerlow(devctl_hdl_t hdl);
74 
75 int
76 devctl_pm_changepowerhigh(devctl_hdl_t hdl);
77 
78 int
79 devctl_pm_idlecomponent(devctl_hdl_t hdl);
80 
81 int
82 devctl_pm_busycomponent(devctl_hdl_t hdl);
83 
84 int
85 devctl_pm_testbusy(devctl_hdl_t hdl, uint_t *busyp);
86 
87 int
88 devctl_pm_failsuspend(devctl_hdl_t hdl);
89 
90 int
91 devctl_pm_bus_teststrict(devctl_hdl_t hdl, uint_t *strict);
92 
93 int
94 devctl_pm_device_changeonresume(devctl_hdl_t hdl);
95 
96 int
97 devctl_pm_device_no_lower_power(devctl_hdl_t hdl);
98 
99 int
100 devctl_pm_bus_no_invol(devctl_hdl_t hdl);
101 
102 int
103 devctl_pm_device_promprintf(devctl_hdl_t hdl);
104 
105 int
106 devctl_device_online(devctl_hdl_t hdl);
107 
108 int
109 devctl_device_reset(devctl_hdl_t hdl);
110 
111 int
112 devctl_device_getstate(devctl_hdl_t hdl, uint_t *statep);
113 
114 int
115 devctl_bus_quiesce(devctl_hdl_t hdl);
116 
117 int
118 devctl_bus_unquiesce(devctl_hdl_t hdl);
119 
120 int
121 devctl_bus_reset(devctl_hdl_t hdl);
122 
123 int
124 devctl_bus_resetall(devctl_hdl_t hdl);
125 
126 int
127 devctl_bus_getstate(devctl_hdl_t hdl, uint_t *statep);
128 
129 int
130 devctl_bus_configure(devctl_hdl_t hdl);
131 
132 int
133 devctl_bus_unconfigure(devctl_hdl_t hdl);
134 
135 int
136 devctl_ap_insert(devctl_hdl_t, nvlist_t *);
137 
138 int
139 devctl_ap_remove(devctl_hdl_t, nvlist_t *);
140 
141 int
142 devctl_ap_connect(devctl_hdl_t, nvlist_t *);
143 
144 int
145 devctl_ap_disconnect(devctl_hdl_t, nvlist_t *);
146 
147 int
148 devctl_ap_configure(devctl_hdl_t, nvlist_t *);
149 
150 int
151 devctl_ap_unconfigure(devctl_hdl_t, nvlist_t *);
152 
153 int
154 devctl_ap_getstate(devctl_hdl_t, nvlist_t *, devctl_ap_state_t *);
155 
156 devctl_ddef_t
157 devctl_ddef_alloc(char *, int);
158 
159 void
160 devctl_ddef_free(devctl_ddef_t);
161 
162 int
163 devctl_ddef_int(devctl_ddef_t, char *, int32_t);
164 
165 int
166 devctl_ddef_int_array(devctl_ddef_t, char *, int, int32_t *);
167 
168 int
169 devctl_ddef_string(devctl_ddef_t ddef_hdl, char *, char *);
170 
171 int
172 devctl_ddef_string_array(devctl_ddef_t, char *, int, char **);
173 
174 int
175 devctl_ddef_byte_array(devctl_ddef_t, char *, int, uchar_t *);
176 
177 int
178 devctl_bus_dev_create(devctl_hdl_t, devctl_ddef_t, uint_t, devctl_hdl_t *);
179 
180 char *
181 devctl_get_pathname(devctl_hdl_t, char *, size_t);
182 
183 #ifdef	__cplusplus
184 }
185 #endif
186 
187 #endif	/* _LIBDEVICE_H */
188