xref: /onnv-gate/usr/src/uts/common/sys/scsi/generic/mode.h (revision 10131:7fe254ca5fe8)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
51675Sls24207  * Common Development and Distribution License (the "License").
61675Sls24207  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*10131SJane.Chu@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_SYS_SCSI_GENERIC_MODE_H
270Sstevel@tonic-gate #define	_SYS_SCSI_GENERIC_MODE_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #ifdef	__cplusplus
300Sstevel@tonic-gate extern "C" {
310Sstevel@tonic-gate #endif
320Sstevel@tonic-gate 
330Sstevel@tonic-gate /*
340Sstevel@tonic-gate  *
350Sstevel@tonic-gate  * Defines and Structures for SCSI Mode Sense/Select data - generic
360Sstevel@tonic-gate  *
370Sstevel@tonic-gate  */
380Sstevel@tonic-gate 
390Sstevel@tonic-gate /*
400Sstevel@tonic-gate  * Structures and defines common for all device types
410Sstevel@tonic-gate  */
420Sstevel@tonic-gate 
430Sstevel@tonic-gate /*
440Sstevel@tonic-gate  * Mode Sense/Select Header - Group 0 (6-byte).
450Sstevel@tonic-gate  *
460Sstevel@tonic-gate  * Mode Sense/Select data consists of a header, followed by zero or more
470Sstevel@tonic-gate  * block descriptors, followed by zero or more mode pages.
480Sstevel@tonic-gate  *
490Sstevel@tonic-gate  */
500Sstevel@tonic-gate 
510Sstevel@tonic-gate struct mode_header {
520Sstevel@tonic-gate 	uchar_t length;		/* number of bytes following */
530Sstevel@tonic-gate 	uchar_t medium_type;	/* device specific */
540Sstevel@tonic-gate 	uchar_t device_specific;	/* device specific parameters */
550Sstevel@tonic-gate 	uchar_t bdesc_length;	/* length of block descriptor(s), if any */
560Sstevel@tonic-gate };
570Sstevel@tonic-gate 
580Sstevel@tonic-gate #define	MODE_HEADER_LENGTH	(sizeof (struct mode_header))
590Sstevel@tonic-gate 
600Sstevel@tonic-gate /*
610Sstevel@tonic-gate  * Mode Sense/Select Header - Group 1 (10-bytes)
620Sstevel@tonic-gate  */
630Sstevel@tonic-gate 
640Sstevel@tonic-gate struct mode_header_g1 {
650Sstevel@tonic-gate 	ushort_t	length;		/* number of bytes following */
660Sstevel@tonic-gate 	uchar_t		medium_type;	/* device specific */
670Sstevel@tonic-gate 	uchar_t		device_specific;	/* device specific parameters */
680Sstevel@tonic-gate 	uchar_t		reserved[2];	/* device specific parameters */
690Sstevel@tonic-gate 	ushort_t	bdesc_length;	/* len of block descriptor(s), if any */
700Sstevel@tonic-gate };
710Sstevel@tonic-gate 
720Sstevel@tonic-gate #define	MODE_HEADER_LENGTH_G1	(sizeof (struct mode_header_g1))
730Sstevel@tonic-gate 
740Sstevel@tonic-gate /*
750Sstevel@tonic-gate  * Block Descriptor. Zero, one, or more may normally follow the mode header.
760Sstevel@tonic-gate  *
770Sstevel@tonic-gate  * The density code is device specific.
780Sstevel@tonic-gate  *
790Sstevel@tonic-gate  * The 24-bit value described by blks_{hi, mid, lo} describes the number of
800Sstevel@tonic-gate  * blocks which this block descriptor applies to. A value of zero means
810Sstevel@tonic-gate  * 'the rest of the blocks on the device'.
820Sstevel@tonic-gate  *
830Sstevel@tonic-gate  * The 24-bit value described by blksize_{hi, mid, lo} describes the blocksize
840Sstevel@tonic-gate  * (in bytes) applicable for this block descriptor. For Sequential Access
850Sstevel@tonic-gate  * devices, if this value is zero, the block size will be derived from
860Sstevel@tonic-gate  * the transfer length in I/O operations.
870Sstevel@tonic-gate  *
880Sstevel@tonic-gate  */
890Sstevel@tonic-gate 
900Sstevel@tonic-gate struct block_descriptor {
910Sstevel@tonic-gate 	uchar_t density_code;	/* device specific */
920Sstevel@tonic-gate 	uchar_t blks_hi;	/* hi  */
930Sstevel@tonic-gate 	uchar_t blks_mid;	/* mid */
940Sstevel@tonic-gate 	uchar_t blks_lo;	/* low */
950Sstevel@tonic-gate 	uchar_t reserved;	/* reserved */
960Sstevel@tonic-gate 	uchar_t blksize_hi;	/* hi  */
970Sstevel@tonic-gate 	uchar_t blksize_mid;	/* mid */
980Sstevel@tonic-gate 	uchar_t blksize_lo;	/* low */
990Sstevel@tonic-gate };
1000Sstevel@tonic-gate 
1010Sstevel@tonic-gate #define	MODE_BLK_DESC_LENGTH	(sizeof (struct block_descriptor))
1020Sstevel@tonic-gate #define	MODE_PARAM_LENGTH 	(MODE_HEADER_LENGTH + MODE_BLK_DESC_LENGTH)
1030Sstevel@tonic-gate 
1040Sstevel@tonic-gate /*
1050Sstevel@tonic-gate  * Define a macro to take an address of a mode header to the address
1060Sstevel@tonic-gate  * of the nth (0..n) block_descriptor, or NULL if there either aren't any
1070Sstevel@tonic-gate  * block descriptors or the nth block descriptor doesn't exist.
1080Sstevel@tonic-gate  */
1090Sstevel@tonic-gate 
1100Sstevel@tonic-gate #define	BLOCK_DESCRIPTOR_ADDR(mhdr, bdnum) \
1110Sstevel@tonic-gate 	((mhdr)->bdesc_length && ((unsigned)(bdnum)) < \
1120Sstevel@tonic-gate 	((mhdr)->bdesc_length/(sizeof (struct block_descriptor)))) ? \
1130Sstevel@tonic-gate 	((struct block_descriptor *)(((ulong_t)(mhdr))+MODE_HEADER_LENGTH+ \
1140Sstevel@tonic-gate 	((bdnum) * sizeof (struct block_descriptor)))) : \
1150Sstevel@tonic-gate 	((struct block_descriptor *)0)
1160Sstevel@tonic-gate 
1170Sstevel@tonic-gate /*
1180Sstevel@tonic-gate  * Mode page header. Zero or more Mode Pages follow either the block
1190Sstevel@tonic-gate  * descriptors (if any), or the Mode Header.
1200Sstevel@tonic-gate  *
1210Sstevel@tonic-gate  * The 'ps' bit must be zero for mode select operations.
1220Sstevel@tonic-gate  *
1230Sstevel@tonic-gate  */
1240Sstevel@tonic-gate 
1250Sstevel@tonic-gate struct mode_page {
1260Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH)
1270Sstevel@tonic-gate 	uchar_t	code	:6,	/* page code number */
1280Sstevel@tonic-gate 			:1,	/* reserved */
1290Sstevel@tonic-gate 		ps	:1;	/* 'Parameter Saveable' bit */
1300Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL)
1310Sstevel@tonic-gate 	uchar_t	ps	:1,	/* 'Parameter Saveable' bit */
1320Sstevel@tonic-gate 			:1,	/* reserved */
1330Sstevel@tonic-gate 		code	:6;	/* page code number */
1340Sstevel@tonic-gate #else
1350Sstevel@tonic-gate #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
1360Sstevel@tonic-gate #endif	/* _BIT_FIELDS_LTOH */
1370Sstevel@tonic-gate 	uchar_t	length;		/* length of bytes to follow */
1380Sstevel@tonic-gate 	/*
1390Sstevel@tonic-gate 	 * Mode Page specific data follows right after this...
1400Sstevel@tonic-gate 	 */
1410Sstevel@tonic-gate };
1420Sstevel@tonic-gate 
1430Sstevel@tonic-gate /*
1440Sstevel@tonic-gate  * Define a macro to retrieve the first mode page. Could be more
1450Sstevel@tonic-gate  * general (for multiple mode pages).
1460Sstevel@tonic-gate  */
1470Sstevel@tonic-gate 
1480Sstevel@tonic-gate #define	MODE_PAGE_ADDR(mhdr, type)	\
1490Sstevel@tonic-gate 	((type *)(((ulong_t)(mhdr))+MODE_HEADER_LENGTH+(mhdr)->bdesc_length))
1500Sstevel@tonic-gate 
1510Sstevel@tonic-gate /*
1520Sstevel@tonic-gate  * Page codes follow the following specification:
1530Sstevel@tonic-gate  *
1540Sstevel@tonic-gate  *	Code Value(s)		What
1550Sstevel@tonic-gate  *	----------------------------------------------------------------------
1560Sstevel@tonic-gate  *	0x00			Vendor Unique (does not require page format)
1570Sstevel@tonic-gate  *
1580Sstevel@tonic-gate  *	0x02, 0x09, 0x0A	pages for all Device Types
1590Sstevel@tonic-gate  *	0x1A, 0x1C
1600Sstevel@tonic-gate  *
1610Sstevel@tonic-gate  *	0x01, 0x03-0x08,	pages for specific Device Type
1620Sstevel@tonic-gate  *	0x0B-0x19, 0x1B,
1630Sstevel@tonic-gate  *	0x1D-0x1F
1640Sstevel@tonic-gate  *
1650Sstevel@tonic-gate  *	0x20-0x3E		Vendor Unique (requires page format)
1660Sstevel@tonic-gate  *
1670Sstevel@tonic-gate  *	0x3F			Return all pages (valid for Mode Sense only)
1680Sstevel@tonic-gate  *
1690Sstevel@tonic-gate  */
1700Sstevel@tonic-gate 
1710Sstevel@tonic-gate /*
1720Sstevel@tonic-gate  * Page codes and page length values (all device types)
1730Sstevel@tonic-gate  */
1740Sstevel@tonic-gate 
1750Sstevel@tonic-gate #define	MODEPAGE_DISCO_RECO	0x02
1760Sstevel@tonic-gate #define	MODEPAGE_CACHING	0x08
1770Sstevel@tonic-gate #define	MODEPAGE_PDEVICE	0x09
1780Sstevel@tonic-gate #define	MODEPAGE_CTRL_MODE	0x0A
1790Sstevel@tonic-gate #define	MODEPAGE_POWER_COND	0x1A
1800Sstevel@tonic-gate #define	MODEPAGE_INFO_EXCPT	0x1C
1810Sstevel@tonic-gate 
1820Sstevel@tonic-gate #define	MODEPAGE_ALLPAGES	0x3F
1830Sstevel@tonic-gate 
1840Sstevel@tonic-gate /*
1850Sstevel@tonic-gate  * Mode Select/Sense page structures (for all device types)
1860Sstevel@tonic-gate  */
1870Sstevel@tonic-gate 
1880Sstevel@tonic-gate /*
1890Sstevel@tonic-gate  * Disconnect/Reconnect Page
1900Sstevel@tonic-gate  */
1910Sstevel@tonic-gate 
1920Sstevel@tonic-gate struct mode_disco_reco {
1930Sstevel@tonic-gate 	struct	mode_page mode_page;	/* common mode page header */
1940Sstevel@tonic-gate 	uchar_t	buffer_full_ratio;	/* write, how full before reconnect? */
1950Sstevel@tonic-gate 	uchar_t	buffer_empty_ratio;	/* read, how full before reconnect? */
1960Sstevel@tonic-gate 	ushort_t bus_inactivity_limit;	/* how much bus quiet time for BSY- */
1970Sstevel@tonic-gate 	ushort_t disconect_time_limit;	/* min to remain disconnected */
1980Sstevel@tonic-gate 	ushort_t connect_time_limit;	/* min to remain connected */
1990Sstevel@tonic-gate 	ushort_t max_burst_size;	/* max data burst size */
2000Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH)
2010Sstevel@tonic-gate 	uchar_t		dtdc	: 3,	/* data transfer disconenct control */
2020Sstevel@tonic-gate 			dimm	: 1,	/* disconnect immediate */
2030Sstevel@tonic-gate 			fastat	: 1,	/* fair for status */
2040Sstevel@tonic-gate 			fawrt	: 1,	/* fair for write */
2050Sstevel@tonic-gate 			fard	: 1,	/* fair for read */
2060Sstevel@tonic-gate 			emdp	: 1;	/* enable modify data pointers */
2070Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL)
2080Sstevel@tonic-gate 	uchar_t		emdp	: 1,	/* enable modify data pointers */
2090Sstevel@tonic-gate 			fard	: 1,	/* fair for read */
2100Sstevel@tonic-gate 			fawrt	: 1,	/* fair for write */
2110Sstevel@tonic-gate 			fastat	: 1,	/* fair for status */
2120Sstevel@tonic-gate 			dimm	: 1,	/* disconnect immediate */
2130Sstevel@tonic-gate 			dtdc	: 3;	/* data transfer disconenct control */
2140Sstevel@tonic-gate #else
2150Sstevel@tonic-gate #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
2160Sstevel@tonic-gate #endif	/* _BIT_FIELDS_LTOH */
2170Sstevel@tonic-gate 	uchar_t	reserved;
2180Sstevel@tonic-gate 	ushort_t first_burst_sz;	/* first burst size */
2190Sstevel@tonic-gate };
2200Sstevel@tonic-gate 
2210Sstevel@tonic-gate #define	DTDC_DATADONE	0x01
2220Sstevel@tonic-gate 					/*
2230Sstevel@tonic-gate 					 * Target may not disconnect once
2240Sstevel@tonic-gate 					 * data transfer is started until
2250Sstevel@tonic-gate 					 * all data successfully transferred.
2260Sstevel@tonic-gate 					 */
2270Sstevel@tonic-gate 
2280Sstevel@tonic-gate #define	DTDC_CMDDONE	0x03
2290Sstevel@tonic-gate 					/*
2300Sstevel@tonic-gate 					 * Target may not disconnect once
2310Sstevel@tonic-gate 					 * data transfer is started until
2320Sstevel@tonic-gate 					 * command completed.
2330Sstevel@tonic-gate 					 */
2340Sstevel@tonic-gate /*
2350Sstevel@tonic-gate  * Caching Page
2360Sstevel@tonic-gate  */
2370Sstevel@tonic-gate 
2380Sstevel@tonic-gate struct mode_caching {
2390Sstevel@tonic-gate 	struct	mode_page mode_page;	/* common mode page header */
2400Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH)
2410Sstevel@tonic-gate 	uchar_t	rcd		: 1,	/* Read Cache Disable */
2420Sstevel@tonic-gate 		mf		: 1,	/* Multiplication Factor */
2430Sstevel@tonic-gate 		wce		: 1,	/* Write Cache Enable */
2440Sstevel@tonic-gate 				: 5;	/* Reserved */
2450Sstevel@tonic-gate 	uchar_t	write_ret_prio	: 4,	/* Write Retention Priority */
2460Sstevel@tonic-gate 		dmd_rd_ret_prio	: 4;	/* Demand Read Retention Priority */
2470Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL)
2480Sstevel@tonic-gate 	uchar_t			: 5,	/* Reserved */
2490Sstevel@tonic-gate 		wce		: 1,	/* Write Cache Enable */
2500Sstevel@tonic-gate 		mf		: 1,	/* Multiplication Factor */
2510Sstevel@tonic-gate 		rcd		: 1;	/* Read Cache Disable */
2520Sstevel@tonic-gate 	uchar_t	dmd_rd_ret_prio	: 4,	/* Demand Read Retention Priority */
2530Sstevel@tonic-gate 		write_ret_prio	: 4;	/* Write Retention Priority */
2540Sstevel@tonic-gate #else
2550Sstevel@tonic-gate #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
2560Sstevel@tonic-gate #endif	/* _BIT_FIELDS_LTOH */
2570Sstevel@tonic-gate 	ushort_t pf_dsbl_trans_len;	/* Disable prefetch transfer length */
2580Sstevel@tonic-gate 	ushort_t min_prefetch;		/* Minimum Prefetch */
2590Sstevel@tonic-gate 	ushort_t max_prefetch;		/* Maximum Prefetch */
2600Sstevel@tonic-gate 	ushort_t max_prefetch_ceiling;	/* Maximum Prefetch Ceiling */
2610Sstevel@tonic-gate };
2620Sstevel@tonic-gate 
2630Sstevel@tonic-gate /*
2640Sstevel@tonic-gate  * Peripheral Device Page
2650Sstevel@tonic-gate  */
2660Sstevel@tonic-gate 
2670Sstevel@tonic-gate struct mode_pdevice {
2680Sstevel@tonic-gate 	struct	mode_page mode_page;	/* common mode page header */
2690Sstevel@tonic-gate 	ushort_t if_ident;		/* interface identifier */
2700Sstevel@tonic-gate 	uchar_t	reserved[4];		/* reserved */
2710Sstevel@tonic-gate 	uchar_t	vendor_uniqe[1];	/* vendor unique data */
2720Sstevel@tonic-gate };
2730Sstevel@tonic-gate 
2740Sstevel@tonic-gate #define	PDEV_SCSI	0x0000		/* scsi interface */
2750Sstevel@tonic-gate #define	PDEV_SMD	0x0001		/* SMD interface */
2760Sstevel@tonic-gate #define	PDEV_ESDI	0x0002		/* ESDI interface */
2770Sstevel@tonic-gate #define	PDEV_IPI2	0x0003		/* IPI-2 interface */
2780Sstevel@tonic-gate #define	PDEV_IPI3	0x0004		/* IPI-3 interface */
2790Sstevel@tonic-gate 
2800Sstevel@tonic-gate /*
2810Sstevel@tonic-gate  * Control Mode Page
2820Sstevel@tonic-gate  *
2830Sstevel@tonic-gate  * Note:	This structure is incompatible with previous SCSI
2840Sstevel@tonic-gate  *		implementations. See <scsi/impl/mode.h> for an
2850Sstevel@tonic-gate  *		alternative form of this structure. They can be
2860Sstevel@tonic-gate  *		distinguished by the length of data returned
2870Sstevel@tonic-gate  *		from a MODE SENSE command.
2880Sstevel@tonic-gate  */
2890Sstevel@tonic-gate 
2900Sstevel@tonic-gate #define	PAGELENGTH_MODE_CONTROL_SCSI3	0x0A
2910Sstevel@tonic-gate 
2920Sstevel@tonic-gate struct mode_control_scsi3 {
2930Sstevel@tonic-gate 	struct	mode_page mode_page;	/* common mode page header */
2940Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH)
2950Sstevel@tonic-gate 	uchar_t		rlec	: 1,	/* Report Log Exception bit */
2960Sstevel@tonic-gate 			gltsd	: 1,	/* global logging target save disable */
2970Sstevel@tonic-gate 			d_sense	: 1,	/* Use descriptor sense data (SPC-3) */
2980Sstevel@tonic-gate 				: 5;
2990Sstevel@tonic-gate 	uchar_t		qdisable: 1,	/* Queue disable */
3000Sstevel@tonic-gate 			que_err	: 1,	/* Queue error */
3010Sstevel@tonic-gate 				: 2,
3020Sstevel@tonic-gate 			que_mod : 4;    /* Queue algorithm modifier */
3030Sstevel@tonic-gate 	uchar_t		eanp	: 1,	/* Enable AEN permission */
3040Sstevel@tonic-gate 			uaaenp  : 1,	/* Unit attention AEN permission */
3050Sstevel@tonic-gate 			raenp   : 1,	/* Ready AEN permission */
3060Sstevel@tonic-gate 				: 1,
3070Sstevel@tonic-gate 			bybths	: 1,	/* By both RESET signal */
3080Sstevel@tonic-gate 			byprtm	: 1,	/* By port message */
3090Sstevel@tonic-gate 			rac	: 1,	/* report a check */
3100Sstevel@tonic-gate 			eeca	: 1;	/* enable extended contingent */
3110Sstevel@tonic-gate 					/* allegiance (only pre-SCSI-3) */
3120Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL)
3130Sstevel@tonic-gate 	uchar_t			: 5,
3140Sstevel@tonic-gate 			d_sense	: 1,	/* Use descriptor sense data (SPC-3) */
3150Sstevel@tonic-gate 			gltsd	: 1,	/* global logging target save disable */
3160Sstevel@tonic-gate 			rlec	: 1;	/* Report Log Exception bit */
3170Sstevel@tonic-gate 	uchar_t		que_mod	: 4,	/* Queue algorithm modifier */
3180Sstevel@tonic-gate 				: 2,
3190Sstevel@tonic-gate 			que_err	: 1,	/* Queue error */
3200Sstevel@tonic-gate 			qdisable: 1;	/* Queue disable */
3210Sstevel@tonic-gate 	uchar_t		eeca	: 1,	/* enable extended contingent */
3220Sstevel@tonic-gate 					/* allegiance (only pre-SCSI-3) */
3230Sstevel@tonic-gate 			rac	: 1,	/* report a check */
3240Sstevel@tonic-gate 			byprtm	: 1,	/* By port message */
3250Sstevel@tonic-gate 			bybths	: 1,	/* By both RESET signal */
3260Sstevel@tonic-gate 				: 1,
3270Sstevel@tonic-gate 			raenp   : 1,	/* Ready AEN permission */
3280Sstevel@tonic-gate 			uaaenp  : 1,	/* Unit attention AEN permission */
3290Sstevel@tonic-gate 			eanp	: 1;	/* Enable AEN permission */
3300Sstevel@tonic-gate #else
3310Sstevel@tonic-gate #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
3320Sstevel@tonic-gate #endif	/* _BIT_FIELDS_LTOH */
3330Sstevel@tonic-gate 	uchar_t	reserved;
3340Sstevel@tonic-gate 	ushort_t ready_aen_holdoff;	/* Ready AEN holdoff period */
3350Sstevel@tonic-gate 	ushort_t busy_timeout;		/* Busy timeout period */
3360Sstevel@tonic-gate 	uchar_t	reserved_2[2];
3370Sstevel@tonic-gate };
3380Sstevel@tonic-gate 
3392148Spd144616 #ifdef __lock_lint
3402148Spd144616 _NOTE(SCHEME_PROTECTS_DATA("Unshared SCSI payload", \
3412148Spd144616 	mode_control_scsi3))
3422148Spd144616 #endif
3432148Spd144616 
3440Sstevel@tonic-gate #define	CTRL_QMOD_RESTRICT	0x0
3450Sstevel@tonic-gate #define	CTRL_QMOD_UNRESTRICT	0x1
3460Sstevel@tonic-gate 
3471675Sls24207 /*
3481675Sls24207  * Informational Exceptions Control Mode Page
3491675Sls24207  */
3501675Sls24207 
3511675Sls24207 #define	PAGELENGTH_INFO_EXCPT	0x0A
3521675Sls24207 
3531675Sls24207 struct mode_info_excpt_page {
3541675Sls24207 	struct	mode_page mode_page;	/* common mode page header */
3551675Sls24207 #if defined(_BIT_FIELDS_LTOH)
3561675Sls24207 	uchar_t		log_err	: 1;	/* log errors */
3571675Sls24207 	uchar_t			: 1;	/* reserved */
3581675Sls24207 	uchar_t		test	: 1;	/* create test failure */
3591675Sls24207 	uchar_t		dexcpt	: 1;	/* disable exception */
3601675Sls24207 	uchar_t		ewasc	: 1;	/* enable warning */
3611675Sls24207 	uchar_t		ebf	: 1;	/* enable background function */
3621675Sls24207 	uchar_t			: 1;	/* reserved */
3631675Sls24207 	uchar_t		perf	: 1;	/* performance */
3641675Sls24207 	uchar_t		mrie	: 4;	/* method of reporting info. excpts. */
3651675Sls24207 	uchar_t			: 4;	/* reserved */
3661675Sls24207 #elif defined(_BIT_FIELDS_HTOL)
3671675Sls24207 	uchar_t		perf	: 1;	/* performance */
3681675Sls24207 	uchar_t			: 1;	/* reserved */
3691675Sls24207 	uchar_t		ebf	: 1;	/* enable background function */
3701675Sls24207 	uchar_t		ewasc	: 1;	/* enable warning */
3711675Sls24207 	uchar_t		dexcpt	: 1;	/* disable exception */
3721675Sls24207 	uchar_t		test	: 1;	/* create test failure */
3731675Sls24207 	uchar_t			: 1;	/* reserved */
3741675Sls24207 	uchar_t		log_err	: 1;	/* log errors */
3751675Sls24207 	uchar_t			: 4;	/* reserved */
3761675Sls24207 	uchar_t		mrie	: 4;	/* method of reporting info. excpts. */
3771675Sls24207 #else
3781675Sls24207 #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
3791675Sls24207 #endif
3801675Sls24207 	uchar_t	interval_timer[4];	/* interval timer */
3811675Sls24207 	uchar_t	report_count[4];	/* report count */
3821675Sls24207 };
3831675Sls24207 
3841675Sls24207 #define	MRIE_NO_REPORT		0x0
3851675Sls24207 #define	MRIE_ASYNCH		0x1
3861675Sls24207 #define	MRIE_UNIT_ATTN		0x2
3871675Sls24207 #define	MRIE_COND_RECVD_ERR	0x3
3881675Sls24207 #define	MRIE_UNCOND_RECVD_ERR	0x4
3891675Sls24207 #define	MRIE_NO_SENSE		0x5
3901675Sls24207 #define	MRIE_ONLY_ON_REQUEST	0x6
3911675Sls24207 
392*10131SJane.Chu@Sun.COM struct mode_info_power_cond {
393*10131SJane.Chu@Sun.COM 	struct mode_page mode_page;	/* common mode page header */
394*10131SJane.Chu@Sun.COM 	uchar_t reserved;
395*10131SJane.Chu@Sun.COM #if defined(_BIT_FIELDS_LTOH)
396*10131SJane.Chu@Sun.COM 	uchar_t standby	:1,	/* standby bit */
397*10131SJane.Chu@Sun.COM 		idle	:1,	/* idle bit */
398*10131SJane.Chu@Sun.COM 			:6;	/* reserved */
399*10131SJane.Chu@Sun.COM #elif defined(_BIT_FIELDS_HTOL)
400*10131SJane.Chu@Sun.COM 	uchar_t		:6,	/* reserved */
401*10131SJane.Chu@Sun.COM 		idle	:1,	/* idle bit */
402*10131SJane.Chu@Sun.COM 		standby	:1;	/* standby bit */
403*10131SJane.Chu@Sun.COM #else
404*10131SJane.Chu@Sun.COM #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
405*10131SJane.Chu@Sun.COM #endif
406*10131SJane.Chu@Sun.COM 	uchar_t	idle_cond_timer_high;
407*10131SJane.Chu@Sun.COM 	uchar_t idle_cond_timer_low;
408*10131SJane.Chu@Sun.COM 	uchar_t standby_cond_timer[4];
409*10131SJane.Chu@Sun.COM };
410*10131SJane.Chu@Sun.COM 
411*10131SJane.Chu@Sun.COM struct parameter_control {
412*10131SJane.Chu@Sun.COM #if defined(_BIT_FIELDS_LTOH)
413*10131SJane.Chu@Sun.COM 	uchar_t fmt_link:2,	/* format and link bit */
414*10131SJane.Chu@Sun.COM 		tmc	:2,	/* tmc bit */
415*10131SJane.Chu@Sun.COM 		etc	:1,	/* etc bit */
416*10131SJane.Chu@Sun.COM 		tsd	:1,	/* tsd bit */
417*10131SJane.Chu@Sun.COM 		reserv	:1,	/* obsolete */
418*10131SJane.Chu@Sun.COM 		du	:1;	/* du bit */
419*10131SJane.Chu@Sun.COM #elif defined(_BIT_FIELDS_HTOL)
420*10131SJane.Chu@Sun.COM 	uchar_t	du	:1,	/* du bit */
421*10131SJane.Chu@Sun.COM 		reserv	:1,	/* obsolete */
422*10131SJane.Chu@Sun.COM 		tsd	:1,	/* tsd bit */
423*10131SJane.Chu@Sun.COM 		etc	:1,	/* etc bit */
424*10131SJane.Chu@Sun.COM 		tmc	:2,	/* tmc bit */
425*10131SJane.Chu@Sun.COM 		fmt_link:2;	/* format and link bit */
426*10131SJane.Chu@Sun.COM #else
427*10131SJane.Chu@Sun.COM #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
428*10131SJane.Chu@Sun.COM #endif
429*10131SJane.Chu@Sun.COM };
430*10131SJane.Chu@Sun.COM 
431*10131SJane.Chu@Sun.COM struct start_stop_cycle_counter_log {
432*10131SJane.Chu@Sun.COM #if defined(_BIT_FIELDS_LTOH)
433*10131SJane.Chu@Sun.COM 	uchar_t code	:6,	/* page code bit */
434*10131SJane.Chu@Sun.COM 		spf	:1,	/* spf bit */
435*10131SJane.Chu@Sun.COM 		ds	:1;	/* ds bit */
436*10131SJane.Chu@Sun.COM #elif defined(_BIT_FIELDS_HTOL)
437*10131SJane.Chu@Sun.COM 	uchar_t	ds	:1,	/* ds bit */
438*10131SJane.Chu@Sun.COM 		spf	:1,	/* spf bit */
439*10131SJane.Chu@Sun.COM 		code	:6;	/* page code bit */
440*10131SJane.Chu@Sun.COM #else
441*10131SJane.Chu@Sun.COM #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
442*10131SJane.Chu@Sun.COM #endif
443*10131SJane.Chu@Sun.COM 	uchar_t			sub_page_code;
444*10131SJane.Chu@Sun.COM 	uchar_t			page_len_high;
445*10131SJane.Chu@Sun.COM 	uchar_t			page_len_low;
446*10131SJane.Chu@Sun.COM 
447*10131SJane.Chu@Sun.COM 	uchar_t			manufactor_date_high;
448*10131SJane.Chu@Sun.COM 	uchar_t			manufactor_date_low;
449*10131SJane.Chu@Sun.COM 	struct parameter_control param_1;
450*10131SJane.Chu@Sun.COM 	uchar_t			param_len_1;
451*10131SJane.Chu@Sun.COM 	uchar_t			year_manu[4];
452*10131SJane.Chu@Sun.COM 	uchar_t			week_manu[2];
453*10131SJane.Chu@Sun.COM 
454*10131SJane.Chu@Sun.COM 	uchar_t			account_date_high;
455*10131SJane.Chu@Sun.COM 	uchar_t			account_date_low;
456*10131SJane.Chu@Sun.COM 	struct parameter_control param_2;
457*10131SJane.Chu@Sun.COM 	uchar_t			param_len_2;
458*10131SJane.Chu@Sun.COM 	uchar_t			year_account[4];
459*10131SJane.Chu@Sun.COM 	uchar_t			week_account[2];
460*10131SJane.Chu@Sun.COM 
461*10131SJane.Chu@Sun.COM 	uchar_t			lifetime_code_high;
462*10131SJane.Chu@Sun.COM 	uchar_t			lifetime_code_low;
463*10131SJane.Chu@Sun.COM 	struct parameter_control param_3;
464*10131SJane.Chu@Sun.COM 	uchar_t			param_len_3;
465*10131SJane.Chu@Sun.COM 	uchar_t			cycle_lifetime[4];
466*10131SJane.Chu@Sun.COM 
467*10131SJane.Chu@Sun.COM 	uchar_t			cycle_code_high;
468*10131SJane.Chu@Sun.COM 	uchar_t			cycle_code_low;
469*10131SJane.Chu@Sun.COM 	struct parameter_control param_4;
470*10131SJane.Chu@Sun.COM 	uchar_t			param_len_4;
471*10131SJane.Chu@Sun.COM 	uchar_t			cycle_accumulated[4];
472*10131SJane.Chu@Sun.COM };
473*10131SJane.Chu@Sun.COM 
474*10131SJane.Chu@Sun.COM 
4750Sstevel@tonic-gate #ifdef	__cplusplus
4760Sstevel@tonic-gate }
4770Sstevel@tonic-gate #endif
4780Sstevel@tonic-gate 
4790Sstevel@tonic-gate /*
4800Sstevel@tonic-gate  * Include known generic device specific mode definitions and structures
4810Sstevel@tonic-gate  */
4820Sstevel@tonic-gate 
4830Sstevel@tonic-gate #include <sys/scsi/generic/dad_mode.h>
4840Sstevel@tonic-gate 
4850Sstevel@tonic-gate /*
4860Sstevel@tonic-gate  * Include implementation specific mode information
4870Sstevel@tonic-gate  */
4880Sstevel@tonic-gate 
4890Sstevel@tonic-gate #include <sys/scsi/impl/mode.h>
4900Sstevel@tonic-gate 
4910Sstevel@tonic-gate #endif	/* _SYS_SCSI_GENERIC_MODE_H */
492