fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or http://www.opensolaris.org/os/licensing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * local SCSI definitions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef _G_SCSI_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define _G_SCSI_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Include any headers you depend on.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * I18N message number ranges
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This file: 18500 - 18999
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Shared common messages: 1 - 1999
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern "C" {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define MODEPAGE_GEOMETRY 0x04
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* NOTE: These command op codes are not defined in commands.h */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SCMD_SYNC_CACHE 0x35
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SCMD_LOG_SENSE 0x4d
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SCMD_PERS_RESERV_IN 0x5e
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SCMD_PERS_RESERV_OUT 0x5f
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define MAX_MODE_SENSE_LEN 0xffff
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Structure for MODE SELECT/SENSE 10 byte page header
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct mode_header_10_struct {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ushort_t length;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t medium_type; /* device specific */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t device_specific; /* device specfic parameters */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ushort_t rsvdl; /* reserved */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ushort_t bdesc_length; /* length of block descriptor(s), if any */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} Mode_header_10;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct mode_page_04_struct {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct mode_page mode_page; /* common mode page header */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t num_cylinders_hi;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t num_cylinders_mid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t num_cylinders_lo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t num_heads;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t write_precomp_hi;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t write_precomp_mid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t write_precomp_lo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t reduced_write_i_hi;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t reduced_write_i_mid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t reduced_write_i_lo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ushort_t step_rate;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t landing_zone_hi;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t landing_zone_mid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t landing_zone_lo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if defined(_BIT_FIELDS_LTOH)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t rpl : 2, /* RPL */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte : 6;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#elif defined(_BIT_FIELDS_HTOL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t : 6,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rpl : 2; /* disable correction */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _BIT_FIELDS_LTOH */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t rot_offset;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t : 8; /* reserved */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ushort_t rpm;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t : 8; /* reserved */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t : 8; /* reserved */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} Mp_04;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct mode_page_01_struct {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct mode_page mode_page; /* common mode page header */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if defined(_BIT_FIELDS_LTOH)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t dcr : 1, /* disable correction */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dte : 1, /* disable transfer on error */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte per : 1, /* post error */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte eec : 1, /* enable early correction */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc : 1, /* read continuous */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tb : 1, /* transfer block */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte arre : 1, /* auto read realloc enabled */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte awre : 1; /* auto write realloc enabled */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#elif defined(_BIT_FIELDS_HTOL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t awre : 1, /* auto write realloc enabled */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte arre : 1, /* auto read realloc enabled */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tb : 1, /* transfer block */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc : 1, /* read continuous */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte eec : 1, /* enable early correction */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte per : 1, /* post error */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dte : 1, /* disable transfer on error */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dcr : 1; /* disable correction */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _BIT_FIELDS_LTOH */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t read_retry_count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t correction_span;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t head_offset_count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t strobe_offset_count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t : 8; /* reserved */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t write_retry_count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t : 8; /* reserved */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ushort_t recovery_time_limit;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} Mp_01;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * I define here for backward compatability
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * with 2.5.1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * For 2.6 & above you can use "mode_caching"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct my_mode_caching {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct mode_page mode_page; /* common mode page header */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if defined(_BIT_FIELDS_LTOH)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t rcd : 1, /* Read Cache Disable */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mf : 1, /* Multiplication Factor */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wce : 1, /* Write Cache Enable */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte : 5; /* Reserved */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t write_ret_prio : 4, /* Write Retention Priority */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dmd_rd_ret_prio : 4; /* Demand Read Retention Priority */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#elif defined(_BIT_FIELDS_HTOL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t : 5, /* Reserved */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wce : 1, /* Write Cache Enable */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mf : 1, /* Multiplication Factor */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rcd : 1; /* Read Cache Disable */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t dmd_rd_ret_prio : 4, /* Demand Read Retention Priority */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte write_ret_prio : 4; /* Write Retention Priority */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _BIT_FIELDS_LTOH */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ushort_t pf_dsbl_trans_len; /* Disable prefetch Xfer len. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ushort_t min_prefetch; /* Minimum Prefetch */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ushort_t max_prefetch; /* Maximum Prefetch */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ushort_t max_prefetch_ceiling; /* Maximum Prefetch Ceiling */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * SCSI CDB structures
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct my_cdb_g0 {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned char cmd;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned char lba_msb;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned char lba;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned char lba_lsb;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned char count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned char control;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }my_cdb_g0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned char cmd;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned char byte1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned char byte2;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned char byte3;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned char byte4;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned char byte5;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned char byte6;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned char byte7;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned char byte8;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned char byte9;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }my_cdb_g1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct l_inquiry80_struct {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * byte 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Bits 7-5 are the Peripheral Device Qualifier
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Bits 4-0 are the Peripheral Device Type
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t inq_dtype;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t inq_page_code;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t reserved; /* reserved */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t inq_page_len;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t inq_serial[251];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} L_inquiry80;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct l_inquiry00_struct {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t qual :3,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dtype :5;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t page_code;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t reserved;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t len;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t page_list[251];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} L_inquiry00;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _G_SCSI_H */