inquiry.h revision 36c5fee33fa8b822175d410202aebcf592c8d342
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_SCSI_GENERIC_INQUIRY_H
#define _SYS_SCSI_GENERIC_INQUIRY_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* SCSI Inquiry Data
*
* Format of data returned as a result of an INQUIRY command.
*
*/
#if defined(_BIT_FIELDS_LTOH)
struct scsi_inquiry {
/*
* byte 0
*
* Bits 7-5 are the Peripheral Device Qualifier
* Bits 4-0 are the Peripheral Device Type
*
*/
/* byte 1 */
/* byte 2 */
/* byte 3 */
/* bytes 4-7 */
: 3;
: 2; /* reserved */
/* bytes 8-35 */
/*
* Bytes 36-47 are reserved:
* For Sun qualified hard disk drives the inq_serial field contains
* two bytes of mfg date year code (ascii)
* two bytes of mfg date week code (ascii)
* six bytes of mfg serial number (ascii)
* two bytes unused
*/
char inq_serial[12];
/*
* Bytes 48-95 are reserved.
* 96 to 'n' are vendor-specific parameter bytes
*/
};
#elif defined(_BIT_FIELDS_HTOL)
struct scsi_inquiry {
/*
* byte 0
*
* Bits 7-5 are the Peripheral Device Qualifier
* Bits 4-0 are the Peripheral Device Type
*
*/
/* byte 1 */
/* byte 2 */
/* byte 3 */
/* bytes 4-7 */
: 4;
/* bytes 8-35 */
/*
* Bytes 36-47 are reserved:
* For Sun qualified hard disk drives the inq_serial field contains
* two bytes of mfg date year code (ascii)
* two bytes of mfg date week code (ascii)
* six bytes of mfg serial number (ascii)
* two bytes unused
*/
char inq_serial[12];
/*
* Bytes 48-95 are reserved.
* 96 to 'n' are vendor-specific parameter bytes
*/
};
#else
#endif /* _BIT_FIELDS_LTOH */
/*
* Defined Peripheral Device Types
*/
#define DTYPE_DIRECT 0x00
#define DTYPE_SEQUENTIAL 0x01
#define DTYPE_PRINTER 0x02
#define DTYPE_PROCESSOR 0x03
#define DTYPE_WORM 0x04
#define DTYPE_RODIRECT 0x05
#define DTYPE_OPTICAL 0x07
#define DTYPE_CHANGER 0x08
#define DTYPE_ARRAY_CTRL 0x0C
#define DTYPE_ESI 0x0D
#define DTYPE_RBC 0x0E
#define DTYPE_OCRW 0x0F
#define DTYPE_BCC 0x10
#define DTYPE_OSD 0x11
#define DTYPE_ADC 0x12
/*
* Device types 0x13-0x1D are reserved in spc-3 (r23)
*/
#define DTYPE_WELLKNOWN 0x1E
#define DTYPE_UNKNOWN 0x1F
#define DTYPE_MASK 0x1F
/*
* The peripheral qualifier tells us more about a particular device.
* (DPQ == DEVICE PERIPHERAL QUALIFIER).
*/
#define DPQ_POSSIBLE 0x00
/*
* The specified peripheral device type is
* currently connected to this logical unit.
* If the target cannot detrermine whether
* or not a physical device is currently
* connected, it shall also return this
* qualifier.
*/
#define DPQ_SUPPORTED 0x20
/*
* The target is capable of supporting the
* specified peripheral device type on this
* logical unit, however the the physical
* device is not currently connected to this
* logical unit.
*/
#define DPQ_NEVER 0x60
/*
* The target is not capable of supporting a
* physical device on this logical unit. For
* this peripheral qualifier, the peripheral
* device type will be set to DTYPE_UNKNOWN
* in order to provide compatibility with
* previous versions of SCSI.
*/
#define DPQ_VUNIQ 0x80
/*
* If this bit is set, this is a vendor
* unique qualifier.
*/
/*
* To maintain compatibility with previous versions
* of inquiry data formats, if a device peripheral
* qualifier states that the target is not capable
* of supporting a physical device on this logical unit,
* then the qualifier DPQ_NEVER is set, *AND* the
* actual device type must be set to DTYPE_UNKNOWN.
*
* This may make for some problems with older drivers
* that blindly check the entire first byte, where they
* should be checking for only the least 5 bits to see
* whether the correct type is at the specified nexus.
*/
/*
* Defined Response Data Formats
*
* RDF_LEVEL0 means that this structure complies with SCSI-1 spec.
*
* RDF_CCS means that this structure complies with CCS pseudo-spec.
*
* RDF_SCSI2 means that the structure complies with the SCSI-2/3 spec.
*/
#define RDF_LEVEL0 0x00
#define RDF_CCS 0x01
#define RDF_SCSI2 0x02
/*
* SPC-3 revision 21c, section 7.6.4.1
* Table 289 -- Device Identification VPD page
*/
struct vpd_hdr {
#if defined(_BIT_FIELDS_LTOH)
periph_qual : 4;
#elif defined(_BIT_FIELDS_HTOL)
device_type : 4;
#else
#endif
page_len[2];
};
/*
* SPC-3 revision 21c, section 7.6.4.1
* Table 290 -- Identification descriptor
*/
struct vpd_desc {
#if defined(_BIT_FIELDS_LTOH)
proto_id : 4;
association : 2,
: 1,
piv : 1;
#elif defined(_BIT_FIELDS_HTOL)
code_set : 4;
: 1,
association : 2,
id_type : 4;
#else
#endif
/* ---- data follows ---- */
};
#ifdef __cplusplus
}
#endif
/*
* Include in implementation specifuc
* (non-generic) inquiry definitions.
*/
#endif /* _SYS_SCSI_GENERIC_INQUIRY_H */