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