mode.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_SCSI_GENERIC_MODE_H
#define _SYS_SCSI_GENERIC_MODE_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
*
*
*/
/*
* Structures and defines common for all device types
*/
/*
*
* block descriptors, followed by zero or more mode pages.
*
*/
struct mode_header {
};
#define MODE_HEADER_LENGTH (sizeof (struct mode_header))
/*
*/
struct mode_header_g1 {
};
#define MODE_HEADER_LENGTH_G1 (sizeof (struct mode_header_g1))
/*
* Block Descriptor. Zero, one, or more may normally follow the mode header.
*
* The density code is device specific.
*
* The 24-bit value described by blks_{hi, mid, lo} describes the number of
* blocks which this block descriptor applies to. A value of zero means
* 'the rest of the blocks on the device'.
*
* The 24-bit value described by blksize_{hi, mid, lo} describes the blocksize
* (in bytes) applicable for this block descriptor. For Sequential Access
* devices, if this value is zero, the block size will be derived from
* the transfer length in I/O operations.
*
*/
struct block_descriptor {
};
#define MODE_BLK_DESC_LENGTH (sizeof (struct block_descriptor))
/*
* Define a macro to take an address of a mode header to the address
* of the nth (0..n) block_descriptor, or NULL if there either aren't any
* block descriptors or the nth block descriptor doesn't exist.
*/
((bdnum) * sizeof (struct block_descriptor)))) : \
((struct block_descriptor *)0)
/*
* Mode page header. Zero or more Mode Pages follow either the block
* descriptors (if any), or the Mode Header.
*
* The 'ps' bit must be zero for mode select operations.
*
*/
struct mode_page {
#if defined(_BIT_FIELDS_LTOH)
:1, /* reserved */
#elif defined(_BIT_FIELDS_HTOL)
:1, /* reserved */
#else
#endif /* _BIT_FIELDS_LTOH */
/*
* Mode Page specific data follows right after this...
*/
};
/*
* Define a macro to retrieve the first mode page. Could be more
* general (for multiple mode pages).
*/
/*
* Page codes follow the following specification:
*
* Code Value(s) What
* ----------------------------------------------------------------------
* 0x00 Vendor Unique (does not require page format)
*
* 0x02, 0x09, 0x0A pages for all Device Types
* 0x1A, 0x1C
*
* 0x01, 0x03-0x08, pages for specific Device Type
* 0x0B-0x19, 0x1B,
* 0x1D-0x1F
*
* 0x20-0x3E Vendor Unique (requires page format)
*
* 0x3F Return all pages (valid for Mode Sense only)
*
*/
/*
* Page codes and page length values (all device types)
*/
#define MODEPAGE_DISCO_RECO 0x02
#define MODEPAGE_CACHING 0x08
#define MODEPAGE_PDEVICE 0x09
#define MODEPAGE_CTRL_MODE 0x0A
#define MODEPAGE_POWER_COND 0x1A
#define MODEPAGE_INFO_EXCPT 0x1C
#define MODEPAGE_ALLPAGES 0x3F
/*
*/
/*
* Disconnect/Reconnect Page
*/
struct mode_disco_reco {
#if defined(_BIT_FIELDS_LTOH)
#elif defined(_BIT_FIELDS_HTOL)
#else
#endif /* _BIT_FIELDS_LTOH */
};
#define DTDC_DATADONE 0x01
/*
* Target may not disconnect once
* data transfer is started until
* all data successfully transferred.
*/
#define DTDC_CMDDONE 0x03
/*
* Target may not disconnect once
* data transfer is started until
* command completed.
*/
/*
* Caching Page
*/
struct mode_caching {
#if defined(_BIT_FIELDS_LTOH)
: 5; /* Reserved */
#elif defined(_BIT_FIELDS_HTOL)
#else
#endif /* _BIT_FIELDS_LTOH */
};
/*
* Peripheral Device Page
*/
struct mode_pdevice {
};
/*
* Control Mode Page
*
* Note: This structure is incompatible with previous SCSI
* alternative form of this structure. They can be
* distinguished by the length of data returned
* from a MODE SENSE command.
*/
#define PAGELENGTH_MODE_CONTROL_SCSI3 0x0A
struct mode_control_scsi3 {
#if defined(_BIT_FIELDS_LTOH)
: 5;
: 2,
: 1,
/* allegiance (only pre-SCSI-3) */
#elif defined(_BIT_FIELDS_HTOL)
uchar_t : 5,
: 2,
/* allegiance (only pre-SCSI-3) */
: 1,
#else
#endif /* _BIT_FIELDS_LTOH */
};
#define CTRL_QMOD_RESTRICT 0x0
#define CTRL_QMOD_UNRESTRICT 0x1
#ifdef __cplusplus
}
#endif
/*
* Include known generic device specific mode definitions and structures
*/
/*
* Include implementation specific mode information
*/
#endif /* _SYS_SCSI_GENERIC_MODE_H */