2 * This file has been modified for the cdrkit suite.
4 * The behaviour and appearence of the program code below can differ to a major
5 * extent from the version distributed by the original author(s).
7 * For details, see Changelog file distributed with the cdrkit package. If you
8 * received this file from another source then ask the distributing person for
9 * a log of modifications.
13 /* @(#)scsisense.h 2.18 04/09/04 Copyright 1986 J. Schilling */
15 * Definitions for the SCSI status code and sense structure
17 * Copyright (c) 1986 J. Schilling
20 * This program is free software; you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License version 2
22 * as published by the Free Software Foundation.
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
29 * You should have received a copy of the GNU General Public License along with
30 * this program; see the file COPYING. If not, write to the Free Software
31 * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34 #ifndef _SCG_SCSISENSE_H
35 #define _SCG_SCSISENSE_H
42 * SCSI status completion block.
44 #define SCSI_EXTENDED_STATUS
46 #if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */
49 Ucbit vu_00 : 1; /* vendor unique */
50 Ucbit chk : 1; /* check condition: sense data available */
51 Ucbit cm : 1; /* condition met */
52 Ucbit busy : 1; /* device busy or reserved */
53 Ucbit is : 1; /* intermediate status sent */
54 Ucbit vu_05 : 1; /* vendor unique */
55 #define st_scsi2 vu_05 /* SCSI-2 modifier bit */
56 Ucbit vu_06 : 1; /* vendor unique */
57 Ucbit st_rsvd : 1; /* reserved */
59 #ifdef SCSI_EXTENDED_STATUS
60 #define ext_st1 st_rsvd /* extended status (next byte valid) */
62 Ucbit ha_er : 1; /* host adapter detected error */
63 Ucbit reserved: 6; /* reserved */
64 Ucbit ext_st2 : 1; /* extended status (next byte valid) */
66 Uchar byte2; /* third byte */
67 #endif /* SCSI_EXTENDED_STATUS */
70 #else /* Motorola byteorder */
73 Ucbit st_rsvd : 1; /* reserved */
74 Ucbit vu_06 : 1; /* vendor unique */
75 Ucbit vu_05 : 1; /* vendor unique */
76 #define st_scsi2 vu_05 /* SCSI-2 modifier bit */
77 Ucbit is : 1; /* intermediate status sent */
78 Ucbit busy : 1; /* device busy or reserved */
79 Ucbit cm : 1; /* condition met */
80 Ucbit chk : 1; /* check condition: sense data available */
81 Ucbit vu_00 : 1; /* vendor unique */
82 #ifdef SCSI_EXTENDED_STATUS
83 #define ext_st1 st_rsvd /* extended status (next byte valid) */
85 Ucbit ext_st2 : 1; /* extended status (next byte valid) */
86 Ucbit reserved: 6; /* reserved */
87 Ucbit ha_er : 1; /* host adapter detected error */
89 Uchar byte2; /* third byte */
90 #endif /* SCSI_EXTENDED_STATUS */
95 * OLD Standard (Non Extended) SCSI Sense. Used mainly by the
96 * Adaptec ACB 4000 which is the only controller that
97 * does not support the Extended sense format.
99 #if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */
101 struct scsi_sense { /* scsi sense for error classes 0-6 */
102 Ucbit code : 7; /* error class/code */
103 Ucbit adr_val : 1; /* sense data is valid */
105 Ucbit high_addr:5; /* high byte of block addr */
108 Uchar high_addr; /* high byte of block addr */
110 Uchar mid_addr; /* middle byte of block addr */
111 Uchar low_addr; /* low byte of block addr */
114 #else /* Motorola byteorder */
116 struct scsi_sense { /* scsi sense for error classes 0-6 */
117 Ucbit adr_val : 1; /* sense data is valid */
118 Ucbit code : 7; /* error class/code */
121 Ucbit high_addr:5; /* high byte of block addr */
123 Uchar high_addr; /* high byte of block addr */
125 Uchar mid_addr; /* middle byte of block addr */
126 Uchar low_addr; /* low byte of block addr */
131 * SCSI extended sense parameter block.
134 #define SC_CLASS_EXTENDED_SENSE 0x7 /* indicates extended sense */
137 #if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */
139 struct scsi_ext_sense { /* scsi extended sense for error class 7 */
141 Ucbit type : 7; /* fixed at 0x70 */
142 Ucbit adr_val : 1; /* sense data is valid */
144 Uchar seg_num; /* segment number, applies to copy cmd only */
146 Ucbit key : 4; /* sense key, see below */
147 Ucbit : 1; /* reserved */
148 Ucbit ili : 1; /* incorrect length indicator */
149 Ucbit eom : 1; /* end of media */
150 Ucbit fil_mk : 1; /* file mark on device */
151 /* bytes 3 through 7 */
152 Uchar info_1; /* information byte 1 */
153 Uchar info_2; /* information byte 2 */
154 Uchar info_3; /* information byte 3 */
155 Uchar info_4; /* information byte 4 */
156 Uchar add_len; /* number of additional bytes */
157 /* bytes 8 through 13, CCS additions */
158 Uchar optional_8; /* CCS search and copy only */
159 Uchar optional_9; /* CCS search and copy only */
160 Uchar optional_10; /* CCS search and copy only */
161 Uchar optional_11; /* CCS search and copy only */
162 Uchar sense_code; /* sense code */
163 Uchar qual_code; /* sense code qualifier */
164 Uchar fru_code; /* Field replacable unit code */
165 Ucbit bptr : 3; /* bit pointer for failure (if bpv) */
166 Ucbit bpv : 1; /* bit pointer is valid */
168 Ucbit cd : 1; /* pointers refer to command not data */
169 Ucbit sksv : 1; /* sense key specific valid */
170 Uchar field_ptr[2]; /* field pointer for failure */
171 Uchar add_info[2]; /* round up to 20 bytes */
174 #else /* Motorola byteorder */
176 struct scsi_ext_sense { /* scsi extended sense for error class 7 */
178 Ucbit adr_val : 1; /* sense data is valid */
179 Ucbit type : 7; /* fixed at 0x70 */
181 Uchar seg_num; /* segment number, applies to copy cmd only */
183 Ucbit fil_mk : 1; /* file mark on device */
184 Ucbit eom : 1; /* end of media */
185 Ucbit ili : 1; /* incorrect length indicator */
186 Ucbit : 1; /* reserved */
187 Ucbit key : 4; /* sense key, see below */
188 /* bytes 3 through 7 */
189 Uchar info_1; /* information byte 1 */
190 Uchar info_2; /* information byte 2 */
191 Uchar info_3; /* information byte 3 */
192 Uchar info_4; /* information byte 4 */
193 Uchar add_len; /* number of additional bytes */
194 /* bytes 8 through 13, CCS additions */
195 Uchar optional_8; /* CCS search and copy only */
196 Uchar optional_9; /* CCS search and copy only */
197 Uchar optional_10; /* CCS search and copy only */
198 Uchar optional_11; /* CCS search and copy only */
199 Uchar sense_code; /* sense code */
200 Uchar qual_code; /* sense code qualifier */
201 Uchar fru_code; /* Field replacable unit code */
202 Ucbit sksv : 1; /* sense key specific valid */
203 Ucbit cd : 1; /* pointers refer to command not data */
205 Ucbit bpv : 1; /* bit pointer is valid */
206 Ucbit bptr : 3; /* bit pointer for failure (if bpv) */
207 Uchar field_ptr[2]; /* field pointer for failure */
208 Uchar add_info[2]; /* round up to 20 bytes */
216 #endif /* _SCG_SCSISENSE_H */