xref: /titanic_50/usr/src/uts/sun/sys/dkmpio.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright (c) 1991,1997-1998 by Sun Microsystems, Inc.
24*7c478bd9Sstevel@tonic-gate  * All rights reserved.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef	_SYS_DKMPIO_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_DKMPIO_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate /* from dualport: dkmpio.h 1.5 91/04/11 SMI	*/
32*7c478bd9Sstevel@tonic-gate 
33*7c478bd9Sstevel@tonic-gate /*
34*7c478bd9Sstevel@tonic-gate  * Structures and definitions for multi port disk io control commands
35*7c478bd9Sstevel@tonic-gate  */
36*7c478bd9Sstevel@tonic-gate 
37*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
38*7c478bd9Sstevel@tonic-gate extern "C" {
39*7c478bd9Sstevel@tonic-gate #endif
40*7c478bd9Sstevel@tonic-gate 
41*7c478bd9Sstevel@tonic-gate /*
42*7c478bd9Sstevel@tonic-gate  * Disk driver multi port state.
43*7c478bd9Sstevel@tonic-gate  * dk_gmpstate.dkg_mpstate and dk_smpstate.dks_mpstate values.
44*7c478bd9Sstevel@tonic-gate  */
45*7c478bd9Sstevel@tonic-gate enum dk_mpstate { DKS_INITIAL, DKS_OFFLINE, DKS_ONLINE, DKS_FREEZE};
46*7c478bd9Sstevel@tonic-gate 
47*7c478bd9Sstevel@tonic-gate /*
48*7c478bd9Sstevel@tonic-gate  * Disk drive protocol types
49*7c478bd9Sstevel@tonic-gate  * dk_mpinfo.dke_mptype values.
50*7c478bd9Sstevel@tonic-gate  */
51*7c478bd9Sstevel@tonic-gate enum dk_mptype { DKT_IPI, DKT_SCSI, DKT_UNKNOWN };
52*7c478bd9Sstevel@tonic-gate 
53*7c478bd9Sstevel@tonic-gate /*
54*7c478bd9Sstevel@tonic-gate  * Used for getting disk driver multi port state and status
55*7c478bd9Sstevel@tonic-gate  */
56*7c478bd9Sstevel@tonic-gate struct dk_gmpstate {
57*7c478bd9Sstevel@tonic-gate 	enum dk_mpstate	dkg_mpstate;		/* output: current state */
58*7c478bd9Sstevel@tonic-gate 	uint_t		dkg_fail_state;		/* output: fail state */
59*7c478bd9Sstevel@tonic-gate 	uint_t		dkg_current_status; /* output: current drive status */
60*7c478bd9Sstevel@tonic-gate 	int		dkg_pad[4];		/* Pads for future use */
61*7c478bd9Sstevel@tonic-gate };
62*7c478bd9Sstevel@tonic-gate 
63*7c478bd9Sstevel@tonic-gate /*
64*7c478bd9Sstevel@tonic-gate  * Used for setting driver multi port state and status
65*7c478bd9Sstevel@tonic-gate  */
66*7c478bd9Sstevel@tonic-gate struct dk_smpstate {
67*7c478bd9Sstevel@tonic-gate 	enum dk_mpstate	dks_mpstate;		/* input: requested state */
68*7c478bd9Sstevel@tonic-gate 	int		dks_pad[2];		/* Pads for future use */
69*7c478bd9Sstevel@tonic-gate };
70*7c478bd9Sstevel@tonic-gate 
71*7c478bd9Sstevel@tonic-gate /*
72*7c478bd9Sstevel@tonic-gate  * flags for current status, ro
73*7c478bd9Sstevel@tonic-gate  * dk_gmpstate.dkg_current_status definitions.
74*7c478bd9Sstevel@tonic-gate  */
75*7c478bd9Sstevel@tonic-gate #define	DKF_DRV_RESERVED	0x00000001	/* drive reserved */
76*7c478bd9Sstevel@tonic-gate #define	DKF_DRV_DUAL_ENABLED	0x00000002	/* both ports are enabled */
77*7c478bd9Sstevel@tonic-gate #define	DKF_DRV_RESET		0x00000004	/* drive was reset */
78*7c478bd9Sstevel@tonic-gate #define	DKF_DRV_WRTPROT		0x00000008	/* drive was write protect */
79*7c478bd9Sstevel@tonic-gate #define	DKF_DRV_BUSY		0x00000010	/* drive seems busy */
80*7c478bd9Sstevel@tonic-gate #define	DKF_DRV_TIMEOUT		0x00000020	/* drive timed out */
81*7c478bd9Sstevel@tonic-gate #define	DKF_DRV_DUALPORTED	0x00000040	/* drive is used dual ported */
82*7c478bd9Sstevel@tonic-gate #define	DKF_DRV_ALTRSVD		0x00000080	/* Alternate port reserved */
83*7c478bd9Sstevel@tonic-gate #define	DKF_ADAPT_RESERVED	0x00000100	/* host adaptor reserved */
84*7c478bd9Sstevel@tonic-gate #define	DKF_ADAPT_RESET		0x00000400	/* host adaptor was reset */
85*7c478bd9Sstevel@tonic-gate #define	DKF_ADAPT_BUSY		0x00001000	/* host adaptor seems busy */
86*7c478bd9Sstevel@tonic-gate #define	DKF_ADAPT_TIMEOUT	0x00002000	/* host adaptor timed out */
87*7c478bd9Sstevel@tonic-gate #define	DKF_CTLR_RESERVED	0x00010000	/* ctlr reserved */
88*7c478bd9Sstevel@tonic-gate #define	DKF_CTLR_RESET		0x00040000	/* ctlr was reset */
89*7c478bd9Sstevel@tonic-gate #define	DKF_CTLR_BUSY		0x00100000	/* host adaptor seems busy */
90*7c478bd9Sstevel@tonic-gate #define	DKF_CTLR_TIMEOUT	0x02000000	/* host adaptor timed out */
91*7c478bd9Sstevel@tonic-gate 
92*7c478bd9Sstevel@tonic-gate /*
93*7c478bd9Sstevel@tonic-gate  * Volatile disk drive fail state flags, ro
94*7c478bd9Sstevel@tonic-gate  * dk_gmpstate.dkg_fail_state flags definitions.
95*7c478bd9Sstevel@tonic-gate  */
96*7c478bd9Sstevel@tonic-gate #define	DKF_DRV_RSV_LOST	0x00000001	/* drive lost reservation */
97*7c478bd9Sstevel@tonic-gate #define	DKF_CTLR_RSV_LOST	0x00000002	/* ctlr lost reservation */
98*7c478bd9Sstevel@tonic-gate #define	DKF_DRV_DIAGNOSED	0x00000004	/* drive self diag. */
99*7c478bd9Sstevel@tonic-gate 						/* reports error */
100*7c478bd9Sstevel@tonic-gate #define	DKF_CTLR_DIAGNOSED	0x00000008	/* ctlr self diag. */
101*7c478bd9Sstevel@tonic-gate 						/* reports error */
102*7c478bd9Sstevel@tonic-gate #define	DKF_ADAPT_DIAGNOSED	0x00000010	/* host adapt. self diag. */
103*7c478bd9Sstevel@tonic-gate 						/* reports error */
104*7c478bd9Sstevel@tonic-gate #define	DKF_DRV_FAILED		0x00001000	/* drive failure */
105*7c478bd9Sstevel@tonic-gate #define	DKF_CTLR_FAILED		0x00100000	/* controller failure */
106*7c478bd9Sstevel@tonic-gate #define	DKF_ADAPT_FAILED	0x10000000	/* host adaptor failure */
107*7c478bd9Sstevel@tonic-gate 
108*7c478bd9Sstevel@tonic-gate /*
109*7c478bd9Sstevel@tonic-gate  * Used for getting disk drive error counts
110*7c478bd9Sstevel@tonic-gate  */
111*7c478bd9Sstevel@tonic-gate struct dk_mpdrv_status {
112*7c478bd9Sstevel@tonic-gate 	uint_t	dkd_cum_drv_soft_errors; /* cumulative drive soft errors */
113*7c478bd9Sstevel@tonic-gate 	uint_t	dkd_cum_drv_hard_errors; /* cumulative drive media errors */
114*7c478bd9Sstevel@tonic-gate 	uint_t	dkd_cum_drv_retries;	/* cumulative successful drive */
115*7c478bd9Sstevel@tonic-gate 					/* retries on media errors */
116*7c478bd9Sstevel@tonic-gate 	int	dkd_pad[4];		/* Pads for future use */
117*7c478bd9Sstevel@tonic-gate };
118*7c478bd9Sstevel@tonic-gate 
119*7c478bd9Sstevel@tonic-gate /*
120*7c478bd9Sstevel@tonic-gate  * Used to set/get the configuration and control/status flags
121*7c478bd9Sstevel@tonic-gate  */
122*7c478bd9Sstevel@tonic-gate struct dk_mpflags {
123*7c478bd9Sstevel@tonic-gate 	uint_t	dkf_config_flags;		/* config flags, ro */
124*7c478bd9Sstevel@tonic-gate 	uint_t	dkf_control_flags;		/* control flags, rw */
125*7c478bd9Sstevel@tonic-gate 	int	dkf_pad[4];			/* Pads for future use */
126*7c478bd9Sstevel@tonic-gate };
127*7c478bd9Sstevel@tonic-gate 
128*7c478bd9Sstevel@tonic-gate /*
129*7c478bd9Sstevel@tonic-gate  * Volatile disk drive configuration status flags, ro
130*7c478bd9Sstevel@tonic-gate  * dk_mpflags.dkf_config_flags definitions.
131*7c478bd9Sstevel@tonic-gate  */
132*7c478bd9Sstevel@tonic-gate #define	DKF_DRV_NOEXIST		0x00000001	/* non-existent drive */
133*7c478bd9Sstevel@tonic-gate #define	DKF_CTLR_NOEXIST	0x00000002	/* non-existent controller */
134*7c478bd9Sstevel@tonic-gate #define	DKF_ADAPT_NOEXIST	0x00000004	/* non-existent host adaptor */
135*7c478bd9Sstevel@tonic-gate 
136*7c478bd9Sstevel@tonic-gate /*
137*7c478bd9Sstevel@tonic-gate  * Non-destructive configuration control flags, r/w
138*7c478bd9Sstevel@tonic-gate  * dk_mpflags.dkf_control_flags definitions.
139*7c478bd9Sstevel@tonic-gate  */
140*7c478bd9Sstevel@tonic-gate #define	DKF_ORDERED		0x00000001	/* write ordering of sectors */
141*7c478bd9Sstevel@tonic-gate #define	DKF_PANIC_ABORT		0x00000002	/* commands aborted at panic */
142*7c478bd9Sstevel@tonic-gate #define	DKF_RERUN_UNR_CMDS	0x00000004	/* rerun commands after reset */
143*7c478bd9Sstevel@tonic-gate 						/* on unreserved unit occurs */
144*7c478bd9Sstevel@tonic-gate #define	DKF_RERUN_RSV_CMDS	0x00000008	/* rerun commands after reset */
145*7c478bd9Sstevel@tonic-gate 						/* on reserved unit occurs */
146*7c478bd9Sstevel@tonic-gate #define	DKF_AUTOFAIL		0x00000010	/* make drive/ctlr/adapter */
147*7c478bd9Sstevel@tonic-gate 						/* unavailable after a */
148*7c478bd9Sstevel@tonic-gate 						/* failure */
149*7c478bd9Sstevel@tonic-gate 
150*7c478bd9Sstevel@tonic-gate 
151*7c478bd9Sstevel@tonic-gate 
152*7c478bd9Sstevel@tonic-gate /*
153*7c478bd9Sstevel@tonic-gate  * Extended info: used for getting all the multi port info
154*7c478bd9Sstevel@tonic-gate  */
155*7c478bd9Sstevel@tonic-gate struct dk_mpinfo {
156*7c478bd9Sstevel@tonic-gate 	struct dk_gmpstate	dke_mpstate; /* current state & drive status */
157*7c478bd9Sstevel@tonic-gate 	struct dk_mpflags	dke_mpflags;	/* config/control flags */
158*7c478bd9Sstevel@tonic-gate 	struct dk_mpdrv_status	dke_mpdrv_status; /* cumulative for errors */
159*7c478bd9Sstevel@tonic-gate 	enum dk_mptype		dke_mptype;	/* drive type */
160*7c478bd9Sstevel@tonic-gate 	int			dke_qcapacity;	/* min freeze queue capacity */
161*7c478bd9Sstevel@tonic-gate 	uint_t			dke_max_quiesce; /* maxtime to quiesce drive */
162*7c478bd9Sstevel@tonic-gate 	int			dke_pad[4];	/* Pads for future use */
163*7c478bd9Sstevel@tonic-gate };
164*7c478bd9Sstevel@tonic-gate 
165*7c478bd9Sstevel@tonic-gate /*
166*7c478bd9Sstevel@tonic-gate  * Used for reserve, release, reset, abort, probe and reinitialization.
167*7c478bd9Sstevel@tonic-gate  * May use with the "common command list" flags.
168*7c478bd9Sstevel@tonic-gate  */
169*7c478bd9Sstevel@tonic-gate struct dk_mpcmd {
170*7c478bd9Sstevel@tonic-gate 	uint_t		dkc_mpcmd;		/* command */
171*7c478bd9Sstevel@tonic-gate 	uint_t		dkc_mpflags;		/* execution flags */
172*7c478bd9Sstevel@tonic-gate 	caddr_t		dkc_bufaddr;		/* user's buffer address */
173*7c478bd9Sstevel@tonic-gate 	uint_t 		dkc_buflen;		/* size of user's buffer */
174*7c478bd9Sstevel@tonic-gate 	int		dkc_pad[4];		/* Pads for future use */
175*7c478bd9Sstevel@tonic-gate };
176*7c478bd9Sstevel@tonic-gate 
177*7c478bd9Sstevel@tonic-gate /*
178*7c478bd9Sstevel@tonic-gate  * Common command list, for all protocols.
179*7c478bd9Sstevel@tonic-gate  * dk_mpcmd.dkc_mpcmd definitions.
180*7c478bd9Sstevel@tonic-gate  */
181*7c478bd9Sstevel@tonic-gate #define	DKF_RESERVE	0x00000001		/* reserve drive */
182*7c478bd9Sstevel@tonic-gate #define	DKF_RELEASE	0x00000002		/* release drive */
183*7c478bd9Sstevel@tonic-gate #define	DKF_RESET	0x00000004		/* reset drive */
184*7c478bd9Sstevel@tonic-gate #define	DKF_ABORT	0x00000008		/* abort all cmds */
185*7c478bd9Sstevel@tonic-gate #define	DKF_PROBE	0x00000010		/* ping drive */
186*7c478bd9Sstevel@tonic-gate #define	DKF_REINIT	0x00000020		/* reinitialize drive */
187*7c478bd9Sstevel@tonic-gate 
188*7c478bd9Sstevel@tonic-gate /*
189*7c478bd9Sstevel@tonic-gate  * Execution flags.
190*7c478bd9Sstevel@tonic-gate  * dk_mpcmd.dkc_mpflags definitions.
191*7c478bd9Sstevel@tonic-gate  */
192*7c478bd9Sstevel@tonic-gate #define	DKF_DIAGNOSE	0x00000001	/* fail if any error occurs */
193*7c478bd9Sstevel@tonic-gate #define	DKF_ISOLATE	0x00000002	/* isolate from normal commands */
194*7c478bd9Sstevel@tonic-gate #define	DKF_READ	0x00000004	/* get data from device */
195*7c478bd9Sstevel@tonic-gate #define	DKF_WRITE	0x00000008	/* send data to device */
196*7c478bd9Sstevel@tonic-gate #define	DKF_DESTRUCTIVE	0x00000010	/* destructive action ok */
197*7c478bd9Sstevel@tonic-gate 
198*7c478bd9Sstevel@tonic-gate /*
199*7c478bd9Sstevel@tonic-gate  * Disk io control commands
200*7c478bd9Sstevel@tonic-gate  */
201*7c478bd9Sstevel@tonic-gate #define	DKIOCGMPINFO	(DIOC | 90) /* struct dk_mpinfo Get mp info */
202*7c478bd9Sstevel@tonic-gate #define	DKIOCGMPSTATE	(DIOC | 91) /* struct dk_gmpstate Get mp state */
203*7c478bd9Sstevel@tonic-gate #define	DKIOCSMPSTATE	(DIOC | 92) /* struct dk_smpstate Set mp state */
204*7c478bd9Sstevel@tonic-gate #define	DKIOCGSTATUS	(DIOC | 93) /* struct dk_mpdrv_status Get drv status */
205*7c478bd9Sstevel@tonic-gate #define	DKIOCGMPFLAGS	(DIOC | 94) /* struct dk_mpflags Get mp flags */
206*7c478bd9Sstevel@tonic-gate #define	DKIOCSMPFLAGS	(DIOC | 95) /* struct dk_mpflags Set mp flags */
207*7c478bd9Sstevel@tonic-gate #define	DKIOCSMPCMD	(DIOC | 96) /* struct dk_mpcmd Set generic mp cmd */
208*7c478bd9Sstevel@tonic-gate 
209*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
210*7c478bd9Sstevel@tonic-gate }
211*7c478bd9Sstevel@tonic-gate #endif
212*7c478bd9Sstevel@tonic-gate 
213*7c478bd9Sstevel@tonic-gate #endif	/* !_SYS_DKMPIO_H */
214