VirtualBox

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

Last change on this file since 11798 was 11649, checked in by vboxsync, 16 years ago

BusLogic: FreeBSD works

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