]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/IndustryStandard/Scsi.h
Add UEFI 2.2 and UEFI 2.3 signature.
[mirror_edk2.git] / MdePkg / Include / IndustryStandard / Scsi.h
CommitLineData
a7ed1e2e 1/** @file\r
4135253b 2 Support for SCSI-2 standard\r
a7ed1e2e 3\r
4135253b 4 Copyright (c) 2006 - 2008, Intel Corporation \r
a7ed1e2e 5 All rights reserved. This program and the accompanying materials \r
6 are licensed and made available under the terms and conditions of the BSD License \r
7 which accompanies this distribution. The full text of the license may be found at \r
8 http://opensource.org/licenses/bsd-license.php \r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
12\r
a7ed1e2e 13**/\r
14\r
842f5579
A
15#ifndef __SCSI_H__\r
16#define __SCSI_H__\r
a7ed1e2e 17\r
18//\r
19// SCSI command OP Code\r
20//\r
21//\r
22// Commands for all device types\r
23//\r
24#define EFI_SCSI_OP_CHANGE_DEFINITION 0x40\r
25#define EFI_SCSI_OP_COMPARE 0x39\r
26#define EFI_SCSI_OP_COPY 0x18\r
27#define EFI_SCSI_OP_COPY_VERIFY 0x3a\r
28#define EFI_SCSI_OP_INQUIRY 0x12\r
29#define EFI_SCSI_OP_LOG_SELECT 0x4c\r
30#define EFI_SCSI_OP_LOG_SENSE 0x4d\r
31#define EFI_SCSI_OP_MODE_SEL6 0x15\r
32#define EFI_SCSI_OP_MODE_SEL10 0x55\r
33#define EFI_SCSI_OP_MODE_SEN6 0x1a\r
34#define EFI_SCSI_OP_MODE_SEN10 0x5a\r
35#define EFI_SCSI_OP_READ_BUFFER 0x3c\r
4135253b 36#define EFI_SCSI_OP_RECEIVE_DIAG 0x1c\r
a7ed1e2e 37#define EFI_SCSI_OP_REQUEST_SENSE 0x03\r
38#define EFI_SCSI_OP_SEND_DIAG 0x1d\r
39#define EFI_SCSI_OP_TEST_UNIT_READY 0x00\r
40#define EFI_SCSI_OP_WRITE_BUFF 0x3b\r
41\r
42//\r
4135253b 43// Additional commands for Direct Access Devices\r
a7ed1e2e 44//\r
a7ed1e2e 45#define EFI_SCSI_OP_FORMAT 0x04\r
46#define EFI_SCSI_OP_LOCK_UN_CACHE 0x36\r
47#define EFI_SCSI_OP_PREFETCH 0x34\r
48#define EFI_SCSI_OP_MEDIA_REMOVAL 0x1e\r
49#define EFI_SCSI_OP_READ6 0x08\r
50#define EFI_SCSI_OP_READ10 0x28\r
51#define EFI_SCSI_OP_READ_CAPACITY 0x25\r
ccb491c8 52#define EFI_SCSI_OP_READ_CAPACITY16 0x9e\r
a7ed1e2e 53#define EFI_SCSI_OP_READ_DEFECT 0x37\r
54#define EFI_SCSI_OP_READ_LONG 0x3e\r
55#define EFI_SCSI_OP_REASSIGN_BLK 0x07\r
a7ed1e2e 56#define EFI_SCSI_OP_RELEASE 0x17\r
57#define EFI_SCSI_OP_REZERO 0x01\r
58#define EFI_SCSI_OP_SEARCH_DATA_E 0x31\r
59#define EFI_SCSI_OP_SEARCH_DATA_H 0x30\r
60#define EFI_SCSI_OP_SEARCH_DATA_L 0x32\r
61#define EFI_SCSI_OP_SEEK6 0x0b\r
62#define EFI_SCSI_OP_SEEK10 0x2b\r
63#define EFI_SCSI_OP_SEND_DIAG 0x1d\r
64#define EFI_SCSI_OP_SET_LIMIT 0x33\r
65#define EFI_SCSI_OP_START_STOP_UNIT 0x1b\r
66#define EFI_SCSI_OP_SYNC_CACHE 0x35\r
67#define EFI_SCSI_OP_VERIFY 0x2f\r
68#define EFI_SCSI_OP_WRITE6 0x0a\r
69#define EFI_SCSI_OP_WRITE10 0x2a\r
70#define EFI_SCSI_OP_WRITE_VERIFY 0x2e\r
71#define EFI_SCSI_OP_WRITE_LONG 0x3f\r
72#define EFI_SCSI_OP_WRITE_SAME 0x41\r
73\r
74//\r
4135253b 75// Additional commands for Sequential Access Devices\r
a7ed1e2e 76//\r
77#define EFI_SCSI_OP_ERASE 0x19\r
78#define EFI_SCSI_OP_LOAD_UNLOAD 0x1b\r
79#define EFI_SCSI_OP_LOCATE 0x2b\r
80#define EFI_SCSI_OP_READ_BLOCK_LIMIT 0x05\r
81#define EFI_SCSI_OP_READ_POS 0x34\r
82#define EFI_SCSI_OP_READ_REVERSE 0x0f\r
83#define EFI_SCSI_OP_RECOVER_BUF_DATA 0x14\r
84#define EFI_SCSI_OP_RESERVE_UNIT 0x16\r
85#define EFI_SCSI_OP_REWIND 0x01\r
86#define EFI_SCSI_OP_SPACE 0x11\r
87#define EFI_SCSI_OP_VERIFY_TAPE 0x13\r
88#define EFI_SCSI_OP_WRITE_FILEMARK 0x10\r
89\r
90//\r
4135253b 91// Additional commands for Printer Devices\r
a7ed1e2e 92//\r
93#define EFI_SCSI_OP_PRINT 0x0a\r
94#define EFI_SCSI_OP_SLEW_PRINT 0x0b\r
95#define EFI_SCSI_OP_STOP_PRINT 0x1b\r
96#define EFI_SCSI_OP_SYNC_BUFF 0x10\r
97\r
98//\r
4135253b 99// Additional commands for Processor Devices\r
a7ed1e2e 100//\r
101#define EFI_SCSI_OP_RECEIVE 0x08\r
102#define EFI_SCSI_OP_SEND 0x0a\r
103\r
104//\r
4135253b 105// Additional commands for Write-Once Devices\r
a7ed1e2e 106//\r
107#define EFI_SCSI_OP_MEDIUM_SCAN 0x38\r
108#define EFI_SCSI_OP_SEARCH_DAT_E10 0x31\r
109#define EFI_SCSI_OP_SEARCH_DAT_E12 0xb1\r
110#define EFI_SCSI_OP_SEARCH_DAT_H10 0x30\r
111#define EFI_SCSI_OP_SEARCH_DAT_H12 0xb0\r
112#define EFI_SCSI_OP_SEARCH_DAT_L10 0x32\r
113#define EFI_SCSI_OP_SEARCH_DAT_L12 0xb2\r
114#define EFI_SCSI_OP_SET_LIMIT10 0x33\r
115#define EFI_SCSI_OP_SET_LIMIT12 0xb3\r
116#define EFI_SCSI_OP_VERIFY10 0x2f\r
117#define EFI_SCSI_OP_VERIFY12 0xaf\r
118#define EFI_SCSI_OP_WRITE12 0xaa\r
119#define EFI_SCSI_OP_WRITE_VERIFY10 0x2e\r
120#define EFI_SCSI_OP_WRITE_VERIFY12 0xae\r
121\r
122//\r
4135253b 123// Additional commands for CD-ROM Devices\r
a7ed1e2e 124//\r
125#define EFI_SCSI_OP_PLAY_AUD_10 0x45\r
126#define EFI_SCSI_OP_PLAY_AUD_12 0xa5\r
127#define EFI_SCSI_OP_PLAY_AUD_MSF 0x47\r
128#define EFI_SCSI_OP_PLAY_AUD_TKIN 0x48\r
129#define EFI_SCSI_OP_PLAY_TK_REL10 0x49\r
130#define EFI_SCSI_OP_PLAY_TK_REL12 0xa9\r
131#define EFI_SCSI_OP_READ_CD_CAPACITY 0x25\r
132#define EFI_SCSI_OP_READ_HEADER 0x44\r
133#define EFI_SCSI_OP_READ_SUB_CHANNEL 0x42\r
134#define EFI_SCSI_OP_READ_TOC 0x43\r
135\r
136//\r
4135253b 137// Additional commands for Scanner Devices\r
a7ed1e2e 138//\r
139#define EFI_SCSI_OP_GET_DATABUFF_STAT 0x34\r
140#define EFI_SCSI_OP_GET_WINDOW 0x25\r
141#define EFI_SCSI_OP_OBJECT_POS 0x31\r
142#define EFI_SCSI_OP_SCAN 0x1b\r
143#define EFI_SCSI_OP_SET_WINDOW 0x24\r
144\r
145//\r
4135253b 146// Additional commands for Optical Memory Devices\r
a7ed1e2e 147//\r
148#define EFI_SCSI_OP_UPDATE_BLOCK 0x3d\r
149\r
150//\r
4135253b 151// Additional commands for Medium Changer Devices\r
a7ed1e2e 152//\r
153#define EFI_SCSI_OP_EXCHANGE_MEDIUM 0xa6\r
154#define EFI_SCSI_OP_INIT_ELEMENT_STAT 0x07\r
155#define EFI_SCSI_OP_POS_TO_ELEMENT 0x2b\r
156#define EFI_SCSI_OP_REQUEST_VE_ADDR 0xb5\r
157#define EFI_SCSI_OP_SEND_VOL_TAG 0xb6\r
158\r
159//\r
4135253b 160// Additional commands for Communition Devices\r
a7ed1e2e 161//\r
162#define EFI_SCSI_OP_GET_MESSAGE6 0x08\r
163#define EFI_SCSI_OP_GET_MESSAGE10 0x28\r
164#define EFI_SCSI_OP_GET_MESSAGE12 0xa8\r
165#define EFI_SCSI_OP_SEND_MESSAGE6 0x0a\r
166#define EFI_SCSI_OP_SEND_MESSAGE10 0x2a\r
167#define EFI_SCSI_OP_SEND_MESSAGE12 0xaa\r
168\r
169//\r
170// SCSI Data Transfer Direction\r
171//\r
172#define EFI_SCSI_DATA_IN 0\r
173#define EFI_SCSI_DATA_OUT 1\r
174\r
175//\r
176// Peripheral Device Type Definitions\r
177//\r
4135253b 178#define EFI_SCSI_TYPE_DISK 0x00 ///< Direct-access device (e.g. magnetic disk)\r
179#define EFI_SCSI_TYPE_TAPE 0x01 ///< Sequential-access device (e.g. magnetic tape)\r
180#define EFI_SCSI_TYPE_PRINTER 0x02 ///< Printer device\r
181#define EFI_SCSI_TYPE_PROCESSOR 0x03 ///< Processor device\r
182#define EFI_SCSI_TYPE_WORM 0x04 ///< Write-once device (e.g. some optical disks)\r
183#define EFI_SCSI_TYPE_CDROM 0x05 ///< CD-ROM device\r
184#define EFI_SCSI_TYPE_SCANNER 0x06 ///< Scanner device\r
185#define EFI_SCSI_TYPE_OPTICAL 0x07 ///< Optical memory device (e.g. some optical disks)\r
186#define EFI_SCSI_TYPE_MEDIUMCHANGER 0x08 ///< Medium changer device (e.g. jukeboxes)\r
187#define EFI_SCSI_TYPE_COMMUNICATION 0x09 ///< Communications device\r
188#define EFI_SCSI_TYPE_ASCIT8_1 0x0A ///< Defined by ASC IT8 (Graphic arts pre-press devices)\r
189#define EFI_SCSI_TYPE_ASCIT8_2 0x0B ///< Defined by ASC IT8 (Graphic arts pre-press devices)\r
190//\r
191// 0Ch - 1Eh are reserved\r
192//\r
193#define EFI_SCSI_TYPE_UNKNOWN 0x1F ///< Unknown or no device type\r
194\r
766f4bc1 195#pragma pack(1)\r
4135253b 196///\r
197/// Standard INQUIRY data format\r
198///\r
a7ed1e2e 199typedef struct {\r
200 UINT8 Peripheral_Type : 5;\r
201 UINT8 Peripheral_Qualifier : 3;\r
202 UINT8 DeviceType_Modifier : 7;\r
fbfa4a1d 203 UINT8 Rmb : 1;\r
a7ed1e2e 204 UINT8 Version;\r
205 UINT8 Response_Data_Format;\r
206 UINT8 Addnl_Length;\r
207 UINT8 Reserved_5_95[95 - 5 + 1];\r
208} EFI_SCSI_INQUIRY_DATA;\r
209\r
4135253b 210///\r
211/// Error codes 70h and 71h sense data format\r
212///\r
a7ed1e2e 213typedef struct {\r
214 UINT8 Error_Code : 7;\r
215 UINT8 Valid : 1;\r
216 UINT8 Segment_Number;\r
217 UINT8 Sense_Key : 4;\r
218 UINT8 Reserved_21 : 1;\r
fbfa4a1d 219 UINT8 Ili : 1;\r
a7ed1e2e 220 UINT8 Reserved_22 : 2;\r
221 UINT8 Information_3_6[4];\r
4135253b 222 UINT8 Addnl_Sense_Length; ///< Additional sense length (n-7)\r
a7ed1e2e 223 UINT8 Vendor_Specific_8_11[4];\r
4135253b 224 UINT8 Addnl_Sense_Code; ///< Additional sense code\r
225 UINT8 Addnl_Sense_Code_Qualifier; ///< Additional sense code qualifier\r
226 UINT8 Field_Replaceable_Unit_Code; ///< Field replaceable unit code\r
a7ed1e2e 227 UINT8 Reserved_15_17[3];\r
228} EFI_SCSI_SENSE_DATA;\r
229\r
190f29c0 230///\r
231/// SCSI Disk READ CAPACITY Data\r
232///\r
a7ed1e2e 233typedef struct {\r
234 UINT8 LastLba3;\r
235 UINT8 LastLba2;\r
236 UINT8 LastLba1;\r
237 UINT8 LastLba0;\r
238 UINT8 BlockSize3;\r
239 UINT8 BlockSize2;\r
240 UINT8 BlockSize1;\r
241 UINT8 BlockSize0;\r
242} EFI_SCSI_DISK_CAPACITY_DATA;\r
243\r
ccb491c8 244typedef struct {\r
245 UINT8 LastLba7;\r
246 UINT8 LastLba6;\r
247 UINT8 LastLba5;\r
248 UINT8 LastLba4;\r
249 UINT8 LastLba3;\r
250 UINT8 LastLba2;\r
251 UINT8 LastLba1;\r
252 UINT8 LastLba0;\r
253 UINT8 BlockSize3;\r
254 UINT8 BlockSize2;\r
255 UINT8 BlockSize1;\r
256 UINT8 BlockSize0;\r
257 UINT8 Protection;\r
258 UINT8 LogicPerPhysical;\r
259 UINT8 LowestAlignLogic2; \r
260 UINT8 LowestAlignLogic1; \r
261 UINT8 Reserved[16]; \r
262} EFI_SCSI_DISK_CAPACITY_DATA16;\r
263\r
264\r
766f4bc1 265#pragma pack()\r
266\r
a7ed1e2e 267//\r
268// Sense Key\r
269//\r
a7ed1e2e 270#define EFI_SCSI_SK_NO_SENSE (0x0)\r
271#define EFI_SCSI_SK_RECOVERY_ERROR (0x1)\r
272#define EFI_SCSI_SK_NOT_READY (0x2)\r
273#define EFI_SCSI_SK_MEDIUM_ERROR (0x3)\r
274#define EFI_SCSI_SK_HARDWARE_ERROR (0x4)\r
275#define EFI_SCSI_SK_ILLEGAL_REQUEST (0x5)\r
276#define EFI_SCSI_SK_UNIT_ATTENTION (0x6)\r
277#define EFI_SCSI_SK_DATA_PROTECT (0x7)\r
278#define EFI_SCSI_SK_BLANK_CHECK (0x8)\r
279#define EFI_SCSI_SK_VENDOR_SPECIFIC (0x9)\r
280#define EFI_SCSI_SK_RESERVED_A (0xA)\r
281#define EFI_SCSI_SK_ABORT (0xB)\r
282#define EFI_SCSI_SK_RESERVED_C (0xC)\r
283#define EFI_SCSI_SK_OVERFLOW (0xD)\r
284#define EFI_SCSI_SK_MISCOMPARE (0xE)\r
285#define EFI_SCSI_SK_RESERVED_F (0xF)\r
286\r
287//\r
4135253b 288// Additional Sense Codes and Sense Code Qualifiers.\r
289// Only some frequently used additional sense codes and qualifiers are\r
290// defined here. Please refer to SCSI standard for full value definition.\r
a7ed1e2e 291//\r
292#define EFI_SCSI_ASC_NOT_READY (0x04)\r
14996c96 293#define EFI_SCSI_ASCQ_IN_PROGRESS (0x01)\r
4135253b 294\r
a7ed1e2e 295#define EFI_SCSI_ASC_MEDIA_ERR1 (0x10)\r
296#define EFI_SCSI_ASC_MEDIA_ERR2 (0x11)\r
297#define EFI_SCSI_ASC_MEDIA_ERR3 (0x14)\r
298#define EFI_SCSI_ASC_MEDIA_ERR4 (0x30)\r
299#define EFI_SCSI_ASC_MEDIA_UPSIDE_DOWN (0x06)\r
300#define EFI_SCSI_ASC_INVALID_CMD (0x20)\r
301#define EFI_SCSI_ASC_LBA_OUT_OF_RANGE (0x21)\r
302#define EFI_SCSI_ASC_INVALID_FIELD (0x24)\r
303#define EFI_SCSI_ASC_WRITE_PROTECTED (0x27)\r
304#define EFI_SCSI_ASC_MEDIA_CHANGE (0x28)\r
190f29c0 305#define EFI_SCSI_ASC_RESET (0x29) ///< Power On Reset or Bus Reset occurred\r
a7ed1e2e 306#define EFI_SCSI_ASC_ILLEGAL_FIELD (0x26)\r
307#define EFI_SCSI_ASC_NO_MEDIA (0x3A)\r
308#define EFI_SCSI_ASC_ILLEGAL_MODE_FOR_THIS_TRACK (0x64)\r
309\r
a7ed1e2e 310#endif\r