VirtualBox

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

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

RT_STRICT/VBOX_STRICT vs. DEBUG confusion.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.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 SCSI_REPORT_DENSITY = 0x44,
107 /** Rezero Unit command. Obsolete for ages now, but used by cdrecord. */
108 SCSI_REZERO_UNIT = 0x01,
109 SCSI_SERVICE_ACTION_IN_16 = 0x9e,
110 SCSI_READ_16 = 0x88,
111 SCSI_WRITE_16 = 0x8a,
112 SCSI_READ_6 = 0x08
113} SCSICMD;
114
115/* Mode page codes for mode sense/select commands. */
116#define SCSI_MODEPAGE_ERROR_RECOVERY 0x01
117#define SCSI_MODEPAGE_WRITE_PARAMETER 0x05
118#define SCSI_MODEPAGE_CD_STATUS 0x2a
119
120
121/* Page control codes. */
122#define SCSI_PAGECONTROL_CURRENT 0x00
123#define SCSI_PAGECONTROL_CHANGEABLE 0x01
124#define SCSI_PAGECONTROL_DEFAULT 0x02
125#define SCSI_PAGECONTROL_SAVED 0x03
126
127
128/* Sense keys */
129#define SCSI_SENSE_NONE 0
130#define SCSI_SENSE_RECOVERED_ERROR 1
131#define SCSI_SENSE_NOT_READY 2
132#define SCSI_SENSE_MEDIUM_ERROR 3
133#define SCSI_SENSE_HARDWARE_ERROR 4
134#define SCSI_SENSE_ILLEGAL_REQUEST 5
135#define SCSI_SENSE_UNIT_ATTENTION 6
136#define SCSI_SENSE_DATA_PROTECT 7
137#define SCSI_SENSE_BLANK_CHECK 8
138#define SCSI_SENSE_VENDOR_SPECIFIC 9
139#define SCSI_SENSE_COPY_ABORTED 10
140#define SCSI_SENSE_ABORTED_COMMAND 11
141#define SCSI_SENSE_VOLUME_OVERFLOW 13
142#define SCSI_SENSE_MISCOMPARE 14
143
144
145/* additional sense keys */
146#define SCSI_ASC_NONE 0x00
147#define SCSI_ASC_READ_ERROR 0x11
148#define SCSI_ASC_ILLEGAL_OPCODE 0x20
149#define SCSI_ASC_LOGICAL_BLOCK_OOR 0x21
150#define SCSI_ASC_INV_FIELD_IN_CMD_PACKET 0x24
151#define SCSI_ASC_MEDIUM_MAY_HAVE_CHANGED 0x28
152#define SCSI_ASC_MEDIUM_NOT_PRESENT 0x3a
153#define SCSI_ASC_SAVING_PARAMETERS_NOT_SUPPORTED 0x39
154#define SCSI_ASC_MEDIA_LOAD_OR_EJECT_FAILED 0x53
155
156
157/** @name SCSI_INQUIRY
158 * @{
159 */
160#pragma pack(1)
161typedef struct SCSIINQUIRYCDB
162{
163 unsigned u8Cmd : 8;
164 unsigned fEVPD : 1;
165 unsigned u4Reserved : 4;
166 unsigned u3LUN : 3;
167 unsigned u8PageCode : 8;
168 unsigned u8Reserved : 8;
169 uint8_t cbAlloc;
170 uint8_t u8Control;
171} SCSIINQUIRYCDB;
172#pragma pack()
173AssertCompileSize(SCSIINQUIRYCDB, 6);
174typedef SCSIINQUIRYCDB *PSCSIINQUIRYCDB;
175typedef const SCSIINQUIRYCDB *PCSCSIINQUIRYCDB;
176
177#pragma pack(1)
178typedef struct SCSIINQUIRYDATA
179{
180 unsigned u5PeripheralDeviceType : 5; /**< 0x00 / 00 */
181 unsigned u3PeripheralQualifier : 3;
182 unsigned u6DeviceTypeModifier : 7; /**< 0x01 */
183 unsigned fRMB : 1;
184 unsigned u3AnsiVersion : 3; /**< 0x02 */
185 unsigned u3EcmaVersion : 3;
186 unsigned u2IsoVersion : 2;
187 unsigned u4ResponseDataFormat : 4; /**< 0x03 */
188 unsigned u2Reserved0 : 2;
189 unsigned fTrmlOP : 1;
190 unsigned fAEC : 1;
191 unsigned cbAdditional : 8; /**< 0x04 */
192 unsigned u8Reserved1 : 8; /**< 0x05 */
193 unsigned u8Reserved2 : 8; /**< 0x06 */
194 unsigned fSftRe : 1; /**< 0x07 */
195 unsigned fCmdQue : 1;
196 unsigned fReserved3 : 1;
197 unsigned fLinked : 1;
198 unsigned fSync : 1;
199 unsigned fWBus16 : 1;
200 unsigned fWBus32 : 1;
201 unsigned fRelAdr : 1;
202 int8_t achVendorId[8]; /**< 0x08 */
203 int8_t achProductId[16]; /**< 0x10 */
204 int8_t achProductLevel[4]; /**< 0x20 */
205 uint8_t abVendorSpecific[20]; /**< 0x24/36 - Optional it seems. */
206 uint8_t abReserved4[40];
207 uint8_t abVendorSpecificParameters[1]; /**< 0x60/96 - Variable size. */
208} SCSIINQUIRYDATA;
209#pragma pack()
210AssertCompileSize(SCSIINQUIRYDATA, 97);
211typedef SCSIINQUIRYDATA *PSCSIINQUIRYDATA;
212typedef const SCSIINQUIRYDATA *PCSCSIINQUIRYDATA;
213
214#define SCSI_INQUIRY_DATA_PERIPHERAL_QUALIFIER_CONNECTED 0x00
215#define SCSI_INQUIRY_DATA_PERIPHERAL_QUALIFIER_NOT_CONNECTED_BUT_SUPPORTED 0x01
216#define SCSI_INQUIRY_DATA_PERIPHERAL_QUALIFIER_NOT_CONNECTED_NOT_SUPPORTED 0x03
217
218#define SCSI_INQUIRY_DATA_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS 0x00
219#define SCSI_INQUIRY_DATA_PERIPHERAL_DEVICE_TYPE_SEQUENTIAL_ACCESS 0x01
220#define SCSI_INQUIRY_DATA_PERIPHERAL_DEVICE_TYPE_CD_DVD 0x05
221#define SCSI_INQUIRY_DATA_PERIPHERAL_DEVICE_TYPE_UNKNOWN 0x1f
222
223/** @} */
224
225#if defined(IN_RING3) && (defined(LOG_ENABLED) || defined(RT_STRICT))
226const char * SCSICmdText(uint8_t uCmd);
227const char * SCSISenseText(uint8_t uSense);
228const char * SCSISenseExtText(uint8_t uASC, uint8_t uASCQ);
229#endif
230
231#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