xref: /illumos-gate/usr/src/uts/common/sys/scsi/generic/dad_mode.h (revision e5803b76927480e8f9b67b22201c484ccf4c2bcf)
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) 1996-1998 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef	_SYS_SCSI_GENERIC_DAD_MODE_H
28 #define	_SYS_SCSI_GENERIC_DAD_MODE_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * Structures and defines for DIRECT ACCESS mode sense/select operations
38  */
39 
40 /*
41  * Direct Access Device mode header device specific byte definitions.
42  *
43  * On MODE SELECT operations, the effect of the state of the WP bit is unknown,
44  * else reflects the Write-Protect status of the device.
45  *
46  * On MODE SELECT operations, the the DPOFUA bit is reserved and must
47  * be zero, else on MODE SENSE operations it reflects whether or not
48  * DPO and FUA bits are supported.
49  */
50 
51 #define	MODE_DAD_WP	0x80
52 #define	MODE_DAD_DPOFUA	0x10
53 
54 /*
55  * Direct Access Device Medium Types (for non direct-access magentic tapes)
56  */
57 
58 #define	DAD_MTYP_DFLT	0x0 /* default (currently mounted) type */
59 
60 #define	DAD_MTYP_FLXSS	0x1 /* flexible disk, single side, unspec. media */
61 #define	DAD_MTYP_FLXDS	0x2 /* flexible disk, double side, unspec. media */
62 
63 #define	DAD_MTYP_FLX_8SSSD 0x05	/* 8", single side, single density, 48tpi */
64 #define	DAD_MTYP_FLX_8DSSD 0x06	/* 8", double side, single density, 48tpi */
65 #define	DAD_MTYP_FLX_8SSDD 0x09	/* 8", single side, double density, 48tpi */
66 #define	DAD_MTYP_FLX_8DSDD 0x0A	/* 8", double side, double density, 48tpi */
67 #define	DAD_MTYP_FLX_5SSLD 0x0D	/* 5.25", single side, single density, 48tpi */
68 #define	DAD_MTYP_FLX_5DSMD1 0x12 /* 5.25", double side, medium density, 48tpi */
69 #define	DAD_MTYP_FLX_5DSMD2 0x16 /* 5.25", double side, medium density, 96tpi */
70 #define	DAD_MTYP_FLX_5DSQD 0x1A	/* 5.25", double side, quad density, 96tpi */
71 #define	DAD_MTYP_FLX_3DSLD 0x1E	/* 3.5", double side, low density, 135tpi */
72 
73 
74 /*
75  * Direct Access device Mode Sense/Mode Select Defined pages
76  */
77 
78 #define	DAD_MODE_ERR_RECOV	0x01
79 #define	DAD_MODE_FORMAT		0x03
80 #define	DAD_MODE_GEOMETRY	0x04
81 #define	DAD_MODE_FLEXDISK	0x05
82 #define	DAD_MODE_VRFY_ERR_RECOV	0x07
83 #define	DAD_MODE_CACHE		0x08
84 #define	DAD_MODE_MEDIA_TYPES	0x0B
85 #define	DAD_MODE_NOTCHPART	0x0C
86 #define	DAD_MODE_POWER_COND	0x0D
87 
88 /*
89  * Definitions of selected pages
90  */
91 
92 /*
93  * Page 0x1 - Error Recovery Parameters
94  *
95  * Note:	This structure is incompatible with previous SCSI
96  *		implementations. See <scsi/impl/mode.h> for an
97  *		alternative form of this structure. They can be
98  *		distinguished by the length of data returned
99  *		from a MODE SENSE command.
100  */
101 
102 #define	PAGELENGTH_DAD_MODE_ERR_RECOV	0x0A
103 
104 struct mode_err_recov {
105 	struct	mode_page mode_page;	/* common mode page header */
106 #if defined(_BIT_FIELDS_LTOH)
107 	uchar_t		dcr	: 1,	/* disable correction */
108 			dte	: 1,	/* disable transfer on error */
109 			per	: 1,	/* post error */
110 			eec	: 1,	/* enable early correction */
111 			rc	: 1,	/* read continuous */
112 			tb	: 1,	/* transfer block */
113 			arre	: 1,	/* auto read realloc enabled */
114 			awre	: 1;	/* auto write realloc enabled */
115 #elif defined(_BIT_FIELDS_HTOL)
116 	uchar_t		awre	: 1,	/* auto write realloc enabled */
117 			arre	: 1,	/* auto read realloc enabled */
118 			tb	: 1,	/* transfer block */
119 			rc	: 1,	/* read continuous */
120 			eec	: 1,	/* enable early correction */
121 			per	: 1,	/* post error */
122 			dte	: 1,	/* disable transfer on error */
123 			dcr	: 1;	/* disable correction */
124 #else
125 #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
126 #endif	/* _BIT_FIELDS_LTOH */
127 	uchar_t	read_retry_count;
128 	uchar_t	correction_span;
129 	uchar_t	head_offset_count;
130 	uchar_t	strobe_offset_count;
131 	uchar_t	reserved;
132 	uchar_t	write_retry_count;
133 	uchar_t	reserved_2;
134 	ushort_t recovery_time_limit;
135 };
136 
137 /*
138  * Page 0x3 - Direct Access Device Format Parameters
139  */
140 
141 struct mode_format {
142 	struct	mode_page mode_page;	/* common mode page header */
143 	ushort_t tracks_per_zone;	/* Handling of Defects Fields */
144 	ushort_t alt_sect_zone;
145 	ushort_t alt_tracks_zone;
146 	ushort_t alt_tracks_vol;
147 	ushort_t sect_track;		/* Track Format Field */
148 	ushort_t data_bytes_sect;	/* Sector Format Fields */
149 	ushort_t interleave;
150 	ushort_t track_skew;
151 	ushort_t cylinder_skew;
152 #if defined(_BIT_FIELDS_LTOH)
153 	uchar_t			: 3,
154 		_reserved_ins	: 1,	/* see <scsi/impl/mode.h> */
155 			surf	: 1,
156 			rmb	: 1,
157 			hsec	: 1,
158 			ssec	: 1;	/* Drive Type Field */
159 #elif defined(_BIT_FIELDS_HTOL)
160 	uchar_t		ssec	: 1,	/* Drive Type Field */
161 			hsec	: 1,
162 			rmb	: 1,
163 			surf	: 1,
164 		_reserved_ins	: 1,	/* see <scsi/impl/mode.h> */
165 				: 3;
166 #else
167 #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
168 #endif	/* _BIT_FIELDS_LTOH */
169 	uchar_t	reserved[2];
170 };
171 
172 /*
173  * Page 0x4 - Rigid Disk Drive Geometry Parameters
174  */
175 
176 struct mode_geometry {
177 	struct	mode_page mode_page;	/* common mode page header */
178 	uchar_t	cyl_ub;			/* number of cylinders */
179 	uchar_t	cyl_mb;
180 	uchar_t	cyl_lb;
181 	uchar_t	heads;			/* number of heads */
182 	uchar_t	precomp_cyl_ub;		/* cylinder to start precomp */
183 	uchar_t	precomp_cyl_mb;
184 	uchar_t	precomp_cyl_lb;
185 	uchar_t	current_cyl_ub;		/* cyl to start reduced current */
186 	uchar_t	current_cyl_mb;
187 	uchar_t	current_cyl_lb;
188 	ushort_t step_rate;		/* drive step rate */
189 	uchar_t	landing_cyl_ub;		/* landing zone cylinder */
190 	uchar_t	landing_cyl_mb;
191 	uchar_t	landing_cyl_lb;
192 #if defined(_BIT_FIELDS_LTOH)
193 	uchar_t		rpl	: 2,	/* rotational position locking */
194 				: 6;
195 #elif defined(_BIT_FIELDS_HTOL)
196 	uchar_t			: 6,
197 			rpl	: 2;	/* rotational position locking */
198 #else
199 #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
200 #endif	/* _BIT_FIELDS_LTOH */
201 	uchar_t	rotational_offset;	/* rotational offset */
202 	uchar_t	reserved;
203 	ushort_t rpm;			/* rotations per minute */
204 	uchar_t	reserved2[2];
205 };
206 
207 #define	RPL_SPINDLE_SLAVE		1
208 #define	RPL_SPINDLE_MASTER		2
209 #define	RPL_SPINDLE_MASTER_CONTROL	3
210 
211 /*
212  * Page 0x8 - Caching Page
213  *
214  * Note:	This structure is incompatible with previous SCSI
215  *		implementations. See <scsi/impl/mode.h> for an
216  *		alternative form of this structure. They can be
217  *		distinguished by the length of data returned
218  *		from a MODE SENSE command.
219  */
220 
221 #define	PAGELENGTH_DAD_MODE_CACHE_SCSI3	0x12
222 
223 struct mode_cache_scsi3 {
224 	struct	mode_page mode_page;	/* common mode page header */
225 #if defined(_BIT_FIELDS_LTOH)
226 	uchar_t		rcd	: 1,	/* Read Cache Disable */
227 			mf	: 1,	/* Multiplication Factor */
228 			wce	: 1,	/* Write Cache Enable */
229 			size	: 1,	/* Size Enable */
230 			disc	: 1,	/* Discontinuity */
231 			cap	: 1,	/* Caching Analysis Permitted */
232 			abpf	: 1,	/* Abort Pre-Fetch */
233 			ic	: 1;	/* Initiator Control */
234 	uchar_t	write_reten_pri	: 4,	/* Write Retention Priority */
235 		read_reten_pri	: 4;	/* Demand Read Retention Priority */
236 #elif defined(_BIT_FIELDS_HTOL)
237 	uchar_t		ic	: 1,	/* Initiator Control */
238 			abpf	: 1,	/* Abort Pre-Fetch */
239 			cap	: 1,	/* Caching Analysis Permitted */
240 			disc	: 1,	/* Discontinuity */
241 			size	: 1,	/* Size Enable */
242 			wce	: 1,	/* Write Cache Enable */
243 			mf	: 1,	/* Multiplication Factor */
244 			rcd	: 1;	/* Read Cache Disable */
245 	uchar_t	read_reten_pri	: 4,	/* Demand Read Retention Priority */
246 		write_reten_pri	: 4;	/* Write Retention Priority */
247 #else
248 #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
249 #endif	/* _BIT_FIELDS_LTOH */
250 	ushort_t dis_prefetch_len;	/* Disable prefetch xfer length */
251 	ushort_t min_prefetch;		/* minimum prefetch length */
252 	ushort_t max_prefetch;		/* maximum prefetch length */
253 	ushort_t prefetch_ceiling;	/* max prefetch ceiling */
254 #if defined(_BIT_FIELDS_LTOH)
255 	uchar_t			: 3,	/* reserved */
256 			vu_123	: 1,	/* Vendor Specific, byte 12 bit 3 */
257 			vu_124	: 1,	/* Vendor Specific, byte 12 bit 4 */
258 			dra	: 1,	/* Disable Read-Ahead */
259 			lbcss	: 1,	/* Logical Block Cache Segment Size */
260 			fsw	: 1;	/* Force Sequential Write */
261 #elif defined(_BIT_FIELDS_HTOL)
262 	uchar_t		fsw	: 1,	/* Force Sequential Write */
263 			lbcss	: 1,	/* Logical Block Cache Segment Size */
264 			dra	: 1,	/* Disable Read-Ahead */
265 			vu_124	: 1,	/* Vendor Specific, byte 12 bit 4 */
266 			vu_123	: 1,	/* Vendor Specific, byte 12 bit 3 */
267 				: 3;	/* reserved */
268 #else
269 #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
270 #endif	/* _BIT_FIELDS_LTOH */
271 	uchar_t	num_cache_seg;		/* Number of cache segments */
272 	ushort_t cache_seg_size;	/* Cache segment size */
273 	uchar_t	reserved;
274 	uchar_t	non_cache_seg_size_ub;	/* Non cache segment size */
275 	uchar_t	non_cache_seg_size_mb;
276 	uchar_t	non_cache_seg_size_lb;
277 };
278 
279 #ifdef	__cplusplus
280 }
281 #endif
282 
283 #endif	/* _SYS_SCSI_GENERIC_DAD_MODE_H */
284