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