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