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