This source file includes following definitions.
- scsi_status_is_good
- scsi_is_wlun
1
2
3
4
5
6 #ifndef _SCSI_SCSI_H
7 #define _SCSI_SCSI_H
8
9 #include <linux/types.h>
10 #include <linux/scatterlist.h>
11 #include <linux/kernel.h>
12 #include <scsi/scsi_common.h>
13 #include <scsi/scsi_proto.h>
14
15 struct scsi_cmnd;
16
17 enum scsi_timeouts {
18 SCSI_DEFAULT_EH_TIMEOUT = 10 * HZ,
19 };
20
21
22
23
24
25 #define SCSI_MAX_PROT_SG_SEGMENTS 0xFFFF
26
27
28
29
30
31 #define SCAN_WILD_CARD ~0
32
33
34
35
36
37
38
39
40
41 static inline int scsi_status_is_good(int status)
42 {
43
44
45
46
47
48 status &= 0xfe;
49 return ((status == SAM_STAT_GOOD) ||
50 (status == SAM_STAT_CONDITION_MET) ||
51
52 (status == SAM_STAT_INTERMEDIATE) ||
53 (status == SAM_STAT_INTERMEDIATE_CONDITION_MET) ||
54
55 (status == SAM_STAT_COMMAND_TERMINATED));
56 }
57
58
59
60
61
62
63 struct ccs_modesel_head {
64 __u8 _r1;
65 __u8 medium;
66 __u8 _r2;
67 __u8 block_desc_length;
68 __u8 density;
69 __u8 number_blocks_hi;
70 __u8 number_blocks_med;
71 __u8 number_blocks_lo;
72 __u8 _r3;
73 __u8 block_length_hi;
74 __u8 block_length_med;
75 __u8 block_length_lo;
76 };
77
78
79
80
81 #define SCSI_W_LUN_BASE 0xc100
82 #define SCSI_W_LUN_REPORT_LUNS (SCSI_W_LUN_BASE + 1)
83 #define SCSI_W_LUN_ACCESS_CONTROL (SCSI_W_LUN_BASE + 2)
84 #define SCSI_W_LUN_TARGET_LOG_PAGE (SCSI_W_LUN_BASE + 3)
85
86 static inline int scsi_is_wlun(u64 lun)
87 {
88 return (lun & 0xff00) == SCSI_W_LUN_BASE;
89 }
90
91
92
93
94
95
96 #define COMMAND_COMPLETE 0x00
97 #define EXTENDED_MESSAGE 0x01
98 #define EXTENDED_MODIFY_DATA_POINTER 0x00
99 #define EXTENDED_SDTR 0x01
100 #define EXTENDED_EXTENDED_IDENTIFY 0x02
101 #define EXTENDED_WDTR 0x03
102 #define EXTENDED_PPR 0x04
103 #define EXTENDED_MODIFY_BIDI_DATA_PTR 0x05
104 #define SAVE_POINTERS 0x02
105 #define RESTORE_POINTERS 0x03
106 #define DISCONNECT 0x04
107 #define INITIATOR_ERROR 0x05
108 #define ABORT_TASK_SET 0x06
109 #define MESSAGE_REJECT 0x07
110 #define NOP 0x08
111 #define MSG_PARITY_ERROR 0x09
112 #define LINKED_CMD_COMPLETE 0x0a
113 #define LINKED_FLG_CMD_COMPLETE 0x0b
114 #define TARGET_RESET 0x0c
115 #define ABORT_TASK 0x0d
116 #define CLEAR_TASK_SET 0x0e
117 #define INITIATE_RECOVERY 0x0f
118 #define RELEASE_RECOVERY 0x10
119 #define CLEAR_ACA 0x16
120 #define LOGICAL_UNIT_RESET 0x17
121 #define SIMPLE_QUEUE_TAG 0x20
122 #define HEAD_OF_QUEUE_TAG 0x21
123 #define ORDERED_QUEUE_TAG 0x22
124 #define IGNORE_WIDE_RESIDUE 0x23
125 #define ACA 0x24
126 #define QAS_REQUEST 0x55
127
128
129 #define BUS_DEVICE_RESET TARGET_RESET
130 #define ABORT ABORT_TASK_SET
131
132
133
134
135
136 #define DID_OK 0x00
137 #define DID_NO_CONNECT 0x01
138 #define DID_BUS_BUSY 0x02
139 #define DID_TIME_OUT 0x03
140 #define DID_BAD_TARGET 0x04
141 #define DID_ABORT 0x05
142 #define DID_PARITY 0x06
143 #define DID_ERROR 0x07
144 #define DID_RESET 0x08
145 #define DID_BAD_INTR 0x09
146 #define DID_PASSTHROUGH 0x0a
147 #define DID_SOFT_ERROR 0x0b
148 #define DID_IMM_RETRY 0x0c
149 #define DID_REQUEUE 0x0d
150
151 #define DID_TRANSPORT_DISRUPTED 0x0e
152
153
154
155 #define DID_TRANSPORT_FAILFAST 0x0f
156 #define DID_TARGET_FAILURE 0x10
157
158 #define DID_NEXUS_FAILURE 0x11
159
160 #define DID_ALLOC_FAILURE 0x12
161 #define DID_MEDIUM_ERROR 0x13
162 #define DRIVER_OK 0x00
163
164
165
166
167
168 #define DRIVER_BUSY 0x01
169 #define DRIVER_SOFT 0x02
170 #define DRIVER_MEDIA 0x03
171 #define DRIVER_ERROR 0x04
172
173 #define DRIVER_INVALID 0x05
174 #define DRIVER_TIMEOUT 0x06
175 #define DRIVER_HARD 0x07
176 #define DRIVER_SENSE 0x08
177
178
179
180
181
182 #define NEEDS_RETRY 0x2001
183 #define SUCCESS 0x2002
184 #define FAILED 0x2003
185 #define QUEUED 0x2004
186 #define SOFT_ERROR 0x2005
187 #define ADD_TO_MLQUEUE 0x2006
188 #define TIMEOUT_ERROR 0x2007
189 #define SCSI_RETURN_NOT_HANDLED 0x2008
190 #define FAST_IO_FAIL 0x2009
191
192
193
194
195 #define SCSI_MLQUEUE_HOST_BUSY 0x1055
196 #define SCSI_MLQUEUE_DEVICE_BUSY 0x1056
197 #define SCSI_MLQUEUE_EH_RETRY 0x1057
198 #define SCSI_MLQUEUE_TARGET_BUSY 0x1058
199
200
201
202
203
204
205
206
207
208
209
210 #define status_byte(result) (((result) >> 1) & 0x7f)
211 #define msg_byte(result) (((result) >> 8) & 0xff)
212 #define host_byte(result) (((result) >> 16) & 0xff)
213 #define driver_byte(result) (((result) >> 24) & 0xff)
214
215 #define sense_class(sense) (((sense) >> 4) & 0x7)
216 #define sense_error(sense) ((sense) & 0xf)
217 #define sense_valid(sense) ((sense) & 0x80)
218
219
220
221
222 #define FORMAT_UNIT_TIMEOUT (2 * 60 * 60 * HZ)
223 #define START_STOP_TIMEOUT (60 * HZ)
224 #define MOVE_MEDIUM_TIMEOUT (5 * 60 * HZ)
225 #define READ_ELEMENT_STATUS_TIMEOUT (5 * 60 * HZ)
226 #define READ_DEFECT_DATA_TIMEOUT (60 * HZ )
227
228
229 #define IDENTIFY_BASE 0x80
230 #define IDENTIFY(can_disconnect, lun) (IDENTIFY_BASE |\
231 ((can_disconnect) ? 0x40 : 0) |\
232 ((lun) & 0x07))
233
234
235
236
237
238
239
240
241 #define SCSI_UNKNOWN 0
242 #define SCSI_1 1
243 #define SCSI_1_CCS 2
244 #define SCSI_2 3
245 #define SCSI_3 4
246 #define SCSI_SPC_2 5
247 #define SCSI_SPC_3 6
248
249
250
251
252 #define SCSI_INQ_PQ_CON 0x00
253 #define SCSI_INQ_PQ_NOT_CON 0x01
254 #define SCSI_INQ_PQ_NOT_CAP 0x03
255
256
257
258
259
260
261
262
263
264 #define SCSI_IOCTL_GET_IDLUN 0x5382
265
266
267
268
269 #define SCSI_IOCTL_PROBE_HOST 0x5385
270
271
272 #define SCSI_IOCTL_GET_BUS_NUMBER 0x5386
273
274
275 #define SCSI_IOCTL_GET_PCI 0x5387
276
277 #endif