/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _DS_SCSI_H
#define _DS_SCSI_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/byteorder.h>
#include "ds_impl.h"
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(_BIT_FIELDS_LTOH) && !defined(_BIT_FIELDS_HTOL)
#endif
/*
* Log page structures
*/
#pragma pack(1)
typedef struct scsi_log_header {
#if defined(_BIT_FIELDS_LTOH)
#else
lh_code : 6;
#endif
typedef struct scsi_log_parameter_header {
#if defined(_BIT_FIELDS_LTOH)
#else
#endif
typedef struct scsi_supported_log_pages {
typedef struct scsi_ie_log_param {
/*
* The SCSI-3 SPC document states that IE log page (0x2F) parameter 0
* must have a length of at least 4 (including the length byte).
*/
typedef struct scsi_temp_log_param {
typedef struct scsi_selftest_log_param {
#if defined(_BIT_FIELDS_LTOH)
#else
#endif
#if defined(_BIT_FIELDS_LTOH)
#else
#endif
/* The results field of the self-test log parameter */
((code) == SELFTEST_OK || \
((code) >= SELFTEST_FAILURE_INCOMPLETE && \
((code) <= SELFTEST_FAILURE_SEG_OTHER)))
#define LOGPARAM_TEMP_LEN \
(sizeof (scsi_temp_log_param_t) - \
sizeof (scsi_log_parameter_header_t))
/*
*/
typedef struct scsi_ms_header {
typedef struct scsi_ms_header_g1 {
typedef struct scsi_ms_hdrs {
int ms_length;
union {
} ms_hdr;
typedef struct scsi_ie_page {
#if defined(_BIT_FIELDS_LTOH)
#else
#endif
#pragma pack()
/*
* Values for the MRIE field of the informational exceptions control mode page
*/
#define IE_REPORT_NONE 0
/*
* Constants in support of the CONTROL MODE mode page (page 0xA)
*/
#define LOGPAGE_SELFTEST_PARAM_LEN \
((sizeof (scsi_selftest_log_param_t)) - \
(sizeof (scsi_log_parameter_header_t)))
/*
* Macro to extract the length of a mode sense page
* as returned by a target.
*/
sizeof (struct mode_page))
/*
* Mode Select options
*/
/*
* Mode Sense Page Control
*/
/*
* Log Sense Page Control
*/
/*
* LOG page codes
*/
/* ASC constants */
/* ASCQ constants */
#define ASCQ_INVALID_OPCODE 0
/* Error tests */
(((s) == KEY_ILLEGAL_REQUEST) && ((a) == ASC_INVALID_OPCODE) && \
((aq) == ASCQ_INVALID_OPCODE))
(((s) == KEY_ILLEGAL_REQUEST) && ((a) == ASC_INVALID_CDB_FIELD))
/* command length to use */
#define MODE_CMD_LEN_UNKNOWN 0
/* supported modepages bitmask */
/* supported logpages bitmask */
/*
* For SCSI commands which want to accept arbitrary length responses, we need to
* allocate an appropriate sized buffer. The maximum length is USHRT_MAX,
* because some devices return nothing if the buffer length is too big.
*/
extern ds_transport_t ds_scsi_sim_transport;
#ifdef __cplusplus
}
#endif
#endif /* _DS_SCSI_H */