VirtualBox

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

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

The Giant CDDL Dual-License Header Change.

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