xref: /titanic_50/usr/src/uts/common/sys/scsi/impl/mode.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) 1996-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_SCSI_IMPL_MODE_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_SCSI_IMPL_MODE_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
33*7c478bd9Sstevel@tonic-gate extern "C" {
34*7c478bd9Sstevel@tonic-gate #endif
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate /*
37*7c478bd9Sstevel@tonic-gate  * Defines and Structures for SCSI Mode Sense/Select data
38*7c478bd9Sstevel@tonic-gate  *
39*7c478bd9Sstevel@tonic-gate  * Implementation Specific variations
40*7c478bd9Sstevel@tonic-gate  */
41*7c478bd9Sstevel@tonic-gate 
42*7c478bd9Sstevel@tonic-gate /*
43*7c478bd9Sstevel@tonic-gate  * Variations to Sequential Access device mode header
44*7c478bd9Sstevel@tonic-gate  */
45*7c478bd9Sstevel@tonic-gate struct 	modeheader_seq {
46*7c478bd9Sstevel@tonic-gate 	uchar_t	datalen;	/* sense data length */
47*7c478bd9Sstevel@tonic-gate 	uchar_t	mediumtype;	/* medium type */
48*7c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH)
49*7c478bd9Sstevel@tonic-gate 	uchar_t	speed	:4,	/* speed */
50*7c478bd9Sstevel@tonic-gate 		bufm	:3,	/* buffered mode */
51*7c478bd9Sstevel@tonic-gate 		wp	:1;	/* write protected */
52*7c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL)
53*7c478bd9Sstevel@tonic-gate 	uchar_t	wp	:1,	/* write protected */
54*7c478bd9Sstevel@tonic-gate 		bufm	:3,	/* buffered mode */
55*7c478bd9Sstevel@tonic-gate 		speed	:4;	/* speed */
56*7c478bd9Sstevel@tonic-gate #else
57*7c478bd9Sstevel@tonic-gate #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
58*7c478bd9Sstevel@tonic-gate #endif	/* _BIT_FIELDS_LTOH */
59*7c478bd9Sstevel@tonic-gate 	uchar_t	bd_len;		/* block length in bytes */
60*7c478bd9Sstevel@tonic-gate 	struct  block_descriptor blk_desc;
61*7c478bd9Sstevel@tonic-gate };
62*7c478bd9Sstevel@tonic-gate 
63*7c478bd9Sstevel@tonic-gate /*
64*7c478bd9Sstevel@tonic-gate  * Variations to Direct Access device pages
65*7c478bd9Sstevel@tonic-gate  */
66*7c478bd9Sstevel@tonic-gate 
67*7c478bd9Sstevel@tonic-gate /*
68*7c478bd9Sstevel@tonic-gate  * Page 1: CCS error recovery page was a little different than SCSI-2/3
69*7c478bd9Sstevel@tonic-gate  */
70*7c478bd9Sstevel@tonic-gate 
71*7c478bd9Sstevel@tonic-gate #define	PAGELENGTH_DAD_MODE_ERR_RECOV_CCS	0x06
72*7c478bd9Sstevel@tonic-gate 
73*7c478bd9Sstevel@tonic-gate struct mode_err_recov_ccs {
74*7c478bd9Sstevel@tonic-gate 	struct	mode_page mode_page;	/* common mode page header */
75*7c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH)
76*7c478bd9Sstevel@tonic-gate 	uchar_t		dcr	: 1,	/* disable correction */
77*7c478bd9Sstevel@tonic-gate 			dte	: 1,	/* disable transfer on error */
78*7c478bd9Sstevel@tonic-gate 			per	: 1,	/* post error */
79*7c478bd9Sstevel@tonic-gate 			eec	: 1,	/* enable early correction */
80*7c478bd9Sstevel@tonic-gate 			rc	: 1,	/* read continuous */
81*7c478bd9Sstevel@tonic-gate 			tb	: 1,	/* transfer block */
82*7c478bd9Sstevel@tonic-gate 			arre	: 1,	/* auto read realloc enabled */
83*7c478bd9Sstevel@tonic-gate 			awre	: 1;	/* auto write realloc enabled */
84*7c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL)
85*7c478bd9Sstevel@tonic-gate 	uchar_t		awre	: 1,	/* auto write realloc enabled */
86*7c478bd9Sstevel@tonic-gate 			arre	: 1,	/* auto read realloc enabled */
87*7c478bd9Sstevel@tonic-gate 			tb	: 1,	/* transfer block */
88*7c478bd9Sstevel@tonic-gate 			rc	: 1,	/* read continuous */
89*7c478bd9Sstevel@tonic-gate 			eec	: 1,	/* enable early correction */
90*7c478bd9Sstevel@tonic-gate 			per	: 1,	/* post error */
91*7c478bd9Sstevel@tonic-gate 			dte	: 1,	/* disable transfer on error */
92*7c478bd9Sstevel@tonic-gate 			dcr	: 1;	/* disable correction */
93*7c478bd9Sstevel@tonic-gate #else
94*7c478bd9Sstevel@tonic-gate #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
95*7c478bd9Sstevel@tonic-gate #endif	/* _BIT_FIELDS_LTOH */
96*7c478bd9Sstevel@tonic-gate 	uchar_t	retry_count;
97*7c478bd9Sstevel@tonic-gate 	uchar_t	correction_span;
98*7c478bd9Sstevel@tonic-gate 	uchar_t	head_offset_count;
99*7c478bd9Sstevel@tonic-gate 	uchar_t	strobe_offset_count;
100*7c478bd9Sstevel@tonic-gate 	uchar_t	recovery_time_limit;
101*7c478bd9Sstevel@tonic-gate };
102*7c478bd9Sstevel@tonic-gate 
103*7c478bd9Sstevel@tonic-gate /*
104*7c478bd9Sstevel@tonic-gate  * Page 3: CCS Direct Access Device Format Parameters
105*7c478bd9Sstevel@tonic-gate  *
106*7c478bd9Sstevel@tonic-gate  * The 0x8 bit in the Drive Type byte is used in CCS
107*7c478bd9Sstevel@tonic-gate  * as an INHIBIT SAVE bit. This bit is not in SCSI-2/3.
108*7c478bd9Sstevel@tonic-gate  */
109*7c478bd9Sstevel@tonic-gate 
110*7c478bd9Sstevel@tonic-gate #define	_reserved_ins	ins
111*7c478bd9Sstevel@tonic-gate 
112*7c478bd9Sstevel@tonic-gate /*
113*7c478bd9Sstevel@tonic-gate  * Page 8: SCSI-2 Cache page was a little different than SCSI-3
114*7c478bd9Sstevel@tonic-gate  */
115*7c478bd9Sstevel@tonic-gate 
116*7c478bd9Sstevel@tonic-gate #define	PAGELENGTH_DAD_MODE_CACHE	0x0A
117*7c478bd9Sstevel@tonic-gate 
118*7c478bd9Sstevel@tonic-gate struct mode_cache {
119*7c478bd9Sstevel@tonic-gate 	struct	mode_page mode_page;	/* common mode page header */
120*7c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH)
121*7c478bd9Sstevel@tonic-gate 	uchar_t		rcd	: 1,	/* Read Cache Disable */
122*7c478bd9Sstevel@tonic-gate 			mf	: 1,	/* Multiplication Factor */
123*7c478bd9Sstevel@tonic-gate 			wce	: 1,	/* Write Cache Enable */
124*7c478bd9Sstevel@tonic-gate 				: 5;
125*7c478bd9Sstevel@tonic-gate 	uchar_t	write_reten_pri	: 4,	/* Write Retention Priority */
126*7c478bd9Sstevel@tonic-gate 		read_reten_pri	: 4;	/* Demand Read Retention Priority */
127*7c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL)
128*7c478bd9Sstevel@tonic-gate 	uchar_t			: 5,
129*7c478bd9Sstevel@tonic-gate 			wce	: 1,	/* Write Cache Enable */
130*7c478bd9Sstevel@tonic-gate 			mf	: 1,	/* Multiplication Factor */
131*7c478bd9Sstevel@tonic-gate 			rcd	: 1;	/* Read Cache Disable */
132*7c478bd9Sstevel@tonic-gate 	uchar_t	read_reten_pri	: 4,	/* Demand Read Retention Priority */
133*7c478bd9Sstevel@tonic-gate 		write_reten_pri	: 4;	/* Write Retention Priority */
134*7c478bd9Sstevel@tonic-gate #else
135*7c478bd9Sstevel@tonic-gate #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
136*7c478bd9Sstevel@tonic-gate #endif	/* _BIT_FIELDS_LTOH */
137*7c478bd9Sstevel@tonic-gate 	ushort_t dis_prefetch_len;	/* Disable prefetch xfer length */
138*7c478bd9Sstevel@tonic-gate 	ushort_t min_prefetch;		/* minimum prefetch length */
139*7c478bd9Sstevel@tonic-gate 	ushort_t max_prefetch;		/* maximum prefetch length */
140*7c478bd9Sstevel@tonic-gate 	ushort_t prefetch_ceiling;	/* max prefetch ceiling */
141*7c478bd9Sstevel@tonic-gate };
142*7c478bd9Sstevel@tonic-gate 
143*7c478bd9Sstevel@tonic-gate /*
144*7c478bd9Sstevel@tonic-gate  * Page 0x38 - This is the CCS Cache Page
145*7c478bd9Sstevel@tonic-gate  */
146*7c478bd9Sstevel@tonic-gate 
147*7c478bd9Sstevel@tonic-gate struct mode_cache_ccs {
148*7c478bd9Sstevel@tonic-gate 	struct	mode_page mode_page;	/* common mode page header */
149*7c478bd9Sstevel@tonic-gate 	uchar_t	mode;			/* Cache control and size */
150*7c478bd9Sstevel@tonic-gate 	uchar_t	threshold;		/* Prefetch threshold */
151*7c478bd9Sstevel@tonic-gate 	uchar_t	max_prefetch;		/* Max. prefetch */
152*7c478bd9Sstevel@tonic-gate 	uchar_t	max_multiplier;		/* Max. prefetch multiplier */
153*7c478bd9Sstevel@tonic-gate 	uchar_t	min_prefetch;		/* Min. prefetch */
154*7c478bd9Sstevel@tonic-gate 	uchar_t	min_multiplier;		/* Min. prefetch multiplier */
155*7c478bd9Sstevel@tonic-gate 	uchar_t	rsvd2[8];
156*7c478bd9Sstevel@tonic-gate };
157*7c478bd9Sstevel@tonic-gate 
158*7c478bd9Sstevel@tonic-gate /*
159*7c478bd9Sstevel@tonic-gate  * Page A: SCSI-2 control page was a little different than SCSI-3
160*7c478bd9Sstevel@tonic-gate  */
161*7c478bd9Sstevel@tonic-gate 
162*7c478bd9Sstevel@tonic-gate #define	PAGELENGTH_MODE_CONTROL		0x06
163*7c478bd9Sstevel@tonic-gate 
164*7c478bd9Sstevel@tonic-gate struct mode_control {
165*7c478bd9Sstevel@tonic-gate 	struct	mode_page mode_page;	/* common mode page header */
166*7c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH)
167*7c478bd9Sstevel@tonic-gate 	uchar_t		rlec	: 1,	/* Report Log Exception bit */
168*7c478bd9Sstevel@tonic-gate 				: 7;
169*7c478bd9Sstevel@tonic-gate 	uchar_t		qdisable: 1,	/* Queue disable */
170*7c478bd9Sstevel@tonic-gate 			que_err	: 1,	/* Queue error */
171*7c478bd9Sstevel@tonic-gate 				: 2,
172*7c478bd9Sstevel@tonic-gate 			que_mod : 4;    /* Queue algorithm modifier */
173*7c478bd9Sstevel@tonic-gate 	uchar_t		eanp	: 1,
174*7c478bd9Sstevel@tonic-gate 			uaaenp  : 1,
175*7c478bd9Sstevel@tonic-gate 			raenp   : 1,
176*7c478bd9Sstevel@tonic-gate 				: 4,
177*7c478bd9Sstevel@tonic-gate 			eeca	: 1;
178*7c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL)
179*7c478bd9Sstevel@tonic-gate 	uchar_t			: 7,
180*7c478bd9Sstevel@tonic-gate 			rlec	: 1;	/* Report Log Exception bit */
181*7c478bd9Sstevel@tonic-gate 	uchar_t		que_mod	: 4,	/* Queue algorithm modifier */
182*7c478bd9Sstevel@tonic-gate 				: 2,
183*7c478bd9Sstevel@tonic-gate 			que_err	: 1,	/* Queue error */
184*7c478bd9Sstevel@tonic-gate 			qdisable: 1;	/* Queue disable */
185*7c478bd9Sstevel@tonic-gate 	uchar_t		eeca	: 1,
186*7c478bd9Sstevel@tonic-gate 				: 4,
187*7c478bd9Sstevel@tonic-gate 			raenp	: 1,
188*7c478bd9Sstevel@tonic-gate 			uaaenp	: 1,
189*7c478bd9Sstevel@tonic-gate 			eanp	: 1;
190*7c478bd9Sstevel@tonic-gate #else
191*7c478bd9Sstevel@tonic-gate #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
192*7c478bd9Sstevel@tonic-gate #endif	/* _BIT_FIELDS_LTOH */
193*7c478bd9Sstevel@tonic-gate 	uchar_t	reserved;
194*7c478bd9Sstevel@tonic-gate 	ushort_t ready_aen_holdoff;
195*7c478bd9Sstevel@tonic-gate };
196*7c478bd9Sstevel@tonic-gate 
197*7c478bd9Sstevel@tonic-gate 
198*7c478bd9Sstevel@tonic-gate /*
199*7c478bd9Sstevel@tonic-gate  * Emulex MD21 Unique Mode Select/Sense structure.
200*7c478bd9Sstevel@tonic-gate  * This is apparently not used, although the MD21
201*7c478bd9Sstevel@tonic-gate  * documentation refers to it.
202*7c478bd9Sstevel@tonic-gate  *
203*7c478bd9Sstevel@tonic-gate  * The medium_type in the mode header must be 0x80
204*7c478bd9Sstevel@tonic-gate  * to indicate a vendor unique format. There is then
205*7c478bd9Sstevel@tonic-gate  * a standard block descriptor page, which must be
206*7c478bd9Sstevel@tonic-gate  * zeros (although the block descriptor length is set
207*7c478bd9Sstevel@tonic-gate  * appropriately in the mode header).
208*7c478bd9Sstevel@tonic-gate  *
209*7c478bd9Sstevel@tonic-gate  * After this stuff, comes the vendor unique ESDI
210*7c478bd9Sstevel@tonic-gate  * format parameters for the MD21.
211*7c478bd9Sstevel@tonic-gate  *
212*7c478bd9Sstevel@tonic-gate  * Notes:
213*7c478bd9Sstevel@tonic-gate  *
214*7c478bd9Sstevel@tonic-gate  *	1) The logical number of sectors/track should be the
215*7c478bd9Sstevel@tonic-gate  *	number of physical sectors/track less the number spare
216*7c478bd9Sstevel@tonic-gate  *	sectors/track.
217*7c478bd9Sstevel@tonic-gate  *
218*7c478bd9Sstevel@tonic-gate  *	2) The logical number of cylinders should be the
219*7c478bd9Sstevel@tonic-gate  *	number of physical cylinders less three (3) reserved
220*7c478bd9Sstevel@tonic-gate  *	for use by the drive, and less any alternate cylinders
221*7c478bd9Sstevel@tonic-gate  *	allocated.
222*7c478bd9Sstevel@tonic-gate  *
223*7c478bd9Sstevel@tonic-gate  *	3) head skew- see MD21 manual.
224*7c478bd9Sstevel@tonic-gate  */
225*7c478bd9Sstevel@tonic-gate 
226*7c478bd9Sstevel@tonic-gate struct emulex_format_params {
227*7c478bd9Sstevel@tonic-gate 	uchar_t	alt_cyl;	/* number of alternate cylinders */
228*7c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH)
229*7c478bd9Sstevel@tonic-gate 	uchar_t		: 1,
230*7c478bd9Sstevel@tonic-gate 		sst	: 2,	/* spare sectors per track */
231*7c478bd9Sstevel@tonic-gate 		ssz	: 1,	/* sector size. 1 == 256 bps, 0 == 512 bps */
232*7c478bd9Sstevel@tonic-gate 		nheads	: 4;	/* number of heads */
233*7c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL)
234*7c478bd9Sstevel@tonic-gate 	uchar_t	nheads	: 4,	/* number of heads */
235*7c478bd9Sstevel@tonic-gate 		ssz	: 1,	/* sector size. 1 == 256 bps, 0 == 512 bps */
236*7c478bd9Sstevel@tonic-gate 		sst	: 2,	/* spare sectors per track */
237*7c478bd9Sstevel@tonic-gate 			: 1;
238*7c478bd9Sstevel@tonic-gate #else
239*7c478bd9Sstevel@tonic-gate #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
240*7c478bd9Sstevel@tonic-gate #endif	/* _BIT_FIELDS_LTOH */
241*7c478bd9Sstevel@tonic-gate 	uchar_t	nsect;		/* logical sectors/track */
242*7c478bd9Sstevel@tonic-gate 	uchar_t	ncyl_hi;	/* logical number of cylinders, msb */
243*7c478bd9Sstevel@tonic-gate 	uchar_t	ncyl_lo;	/* logical number of cylinders, lsb */
244*7c478bd9Sstevel@tonic-gate 	uchar_t	head_skew;	/* head skew */
245*7c478bd9Sstevel@tonic-gate 	uchar_t	reserved[3];
246*7c478bd9Sstevel@tonic-gate };
247*7c478bd9Sstevel@tonic-gate 
248*7c478bd9Sstevel@tonic-gate /*
249*7c478bd9Sstevel@tonic-gate  * Page 0x31: CD-ROM speed page
250*7c478bd9Sstevel@tonic-gate  */
251*7c478bd9Sstevel@tonic-gate 
252*7c478bd9Sstevel@tonic-gate #define	CDROM_MODE_SPEED	0x31
253*7c478bd9Sstevel@tonic-gate 
254*7c478bd9Sstevel@tonic-gate struct mode_speed {
255*7c478bd9Sstevel@tonic-gate 	struct	mode_page mode_page;	/* common mode page header */
256*7c478bd9Sstevel@tonic-gate 	uchar_t	speed;			/* drive speed */
257*7c478bd9Sstevel@tonic-gate 	uchar_t	reserved;
258*7c478bd9Sstevel@tonic-gate };
259*7c478bd9Sstevel@tonic-gate 
260*7c478bd9Sstevel@tonic-gate /*
261*7c478bd9Sstevel@tonic-gate  * Definitions for drive speed supported are in cdio.h
262*7c478bd9Sstevel@tonic-gate  */
263*7c478bd9Sstevel@tonic-gate 
264*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
265*7c478bd9Sstevel@tonic-gate }
266*7c478bd9Sstevel@tonic-gate #endif
267*7c478bd9Sstevel@tonic-gate 
268*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_SCSI_IMPL_MODE_H */
269