]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/ScsiPassThruExt.h
Reviewed the code comments in the Include/Protocol directory for typos, grammar issue...
[mirror_edk2.git] / MdePkg / Include / Protocol / ScsiPassThruExt.h
CommitLineData
d1f95000 1/** @file\r
2 EFI_EXT_SCSI_PASS_THRU_PROTOCOL as defined in UEFI 2.0.\r
4ca9b6c4
LG
3 This protocol provides services that allow SCSI Pass Thru commands \r
4 to be sent to SCSI devices attached to a SCSI channel.\r
d1f95000 5\r
4ca9b6c4 6 Copyright (c) 2006 - 2008, Intel Corporation \r
d1f95000 7 All rights reserved. This program and the accompanying materials \r
8 are licensed and made available under the terms and conditions of the BSD License \r
9 which accompanies this distribution. The full text of the license may be found at \r
10 http://opensource.org/licenses/bsd-license.php \r
11\r
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
14\r
d1f95000 15**/\r
16\r
17#ifndef __EXT_SCSI_PASS_THROUGH_PROTOCOL_H__\r
18#define __EXT_SCSI_PASS_THROUGH_PROTOCOL_H__\r
19\r
20#define EFI_EXT_SCSI_PASS_THRU_PROTOCOL_GUID \\r
21 { \\r
eecd469b 22 0x143b7632, 0xb81b, 0x4cb7, {0xab, 0xd3, 0xb6, 0x25, 0xa5, 0xb9, 0xbf, 0xfe } \\r
d1f95000 23 }\r
24\r
25typedef struct _EFI_EXT_SCSI_PASS_THRU_PROTOCOL EFI_EXT_SCSI_PASS_THRU_PROTOCOL;\r
26\r
27#define TARGET_MAX_BYTES 0x10\r
28\r
29#define EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL 0x0001\r
30#define EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL 0x0002\r
31#define EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_NONBLOCKIO 0x0004\r
32\r
33//\r
34// DataDirection\r
35//\r
36#define EFI_EXT_SCSI_DATA_DIRECTION_READ 0\r
37#define EFI_EXT_SCSI_DATA_DIRECTION_WRITE 1\r
38#define EFI_EXT_SCSI_DATA_DIRECTION_BIDIRECTIONAL 2\r
39//\r
40// HostAdapterStatus\r
41//\r
42#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OK 0x00\r
43#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND 0x09\r
44#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_TIMEOUT 0x0b\r
45#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_MESSAGE_REJECT 0x0d\r
46#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_BUS_RESET 0x0e\r
47#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_PARITY_ERROR 0x0f\r
48#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_REQUEST_SENSE_FAILED 0x10\r
49#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_SELECTION_TIMEOUT 0x11\r
50#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN 0x12\r
51#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_BUS_FREE 0x13\r
52#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_PHASE_ERROR 0x14\r
53#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OTHER 0x7f\r
54//\r
55// TargetStatus\r
56//\r
57#define EFI_EXT_SCSI_STATUS_TARGET_GOOD 0x00\r
58#define EFI_EXT_SCSI_STATUS_TARGET_CHECK_CONDITION 0x02\r
59#define EFI_EXT_SCSI_STATUS_TARGET_CONDITION_MET 0x04\r
60#define EFI_EXT_SCSI_STATUS_TARGET_BUSY 0x08\r
61#define EFI_EXT_SCSI_STATUS_TARGET_INTERMEDIATE 0x10\r
62#define EFI_EXT_SCSI_STATUS_TARGET_INTERMEDIATE_CONDITION_MET 0x14\r
63#define EFI_EXT_SCSI_STATUS_TARGET_RESERVATION_CONFLICT 0x18\r
64#define EFI_EXT_SCSI_STATUS_TARGET_TASK_SET_FULL 0x28\r
65#define EFI_EXT_SCSI_STATUS_TARGET_ACA_ACTIVE 0x30\r
66#define EFI_EXT_SCSI_STATUS_TARGET_TASK_ABORTED 0x40\r
67\r
68typedef struct {\r
992f22b9
LG
69 ///\r
70 /// The Target ID of the host adapter on the SCSI channel.\r
71 ///\r
d1f95000 72 UINT32 AdapterId;\r
992f22b9
LG
73 ///\r
74 /// Additional information on the attributes of the SCSI channel.\r
75 ///\r
d1f95000 76 UINT32 Attributes;\r
992f22b9
LG
77 ///\r
78 /// Supplies the alignment requirement for any buffer used in a data transfer.\r
79 ///\r
d1f95000 80 UINT32 IoAlign;\r
81} EFI_EXT_SCSI_PASS_THRU_MODE;\r
82\r
83typedef struct {\r
992f22b9
LG
84 ///\r
85 /// The timeout, in 100 ns units, to use for the execution of this SCSI\r
86 /// Request Packet. A Timeout value of 0 means that this function\r
87 /// will wait indefinitely for the SCSI Request Packet to execute. If\r
88 /// Timeout is greater than zero, then this function will return\r
89 /// EFI_TIMEOUT if the time required to execute the SCSI\r
90 /// Request Packet is greater than Timeout.\r
91 ///\r
d1f95000 92 UINT64 Timeout;\r
992f22b9
LG
93 ///\r
94 /// A pointer to the data buffer to transfer between the SCSI\r
95 /// controller and the SCSI device for read and bidirectional commands.\r
96 ///\r
d1f95000 97 VOID *InDataBuffer;\r
992f22b9
LG
98 ///\r
99 /// A pointer to the data buffer to transfer between the SCSI\r
100 /// controller and the SCSI device for write or bidirectional commands.\r
101 ///\r
d1f95000 102 VOID *OutDataBuffer;\r
992f22b9
LG
103 ///\r
104 /// A pointer to the sense data that was generated by the execution of\r
105 /// the SCSI Request Packet.\r
106 ///\r
d1f95000 107 VOID *SenseData;\r
992f22b9
LG
108 ///\r
109 /// A pointer to buffer that contains the Command Data Block to\r
110 /// send to the SCSI device specified by Target and Lun.\r
111 ///\r
d1f95000 112 VOID *Cdb;\r
992f22b9
LG
113 ///\r
114 /// On Input, the size, in bytes, of InDataBuffer. On output, the\r
115 /// number of bytes transferred between the SCSI controller and the SCSI device.\r
116 ///\r
d1f95000 117 UINT32 InTransferLength;\r
992f22b9
LG
118 ///\r
119 /// On Input, the size, in bytes of OutDataBuffer. On Output, the\r
120 /// Number of bytes transferred between SCSI Controller and the SCSI device.\r
121 ///\r
d1f95000 122 UINT32 OutTransferLength;\r
992f22b9
LG
123 ///\r
124 /// The length, in bytes, of the buffer Cdb. The standard values are 6,\r
125 /// 10, 12, and 16, but other values are possible if a variable length CDB is used.\r
126 ///\r
d1f95000 127 UINT8 CdbLength;\r
992f22b9
LG
128 ///\r
129 /// The direction of the data transfer. 0 for reads, 1 for writes. A\r
130 /// value of 2 is Reserved for Bi-Directional SCSI commands.\r
131 ///\r
d1f95000 132 UINT8 DataDirection;\r
992f22b9
LG
133 ///\r
134 /// The status of the host adapter specified by This when the SCSI\r
135 /// Request Packet was executed on the target device.\r
136 ///\r
d1f95000 137 UINT8 HostAdapterStatus;\r
992f22b9
LG
138 ///\r
139 /// The status returned by the device specified by Target and Lun\r
140 /// when the SCSI Request Packet was executed.\r
141 ///\r
d1f95000 142 UINT8 TargetStatus;\r
992f22b9
LG
143 ///\r
144 /// On input, the length in bytes of the SenseData buffer. On\r
145 /// output, the number of bytes written to the SenseData buffer.\r
146 ///\r
d1f95000 147 UINT8 SenseDataLength;\r
148} EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET;\r
149\r
150/**\r
151 Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel. This function \r
152 supports both blocking I/O and nonblocking I/O. The blocking I/O functionality is required, and the\r
153 nonblocking I/O functionality is optional. \r
154\r
155 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
630b4187 156 @param Target The Target is an array of size TARGET_MAX_BYTES. It represents\r
157 the id of the SCSI device that will send the SCSI Request Packet. Each\r
158 transport driver may choose to utilize a subset of this size to suit the needs\r
d1f95000 159 of transport target representation. For example, a Fibre Channel driver\r
160 may use only 8 bytes (WWN) to represent an FC target.\r
161 @param Lun The LUN of the SCSI device to send the SCSI Request Packet.\r
162 @param Packet A pointer to the SCSI Request Packet to send to the SCSI device\r
163 specified by Target and Lun.\r
164 @param Event If nonblocking I/O is not supported then Event is ignored, and blocking\r
165 I/O is performed. If Event is NULL, then blocking I/O is performed. If\r
166 Event is not NULL and non blocking I/O is supported, then\r
167 nonblocking I/O is performed, and Event will be signaled when the\r
168 SCSI Request Packet completes.\r
169\r
170 @retval EFI_SUCCESS The SCSI Request Packet was sent by the host. For bi-directional\r
171 commands, InTransferLength bytes were transferred from\r
172 InDataBuffer. For write and bi-directional commands,\r
173 OutTransferLength bytes were transferred by\r
174 OutDataBuffer.\r
175 @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was not executed. The number of bytes that\r
176 could be transferred is returned in InTransferLength. For write\r
177 and bi-directional commands, OutTransferLength bytes were\r
178 transferred by OutDataBuffer.\r
179 @retval EFI_NOT_READY The SCSI Request Packet could not be sent because there are too many\r
180 SCSI Request Packets already queued. The caller may retry again later.\r
181 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the SCSI Request\r
182 Packet.\r
183 @retval EFI_INVALID_PARAMETER Target, Lun, or the contents of ScsiRequestPacket are invalid.\r
184 @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not supported\r
185 by the host adapter. This includes the case of Bi-directional SCSI\r
186 commands not supported by the implementation. The SCSI Request\r
187 Packet was not sent, so no additional status information is available.\r
188 @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request Packet to execute.\r
189\r
190**/\r
191typedef\r
192EFI_STATUS\r
8b13229b 193(EFIAPI *EFI_EXT_SCSI_PASS_THRU_PASSTHRU)(\r
d1f95000 194 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
195 IN UINT8 *Target,\r
196 IN UINT64 Lun,\r
197 IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,\r
198 IN EFI_EVENT Event OPTIONAL\r
ed66e1bc 199 ); \r
d1f95000 200\r
201/**\r
202 Used to retrieve the list of legal Target IDs and LUNs for SCSI devices on a SCSI channel. These \r
203 can either be the list SCSI devices that are actually present on the SCSI channel, or the list of legal\r
630b4187 204 Target Ids and LUNs for the SCSI channel. Either way, the caller of this function must probe the \r
d1f95000 205 Target ID and LUN returned to see if a SCSI device is actually present at that location on the SCSI \r
206 channel. \r
207\r
208 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
209 @param Target On input, a pointer to the Target ID (an array of size\r
210 TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.\r
211 On output, a pointer to the Target ID (an array of\r
212 TARGET_MAX_BYTES) of the next SCSI device present on a SCSI\r
213 channel. An input value of 0xF(all bytes in the array are 0xF) in the\r
214 Target array retrieves the Target ID of the first SCSI device present on a\r
215 SCSI channel.\r
216 @param Lun On input, a pointer to the LUN of a SCSI device present on the SCSI\r
217 channel. On output, a pointer to the LUN of the next SCSI device present\r
218 on a SCSI channel.\r
219\r
220 @retval EFI_SUCCESS The Target ID and LUN of the next SCSI device on the SCSI\r
221 channel was returned in Target and Lun.\r
222 @retval EFI_INVALID_PARAMETER Target array is not all 0xF, and Target and Lun were\r
223 not returned on a previous call to GetNextTargetLun().\r
224 @retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel.\r
225\r
226**/\r
227typedef\r
228EFI_STATUS\r
8b13229b 229(EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET_LUN)(\r
d1f95000 230 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
231 IN OUT UINT8 **Target,\r
232 IN OUT UINT64 *Lun\r
ed66e1bc 233 ); \r
d1f95000 234\r
235/**\r
236 Used to allocate and build a device path node for a SCSI device on a SCSI channel.\r
237\r
238 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
239 @param Target The Target is an array of size TARGET_MAX_BYTES and it specifies the\r
240 Target ID of the SCSI device for which a device path node is to be\r
241 allocated and built. Transport drivers may chose to utilize a subset of\r
242 this size to suit the representation of targets. For example, a Fibre\r
243 Channel driver may use only 8 bytes (WWN) in the array to represent a\r
244 FC target.\r
245 @param Lun The LUN of the SCSI device for which a device path node is to be\r
246 allocated and built.\r
247 @param DevicePath A pointer to a single device path node that describes the SCSI device\r
248 specified by Target and Lun. This function is responsible for\r
249 allocating the buffer DevicePath with the boot service\r
250 AllocatePool(). It is the caller's responsibility to free\r
251 DevicePath when the caller is finished with DevicePath.\r
252\r
253 @retval EFI_SUCCESS The device path node that describes the SCSI device specified by\r
254 Target and Lun was allocated and returned in\r
255 DevicePath.\r
256 @retval EFI_INVALID_PARAMETER DevicePath is NULL.\r
257 @retval EFI_NOT_FOUND The SCSI devices specified by Target and Lun does not exist\r
258 on the SCSI channel.\r
259 @retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate DevicePath.\r
260\r
261**/\r
262typedef\r
263EFI_STATUS\r
8b13229b 264(EFIAPI *EFI_EXT_SCSI_PASS_THRU_BUILD_DEVICE_PATH)(\r
d1f95000 265 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
266 IN UINT8 *Target,\r
267 IN UINT64 Lun,\r
268 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath\r
eecd469b 269 );\r
d1f95000 270\r
271/**\r
272 Used to translate a device path node to a Target ID and LUN.\r
273\r
274 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
275 @param DevicePath A pointer to a single device path node that describes the SCSI device\r
276 on the SCSI channel.\r
277 @param Target A pointer to the Target Array which represents the ID of a SCSI device\r
278 on the SCSI channel.\r
279 @param Lun A pointer to the LUN of a SCSI device on the SCSI channel.\r
280\r
281 @retval EFI_SUCCESS DevicePath was successfully translated to a Target ID and\r
282 LUN, and they were returned in Target and Lun.\r
283 @retval EFI_INVALID_PARAMETER DevicePath or Target or Lun is NULL.\r
284 @retval EFI_NOT_FOUND A valid translation from DevicePath to a Target ID and LUN\r
285 does not exist.\r
286 @retval EFI_UNSUPPORTED This driver does not support the device path node type in\r
287 DevicePath.\r
288\r
289**/\r
290typedef\r
291EFI_STATUS\r
8b13229b 292(EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_TARGET_LUN)(\r
d1f95000 293 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
294 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
295 OUT UINT8 **Target,\r
296 OUT UINT64 *Lun\r
ed66e1bc 297 ); \r
d1f95000 298\r
299/**\r
300 Resets a SCSI channel. This operation resets all the SCSI devices connected to the SCSI channel.\r
301\r
302 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
303\r
304 @retval EFI_SUCCESS The SCSI channel was reset.\r
305 @retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the SCSI channel.\r
306 @retval EFI_TIMEOUT A timeout occurred while attempting to reset the SCSI channel.\r
307 @retval EFI_UNSUPPORTED The SCSI channel does not support a channel reset operation.\r
308\r
309**/\r
310typedef\r
311EFI_STATUS\r
8b13229b 312(EFIAPI *EFI_EXT_SCSI_PASS_THRU_RESET_CHANNEL)(\r
d1f95000 313 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This\r
ed66e1bc 314 ); \r
d1f95000 315 \r
316/**\r
317 Resets a SCSI logical unit that is connected to a SCSI channel.\r
318\r
319 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
630b4187 320 @param Target The Target is an array of size TARGET_MAX_BYTE. It represents the\r
d1f95000 321 target port ID of the SCSI device containing the SCSI logical unit to\r
322 reset. Transport drivers may chose to utilize a subset of this array to suit\r
323 the representation of their targets.\r
324 @param Lun The LUN of the SCSI device to reset.\r
325\r
326 @retval EFI_SUCCESS The SCSI device specified by Target and Lun was reset.\r
327 @retval EFI_INVALID_PARAMETER Target or Lun is NULL.\r
328 @retval EFI_TIMEOUT A timeout occurred while attempting to reset the SCSI device\r
329 specified by Target and Lun.\r
330 @retval EFI_UNSUPPORTED The SCSI channel does not support a target reset operation.\r
331 @retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the SCSI device\r
332 specified by Target and Lun.\r
333\r
334**/\r
335typedef\r
336EFI_STATUS\r
8b13229b 337(EFIAPI *EFI_EXT_SCSI_PASS_THRU_RESET_TARGET_LUN)(\r
d1f95000 338 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
339 IN UINT8 *Target,\r
340 IN UINT64 Lun\r
ed66e1bc 341 ); \r
d1f95000 342\r
343/**\r
344 Used to retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. These can either \r
345 be the list SCSI devices that are actually present on the SCSI channel, or the list of legal Target IDs\r
346 for the SCSI channel. Regardless, the caller of this function must probe the Target ID returned to \r
347 see if a SCSI device is actually present at that location on the SCSI channel. \r
348\r
349 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
350 @param Target (TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.\r
351 On output, a pointer to the Target ID (an array of\r
352 TARGET_MAX_BYTES) of the next SCSI device present on a SCSI\r
353 channel. An input value of 0xF(all bytes in the array are 0xF) in the\r
354 Target array retrieves the Target ID of the first SCSI device present on a\r
355 SCSI channel.\r
356\r
357 @retval EFI_SUCCESS The Target ID of the next SCSI device on the SCSI\r
358 channel was returned in Target.\r
359 @retval EFI_INVALID_PARAMETER Target or Lun is NULL.\r
630b4187 360 @retval EFI_TIMEOUT Target array is not all 0xF, and Target was not\r
d1f95000 361 returned on a previous call to GetNextTarget().\r
362 @retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel.\r
363\r
364**/\r
365typedef\r
366EFI_STATUS\r
8b13229b 367(EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET)(\r
d1f95000 368 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
369 IN OUT UINT8 **Target\r
ed66e1bc 370 ); \r
4ca9b6c4 371\r
44717a39 372///\r
373/// The EFI_EXT_SCSI_PASS_THRU_PROTOCOL provides information about a SCSI channel \r
374/// and the ability to send SCI Request Packets to any SCSI device attached to \r
375/// that SCSI channel. The information includes the Target ID of the host controller \r
376/// on the SCSI channel and the attributes of the SCSI channel.\r
377///\r
d1f95000 378struct _EFI_EXT_SCSI_PASS_THRU_PROTOCOL {\r
44717a39 379 ///\r
380 /// A pointer to the EFI_EXT_SCSI_PASS_THRU_MODE data for this SCSI channel.\r
381 ///\r
d1f95000 382 EFI_EXT_SCSI_PASS_THRU_MODE *Mode;\r
383 EFI_EXT_SCSI_PASS_THRU_PASSTHRU PassThru;\r
384 EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET_LUN GetNextTargetLun;\r
385 EFI_EXT_SCSI_PASS_THRU_BUILD_DEVICE_PATH BuildDevicePath;\r
386 EFI_EXT_SCSI_PASS_THRU_GET_TARGET_LUN GetTargetLun;\r
387 EFI_EXT_SCSI_PASS_THRU_RESET_CHANNEL ResetChannel;\r
388 EFI_EXT_SCSI_PASS_THRU_RESET_TARGET_LUN ResetTargetLun;\r
389 EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET GetNextTarget;\r
390};\r
391\r
392extern EFI_GUID gEfiExtScsiPassThruProtocolGuid;\r
393\r
394#endif\r