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 55c46c6a0Spd * Common Development and Distribution License (the "License"). 65c46c6a0Spd * 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*63aa5377SAlan Perry * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _SYS_SCSI_GENERIC_SENSE_H 277c478bd9Sstevel@tonic-gate #define _SYS_SCSI_GENERIC_SENSE_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #ifdef __cplusplus 307c478bd9Sstevel@tonic-gate extern "C" { 317c478bd9Sstevel@tonic-gate #endif 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate /* 347c478bd9Sstevel@tonic-gate * Standard (Non-Extended) SCSI Sense. 357c478bd9Sstevel@tonic-gate * 367c478bd9Sstevel@tonic-gate * For Error Classe 0-6. This is all 377c478bd9Sstevel@tonic-gate * Vendor Unique sense information. 387c478bd9Sstevel@tonic-gate * 397c478bd9Sstevel@tonic-gate * Note: This is pre-SCSI-2. 407c478bd9Sstevel@tonic-gate */ 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate struct scsi_sense { 437c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH) 447c478bd9Sstevel@tonic-gate uchar_t ns_code : 4, /* Vendor Uniqe error code */ 457c478bd9Sstevel@tonic-gate ns_class : 3, /* Error class */ 467c478bd9Sstevel@tonic-gate ns_valid : 1; /* Logical Block Address is val */ 477c478bd9Sstevel@tonic-gate uchar_t ns_lba_hi : 5, /* High Logical Block Address */ 487c478bd9Sstevel@tonic-gate ns_vu : 3; /* Vendor Unique value */ 497c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL) 507c478bd9Sstevel@tonic-gate uchar_t ns_valid : 1, /* Logical Block Address is valid */ 517c478bd9Sstevel@tonic-gate ns_class : 3, /* Error class */ 527c478bd9Sstevel@tonic-gate ns_code : 4; /* Vendor Uniqe error code */ 537c478bd9Sstevel@tonic-gate uchar_t ns_vu : 3, /* Vendor Unique value */ 547c478bd9Sstevel@tonic-gate ns_lba_hi : 5; /* High Logical Block Address */ 557c478bd9Sstevel@tonic-gate #else 567c478bd9Sstevel@tonic-gate #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 577c478bd9Sstevel@tonic-gate #endif /* _BIT_FIELDS_LTOH */ 587c478bd9Sstevel@tonic-gate uchar_t ns_lba_mid; /* Middle Logical Block Address */ 597c478bd9Sstevel@tonic-gate uchar_t ns_lba_lo; /* Low part of Logical Block Address */ 607c478bd9Sstevel@tonic-gate }; 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gate /* 637c478bd9Sstevel@tonic-gate * SCSI Extended Sense structure 647c478bd9Sstevel@tonic-gate * 657c478bd9Sstevel@tonic-gate * For Error Class 7, the Extended Sense Structure is applicable (now referred 667c478bd9Sstevel@tonic-gate * to in SPC-3 as "fixed format sense data"). The es_code field is used 677c478bd9Sstevel@tonic-gate * to determine whether the extended sense data is actually "fixed format" or 687c478bd9Sstevel@tonic-gate * the newer "descriptor format" introduced in SPC-3. 697c478bd9Sstevel@tonic-gate */ 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gate #define CLASS_EXTENDED_SENSE 0x7 /* indicates extended sense */ 725c46c6a0Spd #define ADDL_SENSE_ADJUST 0x8 /* Add to es_add_length for total */ 735c46c6a0Spd #define MIN_FIXED_SENSE_LEN 0xE /* Minimum allowed fixed buf len */ 747c478bd9Sstevel@tonic-gate 757c478bd9Sstevel@tonic-gate struct scsi_extended_sense { 767c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH) 777c478bd9Sstevel@tonic-gate uchar_t es_code : 4, /* Vendor Unique error code */ 787c478bd9Sstevel@tonic-gate es_class : 3, /* Error Class- fixed at 0x7 */ 797c478bd9Sstevel@tonic-gate es_valid : 1; /* sense data is valid */ 807c478bd9Sstevel@tonic-gate 817c478bd9Sstevel@tonic-gate uchar_t es_segnum; /* segment number: for COPY cmd */ 827c478bd9Sstevel@tonic-gate 837c478bd9Sstevel@tonic-gate uchar_t es_key : 4, /* Sense key (see below) */ 847c478bd9Sstevel@tonic-gate : 1, /* reserved */ 857c478bd9Sstevel@tonic-gate es_ili : 1, /* Incorrect Length Indicator */ 867c478bd9Sstevel@tonic-gate es_eom : 1, /* End of Media */ 877c478bd9Sstevel@tonic-gate es_filmk : 1; /* File Mark Detected */ 887c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL) 897c478bd9Sstevel@tonic-gate uchar_t es_valid : 1, /* sense data is valid */ 907c478bd9Sstevel@tonic-gate es_class : 3, /* Error Class- fixed at 0x7 */ 917c478bd9Sstevel@tonic-gate es_code : 4; /* Vendor Unique error code */ 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gate uchar_t es_segnum; /* segment number: for COPY cmd */ 947c478bd9Sstevel@tonic-gate 957c478bd9Sstevel@tonic-gate uchar_t es_filmk : 1, /* File Mark Detected */ 967c478bd9Sstevel@tonic-gate es_eom : 1, /* End of Media */ 977c478bd9Sstevel@tonic-gate es_ili : 1, /* Incorrect Length Indicator */ 987c478bd9Sstevel@tonic-gate : 1, /* reserved */ 997c478bd9Sstevel@tonic-gate es_key : 4; /* Sense key (see below) */ 1007c478bd9Sstevel@tonic-gate #else 1017c478bd9Sstevel@tonic-gate #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 1027c478bd9Sstevel@tonic-gate #endif /* _BIT_FIELDS_LTOH */ 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gate uchar_t es_info_1; /* information byte 1 */ 1057c478bd9Sstevel@tonic-gate uchar_t es_info_2; /* information byte 2 */ 1067c478bd9Sstevel@tonic-gate uchar_t es_info_3; /* information byte 3 */ 1077c478bd9Sstevel@tonic-gate uchar_t es_info_4; /* information byte 4 */ 1087c478bd9Sstevel@tonic-gate uchar_t es_add_len; /* number of additional bytes */ 1097c478bd9Sstevel@tonic-gate 1107c478bd9Sstevel@tonic-gate uchar_t es_cmd_info[4]; /* command specific information */ 1117c478bd9Sstevel@tonic-gate uchar_t es_add_code; /* Additional Sense Code */ 1127c478bd9Sstevel@tonic-gate uchar_t es_qual_code; /* Additional Sense Code Qualifier */ 1137c478bd9Sstevel@tonic-gate uchar_t es_fru_code; /* Field Replaceable Unit Code */ 1147c478bd9Sstevel@tonic-gate uchar_t es_skey_specific[3]; /* Sense Key Specific information */ 1157c478bd9Sstevel@tonic-gate 1167c478bd9Sstevel@tonic-gate /* 1177c478bd9Sstevel@tonic-gate * Additional bytes may be defined in each implementation. 1187c478bd9Sstevel@tonic-gate * The actual amount of space allocated for Sense Information 1197c478bd9Sstevel@tonic-gate * is also implementation dependent. 1207c478bd9Sstevel@tonic-gate * 1217c478bd9Sstevel@tonic-gate * Modulo that, the declaration of an array two bytes in size 1227c478bd9Sstevel@tonic-gate * nicely rounds this entire structure to a size of 20 bytes. 1237c478bd9Sstevel@tonic-gate */ 1247c478bd9Sstevel@tonic-gate 1257c478bd9Sstevel@tonic-gate uchar_t es_add_info[2]; /* additional information */ 1267c478bd9Sstevel@tonic-gate 1277c478bd9Sstevel@tonic-gate }; 1287c478bd9Sstevel@tonic-gate 1297c478bd9Sstevel@tonic-gate /* 1307c478bd9Sstevel@tonic-gate * Sense code values for Extended Sense 1317c478bd9Sstevel@tonic-gate */ 1327c478bd9Sstevel@tonic-gate 1337c478bd9Sstevel@tonic-gate #define CODE_FMT_FIXED_CURRENT 0x0 1347c478bd9Sstevel@tonic-gate #define CODE_FMT_FIXED_DEFERRED 0x1 1357c478bd9Sstevel@tonic-gate #define CODE_FMT_DESCR_CURRENT 0x2 1367c478bd9Sstevel@tonic-gate #define CODE_FMT_DESCR_DEFERRED 0x3 1377c478bd9Sstevel@tonic-gate #define CODE_FMT_VENDOR_SPECIFIC 0xF 1387c478bd9Sstevel@tonic-gate 1395c46c6a0Spd #define SCSI_IS_DESCR_SENSE(sns_ptr) \ 1405c46c6a0Spd (((((struct scsi_extended_sense *)(sns_ptr))->es_code) == \ 1415c46c6a0Spd CODE_FMT_DESCR_CURRENT) || \ 1425c46c6a0Spd ((((struct scsi_extended_sense *)(sns_ptr))->es_code) == \ 1435c46c6a0Spd CODE_FMT_DESCR_DEFERRED)) 1445c46c6a0Spd 1457c478bd9Sstevel@tonic-gate /* 1467c478bd9Sstevel@tonic-gate * Sense Key values for Extended Sense. 1477c478bd9Sstevel@tonic-gate */ 1487c478bd9Sstevel@tonic-gate 1497c478bd9Sstevel@tonic-gate #define KEY_NO_SENSE 0x00 1507c478bd9Sstevel@tonic-gate #define KEY_RECOVERABLE_ERROR 0x01 1517c478bd9Sstevel@tonic-gate #define KEY_NOT_READY 0x02 1527c478bd9Sstevel@tonic-gate #define KEY_MEDIUM_ERROR 0x03 1537c478bd9Sstevel@tonic-gate #define KEY_HARDWARE_ERROR 0x04 1547c478bd9Sstevel@tonic-gate #define KEY_ILLEGAL_REQUEST 0x05 1557c478bd9Sstevel@tonic-gate #define KEY_UNIT_ATTENTION 0x06 1567c478bd9Sstevel@tonic-gate #define KEY_WRITE_PROTECT 0x07 1577c478bd9Sstevel@tonic-gate #define KEY_DATA_PROTECT KEY_WRITE_PROTECT 1587c478bd9Sstevel@tonic-gate #define KEY_BLANK_CHECK 0x08 1597c478bd9Sstevel@tonic-gate #define KEY_VENDOR_UNIQUE 0x09 1607c478bd9Sstevel@tonic-gate #define KEY_COPY_ABORTED 0x0A 1617c478bd9Sstevel@tonic-gate #define KEY_ABORTED_COMMAND 0x0B 1627c478bd9Sstevel@tonic-gate #define KEY_EQUAL 0x0C 1637c478bd9Sstevel@tonic-gate #define KEY_VOLUME_OVERFLOW 0x0D 1647c478bd9Sstevel@tonic-gate #define KEY_MISCOMPARE 0x0E 1657c478bd9Sstevel@tonic-gate #define KEY_RESERVED 0x0F 1667c478bd9Sstevel@tonic-gate 1677c478bd9Sstevel@tonic-gate /* 1687c478bd9Sstevel@tonic-gate * Descriptor sense data header 1697c478bd9Sstevel@tonic-gate * 1707c478bd9Sstevel@tonic-gate * Descriptor format sense data is described in the SPC-3 standard. Unlike 1717c478bd9Sstevel@tonic-gate * the fixed format sense data, descriptor format consists of a header 1727c478bd9Sstevel@tonic-gate * followed by a variable length list of sense data descriptors. 1737c478bd9Sstevel@tonic-gate */ 1747c478bd9Sstevel@tonic-gate 1757c478bd9Sstevel@tonic-gate struct scsi_descr_sense_hdr { 1767c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH) 1777c478bd9Sstevel@tonic-gate uchar_t ds_code : 4, /* Vendor Unique error code */ 1787c478bd9Sstevel@tonic-gate ds_class : 3, /* Error Class- fixed at 0x7 */ 1797c478bd9Sstevel@tonic-gate ds_reserved : 1; /* sense data is valid */ 1807c478bd9Sstevel@tonic-gate 1817c478bd9Sstevel@tonic-gate uchar_t ds_key : 4, /* Sense key */ 1827c478bd9Sstevel@tonic-gate ds_reserved2 : 4; /* reserved */ 1837c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL) 1847c478bd9Sstevel@tonic-gate uchar_t ds_reserved : 1, /* sense data is valid */ 1857c478bd9Sstevel@tonic-gate ds_class : 3, /* Error Class- fixed at 0x7 */ 1867c478bd9Sstevel@tonic-gate ds_code : 4; /* Vendor Unique error code */ 1877c478bd9Sstevel@tonic-gate 1887c478bd9Sstevel@tonic-gate uchar_t ds_reserved2 : 4, /* reserved */ 1897c478bd9Sstevel@tonic-gate ds_key : 4; /* Sense key (see below) */ 1907c478bd9Sstevel@tonic-gate #else 1917c478bd9Sstevel@tonic-gate #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 1927c478bd9Sstevel@tonic-gate #endif /* _BIT_FIELDS_LTOH */ 1937c478bd9Sstevel@tonic-gate 1947c478bd9Sstevel@tonic-gate uchar_t ds_add_code; /* Additional Sense Code */ 1957c478bd9Sstevel@tonic-gate uchar_t ds_qual_code; /* Additional Sense Code Qualifier */ 1967c478bd9Sstevel@tonic-gate 1977c478bd9Sstevel@tonic-gate uchar_t ds_reserved3[3]; /* reserved */ 1987c478bd9Sstevel@tonic-gate 1997c478bd9Sstevel@tonic-gate uchar_t ds_addl_sense_length; /* Additional sense data length */ 2007c478bd9Sstevel@tonic-gate }; 2017c478bd9Sstevel@tonic-gate 2027c478bd9Sstevel@tonic-gate /* 2037c478bd9Sstevel@tonic-gate * SCSI sense descriptors 2047c478bd9Sstevel@tonic-gate */ 2057c478bd9Sstevel@tonic-gate 2067c478bd9Sstevel@tonic-gate struct scsi_information_sense_descr { 2077c478bd9Sstevel@tonic-gate uchar_t isd_descr_type; /* Descriptor type (0x00) */ 2087c478bd9Sstevel@tonic-gate uchar_t isd_addl_length; /* Additional byte count (0x0A) */ 2097c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH) 2107c478bd9Sstevel@tonic-gate uchar_t isd_reserved1 : 7, /* reserved */ 2117c478bd9Sstevel@tonic-gate isd_valid : 1; /* Always set to 1 */ 2127c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL) 2137c478bd9Sstevel@tonic-gate uchar_t isd_valid : 1, /* Always set to 1 */ 2147c478bd9Sstevel@tonic-gate isd_reserved1 : 7; /* reserved */ 2157c478bd9Sstevel@tonic-gate #else 2167c478bd9Sstevel@tonic-gate #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 2177c478bd9Sstevel@tonic-gate #endif /* _BIT_FIELDS_LTOH */ 2187c478bd9Sstevel@tonic-gate uchar_t isd_reserved2; /* reserved */ 2197c478bd9Sstevel@tonic-gate uchar_t isd_information[8]; /* Information bytes */ 2207c478bd9Sstevel@tonic-gate }; 2217c478bd9Sstevel@tonic-gate 2227c478bd9Sstevel@tonic-gate struct scsi_cmd_specific_sense_descr { 2237c478bd9Sstevel@tonic-gate uchar_t css_descr_type; /* Descriptor type (0x01) */ 2247c478bd9Sstevel@tonic-gate uchar_t css_addl_length; /* Additional byte count (0x0A) */ 2257c478bd9Sstevel@tonic-gate uchar_t css_reserved[2]; /* reserved */ 2267c478bd9Sstevel@tonic-gate uchar_t css_cmd_specific_info[8]; /* Command specific info */ 2277c478bd9Sstevel@tonic-gate }; 2287c478bd9Sstevel@tonic-gate 2295c46c6a0Spd union scsi_sk_specific_data { 2305c46c6a0Spd /* 2315c46c6a0Spd * Field pointer (Sense key = Illegal Request) 2325c46c6a0Spd */ 2335c46c6a0Spd struct { 2347c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH) 2355c46c6a0Spd uchar_t bit_pointer : 3, 2365c46c6a0Spd bpv : 1, 2375c46c6a0Spd reserved : 2, 2385c46c6a0Spd cd : 1, 2395c46c6a0Spd sksv : 1; 2407c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL) 2415c46c6a0Spd uchar_t sksv : 1, 2425c46c6a0Spd cd : 1, 2435c46c6a0Spd reserved : 2, 2445c46c6a0Spd bpv : 1, 2455c46c6a0Spd bit_pointer : 3; 2467c478bd9Sstevel@tonic-gate #else 2477c478bd9Sstevel@tonic-gate #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 2487c478bd9Sstevel@tonic-gate #endif /* _BIT_FIELDS_LTOH */ 2495c46c6a0Spd uchar_t field_pointer[2]; 2505c46c6a0Spd } fp; 2515c46c6a0Spd /* 2525c46c6a0Spd * Actual Retry Count (Sense key = Hardware error, 2535c46c6a0Spd * Medium Error or Recovered Error) 2545c46c6a0Spd */ 2555c46c6a0Spd struct { 2565c46c6a0Spd uchar_t sksv; 2575c46c6a0Spd uchar_t actual_retry_count[2]; 2585c46c6a0Spd } arc; 2595c46c6a0Spd /* 2605c46c6a0Spd * Progress Indication (Sense key = No Sense or Not Ready 2615c46c6a0Spd */ 2625c46c6a0Spd struct { 2635c46c6a0Spd uchar_t sksv; 2645c46c6a0Spd uchar_t progress_indication[2]; 2655c46c6a0Spd } pi; 2665c46c6a0Spd /* 2675c46c6a0Spd * Segment Pointer (Sense key = Copy Aborted) 2685c46c6a0Spd */ 2695c46c6a0Spd struct { 2707c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH) 2715c46c6a0Spd uchar_t bit_pointer : 3, 2725c46c6a0Spd bpv : 1, 2735c46c6a0Spd reserved : 1, 2745c46c6a0Spd sd : 1, 2755c46c6a0Spd reserved2 : 1, 2765c46c6a0Spd sksv : 1; 2777c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL) 2785c46c6a0Spd uchar_t sksv : 1, 2795c46c6a0Spd reserved2 : 1, 2805c46c6a0Spd sd : 1, 2815c46c6a0Spd reserved : 1, 2825c46c6a0Spd bpv : 1, 2835c46c6a0Spd bit_pointer : 3; 2847c478bd9Sstevel@tonic-gate #else 2857c478bd9Sstevel@tonic-gate #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 2867c478bd9Sstevel@tonic-gate #endif /* _BIT_FIELDS_LTOH */ 2875c46c6a0Spd uchar_t field_pointer[2]; 2885c46c6a0Spd } sp; 2895c46c6a0Spd }; 2905c46c6a0Spd 2915c46c6a0Spd struct scsi_sk_specific_sense_descr { 2925c46c6a0Spd uchar_t sss_descr_type; /* Descriptor type */ 2935c46c6a0Spd uchar_t sss_addl_length; /* Additional byte count (0x06) */ 2945c46c6a0Spd uchar_t sss_reserved[2]; /* reserved */ 2955c46c6a0Spd union scsi_sk_specific_data sss_data; 2965c46c6a0Spd uchar_t sss_reserved2; 2977c478bd9Sstevel@tonic-gate }; 2987c478bd9Sstevel@tonic-gate 2997c478bd9Sstevel@tonic-gate struct scsi_fru_sense_descr { 3007c478bd9Sstevel@tonic-gate uchar_t fs_descr_type; /* Descriptor type (0x03) */ 3017c478bd9Sstevel@tonic-gate uchar_t fs_addl_length; /* Additional byte count (0x02) */ 3027c478bd9Sstevel@tonic-gate uchar_t fs_reserved; /* reserved */ 3037c478bd9Sstevel@tonic-gate uchar_t fs_fru_code; /* Field Replaceable Unit Code */ 3047c478bd9Sstevel@tonic-gate }; 3057c478bd9Sstevel@tonic-gate 3065c46c6a0Spd struct scsi_stream_cmd_data { 3077c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH) 3087c478bd9Sstevel@tonic-gate uchar_t scs_reserved2 : 5, 3097c478bd9Sstevel@tonic-gate scs_ili : 1, 3107c478bd9Sstevel@tonic-gate scs_eom : 1, 3117c478bd9Sstevel@tonic-gate scs_filemark : 1; 3127c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL) 3137c478bd9Sstevel@tonic-gate uchar_t scs_filemark : 1, 3147c478bd9Sstevel@tonic-gate scs_eom : 1, 3157c478bd9Sstevel@tonic-gate scs_ili : 1, 3167c478bd9Sstevel@tonic-gate scs_reserved2 : 5; 3177c478bd9Sstevel@tonic-gate #else 3187c478bd9Sstevel@tonic-gate #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 3197c478bd9Sstevel@tonic-gate #endif /* _BIT_FIELDS_LTOH */ 3207c478bd9Sstevel@tonic-gate }; 3217c478bd9Sstevel@tonic-gate 3225c46c6a0Spd struct scsi_stream_cmd_sense_descr { 3235c46c6a0Spd uchar_t scs_descr_type; /* Descriptor type (0x04) */ 3245c46c6a0Spd uchar_t scs_addl_length; /* Additional byte count (0x02) */ 3255c46c6a0Spd uchar_t scs_reserved; /* reserved */ 3265c46c6a0Spd struct scsi_stream_cmd_data scs_data; 3275c46c6a0Spd }; 3285c46c6a0Spd 3297c478bd9Sstevel@tonic-gate struct scsi_block_cmd_sense_descr { 3307c478bd9Sstevel@tonic-gate uchar_t bcs_descr_type; /* Descriptor type (0x05) */ 3317c478bd9Sstevel@tonic-gate uchar_t bcs_addl_length; /* Additional byte count (0x02) */ 3327c478bd9Sstevel@tonic-gate uchar_t bcs_reserved; /* reserved */ 3337c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH) 3347c478bd9Sstevel@tonic-gate uchar_t bcs_reserved2 : 5, 3357c478bd9Sstevel@tonic-gate bcs_ili : 1, 3367c478bd9Sstevel@tonic-gate bcs_reserved3 : 2; 3377c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL) 3387c478bd9Sstevel@tonic-gate uchar_t bcs_reserved3 : 2, 3397c478bd9Sstevel@tonic-gate bcs_ili : 1, 3407c478bd9Sstevel@tonic-gate bcs_reserved2 : 5; 3417c478bd9Sstevel@tonic-gate #else 3427c478bd9Sstevel@tonic-gate #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 3437c478bd9Sstevel@tonic-gate #endif /* _BIT_FIELDS_LTOH */ 3447c478bd9Sstevel@tonic-gate }; 3457c478bd9Sstevel@tonic-gate 346*63aa5377SAlan Perry struct scsi_ata_status_ret_sense_descr { 347*63aa5377SAlan Perry uchar_t ars_descr_type; /* Descriptor type (0x09) */ 348*63aa5377SAlan Perry uchar_t ars_addl_length; /* Additional byte count (0x0c) */ 349*63aa5377SAlan Perry #if defined(_BIT_FIELDS_LTOH) 350*63aa5377SAlan Perry uchar_t ars_extend : 1, 351*63aa5377SAlan Perry ars_reserved1 : 7; /* reserved */ 352*63aa5377SAlan Perry #elif defined(_BIT_FIELDS_HTOL) 353*63aa5377SAlan Perry uchar_t ars_reserved1 : 7, /* reserved */ 354*63aa5377SAlan Perry ars_extend : 1; 355*63aa5377SAlan Perry #else 356*63aa5377SAlan Perry #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 357*63aa5377SAlan Perry #endif /* _BIT_FIELDS_LTOH */ 358*63aa5377SAlan Perry uchar_t ars_error; 359*63aa5377SAlan Perry uchar_t ars_sec_count_msb; 360*63aa5377SAlan Perry uchar_t ars_sec_count_lsb; 361*63aa5377SAlan Perry uchar_t ars_lba_low_msb; 362*63aa5377SAlan Perry uchar_t ars_lba_low_lsb; 363*63aa5377SAlan Perry uchar_t ars_lba_mid_msb; 364*63aa5377SAlan Perry uchar_t ars_lba_mid_lsb; 365*63aa5377SAlan Perry uchar_t ars_lba_high_msb; 366*63aa5377SAlan Perry uchar_t ars_lba_high_lsb; 367*63aa5377SAlan Perry uchar_t ars_device; 368*63aa5377SAlan Perry uchar_t ars_status; 369*63aa5377SAlan Perry }; 370*63aa5377SAlan Perry 3717c478bd9Sstevel@tonic-gate struct scsi_vendor_specific_sense_descr { 3727c478bd9Sstevel@tonic-gate uchar_t vss_descr_type; /* Descriptor type (0x80-0xFF) */ 3737c478bd9Sstevel@tonic-gate uchar_t vss_addl_length; /* Additional byte count */ 3747c478bd9Sstevel@tonic-gate /* 3757c478bd9Sstevel@tonic-gate * Variable length vendor specific data 3767c478bd9Sstevel@tonic-gate */ 3777c478bd9Sstevel@tonic-gate uchar_t vss_vendor_specific_info[1]; 3787c478bd9Sstevel@tonic-gate }; 3797c478bd9Sstevel@tonic-gate 3807c478bd9Sstevel@tonic-gate /* 3817c478bd9Sstevel@tonic-gate * SCSI Descriptor Types 3827c478bd9Sstevel@tonic-gate */ 3837c478bd9Sstevel@tonic-gate #define DESCR_INFORMATION 0x00 3847c478bd9Sstevel@tonic-gate #define DESCR_COMMAND_SPECIFIC 0x01 3857c478bd9Sstevel@tonic-gate #define DESCR_SENSE_KEY_SPECIFIC 0x02 3867c478bd9Sstevel@tonic-gate #define DESCR_FRU 0x03 3877c478bd9Sstevel@tonic-gate #define DESCR_STREAM_COMMANDS 0x04 3887c478bd9Sstevel@tonic-gate #define DESCR_BLOCK_COMMANDS 0x05 3895c46c6a0Spd #define DESCR_OSD_OID 0x06 3905c46c6a0Spd #define DESCR_OSD_RESP_INTEGRITY 0x07 3915c46c6a0Spd #define DESCR_OSD_ATTR_ID 0x08 392*63aa5377SAlan Perry #define DESCR_ATA_STATUS_RETURN 0x09 3937c478bd9Sstevel@tonic-gate 3947c478bd9Sstevel@tonic-gate #ifdef __cplusplus 3957c478bd9Sstevel@tonic-gate } 3967c478bd9Sstevel@tonic-gate #endif 3977c478bd9Sstevel@tonic-gate 3987c478bd9Sstevel@tonic-gate /* 3997c478bd9Sstevel@tonic-gate * Each implementation will have specific mappings to what 4007c478bd9Sstevel@tonic-gate * Sense Information means 4017c478bd9Sstevel@tonic-gate */ 4027c478bd9Sstevel@tonic-gate 4037c478bd9Sstevel@tonic-gate #include <sys/scsi/impl/sense.h> 4047c478bd9Sstevel@tonic-gate 4057c478bd9Sstevel@tonic-gate #endif /* _SYS_SCSI_GENERIC_SENSE_H */ 406