summaryrefslogtreecommitdiff
path: root/usr/src/uts/sun/sys/dkmpio.h
blob: 9d9dbd9bc5945897e88e696d385f46aedbeee389 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright (c) 1991,1997-1998 by Sun Microsystems, Inc.
 * All rights reserved.
 */

#ifndef	_SYS_DKMPIO_H
#define	_SYS_DKMPIO_H

#pragma ident	"%Z%%M%	%I%	%E% SMI"
/* from dualport: dkmpio.h 1.5 91/04/11 SMI	*/

/*
 * Structures and definitions for multi port disk io control commands
 */

#ifdef __cplusplus
extern "C" {
#endif

/*
 * Disk driver multi port state.
 * dk_gmpstate.dkg_mpstate and dk_smpstate.dks_mpstate values.
 */
enum dk_mpstate { DKS_INITIAL, DKS_OFFLINE, DKS_ONLINE, DKS_FREEZE};

/*
 * Disk drive protocol types
 * dk_mpinfo.dke_mptype values.
 */
enum dk_mptype { DKT_IPI, DKT_SCSI, DKT_UNKNOWN };

/*
 * Used for getting disk driver multi port state and status
 */
struct dk_gmpstate {
	enum dk_mpstate	dkg_mpstate;		/* output: current state */
	uint_t		dkg_fail_state;		/* output: fail state */
	uint_t		dkg_current_status; /* output: current drive status */
	int		dkg_pad[4];		/* Pads for future use */
};

/*
 * Used for setting driver multi port state and status
 */
struct dk_smpstate {
	enum dk_mpstate	dks_mpstate;		/* input: requested state */
	int		dks_pad[2];		/* Pads for future use */
};

/*
 * flags for current status, ro
 * dk_gmpstate.dkg_current_status definitions.
 */
#define	DKF_DRV_RESERVED	0x00000001	/* drive reserved */
#define	DKF_DRV_DUAL_ENABLED	0x00000002	/* both ports are enabled */
#define	DKF_DRV_RESET		0x00000004	/* drive was reset */
#define	DKF_DRV_WRTPROT		0x00000008	/* drive was write protect */
#define	DKF_DRV_BUSY		0x00000010	/* drive seems busy */
#define	DKF_DRV_TIMEOUT		0x00000020	/* drive timed out */
#define	DKF_DRV_DUALPORTED	0x00000040	/* drive is used dual ported */
#define	DKF_DRV_ALTRSVD		0x00000080	/* Alternate port reserved */
#define	DKF_ADAPT_RESERVED	0x00000100	/* host adaptor reserved */
#define	DKF_ADAPT_RESET		0x00000400	/* host adaptor was reset */
#define	DKF_ADAPT_BUSY		0x00001000	/* host adaptor seems busy */
#define	DKF_ADAPT_TIMEOUT	0x00002000	/* host adaptor timed out */
#define	DKF_CTLR_RESERVED	0x00010000	/* ctlr reserved */
#define	DKF_CTLR_RESET		0x00040000	/* ctlr was reset */
#define	DKF_CTLR_BUSY		0x00100000	/* host adaptor seems busy */
#define	DKF_CTLR_TIMEOUT	0x02000000	/* host adaptor timed out */

/*
 * Volatile disk drive fail state flags, ro
 * dk_gmpstate.dkg_fail_state flags definitions.
 */
#define	DKF_DRV_RSV_LOST	0x00000001	/* drive lost reservation */
#define	DKF_CTLR_RSV_LOST	0x00000002	/* ctlr lost reservation */
#define	DKF_DRV_DIAGNOSED	0x00000004	/* drive self diag. */
						/* reports error */
#define	DKF_CTLR_DIAGNOSED	0x00000008	/* ctlr self diag. */
						/* reports error */
#define	DKF_ADAPT_DIAGNOSED	0x00000010	/* host adapt. self diag. */
						/* reports error */
#define	DKF_DRV_FAILED		0x00001000	/* drive failure */
#define	DKF_CTLR_FAILED		0x00100000	/* controller failure */
#define	DKF_ADAPT_FAILED	0x10000000	/* host adaptor failure */

/*
 * Used for getting disk drive error counts
 */
struct dk_mpdrv_status {
	uint_t	dkd_cum_drv_soft_errors; /* cumulative drive soft errors */
	uint_t	dkd_cum_drv_hard_errors; /* cumulative drive media errors */
	uint_t	dkd_cum_drv_retries;	/* cumulative successful drive */
					/* retries on media errors */
	int	dkd_pad[4];		/* Pads for future use */
};

/*
 * Used to set/get the configuration and control/status flags
 */
struct dk_mpflags {
	uint_t	dkf_config_flags;		/* config flags, ro */
	uint_t	dkf_control_flags;		/* control flags, rw */
	int	dkf_pad[4];			/* Pads for future use */
};

/*
 * Volatile disk drive configuration status flags, ro
 * dk_mpflags.dkf_config_flags definitions.
 */
#define	DKF_DRV_NOEXIST		0x00000001	/* non-existent drive */
#define	DKF_CTLR_NOEXIST	0x00000002	/* non-existent controller */
#define	DKF_ADAPT_NOEXIST	0x00000004	/* non-existent host adaptor */

/*
 * Non-destructive configuration control flags, r/w
 * dk_mpflags.dkf_control_flags definitions.
 */
#define	DKF_ORDERED		0x00000001	/* write ordering of sectors */
#define	DKF_PANIC_ABORT		0x00000002	/* commands aborted at panic */
#define	DKF_RERUN_UNR_CMDS	0x00000004	/* rerun commands after reset */
						/* on unreserved unit occurs */
#define	DKF_RERUN_RSV_CMDS	0x00000008	/* rerun commands after reset */
						/* on reserved unit occurs */
#define	DKF_AUTOFAIL		0x00000010	/* make drive/ctlr/adapter */
						/* unavailable after a */
						/* failure */



/*
 * Extended info: used for getting all the multi port info
 */
struct dk_mpinfo {
	struct dk_gmpstate	dke_mpstate; /* current state & drive status */
	struct dk_mpflags	dke_mpflags;	/* config/control flags */
	struct dk_mpdrv_status	dke_mpdrv_status; /* cumulative for errors */
	enum dk_mptype		dke_mptype;	/* drive type */
	int			dke_qcapacity;	/* min freeze queue capacity */
	uint_t			dke_max_quiesce; /* maxtime to quiesce drive */
	int			dke_pad[4];	/* Pads for future use */
};

/*
 * Used for reserve, release, reset, abort, probe and reinitialization.
 * May use with the "common command list" flags.
 */
struct dk_mpcmd {
	uint_t		dkc_mpcmd;		/* command */
	uint_t		dkc_mpflags;		/* execution flags */
	caddr_t		dkc_bufaddr;		/* user's buffer address */
	uint_t 		dkc_buflen;		/* size of user's buffer */
	int		dkc_pad[4];		/* Pads for future use */
};

/*
 * Common command list, for all protocols.
 * dk_mpcmd.dkc_mpcmd definitions.
 */
#define	DKF_RESERVE	0x00000001		/* reserve drive */
#define	DKF_RELEASE	0x00000002		/* release drive */
#define	DKF_RESET	0x00000004		/* reset drive */
#define	DKF_ABORT	0x00000008		/* abort all cmds */
#define	DKF_PROBE	0x00000010		/* ping drive */
#define	DKF_REINIT	0x00000020		/* reinitialize drive */

/*
 * Execution flags.
 * dk_mpcmd.dkc_mpflags definitions.
 */
#define	DKF_DIAGNOSE	0x00000001	/* fail if any error occurs */
#define	DKF_ISOLATE	0x00000002	/* isolate from normal commands */
#define	DKF_READ	0x00000004	/* get data from device */
#define	DKF_WRITE	0x00000008	/* send data to device */
#define	DKF_DESTRUCTIVE	0x00000010	/* destructive action ok */

/*
 * Disk io control commands
 */
#define	DKIOCGMPINFO	(DIOC | 90) /* struct dk_mpinfo Get mp info */
#define	DKIOCGMPSTATE	(DIOC | 91) /* struct dk_gmpstate Get mp state */
#define	DKIOCSMPSTATE	(DIOC | 92) /* struct dk_smpstate Set mp state */
#define	DKIOCGSTATUS	(DIOC | 93) /* struct dk_mpdrv_status Get drv status */
#define	DKIOCGMPFLAGS	(DIOC | 94) /* struct dk_mpflags Get mp flags */
#define	DKIOCSMPFLAGS	(DIOC | 95) /* struct dk_mpflags Set mp flags */
#define	DKIOCSMPCMD	(DIOC | 96) /* struct dk_mpcmd Set generic mp cmd */

#ifdef __cplusplus
}
#endif

#endif	/* !_SYS_DKMPIO_H */