xref: /onnv-gate/usr/src/uts/common/avs/ns/sdbc/sdbc_ioctl.h (revision 7836:4e95154b5b7a)
1*7836SJohn.Forte@Sun.COM /*
2*7836SJohn.Forte@Sun.COM  * CDDL HEADER START
3*7836SJohn.Forte@Sun.COM  *
4*7836SJohn.Forte@Sun.COM  * The contents of this file are subject to the terms of the
5*7836SJohn.Forte@Sun.COM  * Common Development and Distribution License (the "License").
6*7836SJohn.Forte@Sun.COM  * You may not use this file except in compliance with the License.
7*7836SJohn.Forte@Sun.COM  *
8*7836SJohn.Forte@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*7836SJohn.Forte@Sun.COM  * or http://www.opensolaris.org/os/licensing.
10*7836SJohn.Forte@Sun.COM  * See the License for the specific language governing permissions
11*7836SJohn.Forte@Sun.COM  * and limitations under the License.
12*7836SJohn.Forte@Sun.COM  *
13*7836SJohn.Forte@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
14*7836SJohn.Forte@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*7836SJohn.Forte@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
16*7836SJohn.Forte@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
17*7836SJohn.Forte@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
18*7836SJohn.Forte@Sun.COM  *
19*7836SJohn.Forte@Sun.COM  * CDDL HEADER END
20*7836SJohn.Forte@Sun.COM  */
21*7836SJohn.Forte@Sun.COM /*
22*7836SJohn.Forte@Sun.COM  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23*7836SJohn.Forte@Sun.COM  * Use is subject to license terms.
24*7836SJohn.Forte@Sun.COM  */
25*7836SJohn.Forte@Sun.COM 
26*7836SJohn.Forte@Sun.COM 
27*7836SJohn.Forte@Sun.COM #ifndef	_SDBC_IOCTL_H
28*7836SJohn.Forte@Sun.COM #define	_SDBC_IOCTL_H
29*7836SJohn.Forte@Sun.COM 
30*7836SJohn.Forte@Sun.COM #ifdef __cplusplus
31*7836SJohn.Forte@Sun.COM extern "C" {
32*7836SJohn.Forte@Sun.COM #endif
33*7836SJohn.Forte@Sun.COM 
34*7836SJohn.Forte@Sun.COM #include <sys/unistat/spcs_s.h>  /* included for unistat */
35*7836SJohn.Forte@Sun.COM 
36*7836SJohn.Forte@Sun.COM /*
37*7836SJohn.Forte@Sun.COM  * Generic sdbc ioctl arguments structure.
38*7836SJohn.Forte@Sun.COM  * Individual ioctl's will use 0-n of these arguments.
39*7836SJohn.Forte@Sun.COM  *
40*7836SJohn.Forte@Sun.COM  * Each sdbc ioctl is described first by the command number
41*7836SJohn.Forte@Sun.COM  * e.g. #define	SDBC_ADUMP		_SDBC_(4)
42*7836SJohn.Forte@Sun.COM  *
43*7836SJohn.Forte@Sun.COM  * Followed by a description of each argument (if any).
44*7836SJohn.Forte@Sun.COM  * Each argument is on a single line.
45*7836SJohn.Forte@Sun.COM  *
46*7836SJohn.Forte@Sun.COM  */
47*7836SJohn.Forte@Sun.COM 
48*7836SJohn.Forte@Sun.COM typedef struct _sdbc_ioctl_s {
49*7836SJohn.Forte@Sun.COM 	long arg0;
50*7836SJohn.Forte@Sun.COM 	long arg1;
51*7836SJohn.Forte@Sun.COM 	long arg2;
52*7836SJohn.Forte@Sun.COM 	long arg3;
53*7836SJohn.Forte@Sun.COM 	long arg4;
54*7836SJohn.Forte@Sun.COM 	long magic;
55*7836SJohn.Forte@Sun.COM 	spcs_s_info_t sdbc_ustatus;
56*7836SJohn.Forte@Sun.COM 	long pad[1];
57*7836SJohn.Forte@Sun.COM } _sdbc_ioctl_t;
58*7836SJohn.Forte@Sun.COM 
59*7836SJohn.Forte@Sun.COM typedef struct _sdbc_ioctl32_s {
60*7836SJohn.Forte@Sun.COM 	int32_t arg0;
61*7836SJohn.Forte@Sun.COM 	int32_t arg1;
62*7836SJohn.Forte@Sun.COM 	int32_t arg2;
63*7836SJohn.Forte@Sun.COM 	int32_t arg3;
64*7836SJohn.Forte@Sun.COM 	int32_t arg4;
65*7836SJohn.Forte@Sun.COM 	int32_t magic;
66*7836SJohn.Forte@Sun.COM 	spcs_s_info32_t sdbc_ustatus;
67*7836SJohn.Forte@Sun.COM 	int32_t pad[1];
68*7836SJohn.Forte@Sun.COM } _sdbc_ioctl32_t;
69*7836SJohn.Forte@Sun.COM 
70*7836SJohn.Forte@Sun.COM /*
71*7836SJohn.Forte@Sun.COM  * Ioctl command numbers
72*7836SJohn.Forte@Sun.COM  */
73*7836SJohn.Forte@Sun.COM 
74*7836SJohn.Forte@Sun.COM #define	_SDBC_(x)	(('B'<<16)|('C'<<8)|(x))
75*7836SJohn.Forte@Sun.COM 
76*7836SJohn.Forte@Sun.COM /*
77*7836SJohn.Forte@Sun.COM  * Old ioctl commands prior to ioctl reorg. These could be re-used
78*7836SJohn.Forte@Sun.COM  * at a later date
79*7836SJohn.Forte@Sun.COM  */
80*7836SJohn.Forte@Sun.COM #define	SDBC_UNUSED_1 _SDBC_(1)	/* OLD out of date syscall -> ioctl stuff */
81*7836SJohn.Forte@Sun.COM #define	SDBC_UNUSED_2 _SDBC_(2)	/* OLD INFSD_CONC_WRITE */
82*7836SJohn.Forte@Sun.COM #define	SDBC_UNUSED_3 _SDBC_(3)	/* OLD muli-subopcode configuration */
83*7836SJohn.Forte@Sun.COM 
84*7836SJohn.Forte@Sun.COM #define	SDBC_ADUMP _SDBC_(4)
85*7836SJohn.Forte@Sun.COM /*
86*7836SJohn.Forte@Sun.COM  *	int		cd;
87*7836SJohn.Forte@Sun.COM  *	_sdtr_table *	table;
88*7836SJohn.Forte@Sun.COM  *	_sdtr_t *	trace_buffer;
89*7836SJohn.Forte@Sun.COM  *	int		size_of_trace_buffer;
90*7836SJohn.Forte@Sun.COM  *	int		flags;
91*7836SJohn.Forte@Sun.COM  */
92*7836SJohn.Forte@Sun.COM 
93*7836SJohn.Forte@Sun.COM #define	SDBC_TEST_INIT _SDBC_(5)	/* TESTING - tdaemon parameters */
94*7836SJohn.Forte@Sun.COM /*
95*7836SJohn.Forte@Sun.COM  *	char *		device_name;
96*7836SJohn.Forte@Sun.COM  *	int		index;
97*7836SJohn.Forte@Sun.COM  *	int		len;
98*7836SJohn.Forte@Sun.COM  *	int		track_size;
99*7836SJohn.Forte@Sun.COM  *	int		flags;
100*7836SJohn.Forte@Sun.COM  */
101*7836SJohn.Forte@Sun.COM 
102*7836SJohn.Forte@Sun.COM #define	SDBC_TEST_START _SDBC_(6)	/* TESTING - tdaemon .... */
103*7836SJohn.Forte@Sun.COM /*
104*7836SJohn.Forte@Sun.COM  *	int		num;
105*7836SJohn.Forte@Sun.COM  *	int		type;
106*7836SJohn.Forte@Sun.COM  *	int		loops;
107*7836SJohn.Forte@Sun.COM  *	int		from;
108*7836SJohn.Forte@Sun.COM  *	int		seed;
109*7836SJohn.Forte@Sun.COM  */
110*7836SJohn.Forte@Sun.COM 
111*7836SJohn.Forte@Sun.COM #define	SDBC_TEST_END _SDBC_(7)		/* TESTING - tdaemon .... */
112*7836SJohn.Forte@Sun.COM /* NO-ARGS */
113*7836SJohn.Forte@Sun.COM 
114*7836SJohn.Forte@Sun.COM #define	SDBC_ENABLE _SDBC_(8)		/* configure sdbc */
115*7836SJohn.Forte@Sun.COM /*
116*7836SJohn.Forte@Sun.COM  *	_sd_cache_param_t *	user_configuration;
117*7836SJohn.Forte@Sun.COM  */
118*7836SJohn.Forte@Sun.COM 
119*7836SJohn.Forte@Sun.COM #define	SDBC_DISABLE _SDBC_(9)		/* deconfigure sdbc */
120*7836SJohn.Forte@Sun.COM /* NO-ARGS */
121*7836SJohn.Forte@Sun.COM 
122*7836SJohn.Forte@Sun.COM #define	SDBC_SET_CD_HINT _SDBC_(10)
123*7836SJohn.Forte@Sun.COM /*
124*7836SJohn.Forte@Sun.COM  *	int		cd;
125*7836SJohn.Forte@Sun.COM  *	int		hint;
126*7836SJohn.Forte@Sun.COM  *	int		flags;
127*7836SJohn.Forte@Sun.COM  */
128*7836SJohn.Forte@Sun.COM 
129*7836SJohn.Forte@Sun.COM #define	SDBC_GET_CD_HINT _SDBC_(11)
130*7836SJohn.Forte@Sun.COM /*
131*7836SJohn.Forte@Sun.COM  *	int		cd;
132*7836SJohn.Forte@Sun.COM  */
133*7836SJohn.Forte@Sun.COM 
134*7836SJohn.Forte@Sun.COM #define	SDBC_SET_NODE_HINT _SDBC_(12)
135*7836SJohn.Forte@Sun.COM /*
136*7836SJohn.Forte@Sun.COM  *	int		hint;
137*7836SJohn.Forte@Sun.COM  *	int		flags;
138*7836SJohn.Forte@Sun.COM  */
139*7836SJohn.Forte@Sun.COM 
140*7836SJohn.Forte@Sun.COM #define	SDBC_GET_NODE_HINT _SDBC_(13)
141*7836SJohn.Forte@Sun.COM /* NO-ARGS */
142*7836SJohn.Forte@Sun.COM 
143*7836SJohn.Forte@Sun.COM #define	SDBC_STATS _SDBC_(14)
144*7836SJohn.Forte@Sun.COM /*
145*7836SJohn.Forte@Sun.COM  *	_sd_stats_t *	stats buffer;
146*7836SJohn.Forte@Sun.COM  */
147*7836SJohn.Forte@Sun.COM 
148*7836SJohn.Forte@Sun.COM #define	SDBC_ZAP_STATS _SDBC_(15)
149*7836SJohn.Forte@Sun.COM /* NO-ARGS */
150*7836SJohn.Forte@Sun.COM 
151*7836SJohn.Forte@Sun.COM #define	SDBC_GET_CD_BLK _SDBC_(16)
152*7836SJohn.Forte@Sun.COM /*
153*7836SJohn.Forte@Sun.COM  *	int		cd;
154*7836SJohn.Forte@Sun.COM  *	nsc_off_t *	block_number;
155*7836SJohn.Forte@Sun.COM  *	void *		addresses[5];
156*7836SJohn.Forte@Sun.COM  */
157*7836SJohn.Forte@Sun.COM 
158*7836SJohn.Forte@Sun.COM #define	SDBC_GET_CLUSTER_SIZE _SDBC_(17)
159*7836SJohn.Forte@Sun.COM /*
160*7836SJohn.Forte@Sun.COM  *	int *		cluster_size;
161*7836SJohn.Forte@Sun.COM  */
162*7836SJohn.Forte@Sun.COM 
163*7836SJohn.Forte@Sun.COM #define	SDBC_GET_CLUSTER_DATA _SDBC_(18)
164*7836SJohn.Forte@Sun.COM /*
165*7836SJohn.Forte@Sun.COM  *	char *		buffer[2*cluster_size];
166*7836SJohn.Forte@Sun.COM  */
167*7836SJohn.Forte@Sun.COM 
168*7836SJohn.Forte@Sun.COM #define	SDBC_GET_GLMUL_SIZES _SDBC_(19)
169*7836SJohn.Forte@Sun.COM /*
170*7836SJohn.Forte@Sun.COM  *	int *		global_sizes;
171*7836SJohn.Forte@Sun.COM  */
172*7836SJohn.Forte@Sun.COM 
173*7836SJohn.Forte@Sun.COM #define	SDBC_GET_GLMUL_INFO _SDBC_(20)
174*7836SJohn.Forte@Sun.COM /*
175*7836SJohn.Forte@Sun.COM  *	char *		buffer[ 2 times sum of global_sizes];
176*7836SJohn.Forte@Sun.COM  */
177*7836SJohn.Forte@Sun.COM 
178*7836SJohn.Forte@Sun.COM /* Unused _SDBC(21,22) */
179*7836SJohn.Forte@Sun.COM 
180*7836SJohn.Forte@Sun.COM #define	SDBC_STATE_DEV _SDBC_(23)	/* set path to sdbc state file/volume */
181*7836SJohn.Forte@Sun.COM /*
182*7836SJohn.Forte@Sun.COM  *	char *		device_name;
183*7836SJohn.Forte@Sun.COM  *	int		device_name_length;
184*7836SJohn.Forte@Sun.COM  */
185*7836SJohn.Forte@Sun.COM #define	SDBC_TOGGLE_FLUSH _SDBC_(24)	/* TESTING - toggle flusher enable */
186*7836SJohn.Forte@Sun.COM 	/* NO-ARGS */
187*7836SJohn.Forte@Sun.COM 
188*7836SJohn.Forte@Sun.COM #define	SDBC_INJ_IOERR _SDBC_(25)	/* TESTING - inject i/o error */
189*7836SJohn.Forte@Sun.COM /*
190*7836SJohn.Forte@Sun.COM  *	int		cd
191*7836SJohn.Forte@Sun.COM  *	int		io_error_number;
192*7836SJohn.Forte@Sun.COM  */
193*7836SJohn.Forte@Sun.COM 
194*7836SJohn.Forte@Sun.COM #define	SDBC_CLR_IOERR _SDBC_(26)	/* TESTING - clear injected i/o error */
195*7836SJohn.Forte@Sun.COM /*
196*7836SJohn.Forte@Sun.COM  *	int		cd
197*7836SJohn.Forte@Sun.COM  */
198*7836SJohn.Forte@Sun.COM 
199*7836SJohn.Forte@Sun.COM #define	SDBC_GET_CONFIG _SDBC_(27)	/* retrieve current configuration */
200*7836SJohn.Forte@Sun.COM /*
201*7836SJohn.Forte@Sun.COM  *	_sdbc_config_t *current_config;
202*7836SJohn.Forte@Sun.COM  */
203*7836SJohn.Forte@Sun.COM 
204*7836SJohn.Forte@Sun.COM #define	SDBC_SET_CONFIG _SDBC_(28)	/* enable cache configuration info */
205*7836SJohn.Forte@Sun.COM /*
206*7836SJohn.Forte@Sun.COM  *	_sdbc_config_t *mgmt_config_info;
207*7836SJohn.Forte@Sun.COM  */
208*7836SJohn.Forte@Sun.COM 
209*7836SJohn.Forte@Sun.COM /* Unused _SDBC(29) */
210*7836SJohn.Forte@Sun.COM 
211*7836SJohn.Forte@Sun.COM #define	SDBC_MAXFILES _SDBC_(30)	/* get maxfiles */
212*7836SJohn.Forte@Sun.COM /*
213*7836SJohn.Forte@Sun.COM  *	int *		max_files;
214*7836SJohn.Forte@Sun.COM  */
215*7836SJohn.Forte@Sun.COM 
216*7836SJohn.Forte@Sun.COM #define	SDBC_VERSION	_SDBC_(31)
217*7836SJohn.Forte@Sun.COM /*
218*7836SJohn.Forte@Sun.COM  *	cache_version_t	*cache_version;
219*7836SJohn.Forte@Sun.COM  */
220*7836SJohn.Forte@Sun.COM 
221*7836SJohn.Forte@Sun.COM #define	_SD_MAGIC   0xD017
222*7836SJohn.Forte@Sun.COM 
223*7836SJohn.Forte@Sun.COM #define	MAX_CACHE_NET	4
224*7836SJohn.Forte@Sun.COM #define	MAX_REMOTE_MIRRORS 64
225*7836SJohn.Forte@Sun.COM #define	MAX_MIR_SEGS MAX_REMOTE_MIRRORS
226*7836SJohn.Forte@Sun.COM #define	MAX_CACHE_SIZE 1024
227*7836SJohn.Forte@Sun.COM 
228*7836SJohn.Forte@Sun.COM /* unexposed configuration bits */
229*7836SJohn.Forte@Sun.COM #define	CFG_USE_DMCHAIN 0x1
230*7836SJohn.Forte@Sun.COM #define	CFG_STATIC_CACHE 0x2
231*7836SJohn.Forte@Sun.COM 
232*7836SJohn.Forte@Sun.COM #define	RESERVED1_DEFAULTS (CFG_STATIC_CACHE)
233*7836SJohn.Forte@Sun.COM 
234*7836SJohn.Forte@Sun.COM /* maintain _sd_cache_param struct layout (MAX_CACHE_NET is deprecated) */
235*7836SJohn.Forte@Sun.COM #define	CACHE_MEM_PAD 4
236*7836SJohn.Forte@Sun.COM 
237*7836SJohn.Forte@Sun.COM typedef struct _sd_cache_param {
238*7836SJohn.Forte@Sun.COM 	int mirror_host;
239*7836SJohn.Forte@Sun.COM 	int blk_size;
240*7836SJohn.Forte@Sun.COM 	int threads;
241*7836SJohn.Forte@Sun.COM 	int procs;
242*7836SJohn.Forte@Sun.COM 	int test_demons;
243*7836SJohn.Forte@Sun.COM 	int write_cache;
244*7836SJohn.Forte@Sun.COM 	int trace_size;
245*7836SJohn.Forte@Sun.COM 	int trace_mask;
246*7836SJohn.Forte@Sun.COM 	int trace_lbolt;
247*7836SJohn.Forte@Sun.COM 	int trace_good;
248*7836SJohn.Forte@Sun.COM 	int trace_net;				/* not used */
249*7836SJohn.Forte@Sun.COM 	int iobuf;
250*7836SJohn.Forte@Sun.COM 	int num_handles;
251*7836SJohn.Forte@Sun.COM 	int cache_mem[CACHE_MEM_PAD];
252*7836SJohn.Forte@Sun.COM 	int prot_lru;
253*7836SJohn.Forte@Sun.COM 	int gen_pattern;
254*7836SJohn.Forte@Sun.COM 	uint_t fill_pattern;
255*7836SJohn.Forte@Sun.COM 	short nodes_conf[MAX_REMOTE_MIRRORS];	/* Actual Nodes in conf file */
256*7836SJohn.Forte@Sun.COM 	short num_nodes;			/* Number of nodes in sd.cf */
257*7836SJohn.Forte@Sun.COM 	short net_type;				/*  not used */
258*7836SJohn.Forte@Sun.COM 	ushort_t magic;				/* Check for proper sd_cadmin */
259*7836SJohn.Forte@Sun.COM 	int reserved1;				/* unexposed config options */
260*7836SJohn.Forte@Sun.COM 	int reserved[8];
261*7836SJohn.Forte@Sun.COM } _sd_cache_param_t;
262*7836SJohn.Forte@Sun.COM 
263*7836SJohn.Forte@Sun.COM typedef struct _sdbc_config {
264*7836SJohn.Forte@Sun.COM 	int cache_mem[CACHE_MEM_PAD];
265*7836SJohn.Forte@Sun.COM 	int threads;
266*7836SJohn.Forte@Sun.COM 	int enabled;
267*7836SJohn.Forte@Sun.COM 	ushort_t magic;
268*7836SJohn.Forte@Sun.COM } _sdbc_config_t;
269*7836SJohn.Forte@Sun.COM 
270*7836SJohn.Forte@Sun.COM typedef struct cache_version {
271*7836SJohn.Forte@Sun.COM 	int	major;			/* Major release number */
272*7836SJohn.Forte@Sun.COM 	int	minor;			/* Minor release number */
273*7836SJohn.Forte@Sun.COM 	int	micro;			/* Micro release number */
274*7836SJohn.Forte@Sun.COM 	int	baseline;		/* Baseline revison number */
275*7836SJohn.Forte@Sun.COM } cache_version_t;
276*7836SJohn.Forte@Sun.COM 
277*7836SJohn.Forte@Sun.COM #if !defined(_KERNEL)
278*7836SJohn.Forte@Sun.COM 
279*7836SJohn.Forte@Sun.COM 
280*7836SJohn.Forte@Sun.COM /* Keep this definition in sync with the one in rdc_ioctl.h. */
281*7836SJohn.Forte@Sun.COM #ifndef SDBC_IOCTL
282*7836SJohn.Forte@Sun.COM #define	SDBC_IOCTL(cmd, a0, a1, a2, a3, a4, ustatus) \
283*7836SJohn.Forte@Sun.COM 		sdbc_ioctl((long)(cmd), (long)(a0), (long)(a1), (long)(a2), \
284*7836SJohn.Forte@Sun.COM 		    (long)(a3), (long)(a4), (spcs_s_info_t *)(ustatus))
285*7836SJohn.Forte@Sun.COM #endif
286*7836SJohn.Forte@Sun.COM 
287*7836SJohn.Forte@Sun.COM int sdbc_ioctl(long, long, long, long, long, long, spcs_s_info_t *);
288*7836SJohn.Forte@Sun.COM 
289*7836SJohn.Forte@Sun.COM 
290*7836SJohn.Forte@Sun.COM #endif	/* ! _KERNEL */
291*7836SJohn.Forte@Sun.COM 
292*7836SJohn.Forte@Sun.COM #ifdef __cplusplus
293*7836SJohn.Forte@Sun.COM }
294*7836SJohn.Forte@Sun.COM #endif
295*7836SJohn.Forte@Sun.COM 
296*7836SJohn.Forte@Sun.COM #endif	/* _SDBC_IOCTL_H */
297