xref: /illumos-gate/usr/src/uts/sun4u/opl/sys/fiomp.h (revision 25cf1a30)
1*25cf1a30Sjl /*
2*25cf1a30Sjl  * CDDL HEADER START
3*25cf1a30Sjl  *
4*25cf1a30Sjl  * The contents of this file are subject to the terms of the
5*25cf1a30Sjl  * Common Development and Distribution License (the "License").
6*25cf1a30Sjl  * You may not use this file except in compliance with the License.
7*25cf1a30Sjl  *
8*25cf1a30Sjl  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*25cf1a30Sjl  * or http://www.opensolaris.org/os/licensing.
10*25cf1a30Sjl  * See the License for the specific language governing permissions
11*25cf1a30Sjl  * and limitations under the License.
12*25cf1a30Sjl  *
13*25cf1a30Sjl  * When distributing Covered Code, include this CDDL HEADER in each
14*25cf1a30Sjl  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*25cf1a30Sjl  * If applicable, add the following below this CDDL HEADER, with the
16*25cf1a30Sjl  * fields enclosed by brackets "[]" replaced with your own identifying
17*25cf1a30Sjl  * information: Portions Copyright [yyyy] [name of copyright owner]
18*25cf1a30Sjl  *
19*25cf1a30Sjl  * CDDL HEADER END
20*25cf1a30Sjl  */
21*25cf1a30Sjl /*
22*25cf1a30Sjl  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23*25cf1a30Sjl  * Use is subject to license terms.
24*25cf1a30Sjl  */
25*25cf1a30Sjl 
26*25cf1a30Sjl #ifndef _FIOMP_H
27*25cf1a30Sjl #define	_FIOMP_H
28*25cf1a30Sjl 
29*25cf1a30Sjl #pragma ident	"%Z%%M%	%I%	%E% SMI"
30*25cf1a30Sjl 
31*25cf1a30Sjl #ifdef	__cplusplus
32*25cf1a30Sjl extern "C" {
33*25cf1a30Sjl #endif
34*25cf1a30Sjl 
35*25cf1a30Sjl #define	FIOMP_TRUE  1
36*25cf1a30Sjl #define	FIOMP_FALSE 0
37*25cf1a30Sjl 
38*25cf1a30Sjl #define	FIOMP_MAX_STR	1024	/* same as FILENAME_MAX */
39*25cf1a30Sjl 
40*25cf1a30Sjl #define	FIOMP_PATH_ALL	(-1)
41*25cf1a30Sjl 
42*25cf1a30Sjl /* ioctl base */
43*25cf1a30Sjl #define	FIOMPC		('f' << 8)
44*25cf1a30Sjl 
45*25cf1a30Sjl /*
46*25cf1a30Sjl  * ioctl for the meta management node
47*25cf1a30Sjl  */
48*25cf1a30Sjl 
49*25cf1a30Sjl /* create a new multi-path */
50*25cf1a30Sjl #define	FIOMPNEW	(FIOMPC|0x0)
51*25cf1a30Sjl /* encapsulate using devices */
52*25cf1a30Sjl #define	FIOMPENCAP	(FIOMPC|0x1)
53*25cf1a30Sjl struct fiompdev {
54*25cf1a30Sjl 	int	api_level;		/* API level = 0 */
55*25cf1a30Sjl 	int	inst_no;		/* instance number */
56*25cf1a30Sjl 	minor_t	inst_minor;		/* instance management node */
57*25cf1a30Sjl 	minor_t	user_minor;		/* user access node */
58*25cf1a30Sjl 	int	num;			/* number of devices */
59*25cf1a30Sjl 	char	**devs;			/* device names */
60*25cf1a30Sjl 	int	mpmode;			/* multi pathing */
61*25cf1a30Sjl 	int	autopath;		/* automatic path change */
62*25cf1a30Sjl 	int	block;			/* able to block physical device */
63*25cf1a30Sjl 	int	needsync;		/* need synchronize path status */
64*25cf1a30Sjl 	void	*ext;			/* for extension = NULL */
65*25cf1a30Sjl };
66*25cf1a30Sjl 
67*25cf1a30Sjl /* get an instance device's information */
68*25cf1a30Sjl #define	FIOMPDEVINFO	(FIOMPC|0x2)
69*25cf1a30Sjl struct fiomp_devinfo {
70*25cf1a30Sjl 	int	inst_no;		/* instance number */
71*25cf1a30Sjl 	char	real_name[FIOMP_MAX_STR]; /* instance management node */
72*25cf1a30Sjl 	char	user_path[FIOMP_MAX_STR]; /* user access path */
73*25cf1a30Sjl 	int	path_num;		/* number of paths */
74*25cf1a30Sjl 	int	mpmode;			/* multi pathing */
75*25cf1a30Sjl 	int	autopath;		/* automatic path change */
76*25cf1a30Sjl 	int	block;			/* able to block physical device */
77*25cf1a30Sjl 	int	needsync;		/* need synchronize path status */
78*25cf1a30Sjl 	void	*ext;			/* for extension = NULL */
79*25cf1a30Sjl };
80*25cf1a30Sjl 
81*25cf1a30Sjl /* get number of all instances */
82*25cf1a30Sjl #define	FIOMPALLINSTNUM	(FIOMPC|0x3)
83*25cf1a30Sjl 
84*25cf1a30Sjl /* get all device's informations */
85*25cf1a30Sjl #define	FIOMPALLDEVINFO	(FIOMPC|0x4)
86*25cf1a30Sjl struct fiomp_all_devinfo {
87*25cf1a30Sjl 	int	num;			/* number of instances */
88*25cf1a30Sjl 	struct	fiomp_devinfo *devinfo;	/* device informations */
89*25cf1a30Sjl };
90*25cf1a30Sjl 
91*25cf1a30Sjl /* keep 0x5 - 0xf for reserve */
92*25cf1a30Sjl 
93*25cf1a30Sjl /*
94*25cf1a30Sjl  * ioctl for instance management nodes
95*25cf1a30Sjl  */
96*25cf1a30Sjl /* get max number of paths */
97*25cf1a30Sjl #define	FIOMPMAXPATHNUM	(FIOMPC|0x10)
98*25cf1a30Sjl 
99*25cf1a30Sjl /* set the device's property */
100*25cf1a30Sjl #define	FIOMPSETPROP	(FIOMPC|0x11)
101*25cf1a30Sjl 
102*25cf1a30Sjl /* get the device's property */
103*25cf1a30Sjl #define	FIOMPGETPROP	(FIOMPC|0x12)
104*25cf1a30Sjl struct fiompprop {
105*25cf1a30Sjl 	char	*iomp_name;		/* instance name */
106*25cf1a30Sjl 	char	*iomp_real_name;
107*25cf1a30Sjl 				/* instance management node (/devices) */
108*25cf1a30Sjl 	char	*iomp_user_path;	/* instance management node (/dev) */
109*25cf1a30Sjl 	char	*iomp_status;		/* status of the instance */
110*25cf1a30Sjl 	int	num;			/* number of paths */
111*25cf1a30Sjl 	char	**iomp_path;		/* target device nodes (/devices) */
112*25cf1a30Sjl 	char	**iomp_logical_path;	/* target device nodes (/dev) */
113*25cf1a30Sjl 	char	**iomp_path_status;	/* status of target devices */
114*25cf1a30Sjl 	char	**iomp_path_block;	/* access block */
115*25cf1a30Sjl };
116*25cf1a30Sjl 
117*25cf1a30Sjl /* destroy the instance */
118*25cf1a30Sjl #define	FIOMPDESTROY	(FIOMPC|0x13)
119*25cf1a30Sjl 
120*25cf1a30Sjl /* stop the path */
121*25cf1a30Sjl #define	FIOMPSTOP	(FIOMPC|0x14)
122*25cf1a30Sjl 
123*25cf1a30Sjl /* start the path */
124*25cf1a30Sjl #define	FIOMPSTART	(FIOMPC|0x15)
125*25cf1a30Sjl 
126*25cf1a30Sjl /* list all paths */
127*25cf1a30Sjl #define	FIOMPLIST	(FIOMPC|0x16)
128*25cf1a30Sjl 
129*25cf1a30Sjl /* get the path status */
130*25cf1a30Sjl #define	FIOMPSTATUS	(FIOMPC|0x17)
131*25cf1a30Sjl struct fiompstatus {
132*25cf1a30Sjl 	int	pathnum;		/* path number */
133*25cf1a30Sjl 	int	status;			/* FIOMP_STAT_xxxx */
134*25cf1a30Sjl 	char	*message;		/* some messages */
135*25cf1a30Sjl 	int	block_status;		/* access block status */
136*25cf1a30Sjl 	void	*ext;			/* reservesd (= NULL) */
137*25cf1a30Sjl };
138*25cf1a30Sjl 
139*25cf1a30Sjl /* status */
140*25cf1a30Sjl #define	FIOMP_STAT_ACTIVE	PATH_STAT_ACTIVE
141*25cf1a30Sjl #define	FIOMP_STAT_STANDBY	PATH_STAT_STANDBY
142*25cf1a30Sjl #define	FIOMP_STAT_STOP		PATH_STAT_STOP
143*25cf1a30Sjl #define	FIOMP_STAT_FAIL		PATH_STAT_FAIL
144*25cf1a30Sjl #define	FIOMP_STAT_DISCON	PATH_STAT_DISCON
145*25cf1a30Sjl #define	FIOMP_STAT_ENCAP	PATH_STAT_ENCAP
146*25cf1a30Sjl #define	FIOMP_STAT_EMPTY	PATH_STAT_EMPTY
147*25cf1a30Sjl 
148*25cf1a30Sjl /* access block status */
149*25cf1a30Sjl #define	FIOMP_BSTAT_BLOCK	1
150*25cf1a30Sjl #define	FIOMP_BSTAT_UNBLOCK	0
151*25cf1a30Sjl 
152*25cf1a30Sjl /* add, delete */
153*25cf1a30Sjl #define	FIOMPADD	(FIOMPC|0x18)
154*25cf1a30Sjl #define	FIOMPDEL	(FIOMPC|0x19)
155*25cf1a30Sjl struct fiomppath {
156*25cf1a30Sjl 	int	num;			/* number of paths */
157*25cf1a30Sjl 	char	**devs;			/* device names */
158*25cf1a30Sjl };
159*25cf1a30Sjl 
160*25cf1a30Sjl /* active, stabdby */
161*25cf1a30Sjl #define	FIOMPACTIVE	(FIOMPC|0x1a)
162*25cf1a30Sjl #define	FIOMPSTANDBY	(FIOMPC|0x1b)
163*25cf1a30Sjl 
164*25cf1a30Sjl /* block, unblock */
165*25cf1a30Sjl #define	FIOMPBLOCK	(FIOMPC|0x1c)
166*25cf1a30Sjl #define	FIOMPUNBLOCK	(FIOMPC|0x1d)
167*25cf1a30Sjl 
168*25cf1a30Sjl /* diagnostic mode ON,OFF */
169*25cf1a30Sjl #define	FIOMPDIAGON	(FIOMPC|0x1e)
170*25cf1a30Sjl #define	FIOMPDIAGOFF	(FIOMPC|0x1f)
171*25cf1a30Sjl struct fiomp_diag_mode {
172*25cf1a30Sjl 	int	 pathnum;		/* path for diagnostic */
173*25cf1a30Sjl 	int	level;			/* = 0 */
174*25cf1a30Sjl };
175*25cf1a30Sjl 
176*25cf1a30Sjl /* get all status */
177*25cf1a30Sjl #define	FIOMPGETALLSTAT	(FIOMPC|0x20)
178*25cf1a30Sjl struct fiomp_all_stat {
179*25cf1a30Sjl 	int	num;			/* number of paths */
180*25cf1a30Sjl 	struct	fiompstatus *status;	/* path status */
181*25cf1a30Sjl };
182*25cf1a30Sjl 
183*25cf1a30Sjl /* change the status of paths */
184*25cf1a30Sjl #define	FIOMPCHG	(FIOMPC|0x21)
185*25cf1a30Sjl struct fiompchg {
186*25cf1a30Sjl 	int num;			/* number of all paths */
187*25cf1a30Sjl 	struct	fiompstatus *set_status; /* setting values */
188*25cf1a30Sjl 	struct	fiompstatus *pre_status; /* previous values */
189*25cf1a30Sjl 	struct	fiompstatus *status;	/* current values */
190*25cf1a30Sjl };
191*25cf1a30Sjl 
192*25cf1a30Sjl /* recover the failed path */
193*25cf1a30Sjl #define	FIOMPRECOVER	(FIOMPC|0x22)
194*25cf1a30Sjl 
195*25cf1a30Sjl /* disconnect/reconnect the path */
196*25cf1a30Sjl #define	FIOMPDISCONNECT	(FIOMPC|0x23)
197*25cf1a30Sjl #define	FIOMPCONNECT	(FIOMPC|0x24)
198*25cf1a30Sjl 
199*25cf1a30Sjl /* keep 0x25 - 0x2f for reserve */
200*25cf1a30Sjl 
201*25cf1a30Sjl /*
202*25cf1a30Sjl  * Common ioctl
203*25cf1a30Sjl  */
204*25cf1a30Sjl /* get event */
205*25cf1a30Sjl #define	FIOMPGETEVENT	(FIOMPC|0x30)
206*25cf1a30Sjl struct fiompevent {
207*25cf1a30Sjl 	int	event;		/* event type = FIOMP_EVT_xx */
208*25cf1a30Sjl 	int	num;		/* instance number(meta management) or */
209*25cf1a30Sjl 				/* number of all path(instance management) */
210*25cf1a30Sjl 	struct	fiompstatus *pre_status; /* previous status */
211*25cf1a30Sjl 	struct	fiompstatus *status;	/* current status */
212*25cf1a30Sjl };
213*25cf1a30Sjl 
214*25cf1a30Sjl /* event type */
215*25cf1a30Sjl #define	FIOMP_EVT_NONE		0x0
216*25cf1a30Sjl #define	FIOMP_EVT_NEW		0x1
217*25cf1a30Sjl #define	FIOMP_EVT_DESTROY	0x2
218*25cf1a30Sjl #define	FIOMP_EVT_STAT		0x101
219*25cf1a30Sjl #define	FIOMP_EVT_PATHS		0x102
220*25cf1a30Sjl 
221*25cf1a30Sjl /*
222*25cf1a30Sjl  * Device property
223*25cf1a30Sjl  */
224*25cf1a30Sjl #define	FIOMP_PROP_NAME		"iomp-name"
225*25cf1a30Sjl #define	FIOMP_PROP_REAL_NAME	"iomp-real-name"
226*25cf1a30Sjl #define	FIOMP_PROP_PATH_N	"iomp-path-"
227*25cf1a30Sjl #define	FIOMP_PROP_USER_PATH	"iomp-user-path"
228*25cf1a30Sjl #define	FIOMP_PROP_LOGIC_PATH_N	"iomp-logical-path-"
229*25cf1a30Sjl #define	FIOMP_PROP_STATUS	"iomp-status"
230*25cf1a30Sjl #define	FIOMP_PROP_PATH_NUM	"iomp-path-num"
231*25cf1a30Sjl #define	FIOMP_PROP_STATUS_N	"iomp-path-status-"
232*25cf1a30Sjl 
233*25cf1a30Sjl #define	FIOMP_PROP_BLOCK_N	"iomp-path-block-"
234*25cf1a30Sjl #define	FIOMP_PROP_BLOCK_DEFAULT "iomp-path-block-default"
235*25cf1a30Sjl 
236*25cf1a30Sjl #ifdef	__cplusplus
237*25cf1a30Sjl }
238*25cf1a30Sjl #endif
239*25cf1a30Sjl 
240*25cf1a30Sjl #endif /* _FIOMP_H */
241