VirtualBox

source: vbox/trunk/include/VBox/scsi.h@ 5959

Last change on this file since 5959 was 5959, checked in by vboxsync, 17 years ago

typo.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 20.2 KB
Line 
1/** @file
2 * VirtualBox - SCSI declarations.
3 */
4
5/*
6 * Copyright (C) 2006-2007 innotek GmbH
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License as published by the Free Software Foundation,
12 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
13 * distribution. VirtualBox OSE is distributed in the hope that it will
14 * be useful, but WITHOUT ANY WARRANTY of any kind.
15 */
16
17#ifndef ___VBox_scsi_h
18#define ___VBox_scsi_h
19
20#include <iprt/assert.h>
21
22
23/**
24 * SCSI command opcode identifiers.
25 *
26 * SCSI-3, so far for CD/DVD Logical Units, from Table 49 of the MMC-3 draft standard.
27 */
28typedef enum SCSICMD
29{
30 SCSI_BLANK = 0xa1,
31 SCSI_CLOSE_TRACK_SESSION = 0x5b,
32 SCSI_ERASE_10 = 0x2c,
33 SCSI_FORMAT_UNIT = 0x04,
34 SCSI_GET_CONFIGURATION = 0x46,
35 SCSI_GET_EVENT_STATUS_NOTIFICATION = 0x4a,
36 SCSI_GET_PERFORMANCE = 0xac,
37 /** Inquiry command. */
38 SCSI_INQUIRY = 0x12,
39 SCSI_LOAD_UNLOAD_MEDIUM = 0xa6,
40 SCSI_MECHANISM_STATUS = 0xbd,
41 SCSI_MODE_SELECT_10 = 0x55,
42 SCSI_MODE_SENSE_10 = 0x5a,
43 SCSI_PAUSE_RESUME = 0x4b,
44 SCSI_PLAY_AUDIO_10 = 0x45,
45 SCSI_PLAY_AUDIO_12 = 0xa5,
46 SCSI_PLAY_AUDIO_MSF = 0x47,
47 SCSI_PREVENT_ALLOW_MEDIUM_REMOVAL = 0x1e,
48 /** Read(10) command. */
49 SCSI_READ_10 = 0x28,
50 SCSI_READ_12 = 0xa8,
51 SCSI_READ_BUFFER = 0x3c,
52 SCSI_READ_BUFFER_CAPACITY = 0x5c,
53 /** Read Capacity(6) command. */
54 SCSI_READ_CAPACITY = 0x25,
55 SCSI_READ_CD = 0xbe,
56 SCSI_READ_CD_MSF = 0xb9,
57 SCSI_READ_DISC_INFORMATION = 0x51,
58 SCSI_READ_DVD_STRUCTURE = 0xad,
59 SCSI_READ_FORMAT_CAPACITIES = 0x23,
60 SCSI_READ_SUBCHANNEL = 0x42,
61 SCSI_READ_TOC_PMA_ATIP = 0x43,
62 SCSI_READ_TRACK_INFORMATION = 0x52,
63 SCSI_REPAIR_TRACK = 0x58,
64 SCSI_REPORT_KEY = 0xa4,
65 SCSI_REQUEST_SENSE = 0x03,
66 SCSI_RESERVE_TRACK = 0x53,
67 SCSI_SCAN = 0xba,
68 SCSI_SEEK_10 = 0x2b,
69 SCSI_SEND_CUE_SHEET = 0x5d,
70 SCSI_SEND_DVD_STRUCTURE = 0xbf,
71 SCSI_SEND_EVENT = 0xa2,
72 SCSI_SEND_KEY = 0xa3,
73 SCSI_SEND_OPC_INFORMATION = 0x54,
74 SCSI_SET_CD_SPEED = 0xbb,
75 SCSI_SET_READ_AHEAD = 0xa7,
76 SCSI_SET_STREAMING = 0xb6,
77 SCSI_START_STOP_UNIT = 0x1b,
78 SCSI_STOP_PLAY_SCAN = 0x4e,
79 /** Synchronize Cache command. */
80 SCSI_SYNCHRONIZE_CACHE = 0x35,
81 SCSI_TEST_UNIT_READY = 0x00,
82 SCSI_VERIFY_10 = 0x2f,
83 /** Write(10) command. */
84 SCSI_WRITE_10 = 0x2a,
85 SCSI_WRITE_12 = 0xaa,
86 SCSI_WRITE_AND_VERIFY_10 = 0x2e,
87 SCSI_WRITE_BUFFER = 0x3b,
88
89 /** Mode Sense(6) command */
90 SCSI_MODE_SENSE_6 = 0x1a,
91 /** Report LUNs command. */
92 SCSI_REPORT_LUNS = 0xa0,
93 /** Rezero Unit command. Obsolete for ages now, but used by cdrecord. */
94 SCSI_REZERO_UNIT = 0x01
95} SCSICMD;
96
97#ifdef DEBUG
98static const char * const g_apszSCSICmdNames[256] =
99{
100 "TEST UNIT READY", /* 0x00 */
101 "REZERO UNIT", /* 0x01 */
102 "", /* 0x02 */
103 "REQUEST SENSE", /* 0x03 */
104 "FORMAT UNIT", /* 0x04 */
105 "READ BLOCK LIMITS", /* 0x05 */
106 "", /* 0x06 */
107 "REASSIGN BLOCKS", /* 0x07 */
108 "READ (6)", /* 0x08 */
109 "", /* 0x09 */
110 "WRITE (6)", /* 0x0a */
111 "SEEK (6)", /* 0x0b */
112 "", /* 0x0c */
113 "", /* 0x0d */
114 "", /* 0x0e */
115 "READ REVERSE (6)", /* 0x0f */
116 "READ FILEMARKS (6)", /* 0x10 */
117 "SPACE (6)", /* 0x11 */
118 "INQUIRY", /* 0x12 */
119 "VERIFY (6)", /* 0x13 */
120 "RECOVER BUFFERED DATA", /* 0x14 */
121 "MODE SELECT (6)", /* 0x15 */
122 "RESERVE (6)", /* 0x16 */
123 "RELEASE (6)", /* 0x17 */
124 "COPY", /* 0x18 */
125 "ERASE (6)", /* 0x19 */
126 "MODE SENSE (6)", /* 0x1a */
127 "START STOP UNIT", /* 0x1b */
128 "RECEIVE DIAGNOSTIC RESULTS", /* 0x1c */
129 "SEND DIAGNOSTIC", /* 0x1d */
130 "PREVENT ALLOW MEDIUM REMOVAL", /* 0x1e */
131 "", /* 0x1f */
132 "", /* 0x20 */
133 "", /* 0x21 */
134 "", /* 0x22 */
135 "READ FORMAT CAPACITIES", /* 0x23 */
136 "SET WINDOW", /* 0x24 */
137 "READ CAPACITY", /* 0x25 */
138 "", /* 0x26 */
139 "", /* 0x27 */
140 "READ (10)", /* 0x28 */
141 "READ GENERATION", /* 0x29 */
142 "WRITE (10)", /* 0x2a */
143 "SEEK (10)", /* 0x2b */
144 "ERASE (10)", /* 0x2c */
145 "READ UPDATED BLOCK", /* 0x2d */
146 "WRITE AND VERIFY (10)", /* 0x2e */
147 "VERIFY (10)", /* 0x2f */
148 "SEARCH DATA HIGH (10)", /* 0x30 */
149 "SEARCH DATA EQUAL (10)", /* 0x31 */
150 "SEARCH DATA LOW (10)", /* 0x32 */
151 "SET LIMITS (10)", /* 0x33 */
152 "PRE-FETCH (10)", /* 0x34 */
153 "SYNCHRONIZE CACHE (10)", /* 0x35 */
154 "LOCK UNLOCK CACHE (10)", /* 0x36 */
155 "READ DEFECT DATA (10)", /* 0x37 */
156 "MEDIUM SCAN", /* 0x38 */
157 "COMPARE", /* 0x39 */
158 "COPY AND VERIFY", /* 0x3a */
159 "WRITE BUFFER", /* 0x3b */
160 "READ BUFFER", /* 0x3c */
161 "UPDATE BLOCK", /* 0x3d */
162 "READ LONG (10)", /* 0x3e */
163 "WRITE LONG (10)", /* 0x3f */
164 "CHANGE DEFINITION", /* 0x40 */
165 "WRITE SAME (10)", /* 0x41 */
166 "READ SUBCHANNEL", /* 0x42 */
167 "READ TOC/PMA/ATIP", /* 0x43 */
168 "REPORT DENSITY SUPPORT", /* 0x44 */
169 "PLAY AUDIO (10)", /* 0x45 */
170 "GET CONFIGURATION", /* 0x46 */
171 "PLAY AUDIO MSF", /* 0x47 */
172 "", /* 0x48 */
173 "", /* 0x49 */
174 "GET EVENT STATUS NOTIFICATION", /* 0x4a */
175 "PAUSE/RESUME", /* 0x4b */
176 "LOG SELECT", /* 0x4c */
177 "LOG SENSE", /* 0x4d */
178 "STOP PLAY/SCAN", /* 0x4e */
179 "", /* 0x4f */
180 "XDWRITE (10)", /* 0x50 */
181 "READ DISC INFORMATION", /* 0x51 */
182 "READ TRACK INFORMATION", /* 0x52 */
183 "RESERVE TRACK", /* 0x53 */
184 "SEND OPC INFORMATION", /* 0x54 */
185 "MODE SELECT (10)", /* 0x55 */
186 "RESERVE (10)", /* 0x56 */
187 "RELEASE (10)", /* 0x57 */
188 "REPAIR TRACK", /* 0x58 */
189 "", /* 0x59 */
190 "MODE SENSE (10)", /* 0x5a */
191 "CLOSE TRACK/SESSION", /* 0x5b */
192 "READ BUFFER CAPACITY", /* 0x5c */
193 "SEND CUE SHEET", /* 0x5d */
194 "PERSISTENT RESERVE IN", /* 0x5e */
195 "PERSISTENT RESERVE OUT", /* 0x5f */
196 "", /* 0x60 */
197 "", /* 0x61 */
198 "", /* 0x62 */
199 "", /* 0x63 */
200 "", /* 0x64 */
201 "", /* 0x65 */
202 "", /* 0x66 */
203 "", /* 0x67 */
204 "", /* 0x68 */
205 "", /* 0x69 */
206 "", /* 0x6a */
207 "", /* 0x6b */
208 "", /* 0x6c */
209 "", /* 0x6d */
210 "", /* 0x6e */
211 "", /* 0x6f */
212 "", /* 0x70 */
213 "", /* 0x71 */
214 "", /* 0x72 */
215 "", /* 0x73 */
216 "", /* 0x74 */
217 "", /* 0x75 */
218 "", /* 0x76 */
219 "", /* 0x77 */
220 "", /* 0x78 */
221 "", /* 0x79 */
222 "", /* 0x7a */
223 "", /* 0x7b */
224 "", /* 0x7c */
225 "", /* 0x7d */
226 "", /* 0x7e */
227 "", /* 0x7f */
228 "WRITE FILEMARKS (16)", /* 0x80 */
229 "READ REVERSE (16)", /* 0x81 */
230 "REGENERATE (16)", /* 0x82 */
231 "EXTENDED COPY", /* 0x83 */
232 "RECEIVE COPY RESULTS", /* 0x84 */
233 "ATA COMMAND PASS THROUGH (16)", /* 0x85 */
234 "ACCESS CONTROL IN", /* 0x86 */
235 "ACCESS CONTROL OUT", /* 0x87 */
236 "READ (16)", /* 0x88 */
237 "", /* 0x89 */
238 "WRITE(16)", /* 0x8a */
239 "", /* 0x8b */
240 "READ ATTRIBUTE", /* 0x8c */
241 "WRITE ATTRIBUTE", /* 0x8d */
242 "WRITE AND VERIFY (16)", /* 0x8e */
243 "VERIFY (16)", /* 0x8f */
244 "PRE-FETCH (16)", /* 0x90 */
245 "SYNCHRONIZE CACHE (16)", /* 0x91 */
246 "LOCK UNLOCK CACHE (16)", /* 0x92 */
247 "WRITE SAME (16)", /* 0x93 */
248 "", /* 0x94 */
249 "", /* 0x95 */
250 "", /* 0x96 */
251 "", /* 0x97 */
252 "", /* 0x98 */
253 "", /* 0x99 */
254 "", /* 0x9a */
255 "", /* 0x9b */
256 "", /* 0x9c */
257 "", /* 0x9d */
258 "SERVICE ACTION IN (16)", /* 0x9e */
259 "SERVICE ACTION OUT (16)", /* 0x9f */
260 "REPORT LUNS", /* 0xa0 */
261 "BLANK", /* 0xa1 */
262 "SEND EVENT", /* 0xa2 */
263 "SEND KEY", /* 0xa3 */
264 "REPORT KEY", /* 0xa4 */
265 "PLAY AUDIO (12)", /* 0xa5 */
266 "LOAD/UNLOAD MEDIUM", /* 0xa6 */
267 "SET READ AHEAD", /* 0xa7 */
268 "READ (12)", /* 0xa8 */
269 "SERVICE ACTION OUT (12)", /* 0xa9 */
270 "WRITE (12)", /* 0xaa */
271 "SERVICE ACTION IN (12)", /* 0xab */
272 "GET PERFORMANCE", /* 0xac */
273 "READ DVD STRUCTURE", /* 0xad */
274 "WRITE AND VERIFY (12)", /* 0xae */
275 "VERIFY (12)", /* 0xaf */
276 "SEARCH DATA HIGH (12)", /* 0xb0 */
277 "SEARCH DATA EQUAL (12)", /* 0xb1 */
278 "SEARCH DATA LOW (12)", /* 0xb2 */
279 "SET LIMITS (12)", /* 0xb3 */
280 "READ ELEMENT STATUS ATTACHED", /* 0xb4 */
281 "REQUEST VOLUME ELEMENT ADDRESS", /* 0xb5 */
282 "SET STREAMING", /* 0xb6 */
283 "READ DEFECT DATA (12)", /* 0xb7 */
284 "READ ELEMENT STATUS", /* 0xb8 */
285 "READ CD MSF", /* 0xb9 */
286 "SCAN", /* 0xba */
287 "SET CD SPEED", /* 0xbb */
288 "SPARE (IN)", /* 0xbc */
289 "MECHANISM STATUS", /* 0xbd */
290 "READ CD", /* 0xbe */
291 "SEND DVD STRUCTURE", /* 0xbf */
292 "", /* 0xc0 */
293 "", /* 0xc1 */
294 "", /* 0xc2 */
295 "", /* 0xc3 */
296 "", /* 0xc4 */
297 "", /* 0xc5 */
298 "", /* 0xc6 */
299 "", /* 0xc7 */
300 "", /* 0xc8 */
301 "", /* 0xc9 */
302 "", /* 0xca */
303 "", /* 0xcb */
304 "", /* 0xcc */
305 "", /* 0xcd */
306 "", /* 0xce */
307 "", /* 0xcf */
308 "", /* 0xd0 */
309 "", /* 0xd1 */
310 "", /* 0xd2 */
311 "", /* 0xd3 */
312 "", /* 0xd4 */
313 "", /* 0xd5 */
314 "", /* 0xd6 */
315 "", /* 0xd7 */
316 "", /* 0xd8 */
317 "", /* 0xd9 */
318 "", /* 0xda */
319 "", /* 0xdb */
320 "", /* 0xdc */
321 "", /* 0xdd */
322 "", /* 0xde */
323 "", /* 0xdf */
324 "", /* 0xe0 */
325 "", /* 0xe1 */
326 "", /* 0xe2 */
327 "", /* 0xe3 */
328 "", /* 0xe4 */
329 "", /* 0xe5 */
330 "", /* 0xe6 */
331 "", /* 0xe7 */
332 "", /* 0xe8 */
333 "", /* 0xe9 */
334 "", /* 0xea */
335 "", /* 0xeb */
336 "", /* 0xec */
337 "", /* 0xed */
338 "", /* 0xee */
339 "", /* 0xef */
340 "", /* 0xf0 */
341 "", /* 0xf1 */
342 "", /* 0xf2 */
343 "", /* 0xf3 */
344 "", /* 0xf4 */
345 "", /* 0xf5 */
346 "", /* 0xf6 */
347 "", /* 0xf7 */
348 "", /* 0xf8 */
349 "", /* 0xf9 */
350 "", /* 0xfa */
351 "", /* 0xfb */
352 "", /* 0xfc */
353 "", /* 0xfd */
354 "", /* 0xfe */
355 "" /* 0xff */
356};
357#endif /* DEBUG */
358
359/* Mode page codes for mode sense/select commands. */
360#define SCSI_MODEPAGE_ERROR_RECOVERY 0x01
361#define SCSI_MODEPAGE_WRITE_PARAMETER 0x05
362#define SCSI_MODEPAGE_CD_STATUS 0x2a
363
364
365/* Page control codes. */
366#define SCSI_PAGECONTROL_CURRENT 0x00
367#define SCSI_PAGECONTROL_CHANGEABLE 0x01
368#define SCSI_PAGECONTROL_DEFAULT 0x02
369#define SCSI_PAGECONTROL_SAVED 0x03
370
371
372#define SCSI_SENSE_NONE 0
373#define SCSI_SENSE_NOT_READY 2
374#define SCSI_SENSE_MEDIUM_ERROR 3
375#define SCSI_SENSE_ILLEGAL_REQUEST 5
376#define SCSI_SENSE_UNIT_ATTENTION 6
377
378
379#define SCSI_ASC_NONE 0x00
380#define SCSI_ASC_READ_ERROR 0x11
381#define SCSI_ASC_ILLEGAL_OPCODE 0x20
382#define SCSI_ASC_LOGICAL_BLOCK_OOR 0x21
383#define SCSI_ASC_INV_FIELD_IN_CMD_PACKET 0x24
384#define SCSI_ASC_MEDIUM_MAY_HAVE_CHANGED 0x28
385#define SCSI_ASC_MEDIUM_NOT_PRESENT 0x3a
386#define SCSI_ASC_SAVING_PARAMETERS_NOT_SUPPORTED 0x39
387#define SCSI_ASC_MEDIA_LOAD_OR_EJECT_FAILED 0x53
388
389
390/** @name SCSI_INQUIRY
391 * @{
392 */
393#pragma pack(1)
394typedef struct SCSIINQUIRYCDB
395{
396 unsigned u8Cmd : 8;
397 unsigned fEVPD : 1;
398 unsigned u4Reserved : 4;
399 unsigned u3LUN : 3;
400 unsigned u8PageCode : 8;
401 unsigned u8Reserved : 8;
402 uint8_t cbAlloc;
403 uint8_t u8Control;
404} SCSIINQUIRYCDB;
405#pragma pack()
406AssertCompileSize(SCSIINQUIRYCDB, 6);
407typedef SCSIINQUIRYCDB *PSCSIINQUIRYCDB;
408typedef const SCSIINQUIRYCDB *PCSCSIINQUIRYCDB;
409
410#pragma pack(1)
411typedef struct SCSIINQUIRYDATA
412{
413 unsigned u5PeripherialDeviceType : 5; /**< 0x00 / 00 */
414 unsigned u3PeripherialQualifier : 3;
415 unsigned u6DeviceTypeModifier : 7; /**< 0x01 */
416 unsigned fRMB : 1;
417 unsigned u3AnsiVersion : 3; /**< 0x02 */
418 unsigned u3EcmaVersion : 3;
419 unsigned u2IsoVersion : 2;
420 unsigned u4ResponseDataFormat : 4; /**< 0x03 */
421 unsigned u2Reserved0 : 2;
422 unsigned fTrmlOP : 1;
423 unsigned fAEC : 1;
424 unsigned cbAdditional : 8; /**< 0x04 */
425 unsigned u8Reserved1 : 8; /**< 0x05 */
426 unsigned u8Reserved2 : 8; /**< 0x06 */
427 unsigned fSftRe : 1; /**< 0x07 */
428 unsigned fCmdQue : 1;
429 unsigned fReserved3 : 1;
430 unsigned fLinked : 1;
431 unsigned fSync : 1;
432 unsigned fWBus16 : 1;
433 unsigned fWBus32 : 1;
434 unsigned fRelAdr : 1;
435 int8_t achVendorId[8]; /**< 0x08 */
436 int8_t achProductId[16]; /**< 0x10 */
437 int8_t achProductLevel[4]; /**< 0x20 */
438 uint8_t abVendorSpecific[20]; /**< 0x24/36 - Optional it seems. */
439 uint8_t abReserved4[40];
440 uint8_t abVendorSpecificParameters[1]; /**< 0x60/96 - Variable size. */
441} SCSIINQUIRYDATA;
442#pragma pack()
443AssertCompileSize(SCSIINQUIRYDATA, 97);
444typedef SCSIINQUIRYDATA *PSCSIINQUIRYDATA;
445typedef const SCSIINQUIRYDATA *PCSCSIINQUIRYDATA;
446/** @} */
447
448#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette