xref: /onnv-gate/usr/src/uts/common/sys/pool_impl.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef	_SYS_POOL_IMPL_H
28*0Sstevel@tonic-gate #define	_SYS_POOL_IMPL_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #include <sys/types.h>
33*0Sstevel@tonic-gate #include <sys/cpupart.h>
34*0Sstevel@tonic-gate #include <sys/exacct_catalog.h>
35*0Sstevel@tonic-gate #include <sys/nvpair.h>
36*0Sstevel@tonic-gate 
37*0Sstevel@tonic-gate #ifdef	__cplusplus
38*0Sstevel@tonic-gate extern "C" {
39*0Sstevel@tonic-gate #endif
40*0Sstevel@tonic-gate 
41*0Sstevel@tonic-gate /*
42*0Sstevel@tonic-gate  * Pools driver ioctl interfaces
43*0Sstevel@tonic-gate  */
44*0Sstevel@tonic-gate #define	POOL_STATUS	0
45*0Sstevel@tonic-gate #define	POOL_STATUSQ	1
46*0Sstevel@tonic-gate #define	POOL_CREATE	2
47*0Sstevel@tonic-gate #define	POOL_DESTROY	3
48*0Sstevel@tonic-gate #define	POOL_QUERY	4
49*0Sstevel@tonic-gate #define	POOL_ASSOC	5
50*0Sstevel@tonic-gate #define	POOL_DISSOC	6
51*0Sstevel@tonic-gate #define	POOL_TRANSFER	7
52*0Sstevel@tonic-gate #define	POOL_XTRANSFER	8
53*0Sstevel@tonic-gate #define	POOL_PROPGET	9
54*0Sstevel@tonic-gate #define	POOL_PROPPUT	10
55*0Sstevel@tonic-gate #define	POOL_PROPRM	11
56*0Sstevel@tonic-gate #define	POOL_BIND	12
57*0Sstevel@tonic-gate #define	POOL_BINDQ	13
58*0Sstevel@tonic-gate #define	POOL_COMMIT	14
59*0Sstevel@tonic-gate 
60*0Sstevel@tonic-gate /*
61*0Sstevel@tonic-gate  * Pools-related exacct catalog IDs
62*0Sstevel@tonic-gate  */
63*0Sstevel@tonic-gate #define	EXD_GROUP_SYSTEM	0x000000
64*0Sstevel@tonic-gate #define	EXD_SYSTEM_PROP		0x000001
65*0Sstevel@tonic-gate #define	EXD_SYSTEM_TSTAMP	0x000002
66*0Sstevel@tonic-gate 
67*0Sstevel@tonic-gate #define	EXD_GROUP_POOL		0x000100
68*0Sstevel@tonic-gate #define	EXD_POOL_POOLID		0x000101
69*0Sstevel@tonic-gate #define	EXD_POOL_PSETID		0x000102
70*0Sstevel@tonic-gate #define	EXD_POOL_PROP		0x000104
71*0Sstevel@tonic-gate #define	EXD_POOL_TSTAMP		0x000105
72*0Sstevel@tonic-gate 
73*0Sstevel@tonic-gate #define	EXD_GROUP_PSET		0x000200
74*0Sstevel@tonic-gate #define	EXD_PSET_PSETID		0x000201
75*0Sstevel@tonic-gate #define	EXD_PSET_PROP		0x000202
76*0Sstevel@tonic-gate #define	EXD_PSET_TSTAMP		0x000203
77*0Sstevel@tonic-gate 
78*0Sstevel@tonic-gate #define	EXD_GROUP_CPU		0x000400
79*0Sstevel@tonic-gate #define	EXD_CPU_CPUID		0x000401
80*0Sstevel@tonic-gate #define	EXD_CPU_PROP		0x000402
81*0Sstevel@tonic-gate #define	EXD_CPU_TSTAMP		0x000403
82*0Sstevel@tonic-gate 
83*0Sstevel@tonic-gate /*
84*0Sstevel@tonic-gate  * Element Types
85*0Sstevel@tonic-gate  */
86*0Sstevel@tonic-gate typedef enum pool_elem_class {
87*0Sstevel@tonic-gate 	PEC_INVALID = 0,	/* invalid class, for error reporting */
88*0Sstevel@tonic-gate 	PEC_SYSTEM,		/* a system */
89*0Sstevel@tonic-gate 	PEC_POOL,		/* a pool */
90*0Sstevel@tonic-gate 	PEC_RES_COMP,		/* a set */
91*0Sstevel@tonic-gate 	PEC_RES_AGG,		/* a set */
92*0Sstevel@tonic-gate 	PEC_COMP		/* a resource component */
93*0Sstevel@tonic-gate } pool_elem_class_t;
94*0Sstevel@tonic-gate 
95*0Sstevel@tonic-gate typedef enum pool_resource_elem_class {
96*0Sstevel@tonic-gate 	PREC_INVALID = 0,
97*0Sstevel@tonic-gate 	PREC_PSET		/* processor set */
98*0Sstevel@tonic-gate } pool_resource_elem_class_t;
99*0Sstevel@tonic-gate 
100*0Sstevel@tonic-gate typedef enum pool_component_elem_class {
101*0Sstevel@tonic-gate 	PCEC_INVALID = 0,
102*0Sstevel@tonic-gate 	PCEC_CPU		/* CPU */
103*0Sstevel@tonic-gate } pool_component_elem_class_t;
104*0Sstevel@tonic-gate 
105*0Sstevel@tonic-gate /*
106*0Sstevel@tonic-gate  * Constants used by devpool.
107*0Sstevel@tonic-gate  */
108*0Sstevel@tonic-gate #define	POOL_IDLIST_SIZE	1024
109*0Sstevel@tonic-gate #define	POOL_PROPNAME_SIZE	8192
110*0Sstevel@tonic-gate #define	POOL_PROPBUF_SIZE	65535
111*0Sstevel@tonic-gate 
112*0Sstevel@tonic-gate typedef struct pool_status {
113*0Sstevel@tonic-gate 	int				ps_io_state;
114*0Sstevel@tonic-gate } pool_status_t;
115*0Sstevel@tonic-gate 
116*0Sstevel@tonic-gate typedef struct pool_create {
117*0Sstevel@tonic-gate 	id_t				pc_i_id;
118*0Sstevel@tonic-gate 	int				pc_o_type;
119*0Sstevel@tonic-gate 	int				pc_o_sub_type;
120*0Sstevel@tonic-gate } pool_create_t;
121*0Sstevel@tonic-gate 
122*0Sstevel@tonic-gate typedef struct pool_destroy {
123*0Sstevel@tonic-gate 	int				pd_o_type;
124*0Sstevel@tonic-gate 	int				pd_o_sub_type;
125*0Sstevel@tonic-gate 	id_t				pd_o_id;
126*0Sstevel@tonic-gate } pool_destroy_t;
127*0Sstevel@tonic-gate 
128*0Sstevel@tonic-gate typedef struct pool_query {
129*0Sstevel@tonic-gate 	size_t				pq_io_bufsize;
130*0Sstevel@tonic-gate 	void				*pq_io_buf;
131*0Sstevel@tonic-gate } pool_query_t;
132*0Sstevel@tonic-gate 
133*0Sstevel@tonic-gate #ifdef	_SYSCALL32
134*0Sstevel@tonic-gate typedef struct pool_query32 {
135*0Sstevel@tonic-gate 	size32_t			pq_io_bufsize;
136*0Sstevel@tonic-gate 	caddr32_t			pq_io_buf;
137*0Sstevel@tonic-gate } pool_query32_t;
138*0Sstevel@tonic-gate #endif	/* _SYSCALL32 */
139*0Sstevel@tonic-gate 
140*0Sstevel@tonic-gate typedef struct pool_assoc {
141*0Sstevel@tonic-gate 	poolid_t			pa_o_pool_id;
142*0Sstevel@tonic-gate 	pool_resource_elem_class_t	pa_o_id_type;
143*0Sstevel@tonic-gate 	id_t				pa_o_res_id;
144*0Sstevel@tonic-gate } pool_assoc_t;
145*0Sstevel@tonic-gate 
146*0Sstevel@tonic-gate typedef struct pool_dissoc {
147*0Sstevel@tonic-gate 	poolid_t			pd_o_pool_id;
148*0Sstevel@tonic-gate 	pool_resource_elem_class_t	pd_o_id_type;
149*0Sstevel@tonic-gate } pool_dissoc_t;
150*0Sstevel@tonic-gate 
151*0Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
152*0Sstevel@tonic-gate #pragma pack(4)
153*0Sstevel@tonic-gate #endif
154*0Sstevel@tonic-gate 
155*0Sstevel@tonic-gate typedef struct pool_transfer {
156*0Sstevel@tonic-gate 	pool_resource_elem_class_t	pt_o_id_type;
157*0Sstevel@tonic-gate 	id_t				pt_o_src_id;
158*0Sstevel@tonic-gate 	id_t				pt_o_tgt_id;
159*0Sstevel@tonic-gate 	uint64_t			pt_o_qty;
160*0Sstevel@tonic-gate } pool_transfer_t;
161*0Sstevel@tonic-gate 
162*0Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
163*0Sstevel@tonic-gate #pragma pack()
164*0Sstevel@tonic-gate #endif
165*0Sstevel@tonic-gate 
166*0Sstevel@tonic-gate typedef struct pool_xtransfer {
167*0Sstevel@tonic-gate 	pool_resource_elem_class_t	px_o_id_type;
168*0Sstevel@tonic-gate 	id_t				px_o_src_id;
169*0Sstevel@tonic-gate 	id_t				px_o_tgt_id;
170*0Sstevel@tonic-gate 	uint_t				px_o_complist_size;
171*0Sstevel@tonic-gate 	id_t				*px_o_comp_list;
172*0Sstevel@tonic-gate } pool_xtransfer_t;
173*0Sstevel@tonic-gate 
174*0Sstevel@tonic-gate #ifdef	_SYSCALL32
175*0Sstevel@tonic-gate typedef struct pool_xtransfer32 {
176*0Sstevel@tonic-gate 	pool_resource_elem_class_t	px_o_id_type;
177*0Sstevel@tonic-gate 	id_t				px_o_src_id;
178*0Sstevel@tonic-gate 	id_t				px_o_tgt_id;
179*0Sstevel@tonic-gate 	uint_t				px_o_complist_size;
180*0Sstevel@tonic-gate 	caddr32_t			px_o_comp_list;
181*0Sstevel@tonic-gate } pool_xtransfer32_t;
182*0Sstevel@tonic-gate #endif	/* _SYSCALL32 */
183*0Sstevel@tonic-gate 
184*0Sstevel@tonic-gate typedef struct pool_propget {
185*0Sstevel@tonic-gate 	size_t				pp_i_bufsize;
186*0Sstevel@tonic-gate 	char				*pp_i_buf;
187*0Sstevel@tonic-gate 	pool_elem_class_t		pp_o_id_type;
188*0Sstevel@tonic-gate 	pool_resource_elem_class_t	pp_o_id_subtype;
189*0Sstevel@tonic-gate 	id_t				pp_o_id;
190*0Sstevel@tonic-gate 	uint_t				pp_o_prop_name_size;
191*0Sstevel@tonic-gate 	char				*pp_o_prop_name;
192*0Sstevel@tonic-gate } pool_propget_t;
193*0Sstevel@tonic-gate 
194*0Sstevel@tonic-gate #ifdef	_SYSCALL32
195*0Sstevel@tonic-gate typedef	struct pool_propget32 {
196*0Sstevel@tonic-gate 	size32_t			pp_i_bufsize;
197*0Sstevel@tonic-gate 	caddr32_t			pp_i_buf;
198*0Sstevel@tonic-gate 	pool_elem_class_t		pp_o_id_type;
199*0Sstevel@tonic-gate 	pool_resource_elem_class_t	pp_o_id_subtype;
200*0Sstevel@tonic-gate 	id_t				pp_o_id;
201*0Sstevel@tonic-gate 	uint_t				pp_o_prop_name_size;
202*0Sstevel@tonic-gate 	caddr32_t			pp_o_prop_name;
203*0Sstevel@tonic-gate } pool_propget32_t;
204*0Sstevel@tonic-gate #endif	/* _SYSCALL32 */
205*0Sstevel@tonic-gate 
206*0Sstevel@tonic-gate typedef struct pool_propgetall {
207*0Sstevel@tonic-gate 	size_t				pp_i_proplist_size;
208*0Sstevel@tonic-gate 	char				*pp_i_prop_list;
209*0Sstevel@tonic-gate 	pool_elem_class_t		pp_o_id_type;
210*0Sstevel@tonic-gate 	pool_resource_elem_class_t	pp_o_id_sub_type;
211*0Sstevel@tonic-gate 	id_t				pp_o_id;
212*0Sstevel@tonic-gate } pool_propgetall_t;
213*0Sstevel@tonic-gate 
214*0Sstevel@tonic-gate #ifdef	_SYSCALL32
215*0Sstevel@tonic-gate typedef struct pool_propgetall32 {
216*0Sstevel@tonic-gate 	size32_t			pp_i_proplist_size;
217*0Sstevel@tonic-gate 	caddr32_t			pp_i_prop_list;
218*0Sstevel@tonic-gate 	pool_elem_class_t		pp_o_id_type;
219*0Sstevel@tonic-gate 	pool_resource_elem_class_t	pp_o_id_sub_type;
220*0Sstevel@tonic-gate 	id_t				pp_o_id;
221*0Sstevel@tonic-gate } pool_propgetall32_t;
222*0Sstevel@tonic-gate #endif	/* _SYSCALL32 */
223*0Sstevel@tonic-gate 
224*0Sstevel@tonic-gate typedef struct pool_propput {
225*0Sstevel@tonic-gate 	pool_elem_class_t		pp_o_id_type;
226*0Sstevel@tonic-gate 	pool_resource_elem_class_t	pp_o_id_sub_type;
227*0Sstevel@tonic-gate 	id_t				pp_o_id;
228*0Sstevel@tonic-gate 	size_t				pp_o_bufsize;
229*0Sstevel@tonic-gate 	char				*pp_o_buf;
230*0Sstevel@tonic-gate } pool_propput_t;
231*0Sstevel@tonic-gate 
232*0Sstevel@tonic-gate #ifdef	_SYSCALL32
233*0Sstevel@tonic-gate typedef struct pool_propput32 {
234*0Sstevel@tonic-gate 	pool_elem_class_t		pp_o_id_type;
235*0Sstevel@tonic-gate 	pool_resource_elem_class_t	pp_o_id_sub_type;
236*0Sstevel@tonic-gate 	id_t				pp_o_id;
237*0Sstevel@tonic-gate 	size32_t			pp_o_bufsize;
238*0Sstevel@tonic-gate 	caddr32_t			pp_o_buf;
239*0Sstevel@tonic-gate } pool_propput32_t;
240*0Sstevel@tonic-gate #endif	/* _SYSCALL32 */
241*0Sstevel@tonic-gate 
242*0Sstevel@tonic-gate typedef struct pool_proprm {
243*0Sstevel@tonic-gate 	pool_elem_class_t		pp_o_id_type;
244*0Sstevel@tonic-gate 	pool_resource_elem_class_t	pp_o_id_sub_type;
245*0Sstevel@tonic-gate 	id_t				pp_o_id;
246*0Sstevel@tonic-gate 	size_t				pp_o_prop_name_size;
247*0Sstevel@tonic-gate 	char				*pp_o_prop_name;
248*0Sstevel@tonic-gate } pool_proprm_t;
249*0Sstevel@tonic-gate 
250*0Sstevel@tonic-gate #ifdef	_SYSCALL32
251*0Sstevel@tonic-gate typedef struct pool_proprm32 {
252*0Sstevel@tonic-gate 	pool_elem_class_t		pp_o_id_type;
253*0Sstevel@tonic-gate 	pool_resource_elem_class_t	pp_o_id_sub_type;
254*0Sstevel@tonic-gate 	id_t				pp_o_id;
255*0Sstevel@tonic-gate 	size32_t			pp_o_prop_name_size;
256*0Sstevel@tonic-gate 	caddr32_t			pp_o_prop_name;
257*0Sstevel@tonic-gate } pool_proprm32_t;
258*0Sstevel@tonic-gate #endif	/* _SYSCALL32 */
259*0Sstevel@tonic-gate 
260*0Sstevel@tonic-gate typedef struct pool_bind {
261*0Sstevel@tonic-gate 	idtype_t			pb_o_id_type;
262*0Sstevel@tonic-gate 	id_t				pb_o_pool_id;
263*0Sstevel@tonic-gate 	id_t				pb_o_id;
264*0Sstevel@tonic-gate } pool_bind_t;
265*0Sstevel@tonic-gate 
266*0Sstevel@tonic-gate typedef struct pool_bindq {
267*0Sstevel@tonic-gate 	idtype_t			pb_o_id_type;
268*0Sstevel@tonic-gate 	poolid_t			pb_i_id;
269*0Sstevel@tonic-gate 	id_t				pb_o_id;
270*0Sstevel@tonic-gate } pool_bindq_t;
271*0Sstevel@tonic-gate 
272*0Sstevel@tonic-gate /*
273*0Sstevel@tonic-gate  * Values for pp_type below
274*0Sstevel@tonic-gate  */
275*0Sstevel@tonic-gate #define	PP_READ		0x0001
276*0Sstevel@tonic-gate #define	PP_WRITE	0x0002
277*0Sstevel@tonic-gate #define	PP_RDWR		0x0003
278*0Sstevel@tonic-gate #define	PP_OPTIONAL	0x0004
279*0Sstevel@tonic-gate #define	PP_STORED	0x0008
280*0Sstevel@tonic-gate #define	PP_INIT		0x0010
281*0Sstevel@tonic-gate #define	PP_HIDDEN	0x0020
282*0Sstevel@tonic-gate 
283*0Sstevel@tonic-gate #ifdef	_KERNEL
284*0Sstevel@tonic-gate 
285*0Sstevel@tonic-gate /*
286*0Sstevel@tonic-gate  * For special properties
287*0Sstevel@tonic-gate  */
288*0Sstevel@tonic-gate typedef struct pool_property {
289*0Sstevel@tonic-gate 	char		*pp_name;	/* name of the property */
290*0Sstevel@tonic-gate 	data_type_t	pp_type;	/* type of the property */
291*0Sstevel@tonic-gate 	int		pp_perm;	/* permissions */
292*0Sstevel@tonic-gate } pool_property_t;
293*0Sstevel@tonic-gate 
294*0Sstevel@tonic-gate extern int pool_propput_common(nvlist_t *, nvpair_t *, pool_property_t *);
295*0Sstevel@tonic-gate extern int pool_proprm_common(nvlist_t *, char *, pool_property_t *);
296*0Sstevel@tonic-gate 
297*0Sstevel@tonic-gate #endif	/* _KERNEL */
298*0Sstevel@tonic-gate 
299*0Sstevel@tonic-gate #ifdef	__cplusplus
300*0Sstevel@tonic-gate }
301*0Sstevel@tonic-gate #endif
302*0Sstevel@tonic-gate 
303*0Sstevel@tonic-gate #endif	/* _SYS_POOL_IMPL_H */
304