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 2005 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef	_SYS_SCSI_GENERIC_MODE_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_SCSI_GENERIC_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  *
38*7c478bd9Sstevel@tonic-gate  * Defines and Structures for SCSI Mode Sense/Select data - generic
39*7c478bd9Sstevel@tonic-gate  *
40*7c478bd9Sstevel@tonic-gate  */
41*7c478bd9Sstevel@tonic-gate 
42*7c478bd9Sstevel@tonic-gate /*
43*7c478bd9Sstevel@tonic-gate  * Structures and defines common for all device types
44*7c478bd9Sstevel@tonic-gate  */
45*7c478bd9Sstevel@tonic-gate 
46*7c478bd9Sstevel@tonic-gate /*
47*7c478bd9Sstevel@tonic-gate  * Mode Sense/Select Header - Group 0 (6-byte).
48*7c478bd9Sstevel@tonic-gate  *
49*7c478bd9Sstevel@tonic-gate  * Mode Sense/Select data consists of a header, followed by zero or more
50*7c478bd9Sstevel@tonic-gate  * block descriptors, followed by zero or more mode pages.
51*7c478bd9Sstevel@tonic-gate  *
52*7c478bd9Sstevel@tonic-gate  */
53*7c478bd9Sstevel@tonic-gate 
54*7c478bd9Sstevel@tonic-gate struct mode_header {
55*7c478bd9Sstevel@tonic-gate 	uchar_t length;		/* number of bytes following */
56*7c478bd9Sstevel@tonic-gate 	uchar_t medium_type;	/* device specific */
57*7c478bd9Sstevel@tonic-gate 	uchar_t device_specific;	/* device specific parameters */
58*7c478bd9Sstevel@tonic-gate 	uchar_t bdesc_length;	/* length of block descriptor(s), if any */
59*7c478bd9Sstevel@tonic-gate };
60*7c478bd9Sstevel@tonic-gate 
61*7c478bd9Sstevel@tonic-gate #define	MODE_HEADER_LENGTH	(sizeof (struct mode_header))
62*7c478bd9Sstevel@tonic-gate 
63*7c478bd9Sstevel@tonic-gate /*
64*7c478bd9Sstevel@tonic-gate  * Mode Sense/Select Header - Group 1 (10-bytes)
65*7c478bd9Sstevel@tonic-gate  */
66*7c478bd9Sstevel@tonic-gate 
67*7c478bd9Sstevel@tonic-gate struct mode_header_g1 {
68*7c478bd9Sstevel@tonic-gate 	ushort_t	length;		/* number of bytes following */
69*7c478bd9Sstevel@tonic-gate 	uchar_t		medium_type;	/* device specific */
70*7c478bd9Sstevel@tonic-gate 	uchar_t		device_specific;	/* device specific parameters */
71*7c478bd9Sstevel@tonic-gate 	uchar_t		reserved[2];	/* device specific parameters */
72*7c478bd9Sstevel@tonic-gate 	ushort_t	bdesc_length;	/* len of block descriptor(s), if any */
73*7c478bd9Sstevel@tonic-gate };
74*7c478bd9Sstevel@tonic-gate 
75*7c478bd9Sstevel@tonic-gate #define	MODE_HEADER_LENGTH_G1	(sizeof (struct mode_header_g1))
76*7c478bd9Sstevel@tonic-gate 
77*7c478bd9Sstevel@tonic-gate /*
78*7c478bd9Sstevel@tonic-gate  * Block Descriptor. Zero, one, or more may normally follow the mode header.
79*7c478bd9Sstevel@tonic-gate  *
80*7c478bd9Sstevel@tonic-gate  * The density code is device specific.
81*7c478bd9Sstevel@tonic-gate  *
82*7c478bd9Sstevel@tonic-gate  * The 24-bit value described by blks_{hi, mid, lo} describes the number of
83*7c478bd9Sstevel@tonic-gate  * blocks which this block descriptor applies to. A value of zero means
84*7c478bd9Sstevel@tonic-gate  * 'the rest of the blocks on the device'.
85*7c478bd9Sstevel@tonic-gate  *
86*7c478bd9Sstevel@tonic-gate  * The 24-bit value described by blksize_{hi, mid, lo} describes the blocksize
87*7c478bd9Sstevel@tonic-gate  * (in bytes) applicable for this block descriptor. For Sequential Access
88*7c478bd9Sstevel@tonic-gate  * devices, if this value is zero, the block size will be derived from
89*7c478bd9Sstevel@tonic-gate  * the transfer length in I/O operations.
90*7c478bd9Sstevel@tonic-gate  *
91*7c478bd9Sstevel@tonic-gate  */
92*7c478bd9Sstevel@tonic-gate 
93*7c478bd9Sstevel@tonic-gate struct block_descriptor {
94*7c478bd9Sstevel@tonic-gate 	uchar_t density_code;	/* device specific */
95*7c478bd9Sstevel@tonic-gate 	uchar_t blks_hi;	/* hi  */
96*7c478bd9Sstevel@tonic-gate 	uchar_t blks_mid;	/* mid */
97*7c478bd9Sstevel@tonic-gate 	uchar_t blks_lo;	/* low */
98*7c478bd9Sstevel@tonic-gate 	uchar_t reserved;	/* reserved */
99*7c478bd9Sstevel@tonic-gate 	uchar_t blksize_hi;	/* hi  */
100*7c478bd9Sstevel@tonic-gate 	uchar_t blksize_mid;	/* mid */
101*7c478bd9Sstevel@tonic-gate 	uchar_t blksize_lo;	/* low */
102*7c478bd9Sstevel@tonic-gate };
103*7c478bd9Sstevel@tonic-gate 
104*7c478bd9Sstevel@tonic-gate #define	MODE_BLK_DESC_LENGTH	(sizeof (struct block_descriptor))
105*7c478bd9Sstevel@tonic-gate #define	MODE_PARAM_LENGTH 	(MODE_HEADER_LENGTH + MODE_BLK_DESC_LENGTH)
106*7c478bd9Sstevel@tonic-gate 
107*7c478bd9Sstevel@tonic-gate /*
108*7c478bd9Sstevel@tonic-gate  * Define a macro to take an address of a mode header to the address
109*7c478bd9Sstevel@tonic-gate  * of the nth (0..n) block_descriptor, or NULL if there either aren't any
110*7c478bd9Sstevel@tonic-gate  * block descriptors or the nth block descriptor doesn't exist.
111*7c478bd9Sstevel@tonic-gate  */
112*7c478bd9Sstevel@tonic-gate 
113*7c478bd9Sstevel@tonic-gate #define	BLOCK_DESCRIPTOR_ADDR(mhdr, bdnum) \
114*7c478bd9Sstevel@tonic-gate 	((mhdr)->bdesc_length && ((unsigned)(bdnum)) < \
115*7c478bd9Sstevel@tonic-gate 	((mhdr)->bdesc_length/(sizeof (struct block_descriptor)))) ? \
116*7c478bd9Sstevel@tonic-gate 	((struct block_descriptor *)(((ulong_t)(mhdr))+MODE_HEADER_LENGTH+ \
117*7c478bd9Sstevel@tonic-gate 	((bdnum) * sizeof (struct block_descriptor)))) : \
118*7c478bd9Sstevel@tonic-gate 	((struct block_descriptor *)0)
119*7c478bd9Sstevel@tonic-gate 
120*7c478bd9Sstevel@tonic-gate /*
121*7c478bd9Sstevel@tonic-gate  * Mode page header. Zero or more Mode Pages follow either the block
122*7c478bd9Sstevel@tonic-gate  * descriptors (if any), or the Mode Header.
123*7c478bd9Sstevel@tonic-gate  *
124*7c478bd9Sstevel@tonic-gate  * The 'ps' bit must be zero for mode select operations.
125*7c478bd9Sstevel@tonic-gate  *
126*7c478bd9Sstevel@tonic-gate  */
127*7c478bd9Sstevel@tonic-gate 
128*7c478bd9Sstevel@tonic-gate struct mode_page {
129*7c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH)
130*7c478bd9Sstevel@tonic-gate 	uchar_t	code	:6,	/* page code number */
131*7c478bd9Sstevel@tonic-gate 			:1,	/* reserved */
132*7c478bd9Sstevel@tonic-gate 		ps	:1;	/* 'Parameter Saveable' bit */
133*7c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL)
134*7c478bd9Sstevel@tonic-gate 	uchar_t	ps	:1,	/* 'Parameter Saveable' bit */
135*7c478bd9Sstevel@tonic-gate 			:1,	/* reserved */
136*7c478bd9Sstevel@tonic-gate 		code	:6;	/* page code number */
137*7c478bd9Sstevel@tonic-gate #else
138*7c478bd9Sstevel@tonic-gate #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
139*7c478bd9Sstevel@tonic-gate #endif	/* _BIT_FIELDS_LTOH */
140*7c478bd9Sstevel@tonic-gate 	uchar_t	length;		/* length of bytes to follow */
141*7c478bd9Sstevel@tonic-gate 	/*
142*7c478bd9Sstevel@tonic-gate 	 * Mode Page specific data follows right after this...
143*7c478bd9Sstevel@tonic-gate 	 */
144*7c478bd9Sstevel@tonic-gate };
145*7c478bd9Sstevel@tonic-gate 
146*7c478bd9Sstevel@tonic-gate /*
147*7c478bd9Sstevel@tonic-gate  * Define a macro to retrieve the first mode page. Could be more
148*7c478bd9Sstevel@tonic-gate  * general (for multiple mode pages).
149*7c478bd9Sstevel@tonic-gate  */
150*7c478bd9Sstevel@tonic-gate 
151*7c478bd9Sstevel@tonic-gate #define	MODE_PAGE_ADDR(mhdr, type)	\
152*7c478bd9Sstevel@tonic-gate 	((type *)(((ulong_t)(mhdr))+MODE_HEADER_LENGTH+(mhdr)->bdesc_length))
153*7c478bd9Sstevel@tonic-gate 
154*7c478bd9Sstevel@tonic-gate /*
155*7c478bd9Sstevel@tonic-gate  * Page codes follow the following specification:
156*7c478bd9Sstevel@tonic-gate  *
157*7c478bd9Sstevel@tonic-gate  *	Code Value(s)		What
158*7c478bd9Sstevel@tonic-gate  *	----------------------------------------------------------------------
159*7c478bd9Sstevel@tonic-gate  *	0x00			Vendor Unique (does not require page format)
160*7c478bd9Sstevel@tonic-gate  *
161*7c478bd9Sstevel@tonic-gate  *	0x02, 0x09, 0x0A	pages for all Device Types
162*7c478bd9Sstevel@tonic-gate  *	0x1A, 0x1C
163*7c478bd9Sstevel@tonic-gate  *
164*7c478bd9Sstevel@tonic-gate  *	0x01, 0x03-0x08,	pages for specific Device Type
165*7c478bd9Sstevel@tonic-gate  *	0x0B-0x19, 0x1B,
166*7c478bd9Sstevel@tonic-gate  *	0x1D-0x1F
167*7c478bd9Sstevel@tonic-gate  *
168*7c478bd9Sstevel@tonic-gate  *	0x20-0x3E		Vendor Unique (requires page format)
169*7c478bd9Sstevel@tonic-gate  *
170*7c478bd9Sstevel@tonic-gate  *	0x3F			Return all pages (valid for Mode Sense only)
171*7c478bd9Sstevel@tonic-gate  *
172*7c478bd9Sstevel@tonic-gate  */
173*7c478bd9Sstevel@tonic-gate 
174*7c478bd9Sstevel@tonic-gate /*
175*7c478bd9Sstevel@tonic-gate  * Page codes and page length values (all device types)
176*7c478bd9Sstevel@tonic-gate  */
177*7c478bd9Sstevel@tonic-gate 
178*7c478bd9Sstevel@tonic-gate #define	MODEPAGE_DISCO_RECO	0x02
179*7c478bd9Sstevel@tonic-gate #define	MODEPAGE_CACHING	0x08
180*7c478bd9Sstevel@tonic-gate #define	MODEPAGE_PDEVICE	0x09
181*7c478bd9Sstevel@tonic-gate #define	MODEPAGE_CTRL_MODE	0x0A
182*7c478bd9Sstevel@tonic-gate #define	MODEPAGE_POWER_COND	0x1A
183*7c478bd9Sstevel@tonic-gate #define	MODEPAGE_INFO_EXCPT	0x1C
184*7c478bd9Sstevel@tonic-gate 
185*7c478bd9Sstevel@tonic-gate #define	MODEPAGE_ALLPAGES	0x3F
186*7c478bd9Sstevel@tonic-gate 
187*7c478bd9Sstevel@tonic-gate /*
188*7c478bd9Sstevel@tonic-gate  * Mode Select/Sense page structures (for all device types)
189*7c478bd9Sstevel@tonic-gate  */
190*7c478bd9Sstevel@tonic-gate 
191*7c478bd9Sstevel@tonic-gate /*
192*7c478bd9Sstevel@tonic-gate  * Disconnect/Reconnect Page
193*7c478bd9Sstevel@tonic-gate  */
194*7c478bd9Sstevel@tonic-gate 
195*7c478bd9Sstevel@tonic-gate struct mode_disco_reco {
196*7c478bd9Sstevel@tonic-gate 	struct	mode_page mode_page;	/* common mode page header */
197*7c478bd9Sstevel@tonic-gate 	uchar_t	buffer_full_ratio;	/* write, how full before reconnect? */
198*7c478bd9Sstevel@tonic-gate 	uchar_t	buffer_empty_ratio;	/* read, how full before reconnect? */
199*7c478bd9Sstevel@tonic-gate 	ushort_t bus_inactivity_limit;	/* how much bus quiet time for BSY- */
200*7c478bd9Sstevel@tonic-gate 	ushort_t disconect_time_limit;	/* min to remain disconnected */
201*7c478bd9Sstevel@tonic-gate 	ushort_t connect_time_limit;	/* min to remain connected */
202*7c478bd9Sstevel@tonic-gate 	ushort_t max_burst_size;	/* max data burst size */
203*7c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH)
204*7c478bd9Sstevel@tonic-gate 	uchar_t		dtdc	: 3,	/* data transfer disconenct control */
205*7c478bd9Sstevel@tonic-gate 			dimm	: 1,	/* disconnect immediate */
206*7c478bd9Sstevel@tonic-gate 			fastat	: 1,	/* fair for status */
207*7c478bd9Sstevel@tonic-gate 			fawrt	: 1,	/* fair for write */
208*7c478bd9Sstevel@tonic-gate 			fard	: 1,	/* fair for read */
209*7c478bd9Sstevel@tonic-gate 			emdp	: 1;	/* enable modify data pointers */
210*7c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL)
211*7c478bd9Sstevel@tonic-gate 	uchar_t		emdp	: 1,	/* enable modify data pointers */
212*7c478bd9Sstevel@tonic-gate 			fard	: 1,	/* fair for read */
213*7c478bd9Sstevel@tonic-gate 			fawrt	: 1,	/* fair for write */
214*7c478bd9Sstevel@tonic-gate 			fastat	: 1,	/* fair for status */
215*7c478bd9Sstevel@tonic-gate 			dimm	: 1,	/* disconnect immediate */
216*7c478bd9Sstevel@tonic-gate 			dtdc	: 3;	/* data transfer disconenct control */
217*7c478bd9Sstevel@tonic-gate #else
218*7c478bd9Sstevel@tonic-gate #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
219*7c478bd9Sstevel@tonic-gate #endif	/* _BIT_FIELDS_LTOH */
220*7c478bd9Sstevel@tonic-gate 	uchar_t	reserved;
221*7c478bd9Sstevel@tonic-gate 	ushort_t first_burst_sz;	/* first burst size */
222*7c478bd9Sstevel@tonic-gate };
223*7c478bd9Sstevel@tonic-gate 
224*7c478bd9Sstevel@tonic-gate #define	DTDC_DATADONE	0x01
225*7c478bd9Sstevel@tonic-gate 					/*
226*7c478bd9Sstevel@tonic-gate 					 * Target may not disconnect once
227*7c478bd9Sstevel@tonic-gate 					 * data transfer is started until
228*7c478bd9Sstevel@tonic-gate 					 * all data successfully transferred.
229*7c478bd9Sstevel@tonic-gate 					 */
230*7c478bd9Sstevel@tonic-gate 
231*7c478bd9Sstevel@tonic-gate #define	DTDC_CMDDONE	0x03
232*7c478bd9Sstevel@tonic-gate 					/*
233*7c478bd9Sstevel@tonic-gate 					 * Target may not disconnect once
234*7c478bd9Sstevel@tonic-gate 					 * data transfer is started until
235*7c478bd9Sstevel@tonic-gate 					 * command completed.
236*7c478bd9Sstevel@tonic-gate 					 */
237*7c478bd9Sstevel@tonic-gate /*
238*7c478bd9Sstevel@tonic-gate  * Caching Page
239*7c478bd9Sstevel@tonic-gate  */
240*7c478bd9Sstevel@tonic-gate 
241*7c478bd9Sstevel@tonic-gate struct mode_caching {
242*7c478bd9Sstevel@tonic-gate 	struct	mode_page mode_page;	/* common mode page header */
243*7c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH)
244*7c478bd9Sstevel@tonic-gate 	uchar_t	rcd		: 1,	/* Read Cache Disable */
245*7c478bd9Sstevel@tonic-gate 		mf		: 1,	/* Multiplication Factor */
246*7c478bd9Sstevel@tonic-gate 		wce		: 1,	/* Write Cache Enable */
247*7c478bd9Sstevel@tonic-gate 				: 5;	/* Reserved */
248*7c478bd9Sstevel@tonic-gate 	uchar_t	write_ret_prio	: 4,	/* Write Retention Priority */
249*7c478bd9Sstevel@tonic-gate 		dmd_rd_ret_prio	: 4;	/* Demand Read Retention Priority */
250*7c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL)
251*7c478bd9Sstevel@tonic-gate 	uchar_t			: 5,	/* Reserved */
252*7c478bd9Sstevel@tonic-gate 		wce		: 1,	/* Write Cache Enable */
253*7c478bd9Sstevel@tonic-gate 		mf		: 1,	/* Multiplication Factor */
254*7c478bd9Sstevel@tonic-gate 		rcd		: 1;	/* Read Cache Disable */
255*7c478bd9Sstevel@tonic-gate 	uchar_t	dmd_rd_ret_prio	: 4,	/* Demand Read Retention Priority */
256*7c478bd9Sstevel@tonic-gate 		write_ret_prio	: 4;	/* Write Retention Priority */
257*7c478bd9Sstevel@tonic-gate #else
258*7c478bd9Sstevel@tonic-gate #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
259*7c478bd9Sstevel@tonic-gate #endif	/* _BIT_FIELDS_LTOH */
260*7c478bd9Sstevel@tonic-gate 	ushort_t pf_dsbl_trans_len;	/* Disable prefetch transfer length */
261*7c478bd9Sstevel@tonic-gate 	ushort_t min_prefetch;		/* Minimum Prefetch */
262*7c478bd9Sstevel@tonic-gate 	ushort_t max_prefetch;		/* Maximum Prefetch */
263*7c478bd9Sstevel@tonic-gate 	ushort_t max_prefetch_ceiling;	/* Maximum Prefetch Ceiling */
264*7c478bd9Sstevel@tonic-gate };
265*7c478bd9Sstevel@tonic-gate 
266*7c478bd9Sstevel@tonic-gate /*
267*7c478bd9Sstevel@tonic-gate  * Peripheral Device Page
268*7c478bd9Sstevel@tonic-gate  */
269*7c478bd9Sstevel@tonic-gate 
270*7c478bd9Sstevel@tonic-gate struct mode_pdevice {
271*7c478bd9Sstevel@tonic-gate 	struct	mode_page mode_page;	/* common mode page header */
272*7c478bd9Sstevel@tonic-gate 	ushort_t if_ident;		/* interface identifier */
273*7c478bd9Sstevel@tonic-gate 	uchar_t	reserved[4];		/* reserved */
274*7c478bd9Sstevel@tonic-gate 	uchar_t	vendor_uniqe[1];	/* vendor unique data */
275*7c478bd9Sstevel@tonic-gate };
276*7c478bd9Sstevel@tonic-gate 
277*7c478bd9Sstevel@tonic-gate #define	PDEV_SCSI	0x0000		/* scsi interface */
278*7c478bd9Sstevel@tonic-gate #define	PDEV_SMD	0x0001		/* SMD interface */
279*7c478bd9Sstevel@tonic-gate #define	PDEV_ESDI	0x0002		/* ESDI interface */
280*7c478bd9Sstevel@tonic-gate #define	PDEV_IPI2	0x0003		/* IPI-2 interface */
281*7c478bd9Sstevel@tonic-gate #define	PDEV_IPI3	0x0004		/* IPI-3 interface */
282*7c478bd9Sstevel@tonic-gate 
283*7c478bd9Sstevel@tonic-gate /*
284*7c478bd9Sstevel@tonic-gate  * Control Mode Page
285*7c478bd9Sstevel@tonic-gate  *
286*7c478bd9Sstevel@tonic-gate  * Note:	This structure is incompatible with previous SCSI
287*7c478bd9Sstevel@tonic-gate  *		implementations. See <scsi/impl/mode.h> for an
288*7c478bd9Sstevel@tonic-gate  *		alternative form of this structure. They can be
289*7c478bd9Sstevel@tonic-gate  *		distinguished by the length of data returned
290*7c478bd9Sstevel@tonic-gate  *		from a MODE SENSE command.
291*7c478bd9Sstevel@tonic-gate  */
292*7c478bd9Sstevel@tonic-gate 
293*7c478bd9Sstevel@tonic-gate #define	PAGELENGTH_MODE_CONTROL_SCSI3	0x0A
294*7c478bd9Sstevel@tonic-gate 
295*7c478bd9Sstevel@tonic-gate struct mode_control_scsi3 {
296*7c478bd9Sstevel@tonic-gate 	struct	mode_page mode_page;	/* common mode page header */
297*7c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH)
298*7c478bd9Sstevel@tonic-gate 	uchar_t		rlec	: 1,	/* Report Log Exception bit */
299*7c478bd9Sstevel@tonic-gate 			gltsd	: 1,	/* global logging target save disable */
300*7c478bd9Sstevel@tonic-gate 			d_sense	: 1,	/* Use descriptor sense data (SPC-3) */
301*7c478bd9Sstevel@tonic-gate 				: 5;
302*7c478bd9Sstevel@tonic-gate 	uchar_t		qdisable: 1,	/* Queue disable */
303*7c478bd9Sstevel@tonic-gate 			que_err	: 1,	/* Queue error */
304*7c478bd9Sstevel@tonic-gate 				: 2,
305*7c478bd9Sstevel@tonic-gate 			que_mod : 4;    /* Queue algorithm modifier */
306*7c478bd9Sstevel@tonic-gate 	uchar_t		eanp	: 1,	/* Enable AEN permission */
307*7c478bd9Sstevel@tonic-gate 			uaaenp  : 1,	/* Unit attention AEN permission */
308*7c478bd9Sstevel@tonic-gate 			raenp   : 1,	/* Ready AEN permission */
309*7c478bd9Sstevel@tonic-gate 				: 1,
310*7c478bd9Sstevel@tonic-gate 			bybths	: 1,	/* By both RESET signal */
311*7c478bd9Sstevel@tonic-gate 			byprtm	: 1,	/* By port message */
312*7c478bd9Sstevel@tonic-gate 			rac	: 1,	/* report a check */
313*7c478bd9Sstevel@tonic-gate 			eeca	: 1;	/* enable extended contingent */
314*7c478bd9Sstevel@tonic-gate 					/* allegiance (only pre-SCSI-3) */
315*7c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL)
316*7c478bd9Sstevel@tonic-gate 	uchar_t			: 5,
317*7c478bd9Sstevel@tonic-gate 			d_sense	: 1,	/* Use descriptor sense data (SPC-3) */
318*7c478bd9Sstevel@tonic-gate 			gltsd	: 1,	/* global logging target save disable */
319*7c478bd9Sstevel@tonic-gate 			rlec	: 1;	/* Report Log Exception bit */
320*7c478bd9Sstevel@tonic-gate 	uchar_t		que_mod	: 4,	/* Queue algorithm modifier */
321*7c478bd9Sstevel@tonic-gate 				: 2,
322*7c478bd9Sstevel@tonic-gate 			que_err	: 1,	/* Queue error */
323*7c478bd9Sstevel@tonic-gate 			qdisable: 1;	/* Queue disable */
324*7c478bd9Sstevel@tonic-gate 	uchar_t		eeca	: 1,	/* enable extended contingent */
325*7c478bd9Sstevel@tonic-gate 					/* allegiance (only pre-SCSI-3) */
326*7c478bd9Sstevel@tonic-gate 			rac	: 1,	/* report a check */
327*7c478bd9Sstevel@tonic-gate 			byprtm	: 1,	/* By port message */
328*7c478bd9Sstevel@tonic-gate 			bybths	: 1,	/* By both RESET signal */
329*7c478bd9Sstevel@tonic-gate 				: 1,
330*7c478bd9Sstevel@tonic-gate 			raenp   : 1,	/* Ready AEN permission */
331*7c478bd9Sstevel@tonic-gate 			uaaenp  : 1,	/* Unit attention AEN permission */
332*7c478bd9Sstevel@tonic-gate 			eanp	: 1;	/* Enable AEN permission */
333*7c478bd9Sstevel@tonic-gate #else
334*7c478bd9Sstevel@tonic-gate #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
335*7c478bd9Sstevel@tonic-gate #endif	/* _BIT_FIELDS_LTOH */
336*7c478bd9Sstevel@tonic-gate 	uchar_t	reserved;
337*7c478bd9Sstevel@tonic-gate 	ushort_t ready_aen_holdoff;	/* Ready AEN holdoff period */
338*7c478bd9Sstevel@tonic-gate 	ushort_t busy_timeout;		/* Busy timeout period */
339*7c478bd9Sstevel@tonic-gate 	uchar_t	reserved_2[2];
340*7c478bd9Sstevel@tonic-gate };
341*7c478bd9Sstevel@tonic-gate 
342*7c478bd9Sstevel@tonic-gate #define	CTRL_QMOD_RESTRICT	0x0
343*7c478bd9Sstevel@tonic-gate #define	CTRL_QMOD_UNRESTRICT	0x1
344*7c478bd9Sstevel@tonic-gate 
345*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
346*7c478bd9Sstevel@tonic-gate }
347*7c478bd9Sstevel@tonic-gate #endif
348*7c478bd9Sstevel@tonic-gate 
349*7c478bd9Sstevel@tonic-gate /*
350*7c478bd9Sstevel@tonic-gate  * Include known generic device specific mode definitions and structures
351*7c478bd9Sstevel@tonic-gate  */
352*7c478bd9Sstevel@tonic-gate 
353*7c478bd9Sstevel@tonic-gate #include <sys/scsi/generic/dad_mode.h>
354*7c478bd9Sstevel@tonic-gate 
355*7c478bd9Sstevel@tonic-gate /*
356*7c478bd9Sstevel@tonic-gate  * Include implementation specific mode information
357*7c478bd9Sstevel@tonic-gate  */
358*7c478bd9Sstevel@tonic-gate 
359*7c478bd9Sstevel@tonic-gate #include <sys/scsi/impl/mode.h>
360*7c478bd9Sstevel@tonic-gate 
361*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_SCSI_GENERIC_MODE_H */
362