17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c70629eStaylor  * Common Development and Distribution License (the "License").
67c70629eStaylor  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*2ee4dfc7SJane Chu  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c70629eStaylor  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_SYS_SCSI_GENERIC_INQUIRY_H
277c478bd9Sstevel@tonic-gate #define	_SYS_SCSI_GENERIC_INQUIRY_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
307c478bd9Sstevel@tonic-gate extern "C" {
317c478bd9Sstevel@tonic-gate #endif
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate /*
34d91393a8SChris Horne  * SCSI Standard Inquiry Data:
357c478bd9Sstevel@tonic-gate  *
367c478bd9Sstevel@tonic-gate  * Format of data returned as a result of an INQUIRY command.
377c478bd9Sstevel@tonic-gate  *
38d91393a8SChris Horne  * NOTE: Fields marked 'DEPRECATED' are defined in older versions of t10 "SCSI
39d91393a8SChris Horne  * Primary Command" spec, and are marked 'Obsolete' in newer versions.
407c478bd9Sstevel@tonic-gate  */
417c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH)
427c478bd9Sstevel@tonic-gate struct scsi_inquiry {
437c478bd9Sstevel@tonic-gate 	/*
447c478bd9Sstevel@tonic-gate 	 * byte 0
457c478bd9Sstevel@tonic-gate 	 *
467c478bd9Sstevel@tonic-gate 	 * Bits 7-5 are the Peripheral Device Qualifier
477c478bd9Sstevel@tonic-gate 	 * Bits 4-0 are the Peripheral Device Type
487c478bd9Sstevel@tonic-gate 	 */
497c478bd9Sstevel@tonic-gate 	uchar_t	inq_dtype;
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate 	/* byte 1 */
52d91393a8SChris Horne 	uchar_t	inq_qual	: 7,	/* device type qualifier */
53d91393a8SChris Horne 		inq_rmb		: 1;	/* removable media */
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate 	/* byte 2 */
56d91393a8SChris Horne 	uchar_t	inq_ansi	: 3,	/* ANSI version */
57d91393a8SChris Horne 		inq_ecma	: 3,	/* ECMA version */
58d91393a8SChris Horne 		inq_iso		: 2;	/* ISO version */
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate 	/* byte 3 */
61d91393a8SChris Horne 	uchar_t	inq_rdf		: 4,	/* response data format */
62d91393a8SChris Horne 		inq_hisup	: 1,	/* hierarchical addressing model */
637c478bd9Sstevel@tonic-gate 		inq_normaca	: 1,	/* setting NACA bit supported */
64d91393a8SChris Horne 		inq_trmiop	: 1,	/* DEPRECATED: terminate I/O proc */
65d91393a8SChris Horne 		inq_aenc	: 1;	/* DEPRECATED: async event notify */
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate 	/* bytes 4-7 */
68d91393a8SChris Horne 	uchar_t	inq_len;		/* additional length */
697c478bd9Sstevel@tonic-gate 
70d91393a8SChris Horne 	uchar_t	inq_protect	: 1,	/* supports protection information */
71d91393a8SChris Horne 		inq_5_1		: 1,
72d91393a8SChris Horne 		inq_5_2		: 1,
73d91393a8SChris Horne 		inq_3pc		: 1,	/* third-party copy */
74d91393a8SChris Horne 		inq_tpgs	: 2,	/* impl/expl asymmetric lun access */
75d91393a8SChris Horne 		inq_acc		: 1,	/* access controls coordinator */
76d91393a8SChris Horne 		inq_sccs	: 1;	/* embedded storage array */
77d91393a8SChris Horne 
78d91393a8SChris Horne 	uchar_t	inq_addr16	: 1,	/* SPI: 16-bit wide SCSI addr */
79d91393a8SChris Horne 		inq_addr32	: 1,	/* DEPRECATED: 32 bit wide address */
80d91393a8SChris Horne 		inq_ackqreqq	: 1,	/* DEPRECATED: data xfer on Q cable */
81d91393a8SChris Horne 		inq_mchngr	: 1,	/* DEPRECATED: embeded medium changer */
82d91393a8SChris Horne 		inq_dualp	: 1,	/* multi port device */
83d91393a8SChris Horne 		inq_port	: 1,	/* DEPRECATED: port rcv inquiry cmd */
84d91393a8SChris Horne 		inq_encserv	: 1,	/* embedded enclosure services */
85d91393a8SChris Horne 		inq_bque	: 1;	/* DEPRECATED: combined with cmdque */
86d91393a8SChris Horne 
87d91393a8SChris Horne 	uchar_t	inq_sftre	: 1,	/* DEPRECATED: Soft Reset option */
88d91393a8SChris Horne 		inq_cmdque	: 1,	/* supports command queueing */
89d91393a8SChris Horne 		inq_trandis	: 1,	/* DEPRECATED: transfer disable msgs */
90d91393a8SChris Horne 		inq_linked	: 1,	/* DEPRECATED: linked commands */
91d91393a8SChris Horne 		inq_sync	: 1,	/* SPI: synchronous data xfers */
92d91393a8SChris Horne 		inq_wbus16	: 1,	/* SPI: 16-bit wide data xfers */
93d91393a8SChris Horne 		inq_wbus32	: 1,	/* DEPRECATED: 32 bit wide data xfers */
94d91393a8SChris Horne 		inq_reladdr	: 1;	/* DEPRECATED: relative addressing */
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate 	/* bytes 8-35 */
97d91393a8SChris Horne 	char	inq_vid[8];		/* vendor ID */
98d91393a8SChris Horne 	char	inq_pid[16];		/* product ID */
99d91393a8SChris Horne 	char	inq_revision[4];	/* revision level */
1007c478bd9Sstevel@tonic-gate 
1017c478bd9Sstevel@tonic-gate 	/*
1027c478bd9Sstevel@tonic-gate 	 * Bytes 36-47 are reserved:
1037c478bd9Sstevel@tonic-gate 	 *	For Sun qualified hard disk drives the inq_serial field contains
1047c478bd9Sstevel@tonic-gate 	 *		two bytes of mfg date year code (ascii)
1057c478bd9Sstevel@tonic-gate 	 *		two bytes of mfg date week code (ascii)
1067c478bd9Sstevel@tonic-gate 	 *		six bytes of mfg serial number (ascii)
1077c478bd9Sstevel@tonic-gate 	 *		two bytes unused
1087c478bd9Sstevel@tonic-gate 	 */
1097c478bd9Sstevel@tonic-gate 	char	inq_serial[12];
1107c478bd9Sstevel@tonic-gate 
1117c478bd9Sstevel@tonic-gate 	/*
112d91393a8SChris Horne 	 * Bytes 48-55 are reserved.
113d91393a8SChris Horne 	 */
114d91393a8SChris Horne 	uchar_t	__inq_48	: 8;
115d91393a8SChris Horne 	uchar_t	__inq_49	: 8;
116d91393a8SChris Horne 	uchar_t	__inq_50	: 8;
117d91393a8SChris Horne 	uchar_t	__inq_51	: 8;
118d91393a8SChris Horne 	uchar_t	__inq_52	: 8;
119d91393a8SChris Horne 	uchar_t	__inq_53	: 8;
120d91393a8SChris Horne 	uchar_t	__inq_54	: 8;
121d91393a8SChris Horne 	uchar_t	__inq_55	: 8;
122d91393a8SChris Horne 
123d91393a8SChris Horne 	/*
124d91393a8SChris Horne 	 * The meanings of byte 56 is specific to SPI-3. For protocols older
125d91393a8SChris Horne 	 * or other than this these fields are reserved.
126d91393a8SChris Horne 	 */
127d91393a8SChris Horne 	uchar_t	inq_ius		: 1,	/* SPI3: information units */
128d91393a8SChris Horne 		inq_qas		: 1,	/* SPI3: quick arb sel */
129d91393a8SChris Horne 		inq_clk		: 2,	/* SPI3: clocking */
130d91393a8SChris Horne 		__inq_56_4	: 1,	/* reserved */
131d91393a8SChris Horne 		__inq_56_5	: 1,	/* reserved */
132d91393a8SChris Horne 		__inq_56_6	: 1,	/* reserved */
133d91393a8SChris Horne 		__inq_56_7	: 1;	/* reserved */
134d91393a8SChris Horne 
135d91393a8SChris Horne 	uchar_t	__inq_57	: 8;	/* reserved */
136d91393a8SChris Horne 
137d91393a8SChris Horne 	/*
138d91393a8SChris Horne 	 * byte pairs 58-73 are version descriptors
139d91393a8SChris Horne 	 *  See: Table 51: dpANS SCSI Primary Commands - 2 (SPC-2) T10/1236
140d91393a8SChris Horne 	 */
141d91393a8SChris Horne 	struct	inq_vd {
142d91393a8SChris Horne 		uchar_t		inq_vd_msb;
143d91393a8SChris Horne 		uchar_t		inq_vd_lsb;
144d91393a8SChris Horne 	}	inq_vd[8];
145d91393a8SChris Horne 
146d91393a8SChris Horne 	/*
147d91393a8SChris Horne 	 * Bytes 74-95 are reserved.
148d91393a8SChris Horne 	 * 96 to 'n' are vendor-specific parameter bytes.
149d91393a8SChris Horne 	 *
150d91393a8SChris Horne 	 * Pad structure to 132 bytes so that access to some vendor-specific
151d91393a8SChris Horne 	 * data is possible via scsi_device(9S) sd_inq (for mpxio).
1527c478bd9Sstevel@tonic-gate 	 */
153d91393a8SChris Horne 	uchar_t	__inq_74_127[132 - 74];
1547c478bd9Sstevel@tonic-gate };
1557c478bd9Sstevel@tonic-gate 
1567c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL)
1577c478bd9Sstevel@tonic-gate 
1587c478bd9Sstevel@tonic-gate struct scsi_inquiry {
1597c478bd9Sstevel@tonic-gate 	/*
1607c478bd9Sstevel@tonic-gate 	 * byte 0
1617c478bd9Sstevel@tonic-gate 	 *
1627c478bd9Sstevel@tonic-gate 	 * Bits 7-5 are the Peripheral Device Qualifier
1637c478bd9Sstevel@tonic-gate 	 * Bits 4-0 are the Peripheral Device Type
1647c478bd9Sstevel@tonic-gate 	 */
1657c478bd9Sstevel@tonic-gate 	uchar_t	inq_dtype;
1667c478bd9Sstevel@tonic-gate 
1677c478bd9Sstevel@tonic-gate 	/* byte 1 */
1687c478bd9Sstevel@tonic-gate 	uchar_t	inq_rmb		: 1,	/* removable media */
1697c478bd9Sstevel@tonic-gate 		inq_qual	: 7;	/* device type qualifier */
1707c478bd9Sstevel@tonic-gate 
1717c478bd9Sstevel@tonic-gate 	/* byte 2 */
1727c478bd9Sstevel@tonic-gate 	uchar_t	inq_iso		: 2,	/* ISO version */
1737c478bd9Sstevel@tonic-gate 		inq_ecma	: 3,	/* ECMA version */
1747c478bd9Sstevel@tonic-gate 		inq_ansi	: 3;	/* ANSI version */
1757c478bd9Sstevel@tonic-gate 
1767c478bd9Sstevel@tonic-gate 	/* byte 3 */
177d91393a8SChris Horne 	uchar_t	inq_aenc	: 1,	/* DEPRECATED: async event notify */
178d91393a8SChris Horne 		inq_trmiop	: 1,	/* DEPRECATED: terminate I/O proc */
1797c478bd9Sstevel@tonic-gate 		inq_normaca	: 1,	/* setting NACA bit supported */
180d91393a8SChris Horne 		inq_hisup	: 1,	/* hierarchical addressing model */
1817c478bd9Sstevel@tonic-gate 		inq_rdf		: 4;	/* response data format */
1827c478bd9Sstevel@tonic-gate 
1837c478bd9Sstevel@tonic-gate 	/* bytes 4-7 */
1847c478bd9Sstevel@tonic-gate 	uchar_t	inq_len;		/* additional length */
1857c478bd9Sstevel@tonic-gate 
186d91393a8SChris Horne 	uchar_t	inq_sccs	: 1,	/* embedded storage array */
187d91393a8SChris Horne 		inq_acc		: 1,	/* access controls coordinator */
188d91393a8SChris Horne 		inq_tpgs	: 2,	/* impl/expl asymmetric lun access */
189d91393a8SChris Horne 		inq_3pc		: 1,	/* third-party copy */
190d91393a8SChris Horne 		inq_5_2		: 1,
191d91393a8SChris Horne 		inq_5_1		: 1,
192d91393a8SChris Horne 		inq_protect	: 1;	/* supports protection information */
193d91393a8SChris Horne 
194d91393a8SChris Horne 	uchar_t	inq_bque	: 1,	/* DEPRECATED: combined with cmdque */
195d91393a8SChris Horne 		inq_encserv	: 1,	/* embedded enclosure services */
196d91393a8SChris Horne 		inq_port	: 1,	/* DEPRECATED: port rcv inquiry cmd */
197d91393a8SChris Horne 		inq_dualp	: 1,	/* multi port device */
198d91393a8SChris Horne 		inq_mchngr	: 1,	/* DEPRECATED: embeded medium changer */
199d91393a8SChris Horne 		inq_ackqreqq	: 1,	/* DEPRECATED: data xfer on Q cable */
200d91393a8SChris Horne 		inq_addr32	: 1,	/* DEPRECATED: 32 bit wide address */
201d91393a8SChris Horne 		inq_addr16	: 1;	/* SPI: 16-bit wide SCSI addr */
202d91393a8SChris Horne 
203d91393a8SChris Horne 	uchar_t	inq_reladdr	: 1,	/* DEPRECATED: relative addressing */
204d91393a8SChris Horne 		inq_wbus32	: 1,	/* DEPRECATED: 32 bit wide data xfers */
205d91393a8SChris Horne 		inq_wbus16	: 1,	/* SPI: 16-bit wide data xfers */
206d91393a8SChris Horne 		inq_sync	: 1,	/* SPI: synchronous data xfers */
207d91393a8SChris Horne 		inq_linked	: 1,	/* DEPRECATED: linked commands */
208d91393a8SChris Horne 		inq_trandis	: 1,	/* DEPRECATED: transfer disable msgs */
2097c478bd9Sstevel@tonic-gate 		inq_cmdque	: 1,	/* supports command queueing */
210d91393a8SChris Horne 		inq_sftre	: 1;	/* DEPRECATED: Soft Reset option */
2117c478bd9Sstevel@tonic-gate 
2127c478bd9Sstevel@tonic-gate 	/* bytes 8-35 */
2137c478bd9Sstevel@tonic-gate 	char	inq_vid[8];		/* vendor ID */
2147c478bd9Sstevel@tonic-gate 	char	inq_pid[16];		/* product ID */
2157c478bd9Sstevel@tonic-gate 	char	inq_revision[4];	/* revision level */
2167c478bd9Sstevel@tonic-gate 
2177c478bd9Sstevel@tonic-gate 	/*
2187c478bd9Sstevel@tonic-gate 	 * Bytes 36-47 are reserved:
2197c478bd9Sstevel@tonic-gate 	 *	For Sun qualified hard disk drives the inq_serial field contains
2207c478bd9Sstevel@tonic-gate 	 *		two bytes of mfg date year code (ascii)
2217c478bd9Sstevel@tonic-gate 	 *		two bytes of mfg date week code (ascii)
2227c478bd9Sstevel@tonic-gate 	 *		six bytes of mfg serial number (ascii)
2237c478bd9Sstevel@tonic-gate 	 *		two bytes unused
2247c478bd9Sstevel@tonic-gate 	 */
2257c478bd9Sstevel@tonic-gate 	char	inq_serial[12];
2267c478bd9Sstevel@tonic-gate 
2277c478bd9Sstevel@tonic-gate 	/*
228d91393a8SChris Horne 	 * Bytes 48-55 are reserved.
229d91393a8SChris Horne 	 */
230d91393a8SChris Horne 	uchar_t	__inq_48	: 8;
231d91393a8SChris Horne 	uchar_t	__inq_49	: 8;
232d91393a8SChris Horne 	uchar_t	__inq_50	: 8;
233d91393a8SChris Horne 	uchar_t	__inq_51	: 8;
234d91393a8SChris Horne 	uchar_t	__inq_52	: 8;
235d91393a8SChris Horne 	uchar_t	__inq_53	: 8;
236d91393a8SChris Horne 	uchar_t	__inq_54	: 8;
237d91393a8SChris Horne 	uchar_t	__inq_55	: 8;
238d91393a8SChris Horne 
239d91393a8SChris Horne 	/*
240d91393a8SChris Horne 	 * The meanings of byte 56 is specific to SPI-3. For protocols older
241d91393a8SChris Horne 	 * or other than this these fields are reserved.
242d91393a8SChris Horne 	 */
243d91393a8SChris Horne 	uchar_t	__inq_56_7	: 1,	/* reserved */
244d91393a8SChris Horne 		__inq_56_6	: 1,	/* reserved */
245d91393a8SChris Horne 		__inq_56_5	: 1,	/* reserved */
246d91393a8SChris Horne 		__inq_56_4	: 1,	/* reserved */
247d91393a8SChris Horne 		inq_clk		: 2,	/* SPI3: clocking */
248d91393a8SChris Horne 		inq_qas		: 1,	/* SPI3: quick arb sel */
249d91393a8SChris Horne 		inq_ius		: 1;	/* SPI3: information units */
250d91393a8SChris Horne 
251d91393a8SChris Horne 	uchar_t	__inq_57	: 8;		/* reserved */
252d91393a8SChris Horne 
253d91393a8SChris Horne 	/*
254d91393a8SChris Horne 	 * byte pairs 58-73 are version descriptors
255d91393a8SChris Horne 	 *  See: Table 51: dpANS SCSI Primary Commands - 2 (SPC-2) T10/1236
2567c478bd9Sstevel@tonic-gate 	 */
257d91393a8SChris Horne 	struct	inq_vd {
258d91393a8SChris Horne 		uchar_t		inq_vd_msb;
259d91393a8SChris Horne 		uchar_t		inq_vd_lsb;
260d91393a8SChris Horne 	}	inq_vd[8];
261d91393a8SChris Horne 
262d91393a8SChris Horne 	/*
263d91393a8SChris Horne 	 * Bytes 74-95 are reserved.
264d91393a8SChris Horne 	 * 96 to 'n' are vendor-specific parameter bytes.
265d91393a8SChris Horne 	 *
266d91393a8SChris Horne 	 * Pad structure to 132 bytes so that access to some vendor-specific
267d91393a8SChris Horne 	 * data is possible via scsi_device(9S) sd_inq (for mpxio).
268d91393a8SChris Horne 	 */
269d91393a8SChris Horne 	uchar_t	__inq_74_127[132 - 74];
2707c478bd9Sstevel@tonic-gate };
2717c478bd9Sstevel@tonic-gate #else
2727c478bd9Sstevel@tonic-gate #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
2737c478bd9Sstevel@tonic-gate #endif	/* _BIT_FIELDS_LTOH */
2747c478bd9Sstevel@tonic-gate 
2757c478bd9Sstevel@tonic-gate /*
2767c478bd9Sstevel@tonic-gate  * Defined Peripheral Device Types
2777c478bd9Sstevel@tonic-gate  */
278d91393a8SChris Horne #define	DTYPE_DIRECT		0x00	/* magnetic disk */
279d91393a8SChris Horne #define	DTYPE_SEQUENTIAL	0x01	/* magnetic tape */
2807c478bd9Sstevel@tonic-gate #define	DTYPE_PRINTER		0x02
2817c478bd9Sstevel@tonic-gate #define	DTYPE_PROCESSOR		0x03
282d91393a8SChris Horne #define	DTYPE_WORM		0x04	/* some optical disks */
2837c478bd9Sstevel@tonic-gate #define	DTYPE_RODIRECT		0x05
2847c70629eStaylor #define	DTYPE_SCANNER		0x06	/* obsolete */
2857c478bd9Sstevel@tonic-gate #define	DTYPE_OPTICAL		0x07
286d91393a8SChris Horne #define	DTYPE_CHANGER		0x08	/* jukeboxes */
2877c70629eStaylor #define	DTYPE_COMM		0x09	/* obsolete */
2887c478bd9Sstevel@tonic-gate #define	DTYPE_ARRAY_CTRL	0x0C
289d91393a8SChris Horne #define	DTYPE_ESI		0x0D	/* Enclosure services device */
290d91393a8SChris Horne #define	DTYPE_RBC		0x0E	/* Simplified direct-access device */
291d91393a8SChris Horne #define	DTYPE_OCRW		0x0F	/* Optical card reader/writer device */
2927c70629eStaylor #define	DTYPE_BCC		0x10
293d91393a8SChris Horne #define	DTYPE_OSD		0x11	/* Object-based Storage Device */
2947c70629eStaylor #define	DTYPE_ADC		0x12
2957c478bd9Sstevel@tonic-gate /*
2967c70629eStaylor  * Device types 0x13-0x1D are reserved in spc-3 (r23)
2977c478bd9Sstevel@tonic-gate  */
2987c478bd9Sstevel@tonic-gate 
2997c70629eStaylor #define	DTYPE_WELLKNOWN		0x1E
3007c478bd9Sstevel@tonic-gate #define	DTYPE_UNKNOWN		0x1F
3017c478bd9Sstevel@tonic-gate #define	DTYPE_MASK		0x1F
3027c478bd9Sstevel@tonic-gate 
303d91393a8SChris Horne /* ASCII mapping used by scsi_dname(9F) */
304d91393a8SChris Horne #define	DTYPE_ASCII		{ \
305d91393a8SChris Horne 		"Direct Access", "Sequential Access", "Printer", "Processor", \
306d91393a8SChris Horne 		"Write-Once/Read-Many", "Read-Only Direct Access", "Scanner", \
307d91393a8SChris Horne 		"Optical", "Changer", "Communications", "Unknown-0A", \
308d91393a8SChris Horne 		"Unknown-0B", "Array Controller", "Enclosure-Services", \
309d91393a8SChris Horne 		"Simplified-Direct-Access", "Optical-Card", "Bridge", \
310d91393a8SChris Horne 		"Object-Storage", NULL}
311d91393a8SChris Horne 
3127c478bd9Sstevel@tonic-gate /*
3137c478bd9Sstevel@tonic-gate  * The peripheral qualifier tells us more about a particular device.
3147c478bd9Sstevel@tonic-gate  * (DPQ == DEVICE PERIPHERAL QUALIFIER).
3157c478bd9Sstevel@tonic-gate  */
316d91393a8SChris Horne #define	DPQ_MASK	0x60	/* DPQ bits */
3177c478bd9Sstevel@tonic-gate #define	DPQ_POSSIBLE	0x00
3187c478bd9Sstevel@tonic-gate 				/*
3197c478bd9Sstevel@tonic-gate 				 * The specified peripheral device type is
3207c478bd9Sstevel@tonic-gate 				 * currently connected to this logical unit.
321d91393a8SChris Horne 				 * If the target cannot determine whether
3227c478bd9Sstevel@tonic-gate 				 * or not a physical device is currently
3237c478bd9Sstevel@tonic-gate 				 * connected, it shall also return this
3247c478bd9Sstevel@tonic-gate 				 * qualifier.
3257c478bd9Sstevel@tonic-gate 				 */
3267c478bd9Sstevel@tonic-gate #define	DPQ_SUPPORTED	0x20
3277c478bd9Sstevel@tonic-gate 				/*
3287c478bd9Sstevel@tonic-gate 				 * The target is capable of supporting the
3297c478bd9Sstevel@tonic-gate 				 * specified peripheral device type on this
330d91393a8SChris Horne 				 * logical unit, however the physical device
331d91393a8SChris Horne 				 * is not currently connected to this logical
332d91393a8SChris Horne 				 * unit.
3337c478bd9Sstevel@tonic-gate 				 */
3347c478bd9Sstevel@tonic-gate #define	DPQ_NEVER	0x60
3357c478bd9Sstevel@tonic-gate 				/*
3367c478bd9Sstevel@tonic-gate 				 * The target is not capable of supporting a
3377c478bd9Sstevel@tonic-gate 				 * physical device on this logical unit. For
3387c478bd9Sstevel@tonic-gate 				 * this peripheral qualifier, the peripheral
3397c478bd9Sstevel@tonic-gate 				 * device type will be set to DTYPE_UNKNOWN
3407c478bd9Sstevel@tonic-gate 				 * in order to provide compatibility with
3417c478bd9Sstevel@tonic-gate 				 * previous versions of SCSI.
3427c478bd9Sstevel@tonic-gate 				 */
3437c478bd9Sstevel@tonic-gate #define	DPQ_VUNIQ	0x80
3447c478bd9Sstevel@tonic-gate 				/*
3457c478bd9Sstevel@tonic-gate 				 * If this bit is set, this is a vendor
3467c478bd9Sstevel@tonic-gate 				 * unique qualifier.
3477c478bd9Sstevel@tonic-gate 				 */
348d91393a8SChris Horne 
3497c478bd9Sstevel@tonic-gate /*
3507c478bd9Sstevel@tonic-gate  * To maintain compatibility with previous versions
3517c478bd9Sstevel@tonic-gate  * of inquiry data formats, if a device peripheral
3527c478bd9Sstevel@tonic-gate  * qualifier states that the target is not capable
3537c478bd9Sstevel@tonic-gate  * of supporting a physical device on this logical unit,
3547c478bd9Sstevel@tonic-gate  * then the qualifier DPQ_NEVER is set, *AND* the
3557c478bd9Sstevel@tonic-gate  * actual device type must be set to DTYPE_UNKNOWN.
3567c478bd9Sstevel@tonic-gate  *
3577c478bd9Sstevel@tonic-gate  * This may make for some problems with older drivers
3587c478bd9Sstevel@tonic-gate  * that blindly check the entire first byte, where they
3597c478bd9Sstevel@tonic-gate  * should be checking for only the least 5 bits to see
3607c478bd9Sstevel@tonic-gate  * whether the correct type is at the specified nexus.
3617c478bd9Sstevel@tonic-gate  */
3627c478bd9Sstevel@tonic-gate #define	DTYPE_NOTPRESENT	(DPQ_NEVER | DTYPE_UNKNOWN)
3637c478bd9Sstevel@tonic-gate 
3647c478bd9Sstevel@tonic-gate /*
365d91393a8SChris Horne  * Defined Response Data Formats:
3667c478bd9Sstevel@tonic-gate  */
367d91393a8SChris Horne #define	RDF_LEVEL0		0x00	/* no conformance claim (SCSI-1) */
368d91393a8SChris Horne #define	RDF_CCS			0x01	/* Obsolete (pseudo-spec) */
369d91393a8SChris Horne #define	RDF_SCSI2		0x02	/* Obsolete (SCSI-2/3 spec) */
370d91393a8SChris Horne #define	RDF_SCSI_SPC		0x03	/* ANSI INCITS 301-1997 (SPC) */
371d91393a8SChris Horne #define	RDF_SCSI_SPC2		0x04	/* ANSI INCITS 351-2001 (SPC-2) */
372d91393a8SChris Horne #define	RDF_SCSI_SPC3		0x05	/* ANSI INCITS 408-2005 (SPC-3) */
373d91393a8SChris Horne #define	RDF_SCSI_SPC4		0x06	/* t10 (SPC-4) */
3747c478bd9Sstevel@tonic-gate 
375d91393a8SChris Horne /*
376d91393a8SChris Horne  * Defined Target Port Group Select values:
377d91393a8SChris Horne  */
378d91393a8SChris Horne #define	TPGS_FAILOVER_NONE	0x0
379d91393a8SChris Horne #define	TPGS_FAILOVER_IMPLICIT	0x1
380d91393a8SChris Horne #define	TPGS_FAILOVER_EXPLICIT	0x2
381d91393a8SChris Horne #define	TPGS_FAILOVER_BOTH	0x3
3827c478bd9Sstevel@tonic-gate 
38336c5fee3Smcneal /*
38436c5fee3Smcneal  * SPC-3 revision 21c, section 7.6.4.1
38536c5fee3Smcneal  * Table 289 -- Device Identification VPD page
38636c5fee3Smcneal  */
38736c5fee3Smcneal struct vpd_hdr {
38836c5fee3Smcneal #if defined(_BIT_FIELDS_LTOH)
38936c5fee3Smcneal 	uchar_t	device_type	: 4,
39036c5fee3Smcneal 		periph_qual	: 4;
39136c5fee3Smcneal #elif defined(_BIT_FIELDS_HTOL)
39236c5fee3Smcneal 	uchar_t	periph_qual	: 4,
39336c5fee3Smcneal 		device_type	: 4;
39436c5fee3Smcneal #else
39536c5fee3Smcneal #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
39636c5fee3Smcneal #endif
39736c5fee3Smcneal 	uchar_t	page_code,
39836c5fee3Smcneal 		page_len[2];
39936c5fee3Smcneal };
40036c5fee3Smcneal 
40136c5fee3Smcneal /*
40236c5fee3Smcneal  * SPC-3 revision 21c, section 7.6.4.1
40336c5fee3Smcneal  * Table 290 -- Identification descriptor
40436c5fee3Smcneal  */
40536c5fee3Smcneal struct vpd_desc {
40636c5fee3Smcneal #if defined(_BIT_FIELDS_LTOH)
40736c5fee3Smcneal 	uchar_t	code_set	: 4,
40836c5fee3Smcneal 		proto_id	: 4;
409d91393a8SChris Horne 	uchar_t	id_type		: 4,
41036c5fee3Smcneal 		association	: 2,
41136c5fee3Smcneal 				: 1,
41236c5fee3Smcneal 		piv		: 1;
41336c5fee3Smcneal #elif defined(_BIT_FIELDS_HTOL)
41436c5fee3Smcneal 	uchar_t	proto_id	: 4,
41536c5fee3Smcneal 		code_set	: 4;
416d91393a8SChris Horne 	uchar_t	piv		: 1,
41736c5fee3Smcneal 				: 1,
41836c5fee3Smcneal 		association	: 2,
41936c5fee3Smcneal 		id_type		: 4;
42036c5fee3Smcneal #else
42136c5fee3Smcneal #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
42236c5fee3Smcneal #endif
42336c5fee3Smcneal 	uchar_t	resrv1;
42436c5fee3Smcneal 	uchar_t	len;
42536c5fee3Smcneal 	/* ---- data follows ---- */
42636c5fee3Smcneal };
42736c5fee3Smcneal 
428*2ee4dfc7SJane Chu /*
429*2ee4dfc7SJane Chu  * "pm-capable" integer property bit mask definitions
430*2ee4dfc7SJane Chu  */
431*2ee4dfc7SJane Chu #define	PM_CAPABLE_PM_MASK	0x0000ffff	/* use lower 16 bits to */
432*2ee4dfc7SJane Chu 						/* indicate PM mode */
433*2ee4dfc7SJane Chu #define	PM_CAPABLE_CCS		RDF_CCS
434*2ee4dfc7SJane Chu #define	PM_CAPABLE_SCSI2	RDF_SCSI2
435*2ee4dfc7SJane Chu #define	PM_CAPABLE_SPC		RDF_SCSI_SPC
436*2ee4dfc7SJane Chu #define	PM_CAPABLE_SPC2		RDF_SCSI_SPC2
437*2ee4dfc7SJane Chu #define	PM_CAPABLE_SPC3		RDF_SCSI_SPC3
438*2ee4dfc7SJane Chu #define	PM_CAPABLE_SPC4		RDF_SCSI_SPC4
439*2ee4dfc7SJane Chu #define	PM_CAPABLE_LOG_MASK	0xffff0000	/* use upper 16 bit to */
440*2ee4dfc7SJane Chu 						/* indicate log specifics */
441*2ee4dfc7SJane Chu #define	PM_CAPABLE_LOG_SUPPORTED	0x10000	/* Log page 0xE might be */
442*2ee4dfc7SJane Chu 						/* supported */
443*2ee4dfc7SJane Chu #define	PM_CAPABLE_SMART_LOG		0x20000 /* Log page 0xE reports SMART */
444*2ee4dfc7SJane Chu 						/* attributes instead of the */
445*2ee4dfc7SJane Chu 						/* default SCSI Log pages */
4467c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
4477c478bd9Sstevel@tonic-gate }
4487c478bd9Sstevel@tonic-gate #endif
4497c478bd9Sstevel@tonic-gate 
4507c478bd9Sstevel@tonic-gate /*
4517c478bd9Sstevel@tonic-gate  * Include in implementation specifuc
4527c478bd9Sstevel@tonic-gate  * (non-generic) inquiry definitions.
4537c478bd9Sstevel@tonic-gate  */
4547c478bd9Sstevel@tonic-gate 
4557c478bd9Sstevel@tonic-gate #include <sys/scsi/impl/inquiry.h>
4567c478bd9Sstevel@tonic-gate 
4577c478bd9Sstevel@tonic-gate #endif	/* _SYS_SCSI_GENERIC_INQUIRY_H */
458