scsisense.h
上传用户:xiejiait
上传日期:2007-01-06
资源大小:881k
文件大小:7k
- /* @(#)scsisense.h 2.15 99/10/18 Copyright 1986 J. Schilling */
- /*
- * Definitions for the SCSI status code and sense structure
- *
- * Copyright (c) 1986 J. Schilling
- */
- /*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- */
- #ifndef _SCG_SCSISENSE_H
- #define _SCG_SCSISENSE_H
- /*
- * SCSI status completion block.
- */
- #define SCSI_EXTENDED_STATUS
- #if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */
- struct scsi_status {
- Ucbit vu_00 : 1; /* vendor unique */
- Ucbit chk : 1; /* check condition: sense data available */
- Ucbit cm : 1; /* condition met */
- Ucbit busy : 1; /* device busy or reserved */
- Ucbit is : 1; /* intermediate status sent */
- Ucbit vu_05 : 1; /* vendor unique */
- #define st_scsi2 vu_05 /* SCSI-2 modifier bit */
- Ucbit vu_06 : 1; /* vendor unique */
- Ucbit st_rsvd : 1; /* reserved */
- #ifdef SCSI_EXTENDED_STATUS
- #define ext_st1 st_rsvd /* extended status (next byte valid) */
- /* byte 1 */
- Ucbit ha_er : 1; /* host adapter detected error */
- Ucbit reserved: 6; /* reserved */
- Ucbit ext_st2 : 1; /* extended status (next byte valid) */
- /* byte 2 */
- u_char byte2; /* third byte */
- #endif /* SCSI_EXTENDED_STATUS */
- };
- #else /* Motorola byteorder */
- struct scsi_status {
- Ucbit st_rsvd : 1; /* reserved */
- Ucbit vu_06 : 1; /* vendor unique */
- Ucbit vu_05 : 1; /* vendor unique */
- #define st_scsi2 vu_05 /* SCSI-2 modifier bit */
- Ucbit is : 1; /* intermediate status sent */
- Ucbit busy : 1; /* device busy or reserved */
- Ucbit cm : 1; /* condition met */
- Ucbit chk : 1; /* check condition: sense data available */
- Ucbit vu_00 : 1; /* vendor unique */
- #ifdef SCSI_EXTENDED_STATUS
- #define ext_st1 st_rsvd /* extended status (next byte valid) */
- /* byte 1 */
- Ucbit ext_st2 : 1; /* extended status (next byte valid) */
- Ucbit reserved: 6; /* reserved */
- Ucbit ha_er : 1; /* host adapter detected error */
- /* byte 2 */
- u_char byte2; /* third byte */
- #endif /* SCSI_EXTENDED_STATUS */
- };
- #endif
- /*
- * OLD Standard (Non Extended) SCSI Sense. Used mainly by the
- * Adaptec ACB 4000 which is the only controller that
- * does not support the Extended sense format.
- */
- #if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */
- struct scsi_sense { /* scsi sense for error classes 0-6 */
- Ucbit code : 7; /* error class/code */
- Ucbit adr_val : 1; /* sense data is valid */
- #ifdef comment
- Ucbit high_addr:5; /* high byte of block addr */
- Ucbit rsvd : 3;
- #else
- u_char high_addr; /* high byte of block addr */
- #endif
- u_char mid_addr; /* middle byte of block addr */
- u_char low_addr; /* low byte of block addr */
- };
- #else /* Motorola byteorder */
- struct scsi_sense { /* scsi sense for error classes 0-6 */
- Ucbit adr_val : 1; /* sense data is valid */
- Ucbit code : 7; /* error class/code */
- #ifdef comment
- Ucbit rsvd : 3;
- Ucbit high_addr:5; /* high byte of block addr */
- #else
- u_char high_addr; /* high byte of block addr */
- #endif
- u_char mid_addr; /* middle byte of block addr */
- u_char low_addr; /* low byte of block addr */
- };
- #endif
- /*
- * SCSI extended sense parameter block.
- */
- #ifdef comment
- #define SC_CLASS_EXTENDED_SENSE 0x7 /* indicates extended sense */
- #endif
- #if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */
- struct scsi_ext_sense { /* scsi extended sense for error class 7 */
- /* byte 0 */
- Ucbit type : 7; /* fixed at 0x70 */
- Ucbit adr_val : 1; /* sense data is valid */
- /* byte 1 */
- u_char seg_num; /* segment number, applies to copy cmd only */
- /* byte 2 */
- Ucbit key : 4; /* sense key, see below */
- Ucbit : 1; /* reserved */
- Ucbit ili : 1; /* incorrect length indicator */
- Ucbit eom : 1; /* end of media */
- Ucbit fil_mk : 1; /* file mark on device */
- /* bytes 3 through 7 */
- u_char info_1; /* information byte 1 */
- u_char info_2; /* information byte 2 */
- u_char info_3; /* information byte 3 */
- u_char info_4; /* information byte 4 */
- u_char add_len; /* number of additional bytes */
- /* bytes 8 through 13, CCS additions */
- u_char optional_8; /* CCS search and copy only */
- u_char optional_9; /* CCS search and copy only */
- u_char optional_10; /* CCS search and copy only */
- u_char optional_11; /* CCS search and copy only */
- u_char sense_code; /* sense code */
- u_char qual_code; /* sense code qualifier */
- u_char fru_code; /* Field replacable unit code */
- Ucbit bptr : 3; /* bit pointer for failure (if bpv) */
- Ucbit bpv : 1; /* bit pointer is valid */
- Ucbit : 2;
- Ucbit cd : 1; /* pointers refer to command not data */
- Ucbit sksv : 1; /* sense key specific valid */
- u_char field_ptr[2]; /* field pointer for failure */
- u_char add_info[2]; /* round up to 20 bytes */
- };
- #else /* Motorola byteorder */
- struct scsi_ext_sense { /* scsi extended sense for error class 7 */
- /* byte 0 */
- Ucbit adr_val : 1; /* sense data is valid */
- Ucbit type : 7; /* fixed at 0x70 */
- /* byte 1 */
- u_char seg_num; /* segment number, applies to copy cmd only */
- /* byte 2 */
- Ucbit fil_mk : 1; /* file mark on device */
- Ucbit eom : 1; /* end of media */
- Ucbit ili : 1; /* incorrect length indicator */
- Ucbit : 1; /* reserved */
- Ucbit key : 4; /* sense key, see below */
- /* bytes 3 through 7 */
- u_char info_1; /* information byte 1 */
- u_char info_2; /* information byte 2 */
- u_char info_3; /* information byte 3 */
- u_char info_4; /* information byte 4 */
- u_char add_len; /* number of additional bytes */
- /* bytes 8 through 13, CCS additions */
- u_char optional_8; /* CCS search and copy only */
- u_char optional_9; /* CCS search and copy only */
- u_char optional_10; /* CCS search and copy only */
- u_char optional_11; /* CCS search and copy only */
- u_char sense_code; /* sense code */
- u_char qual_code; /* sense code qualifier */
- u_char fru_code; /* Field replacable unit code */
- Ucbit sksv : 1; /* sense key specific valid */
- Ucbit cd : 1; /* pointers refer to command not data */
- Ucbit : 2;
- Ucbit bpv : 1; /* bit pointer is valid */
- Ucbit bptr : 3; /* bit pointer for failure (if bpv) */
- u_char field_ptr[2]; /* field pointer for failure */
- u_char add_info[2]; /* round up to 20 bytes */
- };
- #endif
- #endif /* _SCG_SCSISENSE_H */