Added more comments.
[mirror/scst/.git] / scst / src / scst_cdbprobe.h
1 /*
2  *  scst_cdbprobe.h
3  *
4  *  Copyright (C) 2004 - 2009 Vladislav Bolkhovitin <vst@vlnb.net>
5  *  Copyright (C) 2004 - 2005 Leonid Stoljar
6  *  Copyright (C) 2007 - 2009 ID7 Ltd.
7  *
8  *  This program is free software; you can redistribute it and/or
9  *  modify it under the terms of the GNU General Public License
10  *  as published by the Free Software Foundation, version 2
11  *  of the License.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  *  GNU General Public License for more details.
17  */
18
19 /* Must be included in only one .c file in the project!! */
20
21 #ifndef __SCST_CDBPROBE_H
22 #define __SCST_CDBPROBE_H
23
24 /* get_trans_len_x extract x bytes from cdb as length starting from off */
25 static int get_trans_len_1(struct scst_cmd *cmd, uint8_t off);
26 static int get_trans_len_1_256(struct scst_cmd *cmd, uint8_t off);
27 static int get_trans_len_2(struct scst_cmd *cmd, uint8_t off);
28 static int get_trans_len_3(struct scst_cmd *cmd, uint8_t off);
29 static int get_trans_len_4(struct scst_cmd *cmd, uint8_t off);
30
31 /* for special commands */
32 static int get_trans_len_block_limit(struct scst_cmd *cmd, uint8_t off);
33 static int get_trans_len_read_capacity(struct scst_cmd *cmd, uint8_t off);
34 static int get_trans_len_serv_act_in(struct scst_cmd *cmd, uint8_t off);
35 static int get_trans_len_single(struct scst_cmd *cmd, uint8_t off);
36 static int get_trans_len_none(struct scst_cmd *cmd, uint8_t off);
37 static int get_trans_len_read_pos(struct scst_cmd *cmd, uint8_t off);
38
39 /*
40 +=====================================-============-======-
41 |  Command name                       | Operation  | Type |
42 |                                     |   code     |      |
43 |-------------------------------------+------------+------+
44
45 +=========================================================+
46 |Key:  M = command implementation is mandatory.           |
47 |      O = command implementation is optional.            |
48 |      V = Vendor-specific                                |
49 |      R = Reserved                                       |
50 |     ' '= DON'T use for this device                      |
51 +=========================================================+
52 */
53
54 #define SCST_CDB_MANDATORY  'M' /* mandatory */
55 #define SCST_CDB_OPTIONAL   'O' /* optional  */
56 #define SCST_CDB_VENDOR     'V' /* vendor    */
57 #define SCST_CDB_RESERVED   'R' /* reserved  */
58 #define SCST_CDB_NOTSUPP    ' ' /* don't use */
59
60 struct scst_sdbops {
61         uint8_t ops;            /* SCSI-2 op codes */
62         uint8_t devkey[16];     /* Key for every device type M,O,V,R
63                                  * type_disk      devkey[0]
64                                  * type_tape      devkey[1]
65                                  * type_printer   devkey[2]
66                                  * type_proseccor devkey[3]
67                                  * type_worm      devkey[4]
68                                  * type_cdrom     devkey[5]
69                                  * type_scanner   devkey[6]
70                                  * type_mod       devkey[7]
71                                  * type_changer   devkey[8]
72                                  * type_commdev   devkey[9]
73                                  * type_reserv    devkey[A]
74                                  * type_reserv    devkey[B]
75                                  * type_raid      devkey[C]
76                                  * type_enclosure devkey[D]
77                                  * type_reserv    devkey[E]
78                                  * type_reserv    devkey[F]
79                                  */
80         const char *op_name;    /* SCSI-2 op codes full name */
81         uint8_t direction;      /* init   --> target: SCST_DATA_WRITE
82                                  * target --> init:   SCST_DATA_READ
83                                  */
84         uint16_t flags;         /* opcode --  various flags */
85         uint8_t off;            /* length offset in cdb */
86         int (*get_trans_len)(struct scst_cmd *cmd, uint8_t off)
87                 __attribute__ ((aligned));
88 }  __attribute__((packed));
89
90 static int scst_scsi_op_list[256];
91
92 #define FLAG_NONE 0
93
94 static const struct scst_sdbops scst_scsi_op_table[] = {
95         /*
96          *      +-------------------> TYPE_IS_DISK      (0)
97          *      |
98          *      |+------------------> TYPE_IS_TAPE      (1)
99          *      ||
100          *      || +----------------> TYPE_IS_PROCESSOR (3)
101          *      || |
102          *      || | +--------------> TYPE_IS_CDROM     (5)
103          *      || | |
104          *      || | | +------------> TYPE_IS_MOD       (7)
105          *      || | | |
106          *      || | | |+-----------> TYPE_IS_CHANGER   (8)
107          *      || | | ||
108          *      || | | ||   +-------> TYPE_IS_RAID      (C)
109          *      || | | ||   |
110          *      || | | ||   |
111          *      0123456789ABCDEF ---> TYPE_IS_????     */
112
113         /* 6-bytes length CDB */
114         {0x00, "MMMMMMMMMMMMMMMM", "TEST UNIT READY",
115          /* let's be HQ to don't look dead under high load */
116          SCST_DATA_NONE, SCST_SMALL_TIMEOUT|SCST_IMPLICIT_HQ, 0, get_trans_len_none},
117         {0x01, " M              ", "REWIND",
118          SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none},
119         {0x01, "O V OO OO       ", "REZERO UNIT",
120          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
121         {0x02, "VVVVVV  V       ", "REQUEST BLOCK ADDR",
122          SCST_DATA_NONE, SCST_SMALL_TIMEOUT, 0, get_trans_len_none},
123         {0x03, "MMMMMMMMMMMMMMMM", "REQUEST SENSE",
124          SCST_DATA_READ, SCST_SMALL_TIMEOUT|SCST_SKIP_UA|SCST_LOCAL_EXEC_NEEDED,
125          4, get_trans_len_1},
126         {0x04, "M    O O        ", "FORMAT UNIT",
127          SCST_DATA_WRITE, SCST_LONG_TIMEOUT|SCST_UNKNOWN_LENGTH|SCST_WRITE_MEDIUM,
128          0, get_trans_len_none},
129         {0x04, "  O             ", "FORMAT",
130          SCST_DATA_NONE, SCST_WRITE_MEDIUM, 0, get_trans_len_none},
131         {0x05, "VMVVVV  V       ", "READ BLOCK LIMITS",
132          SCST_DATA_READ, SCST_SMALL_TIMEOUT, 0, get_trans_len_block_limit},
133         {0x06, "VVVVVV  V       ", "",
134          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
135         {0x07, "        O       ", "INITIALIZE ELEMENT STATUS",
136          SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none},
137         {0x07, "OVV O  OV       ", "REASSIGN BLOCKS",
138          SCST_DATA_NONE, SCST_WRITE_MEDIUM, 0, get_trans_len_none},
139         {0x08, "O               ", "READ(6)",
140          SCST_DATA_READ, SCST_TRANSFER_LEN_TYPE_FIXED, 4, get_trans_len_1_256},
141         {0x08, " MV OO OV       ", "READ(6)",
142          SCST_DATA_READ, SCST_TRANSFER_LEN_TYPE_FIXED, 2, get_trans_len_3},
143         {0x08, "         M      ", "GET MESSAGE(6)",
144          SCST_DATA_READ, FLAG_NONE, 2, get_trans_len_3},
145         {0x08, "    O           ", "RECEIVE",
146          SCST_DATA_READ, FLAG_NONE, 2, get_trans_len_3},
147         {0x09, "VVVVVV  V       ", "",
148          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
149         {0x0A, "O               ", "WRITE(6)",
150          SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED|SCST_WRITE_MEDIUM,
151          4, get_trans_len_1_256},
152         {0x0A, " M  O  OV       ", "WRITE(6)",
153          SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED|SCST_WRITE_MEDIUM,
154          2, get_trans_len_3},
155         {0x0A, "  M             ", "PRINT",
156          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
157         {0x0A, "         M      ", "SEND MESSAGE(6)",
158          SCST_DATA_WRITE, FLAG_NONE, 2, get_trans_len_3},
159         {0x0A, "    M           ", "SEND(6)",
160          SCST_DATA_WRITE, FLAG_NONE, 2, get_trans_len_3},
161         {0x0B, "O   OO OV       ", "SEEK(6)",
162          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
163         {0x0B, "                ", "TRACK SELECT",
164          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
165         {0x0B, "  O             ", "SLEW AND PRINT",
166          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
167         {0x0C, "VVVVVV  V       ", "SEEK BLOCK",
168          SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none},
169         {0x0D, "VVVVVV  V       ", "PARTITION",
170          SCST_DATA_NONE, SCST_LONG_TIMEOUT|SCST_WRITE_MEDIUM,
171          0, get_trans_len_none},
172         {0x0E, "VVVVVV  V       ", "",
173          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
174         {0x0F, "VOVVVV  V       ", "READ REVERSE",
175          SCST_DATA_READ, SCST_TRANSFER_LEN_TYPE_FIXED, 2, get_trans_len_3},
176         {0x10, "VM V V          ", "WRITE FILEMARKS",
177          SCST_DATA_NONE, SCST_WRITE_MEDIUM, 0, get_trans_len_none},
178         {0x10, "  O O           ", "SYNCHRONIZE BUFFER",
179          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
180         {0x11, "VMVVVV          ", "SPACE",
181          SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none},
182         {0x12, "MMMMMMMMMMMMMMMM", "INQUIRY",
183          SCST_DATA_READ, SCST_SMALL_TIMEOUT|SCST_IMPLICIT_HQ|SCST_SKIP_UA,
184          4, get_trans_len_1},
185         {0x13, "VOVVVV          ", "VERIFY(6)",
186          SCST_DATA_NONE, SCST_TRANSFER_LEN_TYPE_FIXED|
187                          SCST_VERIFY_BYTCHK_MISMATCH_ALLOWED,
188          2, get_trans_len_3},
189         {0x14, "VOOVVV          ", "RECOVER BUFFERED DATA",
190          SCST_DATA_READ, SCST_TRANSFER_LEN_TYPE_FIXED, 2, get_trans_len_3},
191         {0x15, "OMOOOOOOOOOOOOOO", "MODE SELECT(6)",
192          SCST_DATA_WRITE, SCST_LOCAL_EXEC_NEEDED, 4, get_trans_len_1},
193         {0x16, "MMMMMMMMMMMMMMMM", "RESERVE",
194          SCST_DATA_NONE, SCST_SMALL_TIMEOUT|SCST_LOCAL_EXEC_NEEDED,
195          0, get_trans_len_none},
196         {0x17, "MMMMMMMMMMMMMMMM", "RELEASE",
197          SCST_DATA_NONE, SCST_SMALL_TIMEOUT|SCST_LOCAL_EXEC_NEEDED,
198          0, get_trans_len_none},
199         {0x18, "OOOOOOOO        ", "COPY",
200          SCST_DATA_WRITE, SCST_LONG_TIMEOUT, 2, get_trans_len_3},
201         {0x19, "VMVVVV          ", "ERASE",
202          SCST_DATA_NONE, SCST_LONG_TIMEOUT|SCST_WRITE_MEDIUM,
203          0, get_trans_len_none},
204         {0x1A, "OMOOOOOOOOOOOOOO", "MODE SENSE(6)",
205          SCST_DATA_READ, SCST_SMALL_TIMEOUT, 4, get_trans_len_1},
206         {0x1B, "      O         ", "SCAN",
207          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
208         {0x1B, " O              ", "LOAD UNLOAD",
209          SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none},
210         {0x1B, "  O             ", "STOP PRINT",
211          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
212         {0x1B, "O   OO O    O   ", "STOP START UNIT",
213          SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none},
214         {0x1C, "OOOOOOOOOOOOOOOO", "RECEIVE DIAGNOSTIC RESULTS",
215          SCST_DATA_READ, FLAG_NONE, 3, get_trans_len_2},
216         {0x1D, "MMMMMMMMMMMMMMMM", "SEND DIAGNOSTIC",
217          SCST_DATA_WRITE, FLAG_NONE, 4, get_trans_len_1},
218         {0x1E, "OOOOOOOOOOOOOOOO", "PREVENT ALLOW MEDIUM REMOVAL",
219          SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none},
220         {0x1F, "            O   ", "PORT STATUS",
221          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
222
223          /* 10-bytes length CDB */
224         {0x20, "V   VV V        ", "",
225          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
226         {0x21, "V   VV V        ", "",
227          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
228         {0x22, "V   VV V        ", "",
229          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
230         {0x23, "V   VV V        ", "READ FORMAT CAPACITY",
231          SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2},
232         {0x24, "V   VVM         ", "SET WINDOW",
233          SCST_DATA_WRITE, FLAG_NONE, 6, get_trans_len_3},
234         {0x25, "M   MM M        ", "READ CAPACITY",
235          SCST_DATA_READ, SCST_IMPLICIT_HQ, 0, get_trans_len_read_capacity},
236         {0x25, "      O         ", "GET WINDOW",
237          SCST_DATA_READ, FLAG_NONE, 6, get_trans_len_3},
238         {0x26, "V   VV          ", "",
239          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
240         {0x27, "V   VV          ", "",
241          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
242         {0x28, "M   MMMM        ", "READ(10)",
243          SCST_DATA_READ, SCST_TRANSFER_LEN_TYPE_FIXED, 7, get_trans_len_2},
244         {0x28, "         O      ", "GET MESSAGE(10)",
245          SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2},
246         {0x29, "V   VV O        ", "READ GENERATION",
247          SCST_DATA_READ, FLAG_NONE, 8, get_trans_len_1},
248         {0x2A, "O   MO M        ", "WRITE(10)",
249          SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED|SCST_WRITE_MEDIUM,
250          7, get_trans_len_2},
251         {0x2A, "         O      ", "SEND MESSAGE(10)",
252          SCST_DATA_WRITE, FLAG_NONE, 7, get_trans_len_2},
253         {0x2A, "      O         ", "SEND(10)",
254          SCST_DATA_WRITE, FLAG_NONE, 7, get_trans_len_2},
255         {0x2B, " O              ", "LOCATE",
256          SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none},
257         {0x2B, "        O       ", "POSITION TO ELEMENT",
258          SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none},
259         {0x2B, "O   OO O        ", "SEEK(10)",
260          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
261         {0x2C, "V    O O        ", "ERASE(10)",
262          SCST_DATA_NONE, SCST_LONG_TIMEOUT|SCST_WRITE_MEDIUM,
263          0, get_trans_len_none},
264         {0x2D, "V   O  O        ", "READ UPDATED BLOCK",
265          SCST_DATA_READ, SCST_TRANSFER_LEN_TYPE_FIXED, 0, get_trans_len_single},
266         {0x2E, "O   OO O        ", "WRITE AND VERIFY(10)",
267          SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED|SCST_WRITE_MEDIUM,
268          7, get_trans_len_2},
269         {0x2F, "O   OO O        ", "VERIFY(10)",
270          SCST_DATA_NONE, SCST_TRANSFER_LEN_TYPE_FIXED|
271                          SCST_VERIFY_BYTCHK_MISMATCH_ALLOWED,
272          7, get_trans_len_2},
273         {0x33, "O   OO O        ", "SET LIMITS(10)",
274          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
275         {0x34, " O              ", "READ POSITION",
276          SCST_DATA_READ, SCST_SMALL_TIMEOUT, 7, get_trans_len_read_pos},
277         {0x34, "      O         ", "GET DATA BUFFER STATUS",
278          SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2},
279         {0x34, "O   OO O        ", "PRE-FETCH",
280          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
281         {0x35, "O   OO O        ", "SYNCHRONIZE CACHE",
282          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
283         {0x36, "O   OO O        ", "LOCK UNLOCK CACHE",
284          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
285         {0x37, "O      O        ", "READ DEFECT DATA(10)",
286          SCST_DATA_READ, FLAG_NONE, 8, get_trans_len_1},
287         {0x38, "    O  O        ", "MEDIUM SCAN",
288          SCST_DATA_READ, FLAG_NONE, 8, get_trans_len_1},
289         {0x39, "OOOOOOOO        ", "COMPARE",
290          SCST_DATA_WRITE, FLAG_NONE, 3, get_trans_len_3},
291         {0x3A, "OOOOOOOO        ", "COPY AND VERIFY",
292          SCST_DATA_WRITE, FLAG_NONE, 3, get_trans_len_3},
293         {0x3B, "OOOOOOOOOOOOOOOO", "WRITE BUFFER",
294          SCST_DATA_WRITE, SCST_SMALL_TIMEOUT, 6, get_trans_len_3},
295         {0x3C, "OOOOOOOOOOOOOOOO", "READ BUFFER",
296          SCST_DATA_READ, SCST_SMALL_TIMEOUT, 6, get_trans_len_3},
297         {0x3D, "    O  O        ", "UPDATE BLOCK",
298          SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED,
299          0, get_trans_len_single},
300         {0x3E, "O   OO O        ", "READ LONG",
301          SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2},
302         {0x3F, "O   O  O        ", "WRITE LONG",
303          SCST_DATA_WRITE, SCST_WRITE_MEDIUM, 7, get_trans_len_2},
304         {0x40, "OOOOOOOOOO      ", "CHANGE DEFINITION",
305          SCST_DATA_WRITE, SCST_SMALL_TIMEOUT, 8, get_trans_len_1},
306         {0x41, "O    O          ", "WRITE SAME",
307          SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED|SCST_WRITE_MEDIUM,
308          0, get_trans_len_single},
309         {0x42, "     O          ", "READ SUB-CHANNEL",
310          SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2},
311         {0x43, "     O          ", "READ TOC/PMA/ATIP",
312          SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2},
313         {0x44, " M              ", "REPORT DENSITY SUPPORT",
314          SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2},
315         {0x44, "     O          ", "READ HEADER",
316          SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2},
317         {0x45, "     O          ", "PLAY AUDIO(10)",
318          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
319         {0x46, "     O          ", "GET CONFIGURATION",
320          SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2},
321         {0x47, "     O          ", "PLAY AUDIO MSF",
322          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
323         {0x48, "     O          ", "PLAY AUDIO TRACK INDEX",
324          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
325         {0x49, "     O          ", "PLAY TRACK RELATIVE(10)",
326          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
327         {0x4A, "     O          ", "GET EVENT STATUS NOTIFICATION",
328          SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2},
329         {0x4B, "     O          ", "PAUSE/RESUME",
330          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
331         {0x4C, "OOOOOOOOOOOOOOOO", "LOG SELECT",
332          SCST_DATA_WRITE, SCST_SMALL_TIMEOUT, 7, get_trans_len_2},
333         {0x4D, "OOOOOOOOOOOOOOOO", "LOG SENSE",
334          SCST_DATA_READ, SCST_SMALL_TIMEOUT, 7, get_trans_len_2},
335         {0x4E, "     O          ", "STOP PLAY/SCAN",
336          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
337         {0x4F, "                ", "",
338          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
339         {0x50, "                ", "XDWRITE",
340          SCST_DATA_NONE, SCST_WRITE_MEDIUM, 0, get_trans_len_none},
341         {0x51, "     O          ", "READ DISC INFORMATION",
342          SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2},
343         {0x51, "                ", "XPWRITE",
344          SCST_DATA_NONE, SCST_WRITE_MEDIUM, 0, get_trans_len_none},
345         {0x52, "     O          ", "READ TRACK INFORMATION",
346          SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2},
347         {0x53, "     O          ", "RESERVE TRACK",
348          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
349         {0x54, "     O          ", "SEND OPC INFORMATION",
350          SCST_DATA_WRITE, FLAG_NONE, 7, get_trans_len_2},
351         {0x55, "OOOOOOOOOOOOOOOO", "MODE SELECT(10)",
352          SCST_DATA_WRITE, SCST_LOCAL_EXEC_NEEDED, 7, get_trans_len_2},
353         {0x56, "OOOOOOOOOOOOOOOO", "RESERVE(10)",
354          SCST_DATA_NONE, SCST_SMALL_TIMEOUT|SCST_LOCAL_EXEC_NEEDED,
355          0, get_trans_len_none},
356         {0x57, "OOOOOOOOOOOOOOOO", "RELEASE(10)",
357          SCST_DATA_NONE, SCST_SMALL_TIMEOUT|SCST_LOCAL_EXEC_NEEDED,
358          0, get_trans_len_none},
359         {0x58, "     O          ", "REPAIR TRACK",
360          SCST_DATA_NONE, SCST_WRITE_MEDIUM, 0, get_trans_len_none},
361         {0x59, "                ", "",
362          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
363         {0x5A, "OOOOOOOOOOOOOOOO", "MODE SENSE(10)",
364          SCST_DATA_READ, SCST_SMALL_TIMEOUT, 7, get_trans_len_2},
365         {0x5B, "     O          ", "CLOSE TRACK/SESSION",
366          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
367         {0x5C, "     O          ", "READ BUFFER CAPACITY",
368          SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_2},
369         {0x5D, "     O          ", "SEND CUE SHEET",
370          SCST_DATA_WRITE, FLAG_NONE, 6, get_trans_len_3},
371         {0x5E, "OOOOO OOOO      ", "PERSISTENT RESERV IN",
372          SCST_DATA_READ, FLAG_NONE, 5, get_trans_len_4},
373         {0x5F, "OOOOO OOOO      ", "PERSISTENT RESERV OUT",
374          SCST_DATA_WRITE, FLAG_NONE, 5, get_trans_len_4},
375
376         /* 16-bytes length CDB */
377         {0x80, "O   OO O        ", "XDWRITE EXTENDED",
378          SCST_DATA_NONE, SCST_WRITE_MEDIUM, 0, get_trans_len_none},
379         {0x80, " M              ", "WRITE FILEMARKS",
380          SCST_DATA_NONE, SCST_WRITE_MEDIUM, 0, get_trans_len_none},
381         {0x81, "O   OO O        ", "REBUILD",
382          SCST_DATA_WRITE, SCST_WRITE_MEDIUM, 10, get_trans_len_4},
383         {0x82, "O   OO O        ", "REGENERATE",
384          SCST_DATA_WRITE, SCST_WRITE_MEDIUM, 10, get_trans_len_4},
385         {0x83, "OOOOOOOOOOOOOOOO", "EXTENDED COPY",
386          SCST_DATA_WRITE, SCST_WRITE_MEDIUM, 10, get_trans_len_4},
387         {0x84, "OOOOOOOOOOOOOOOO", "RECEIVE COPY RESULT",
388          SCST_DATA_WRITE, FLAG_NONE, 10, get_trans_len_4},
389         {0x86, "OOOOOOOOOO      ", "ACCESS CONTROL IN",
390          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
391         {0x87, "OOOOOOOOOO      ", "ACCESS CONTROL OUT",
392          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
393         {0x88, "M   MMMM        ", "READ(16)",
394          SCST_DATA_READ, SCST_TRANSFER_LEN_TYPE_FIXED, 10, get_trans_len_4},
395         {0x8A, "O   OO O        ", "WRITE(16)",
396          SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED|SCST_WRITE_MEDIUM,
397          10, get_trans_len_4},
398         {0x8C, "OOOOOOOOOO      ", "READ ATTRIBUTE",
399          SCST_DATA_READ, FLAG_NONE, 10, get_trans_len_4},
400         {0x8D, "OOOOOOOOOO      ", "WRITE ATTRIBUTE",
401          SCST_DATA_WRITE, SCST_WRITE_MEDIUM, 10, get_trans_len_4},
402         {0x8E, "O   OO O        ", "WRITE AND VERIFY(16)",
403          SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED|SCST_WRITE_MEDIUM,
404          10, get_trans_len_4},
405         {0x8F, "O   OO O        ", "VERIFY(16)",
406          SCST_DATA_NONE, SCST_TRANSFER_LEN_TYPE_FIXED|
407                          SCST_VERIFY_BYTCHK_MISMATCH_ALLOWED,
408          10, get_trans_len_4},
409         {0x90, "O   OO O        ", "PRE-FETCH(16)",
410          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
411         {0x91, "O   OO O        ", "SYNCHRONIZE CACHE(16)",
412          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
413         {0x91, " M              ", "SPACE(16)",
414          SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none},
415         {0x92, "O   OO O        ", "LOCK UNLOCK CACHE(16)",
416          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
417         {0x92, " O              ", "LOCATE(16)",
418          SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none},
419         {0x93, "O    O          ", "WRITE SAME(16)",
420          SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED|SCST_WRITE_MEDIUM,
421          10, get_trans_len_4},
422         {0x93, " M              ", "ERASE(16)",
423          SCST_DATA_NONE, SCST_LONG_TIMEOUT|SCST_WRITE_MEDIUM,
424          0, get_trans_len_none},
425         {0x9E, "O               ", "SERVICE ACTION IN",
426          SCST_DATA_READ, FLAG_NONE, 0, get_trans_len_serv_act_in},
427
428         /* 12-bytes length CDB */
429         {0xA0, "VVVVVVVVVV  M   ", "REPORT LUNS",
430          SCST_DATA_READ, SCST_SMALL_TIMEOUT|SCST_IMPLICIT_HQ|SCST_SKIP_UA|
431                          SCST_LOCAL_CMD|SCST_LOCAL_EXEC_NEEDED,
432          6, get_trans_len_4},
433         {0xA1, "     O          ", "BLANK",
434          SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none},
435         {0xA2, "                ", "",
436          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
437         {0xA3, "     O          ", "SEND KEY",
438          SCST_DATA_WRITE, FLAG_NONE, 8, get_trans_len_2},
439         {0xA3, "OOOOO OOOO      ", "REPORT DEVICE IDENTIDIER",
440          SCST_DATA_READ, FLAG_NONE, 6, get_trans_len_4},
441         {0xA3, "            M   ", "MAINTENANCE(IN)",
442          SCST_DATA_READ, FLAG_NONE, 6, get_trans_len_4},
443         {0xA4, "     O          ", "REPORT KEY",
444          SCST_DATA_READ, FLAG_NONE, 8, get_trans_len_2},
445         {0xA4, "            O   ", "MAINTENANCE(OUT)",
446          SCST_DATA_WRITE, FLAG_NONE, 6, get_trans_len_4},
447         {0xA5, "        M       ", "MOVE MEDIUM",
448          SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none},
449         {0xA5, "     O          ", "PLAY AUDIO(12)",
450          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
451         {0xA6, "     O  O       ", "EXCHANGE/LOAD/UNLOAD MEDIUM",
452          SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none},
453         {0xA7, "     O          ", "SET READ AHEAD",
454          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
455         {0xA8, "         O      ", "GET MESSAGE(12)",
456          SCST_DATA_READ, FLAG_NONE, 6, get_trans_len_4},
457         {0xA8, "O   OO O        ", "READ(12)",
458          SCST_DATA_READ, SCST_TRANSFER_LEN_TYPE_FIXED, 6, get_trans_len_4},
459         {0xA9, "     O          ", "PLAY TRACK RELATIVE(12)",
460          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
461         {0xAA, "O   OO O        ", "WRITE(12)",
462          SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED|SCST_WRITE_MEDIUM,
463          6, get_trans_len_4},
464         {0xAA, "         O      ", "SEND MESSAGE(12)",
465          SCST_DATA_WRITE, FLAG_NONE, 6, get_trans_len_4},
466         {0xAB, "                ", "",
467          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
468         {0xAC, "       O        ", "ERASE(12)",
469          SCST_DATA_NONE, SCST_WRITE_MEDIUM, 0, get_trans_len_none},
470         {0xAC, "     M          ", "GET PERFORMANCE",
471          SCST_DATA_READ, SCST_UNKNOWN_LENGTH, 0, get_trans_len_none},
472         {0xAD, "     O          ", "READ DVD STRUCTURE",
473          SCST_DATA_READ, FLAG_NONE, 8, get_trans_len_2},
474         {0xAE, "O   OO O        ", "WRITE AND VERIFY(12)",
475          SCST_DATA_WRITE, SCST_TRANSFER_LEN_TYPE_FIXED|SCST_WRITE_MEDIUM,
476          6, get_trans_len_4},
477         {0xAF, "O   OO O        ", "VERIFY(12)",
478          SCST_DATA_NONE, SCST_TRANSFER_LEN_TYPE_FIXED|
479                          SCST_VERIFY_BYTCHK_MISMATCH_ALLOWED,
480          6, get_trans_len_4},
481 /* No need to support at all.
482         {0xB0, "    OO O        ", "SEARCH DATA HIGH(12)",
483          SCST_DATA_WRITE, FLAG_NONE, 9, get_trans_len_1},
484         {0xB1, "    OO O        ", "SEARCH DATA EQUAL(12)",
485          SCST_DATA_WRITE, FLAG_NONE, 9, get_trans_len_1},
486         {0xB2, "    OO O        ", "SEARCH DATA LOW(12)",
487          SCST_DATA_WRITE, FLAG_NONE, 9, get_trans_len_1},
488 */
489         {0xB3, "    OO O        ", "SET LIMITS(12)",
490          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
491         {0xB4, "                ", "",
492          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
493         {0xB5, "        O       ", "REQUEST VOLUME ELEMENT ADDRESS",
494          SCST_DATA_READ, FLAG_NONE, 9, get_trans_len_1},
495         {0xB6, "        O       ", "SEND VOLUME TAG",
496          SCST_DATA_WRITE, FLAG_NONE, 9, get_trans_len_1},
497         {0xB6, "     M         ", "SET STREAMING",
498          SCST_DATA_WRITE, FLAG_NONE, 9, get_trans_len_2},
499         {0xB7, "       O        ", "READ DEFECT DATA(12)",
500          SCST_DATA_READ, FLAG_NONE, 9, get_trans_len_1},
501         {0xB8, "        O       ", "READ ELEMENT STATUS",
502          SCST_DATA_READ, FLAG_NONE, 7, get_trans_len_3},
503         {0xB9, "     O          ", "READ CD MSF",
504          SCST_DATA_READ, SCST_UNKNOWN_LENGTH, 0, get_trans_len_none},
505         {0xBA, "     O          ", "SCAN",
506          SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none},
507         {0xBA, "            O   ", "REDUNDANCY GROUP(IN)",
508          SCST_DATA_READ, FLAG_NONE, 6, get_trans_len_4},
509         {0xBB, "     O          ", "SET SPEED",
510          SCST_DATA_NONE, FLAG_NONE, 0, get_trans_len_none},
511         {0xBB, "            O   ", "REDUNDANCY GROUP(OUT)",
512          SCST_DATA_WRITE, FLAG_NONE, 6, get_trans_len_4},
513         {0xBC, "            O   ", "SPARE(IN)",
514          SCST_DATA_READ, FLAG_NONE, 6, get_trans_len_4},
515         {0xBD, "     O          ", "MECHANISM STATUS",
516          SCST_DATA_READ, FLAG_NONE, 8, get_trans_len_2},
517         {0xBD, "            O   ", "SPARE(OUT)",
518          SCST_DATA_WRITE, FLAG_NONE, 6, get_trans_len_4},
519         {0xBE, "     O          ", "READ CD",
520          SCST_DATA_READ, SCST_TRANSFER_LEN_TYPE_FIXED, 6, get_trans_len_3},
521         {0xBE, "            O   ", "VOLUME SET(IN)",
522          SCST_DATA_READ, FLAG_NONE, 6, get_trans_len_4},
523         {0xBF, "     O          ", "SEND DVD STRUCTUE",
524          SCST_DATA_WRITE, FLAG_NONE, 8, get_trans_len_2},
525         {0xBF, "            O   ", "VOLUME SET(OUT)",
526          SCST_DATA_WRITE, FLAG_NONE, 6, get_trans_len_4},
527         {0xE7, "        V       ", "INIT ELEMENT STATUS WRANGE",
528          SCST_DATA_NONE, SCST_LONG_TIMEOUT, 0, get_trans_len_none}
529 };
530
531 #define SCST_CDB_TBL_SIZE \
532         ((int)(sizeof(scst_scsi_op_table)/sizeof(struct scst_sdbops)))
533
534 #endif /* __SCST_CDBPROBE_H */