1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
|
/*
* This file has been modified for the cdrkit suite.
*
* The behaviour and appearence of the program code below can differ to a major
* extent from the version distributed by the original author(s).
*
* For details, see Changelog file distributed with the cdrkit package. If you
* received this file from another source then ask the distributing person for
* a log of modifications.
*
*/
/* @(#)scsisense.h 2.18 04/09/04 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 version 2
* as published by the Free Software Foundation.
*
* 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _SCG_SCSISENSE_H
#define _SCG_SCSISENSE_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* 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 */
Uchar 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 */
Uchar 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
Uchar high_addr; /* high byte of block addr */
#endif
Uchar mid_addr; /* middle byte of block addr */
Uchar 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
Uchar high_addr; /* high byte of block addr */
#endif
Uchar mid_addr; /* middle byte of block addr */
Uchar 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 */
Uchar 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 */
Uchar info_1; /* information byte 1 */
Uchar info_2; /* information byte 2 */
Uchar info_3; /* information byte 3 */
Uchar info_4; /* information byte 4 */
Uchar add_len; /* number of additional bytes */
/* bytes 8 through 13, CCS additions */
Uchar optional_8; /* CCS search and copy only */
Uchar optional_9; /* CCS search and copy only */
Uchar optional_10; /* CCS search and copy only */
Uchar optional_11; /* CCS search and copy only */
Uchar sense_code; /* sense code */
Uchar qual_code; /* sense code qualifier */
Uchar 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 */
Uchar field_ptr[2]; /* field pointer for failure */
Uchar 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 */
Uchar 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 */
Uchar info_1; /* information byte 1 */
Uchar info_2; /* information byte 2 */
Uchar info_3; /* information byte 3 */
Uchar info_4; /* information byte 4 */
Uchar add_len; /* number of additional bytes */
/* bytes 8 through 13, CCS additions */
Uchar optional_8; /* CCS search and copy only */
Uchar optional_9; /* CCS search and copy only */
Uchar optional_10; /* CCS search and copy only */
Uchar optional_11; /* CCS search and copy only */
Uchar sense_code; /* sense code */
Uchar qual_code; /* sense code qualifier */
Uchar 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) */
Uchar field_ptr[2]; /* field pointer for failure */
Uchar add_info[2]; /* round up to 20 bytes */
};
#endif
#ifdef __cplusplus
}
#endif
#endif /* _SCG_SCSISENSE_H */
|