xref: /onnv-gate/usr/src/uts/common/sys/scsi/generic/inquiry.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
52015Staylor  * Common Development and Distribution License (the "License").
62015Staylor  * 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.
232015Staylor  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_SYS_SCSI_GENERIC_INQUIRY_H
270Sstevel@tonic-gate #define	_SYS_SCSI_GENERIC_INQUIRY_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #ifdef	__cplusplus
300Sstevel@tonic-gate extern "C" {
310Sstevel@tonic-gate #endif
320Sstevel@tonic-gate 
330Sstevel@tonic-gate /*
348017SChris.Horne@Sun.COM  * SCSI Standard Inquiry Data:
350Sstevel@tonic-gate  *
360Sstevel@tonic-gate  * Format of data returned as a result of an INQUIRY command.
370Sstevel@tonic-gate  *
388017SChris.Horne@Sun.COM  * NOTE: Fields marked 'DEPRECATED' are defined in older versions of t10 "SCSI
398017SChris.Horne@Sun.COM  * Primary Command" spec, and are marked 'Obsolete' in newer versions.
400Sstevel@tonic-gate  */
410Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH)
420Sstevel@tonic-gate struct scsi_inquiry {
430Sstevel@tonic-gate 	/*
440Sstevel@tonic-gate 	 * byte 0
450Sstevel@tonic-gate 	 *
460Sstevel@tonic-gate 	 * Bits 7-5 are the Peripheral Device Qualifier
470Sstevel@tonic-gate 	 * Bits 4-0 are the Peripheral Device Type
480Sstevel@tonic-gate 	 */
490Sstevel@tonic-gate 	uchar_t	inq_dtype;
500Sstevel@tonic-gate 
510Sstevel@tonic-gate 	/* byte 1 */
528017SChris.Horne@Sun.COM 	uchar_t	inq_qual	: 7,	/* device type qualifier */
538017SChris.Horne@Sun.COM 		inq_rmb		: 1;	/* removable media */
540Sstevel@tonic-gate 
550Sstevel@tonic-gate 	/* byte 2 */
568017SChris.Horne@Sun.COM 	uchar_t	inq_ansi	: 3,	/* ANSI version */
578017SChris.Horne@Sun.COM 		inq_ecma	: 3,	/* ECMA version */
588017SChris.Horne@Sun.COM 		inq_iso		: 2;	/* ISO version */
590Sstevel@tonic-gate 
600Sstevel@tonic-gate 	/* byte 3 */
618017SChris.Horne@Sun.COM 	uchar_t	inq_rdf		: 4,	/* response data format */
628017SChris.Horne@Sun.COM 		inq_hisup	: 1,	/* hierarchical addressing model */
630Sstevel@tonic-gate 		inq_normaca	: 1,	/* setting NACA bit supported */
648017SChris.Horne@Sun.COM 		inq_trmiop	: 1,	/* DEPRECATED: terminate I/O proc */
658017SChris.Horne@Sun.COM 		inq_aenc	: 1;	/* DEPRECATED: async event notify */
660Sstevel@tonic-gate 
670Sstevel@tonic-gate 	/* bytes 4-7 */
688017SChris.Horne@Sun.COM 	uchar_t	inq_len;		/* additional length */
690Sstevel@tonic-gate 
708017SChris.Horne@Sun.COM 	uchar_t	inq_protect	: 1,	/* supports protection information */
718017SChris.Horne@Sun.COM 		inq_5_1		: 1,
728017SChris.Horne@Sun.COM 		inq_5_2		: 1,
738017SChris.Horne@Sun.COM 		inq_3pc		: 1,	/* third-party copy */
748017SChris.Horne@Sun.COM 		inq_tpgs	: 2,	/* impl/expl asymmetric lun access */
758017SChris.Horne@Sun.COM 		inq_acc		: 1,	/* access controls coordinator */
768017SChris.Horne@Sun.COM 		inq_sccs	: 1;	/* embedded storage array */
770Sstevel@tonic-gate 
788017SChris.Horne@Sun.COM 	uchar_t	inq_addr16	: 1,	/* SPI: 16-bit wide SCSI addr */
798017SChris.Horne@Sun.COM 		inq_addr32	: 1,	/* DEPRECATED: 32 bit wide address */
808017SChris.Horne@Sun.COM 		inq_ackqreqq	: 1,	/* DEPRECATED: data xfer on Q cable */
818017SChris.Horne@Sun.COM 		inq_mchngr	: 1,	/* DEPRECATED: embeded medium changer */
828017SChris.Horne@Sun.COM 		inq_dualp	: 1,	/* multi port device */
838017SChris.Horne@Sun.COM 		inq_port	: 1,	/* DEPRECATED: port rcv inquiry cmd */
848017SChris.Horne@Sun.COM 		inq_encserv	: 1,	/* embedded enclosure services */
858017SChris.Horne@Sun.COM 		inq_bque	: 1;	/* DEPRECATED: combined with cmdque */
860Sstevel@tonic-gate 
878017SChris.Horne@Sun.COM 	uchar_t	inq_sftre	: 1,	/* DEPRECATED: Soft Reset option */
888017SChris.Horne@Sun.COM 		inq_cmdque	: 1,	/* supports command queueing */
898017SChris.Horne@Sun.COM 		inq_trandis	: 1,	/* DEPRECATED: transfer disable msgs */
908017SChris.Horne@Sun.COM 		inq_linked	: 1,	/* DEPRECATED: linked commands */
918017SChris.Horne@Sun.COM 		inq_sync	: 1,	/* SPI: synchronous data xfers */
928017SChris.Horne@Sun.COM 		inq_wbus16	: 1,	/* SPI: 16-bit wide data xfers */
938017SChris.Horne@Sun.COM 		inq_wbus32	: 1,	/* DEPRECATED: 32 bit wide data xfers */
948017SChris.Horne@Sun.COM 		inq_reladdr	: 1;	/* DEPRECATED: relative addressing */
950Sstevel@tonic-gate 
960Sstevel@tonic-gate 	/* bytes 8-35 */
970Sstevel@tonic-gate 	char	inq_vid[8];		/* vendor ID */
980Sstevel@tonic-gate 	char	inq_pid[16];		/* product ID */
990Sstevel@tonic-gate 	char	inq_revision[4];	/* revision level */
1000Sstevel@tonic-gate 
1010Sstevel@tonic-gate 	/*
1020Sstevel@tonic-gate 	 * Bytes 36-47 are reserved:
1030Sstevel@tonic-gate 	 *	For Sun qualified hard disk drives the inq_serial field contains
1040Sstevel@tonic-gate 	 *		two bytes of mfg date year code (ascii)
1050Sstevel@tonic-gate 	 *		two bytes of mfg date week code (ascii)
1060Sstevel@tonic-gate 	 *		six bytes of mfg serial number (ascii)
1070Sstevel@tonic-gate 	 *		two bytes unused
1080Sstevel@tonic-gate 	 */
1090Sstevel@tonic-gate 	char	inq_serial[12];
1100Sstevel@tonic-gate 
1110Sstevel@tonic-gate 	/*
1128017SChris.Horne@Sun.COM 	 * Bytes 48-55 are reserved.
1138017SChris.Horne@Sun.COM 	 */
1148017SChris.Horne@Sun.COM 	uchar_t	__inq_48	: 8;
1158017SChris.Horne@Sun.COM 	uchar_t	__inq_49	: 8;
1168017SChris.Horne@Sun.COM 	uchar_t	__inq_50	: 8;
1178017SChris.Horne@Sun.COM 	uchar_t	__inq_51	: 8;
1188017SChris.Horne@Sun.COM 	uchar_t	__inq_52	: 8;
1198017SChris.Horne@Sun.COM 	uchar_t	__inq_53	: 8;
1208017SChris.Horne@Sun.COM 	uchar_t	__inq_54	: 8;
1218017SChris.Horne@Sun.COM 	uchar_t	__inq_55	: 8;
1228017SChris.Horne@Sun.COM 
1238017SChris.Horne@Sun.COM 	/*
1248017SChris.Horne@Sun.COM 	 * The meanings of byte 56 is specific to SPI-3. For protocols older
1258017SChris.Horne@Sun.COM 	 * or other than this these fields are reserved.
1268017SChris.Horne@Sun.COM 	 */
1278017SChris.Horne@Sun.COM 	uchar_t	inq_ius		: 1,	/* SPI3: information units */
1288017SChris.Horne@Sun.COM 		inq_qas		: 1,	/* SPI3: quick arb sel */
1298017SChris.Horne@Sun.COM 		inq_clk		: 2,	/* SPI3: clocking */
1308017SChris.Horne@Sun.COM 		__inq_56_4	: 1,	/* reserved */
1318017SChris.Horne@Sun.COM 		__inq_56_5	: 1,	/* reserved */
1328017SChris.Horne@Sun.COM 		__inq_56_6	: 1,	/* reserved */
1338017SChris.Horne@Sun.COM 		__inq_56_7	: 1;	/* reserved */
1348017SChris.Horne@Sun.COM 
1358017SChris.Horne@Sun.COM 	uchar_t	__inq_57	: 8;	/* reserved */
1368017SChris.Horne@Sun.COM 
1378017SChris.Horne@Sun.COM 	/*
1388017SChris.Horne@Sun.COM 	 * byte pairs 58-73 are version descriptors
1398017SChris.Horne@Sun.COM 	 *  See: Table 51: dpANS SCSI Primary Commands - 2 (SPC-2) T10/1236
1408017SChris.Horne@Sun.COM 	 */
1418017SChris.Horne@Sun.COM 	struct	inq_vd {
1428017SChris.Horne@Sun.COM 		uchar_t		inq_vd_msb;
1438017SChris.Horne@Sun.COM 		uchar_t		inq_vd_lsb;
1448017SChris.Horne@Sun.COM 	}	inq_vd[8];
1458017SChris.Horne@Sun.COM 
1468017SChris.Horne@Sun.COM 	/*
1478017SChris.Horne@Sun.COM 	 * Bytes 74-95 are reserved.
1488017SChris.Horne@Sun.COM 	 * 96 to 'n' are vendor-specific parameter bytes.
1498017SChris.Horne@Sun.COM 	 *
1508017SChris.Horne@Sun.COM 	 * Pad structure to 132 bytes so that access to some vendor-specific
1518017SChris.Horne@Sun.COM 	 * data is possible via scsi_device(9S) sd_inq (for mpxio).
1528017SChris.Horne@Sun.COM 	 */
1538017SChris.Horne@Sun.COM 	uchar_t	__inq_74_127[132 - 74];
1548017SChris.Horne@Sun.COM };
1558017SChris.Horne@Sun.COM 
1568017SChris.Horne@Sun.COM #elif defined(_BIT_FIELDS_HTOL)
1578017SChris.Horne@Sun.COM 
1588017SChris.Horne@Sun.COM struct scsi_inquiry {
1598017SChris.Horne@Sun.COM 	/*
1608017SChris.Horne@Sun.COM 	 * byte 0
1618017SChris.Horne@Sun.COM 	 *
1628017SChris.Horne@Sun.COM 	 * Bits 7-5 are the Peripheral Device Qualifier
1638017SChris.Horne@Sun.COM 	 * Bits 4-0 are the Peripheral Device Type
1640Sstevel@tonic-gate 	 */
1658017SChris.Horne@Sun.COM 	uchar_t	inq_dtype;
1668017SChris.Horne@Sun.COM 
1678017SChris.Horne@Sun.COM 	/* byte 1 */
1688017SChris.Horne@Sun.COM 	uchar_t	inq_rmb		: 1,	/* removable media */
1698017SChris.Horne@Sun.COM 		inq_qual	: 7;	/* device type qualifier */
1708017SChris.Horne@Sun.COM 
1718017SChris.Horne@Sun.COM 	/* byte 2 */
1728017SChris.Horne@Sun.COM 	uchar_t	inq_iso		: 2,	/* ISO version */
1738017SChris.Horne@Sun.COM 		inq_ecma	: 3,	/* ECMA version */
1748017SChris.Horne@Sun.COM 		inq_ansi	: 3;	/* ANSI version */
1758017SChris.Horne@Sun.COM 
1768017SChris.Horne@Sun.COM 	/* byte 3 */
1778017SChris.Horne@Sun.COM 	uchar_t	inq_aenc	: 1,	/* DEPRECATED: async event notify */
1788017SChris.Horne@Sun.COM 		inq_trmiop	: 1,	/* DEPRECATED: terminate I/O proc */
1798017SChris.Horne@Sun.COM 		inq_normaca	: 1,	/* setting NACA bit supported */
1808017SChris.Horne@Sun.COM 		inq_hisup	: 1,	/* hierarchical addressing model */
1818017SChris.Horne@Sun.COM 		inq_rdf		: 4;	/* response data format */
1828017SChris.Horne@Sun.COM 
1838017SChris.Horne@Sun.COM 	/* bytes 4-7 */
1848017SChris.Horne@Sun.COM 	uchar_t	inq_len;		/* additional length */
1858017SChris.Horne@Sun.COM 
1868017SChris.Horne@Sun.COM 	uchar_t	inq_sccs	: 1,	/* embedded storage array */
1878017SChris.Horne@Sun.COM 		inq_acc		: 1,	/* access controls coordinator */
1888017SChris.Horne@Sun.COM 		inq_tpgs	: 2,	/* impl/expl asymmetric lun access */
1898017SChris.Horne@Sun.COM 		inq_3pc		: 1,	/* third-party copy */
1908017SChris.Horne@Sun.COM 		inq_5_2		: 1,
1918017SChris.Horne@Sun.COM 		inq_5_1		: 1,
1928017SChris.Horne@Sun.COM 		inq_protect	: 1;	/* supports protection information */
1938017SChris.Horne@Sun.COM 
1948017SChris.Horne@Sun.COM 	uchar_t	inq_bque	: 1,	/* DEPRECATED: combined with cmdque */
1958017SChris.Horne@Sun.COM 		inq_encserv	: 1,	/* embedded enclosure services */
1968017SChris.Horne@Sun.COM 		inq_port	: 1,	/* DEPRECATED: port rcv inquiry cmd */
1978017SChris.Horne@Sun.COM 		inq_dualp	: 1,	/* multi port device */
1988017SChris.Horne@Sun.COM 		inq_mchngr	: 1,	/* DEPRECATED: embeded medium changer */
1998017SChris.Horne@Sun.COM 		inq_ackqreqq	: 1,	/* DEPRECATED: data xfer on Q cable */
2008017SChris.Horne@Sun.COM 		inq_addr32	: 1,	/* DEPRECATED: 32 bit wide address */
2018017SChris.Horne@Sun.COM 		inq_addr16	: 1;	/* SPI: 16-bit wide SCSI addr */
2028017SChris.Horne@Sun.COM 
2038017SChris.Horne@Sun.COM 	uchar_t	inq_reladdr	: 1,	/* DEPRECATED: relative addressing */
2048017SChris.Horne@Sun.COM 		inq_wbus32	: 1,	/* DEPRECATED: 32 bit wide data xfers */
2058017SChris.Horne@Sun.COM 		inq_wbus16	: 1,	/* SPI: 16-bit wide data xfers */
2068017SChris.Horne@Sun.COM 		inq_sync	: 1,	/* SPI: synchronous data xfers */
2078017SChris.Horne@Sun.COM 		inq_linked	: 1,	/* DEPRECATED: linked commands */
2088017SChris.Horne@Sun.COM 		inq_trandis	: 1,	/* DEPRECATED: transfer disable msgs */
2098017SChris.Horne@Sun.COM 		inq_cmdque	: 1,	/* supports command queueing */
2108017SChris.Horne@Sun.COM 		inq_sftre	: 1;	/* DEPRECATED: Soft Reset option */
2118017SChris.Horne@Sun.COM 
2128017SChris.Horne@Sun.COM 	/* bytes 8-35 */
2138017SChris.Horne@Sun.COM 	char	inq_vid[8];		/* vendor ID */
2148017SChris.Horne@Sun.COM 	char	inq_pid[16];		/* product ID */
2158017SChris.Horne@Sun.COM 	char	inq_revision[4];	/* revision level */
2168017SChris.Horne@Sun.COM 
2178017SChris.Horne@Sun.COM 	/*
2188017SChris.Horne@Sun.COM 	 * Bytes 36-47 are reserved:
2198017SChris.Horne@Sun.COM 	 *	For Sun qualified hard disk drives the inq_serial field contains
2208017SChris.Horne@Sun.COM 	 *		two bytes of mfg date year code (ascii)
2218017SChris.Horne@Sun.COM 	 *		two bytes of mfg date week code (ascii)
2228017SChris.Horne@Sun.COM 	 *		six bytes of mfg serial number (ascii)
2238017SChris.Horne@Sun.COM 	 *		two bytes unused
2248017SChris.Horne@Sun.COM 	 */
2258017SChris.Horne@Sun.COM 	char	inq_serial[12];
2268017SChris.Horne@Sun.COM 
2278017SChris.Horne@Sun.COM 	/*
2288017SChris.Horne@Sun.COM 	 * Bytes 48-55 are reserved.
2298017SChris.Horne@Sun.COM 	 */
2308017SChris.Horne@Sun.COM 	uchar_t	__inq_48	: 8;
2318017SChris.Horne@Sun.COM 	uchar_t	__inq_49	: 8;
2328017SChris.Horne@Sun.COM 	uchar_t	__inq_50	: 8;
2338017SChris.Horne@Sun.COM 	uchar_t	__inq_51	: 8;
2348017SChris.Horne@Sun.COM 	uchar_t	__inq_52	: 8;
2358017SChris.Horne@Sun.COM 	uchar_t	__inq_53	: 8;
2368017SChris.Horne@Sun.COM 	uchar_t	__inq_54	: 8;
2378017SChris.Horne@Sun.COM 	uchar_t	__inq_55	: 8;
2388017SChris.Horne@Sun.COM 
2398017SChris.Horne@Sun.COM 	/*
2408017SChris.Horne@Sun.COM 	 * The meanings of byte 56 is specific to SPI-3. For protocols older
2418017SChris.Horne@Sun.COM 	 * or other than this these fields are reserved.
2428017SChris.Horne@Sun.COM 	 */
2438017SChris.Horne@Sun.COM 	uchar_t	__inq_56_7	: 1,	/* reserved */
2448017SChris.Horne@Sun.COM 		__inq_56_6	: 1,	/* reserved */
2458017SChris.Horne@Sun.COM 		__inq_56_5	: 1,	/* reserved */
2468017SChris.Horne@Sun.COM 		__inq_56_4	: 1,	/* reserved */
2478017SChris.Horne@Sun.COM 		inq_clk		: 2,	/* SPI3: clocking */
2488017SChris.Horne@Sun.COM 		inq_qas		: 1,	/* SPI3: quick arb sel */
2498017SChris.Horne@Sun.COM 		inq_ius		: 1;	/* SPI3: information units */
2508017SChris.Horne@Sun.COM 
2518017SChris.Horne@Sun.COM 	uchar_t	__inq_57	: 8;		/* reserved */
2528017SChris.Horne@Sun.COM 
2538017SChris.Horne@Sun.COM 	/*
2548017SChris.Horne@Sun.COM 	 * byte pairs 58-73 are version descriptors
2558017SChris.Horne@Sun.COM 	 *  See: Table 51: dpANS SCSI Primary Commands - 2 (SPC-2) T10/1236
2568017SChris.Horne@Sun.COM 	 */
2578017SChris.Horne@Sun.COM 	struct	inq_vd {
2588017SChris.Horne@Sun.COM 		uchar_t		inq_vd_msb;
2598017SChris.Horne@Sun.COM 		uchar_t		inq_vd_lsb;
2608017SChris.Horne@Sun.COM 	}	inq_vd[8];
2618017SChris.Horne@Sun.COM 
2628017SChris.Horne@Sun.COM 	/*
2638017SChris.Horne@Sun.COM 	 * Bytes 74-95 are reserved.
2648017SChris.Horne@Sun.COM 	 * 96 to 'n' are vendor-specific parameter bytes.
2658017SChris.Horne@Sun.COM 	 *
2668017SChris.Horne@Sun.COM 	 * Pad structure to 132 bytes so that access to some vendor-specific
2678017SChris.Horne@Sun.COM 	 * data is possible via scsi_device(9S) sd_inq (for mpxio).
2688017SChris.Horne@Sun.COM 	 */
2698017SChris.Horne@Sun.COM 	uchar_t	__inq_74_127[132 - 74];
2700Sstevel@tonic-gate };
2710Sstevel@tonic-gate #else
2720Sstevel@tonic-gate #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
2730Sstevel@tonic-gate #endif	/* _BIT_FIELDS_LTOH */
2740Sstevel@tonic-gate 
2750Sstevel@tonic-gate /*
2760Sstevel@tonic-gate  * Defined Peripheral Device Types
2770Sstevel@tonic-gate  */
2788017SChris.Horne@Sun.COM #define	DTYPE_DIRECT		0x00	/* magnetic disk */
2798017SChris.Horne@Sun.COM #define	DTYPE_SEQUENTIAL	0x01	/* magnetic tape */
2800Sstevel@tonic-gate #define	DTYPE_PRINTER		0x02
2810Sstevel@tonic-gate #define	DTYPE_PROCESSOR		0x03
2828017SChris.Horne@Sun.COM #define	DTYPE_WORM		0x04	/* some optical disks */
2830Sstevel@tonic-gate #define	DTYPE_RODIRECT		0x05
2842015Staylor #define	DTYPE_SCANNER		0x06	/* obsolete */
2850Sstevel@tonic-gate #define	DTYPE_OPTICAL		0x07
2868017SChris.Horne@Sun.COM #define	DTYPE_CHANGER		0x08	/* jukeboxes */
2872015Staylor #define	DTYPE_COMM		0x09	/* obsolete */
2880Sstevel@tonic-gate #define	DTYPE_ARRAY_CTRL	0x0C
2898017SChris.Horne@Sun.COM #define	DTYPE_ESI		0x0D	/* Enclosure services device */
2908017SChris.Horne@Sun.COM #define	DTYPE_RBC		0x0E	/* Simplified direct-access device */
2918017SChris.Horne@Sun.COM #define	DTYPE_OCRW		0x0F	/* Optical card reader/writer device */
2922015Staylor #define	DTYPE_BCC		0x10
2938017SChris.Horne@Sun.COM #define	DTYPE_OSD		0x11	/* Object-based Storage Device */
2942015Staylor #define	DTYPE_ADC		0x12
2950Sstevel@tonic-gate /*
2962015Staylor  * Device types 0x13-0x1D are reserved in spc-3 (r23)
2970Sstevel@tonic-gate  */
2980Sstevel@tonic-gate 
2992015Staylor #define	DTYPE_WELLKNOWN		0x1E
3000Sstevel@tonic-gate #define	DTYPE_UNKNOWN		0x1F
3018017SChris.Horne@Sun.COM #define	DTYPE_MASK		0x1F
3020Sstevel@tonic-gate 
3038017SChris.Horne@Sun.COM /* ASCII mapping used by scsi_dname(9F) */
3048017SChris.Horne@Sun.COM #define	DTYPE_ASCII		{ \
3058017SChris.Horne@Sun.COM 		"Direct Access", "Sequential Access", "Printer", "Processor", \
3068017SChris.Horne@Sun.COM 		"Write-Once/Read-Many", "Read-Only Direct Access", "Scanner", \
3078017SChris.Horne@Sun.COM 		"Optical", "Changer", "Communications", "Unknown-0A", \
3088017SChris.Horne@Sun.COM 		"Unknown-0B", "Array Controller", "Enclosure-Services", \
3098017SChris.Horne@Sun.COM 		"Simplified-Direct-Access", "Optical-Card", "Bridge", \
3108017SChris.Horne@Sun.COM 		"Object-Storage", NULL}
3110Sstevel@tonic-gate 
3120Sstevel@tonic-gate /*
3130Sstevel@tonic-gate  * The peripheral qualifier tells us more about a particular device.
3140Sstevel@tonic-gate  * (DPQ == DEVICE PERIPHERAL QUALIFIER).
3150Sstevel@tonic-gate  */
3168017SChris.Horne@Sun.COM #define	DPQ_MASK	0x60	/* DPQ bits */
3170Sstevel@tonic-gate #define	DPQ_POSSIBLE	0x00
3180Sstevel@tonic-gate 				/*
3190Sstevel@tonic-gate 				 * The specified peripheral device type is
3200Sstevel@tonic-gate 				 * currently connected to this logical unit.
3218017SChris.Horne@Sun.COM 				 * If the target cannot determine whether
3220Sstevel@tonic-gate 				 * or not a physical device is currently
3230Sstevel@tonic-gate 				 * connected, it shall also return this
3240Sstevel@tonic-gate 				 * qualifier.
3250Sstevel@tonic-gate 				 */
3260Sstevel@tonic-gate #define	DPQ_SUPPORTED	0x20
3270Sstevel@tonic-gate 				/*
3280Sstevel@tonic-gate 				 * The target is capable of supporting the
3290Sstevel@tonic-gate 				 * specified peripheral device type on this
3308017SChris.Horne@Sun.COM 				 * logical unit, however the physical device
3318017SChris.Horne@Sun.COM 				 * is not currently connected to this logical
3328017SChris.Horne@Sun.COM 				 * unit.
3330Sstevel@tonic-gate 				 */
3340Sstevel@tonic-gate #define	DPQ_NEVER	0x60
3350Sstevel@tonic-gate 				/*
3360Sstevel@tonic-gate 				 * The target is not capable of supporting a
3370Sstevel@tonic-gate 				 * physical device on this logical unit. For
3380Sstevel@tonic-gate 				 * this peripheral qualifier, the peripheral
3390Sstevel@tonic-gate 				 * device type will be set to DTYPE_UNKNOWN
3400Sstevel@tonic-gate 				 * in order to provide compatibility with
3410Sstevel@tonic-gate 				 * previous versions of SCSI.
3420Sstevel@tonic-gate 				 */
3430Sstevel@tonic-gate #define	DPQ_VUNIQ	0x80
3440Sstevel@tonic-gate 				/*
3450Sstevel@tonic-gate 				 * If this bit is set, this is a vendor
3460Sstevel@tonic-gate 				 * unique qualifier.
3470Sstevel@tonic-gate 				 */
3488017SChris.Horne@Sun.COM 
3490Sstevel@tonic-gate /*
3500Sstevel@tonic-gate  * To maintain compatibility with previous versions
3510Sstevel@tonic-gate  * of inquiry data formats, if a device peripheral
3520Sstevel@tonic-gate  * qualifier states that the target is not capable
3530Sstevel@tonic-gate  * of supporting a physical device on this logical unit,
3540Sstevel@tonic-gate  * then the qualifier DPQ_NEVER is set, *AND* the
3550Sstevel@tonic-gate  * actual device type must be set to DTYPE_UNKNOWN.
3560Sstevel@tonic-gate  *
3570Sstevel@tonic-gate  * This may make for some problems with older drivers
3580Sstevel@tonic-gate  * that blindly check the entire first byte, where they
3590Sstevel@tonic-gate  * should be checking for only the least 5 bits to see
3600Sstevel@tonic-gate  * whether the correct type is at the specified nexus.
3610Sstevel@tonic-gate  */
3620Sstevel@tonic-gate #define	DTYPE_NOTPRESENT	(DPQ_NEVER | DTYPE_UNKNOWN)
3630Sstevel@tonic-gate 
3640Sstevel@tonic-gate /*
3658017SChris.Horne@Sun.COM  * Defined Response Data Formats:
3660Sstevel@tonic-gate  */
3678017SChris.Horne@Sun.COM #define	RDF_LEVEL0		0x00	/* no conformance claim (SCSI-1) */
3688017SChris.Horne@Sun.COM #define	RDF_CCS			0x01	/* Obsolete (pseudo-spec) */
3698017SChris.Horne@Sun.COM #define	RDF_SCSI2		0x02	/* Obsolete (SCSI-2/3 spec) */
3708017SChris.Horne@Sun.COM #define	RDF_SCSI_SPC		0x03	/* ANSI INCITS 301-1997 (SPC) */
3718017SChris.Horne@Sun.COM #define	RDF_SCSI_SPC2		0x04	/* ANSI INCITS 351-2001 (SPC-2) */
3728017SChris.Horne@Sun.COM #define	RDF_SCSI_SPC3		0x05	/* ANSI INCITS 408-2005 (SPC-3) */
3738017SChris.Horne@Sun.COM #define	RDF_SCSI_SPC4		0x06	/* t10 (SPC-4) */
3740Sstevel@tonic-gate 
3758017SChris.Horne@Sun.COM /*
3768017SChris.Horne@Sun.COM  * Defined Target Port Group Select values:
3778017SChris.Horne@Sun.COM  */
3788017SChris.Horne@Sun.COM #define	TPGS_FAILOVER_NONE	0x0
3798017SChris.Horne@Sun.COM #define	TPGS_FAILOVER_IMPLICIT	0x1
3808017SChris.Horne@Sun.COM #define	TPGS_FAILOVER_EXPLICIT	0x2
3818017SChris.Horne@Sun.COM #define	TPGS_FAILOVER_BOTH	0x3
3820Sstevel@tonic-gate 
3832314Smcneal /*
3842314Smcneal  * SPC-3 revision 21c, section 7.6.4.1
3852314Smcneal  * Table 289 -- Device Identification VPD page
3862314Smcneal  */
3872314Smcneal struct vpd_hdr {
3882314Smcneal #if defined(_BIT_FIELDS_LTOH)
3892314Smcneal 	uchar_t	device_type	: 4,
3902314Smcneal 		periph_qual	: 4;
3912314Smcneal #elif defined(_BIT_FIELDS_HTOL)
3922314Smcneal 	uchar_t	periph_qual	: 4,
3932314Smcneal 		device_type	: 4;
3942314Smcneal #else
3952314Smcneal #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
3962314Smcneal #endif
3972314Smcneal 	uchar_t	page_code,
3982314Smcneal 		page_len[2];
3992314Smcneal };
4002314Smcneal 
4012314Smcneal /*
4022314Smcneal  * SPC-3 revision 21c, section 7.6.4.1
4032314Smcneal  * Table 290 -- Identification descriptor
4042314Smcneal  */
4052314Smcneal struct vpd_desc {
4062314Smcneal #if defined(_BIT_FIELDS_LTOH)
4072314Smcneal 	uchar_t	code_set	: 4,
4082314Smcneal 		proto_id	: 4;
4098017SChris.Horne@Sun.COM 	uchar_t	id_type		: 4,
4102314Smcneal 		association	: 2,
4112314Smcneal 				: 1,
4122314Smcneal 		piv		: 1;
4132314Smcneal #elif defined(_BIT_FIELDS_HTOL)
4142314Smcneal 	uchar_t	proto_id	: 4,
4152314Smcneal 		code_set	: 4;
4168017SChris.Horne@Sun.COM 	uchar_t	piv		: 1,
4172314Smcneal 				: 1,
4182314Smcneal 		association	: 2,
4192314Smcneal 		id_type		: 4;
4202314Smcneal #else
4212314Smcneal #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
4222314Smcneal #endif
4232314Smcneal 	uchar_t	resrv1;
4242314Smcneal 	uchar_t	len;
4252314Smcneal 	/* ---- data follows ---- */
4262314Smcneal };
4272314Smcneal 
428*10131SJane.Chu@Sun.COM /*
429*10131SJane.Chu@Sun.COM  * "pm-capable" integer property bit mask definitions
430*10131SJane.Chu@Sun.COM  */
431*10131SJane.Chu@Sun.COM #define	PM_CAPABLE_PM_MASK	0x0000ffff	/* use lower 16 bits to */
432*10131SJane.Chu@Sun.COM 						/* indicate PM mode */
433*10131SJane.Chu@Sun.COM #define	PM_CAPABLE_CCS		RDF_CCS
434*10131SJane.Chu@Sun.COM #define	PM_CAPABLE_SCSI2	RDF_SCSI2
435*10131SJane.Chu@Sun.COM #define	PM_CAPABLE_SPC		RDF_SCSI_SPC
436*10131SJane.Chu@Sun.COM #define	PM_CAPABLE_SPC2		RDF_SCSI_SPC2
437*10131SJane.Chu@Sun.COM #define	PM_CAPABLE_SPC3		RDF_SCSI_SPC3
438*10131SJane.Chu@Sun.COM #define	PM_CAPABLE_SPC4		RDF_SCSI_SPC4
439*10131SJane.Chu@Sun.COM #define	PM_CAPABLE_LOG_MASK	0xffff0000	/* use upper 16 bit to */
440*10131SJane.Chu@Sun.COM 						/* indicate log specifics */
441*10131SJane.Chu@Sun.COM #define	PM_CAPABLE_LOG_SUPPORTED	0x10000	/* Log page 0xE might be */
442*10131SJane.Chu@Sun.COM 						/* supported */
443*10131SJane.Chu@Sun.COM #define	PM_CAPABLE_SMART_LOG		0x20000 /* Log page 0xE reports SMART */
444*10131SJane.Chu@Sun.COM 						/* attributes instead of the */
445*10131SJane.Chu@Sun.COM 						/* default SCSI Log pages */
4460Sstevel@tonic-gate #ifdef	__cplusplus
4470Sstevel@tonic-gate }
4480Sstevel@tonic-gate #endif
4490Sstevel@tonic-gate 
4500Sstevel@tonic-gate /*
4510Sstevel@tonic-gate  * Include in implementation specifuc
4520Sstevel@tonic-gate  * (non-generic) inquiry definitions.
4530Sstevel@tonic-gate  */
4540Sstevel@tonic-gate 
4550Sstevel@tonic-gate #include <sys/scsi/impl/inquiry.h>
4560Sstevel@tonic-gate 
4570Sstevel@tonic-gate #endif	/* _SYS_SCSI_GENERIC_INQUIRY_H */
458