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