]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/ScsiPassThruExt.h
Code Scrub for Protocol and Ppi Definition
[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
22 0x1d3de7f0, 0x0807, 0x424f, {0xaa, 0x69, 0x11, 0xa5, 0x4e, 0x19, 0xa4, 0x6f } \\r
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
69 UINT32 AdapterId;\r
70 UINT32 Attributes;\r
71 UINT32 IoAlign;\r
72} EFI_EXT_SCSI_PASS_THRU_MODE;\r
73\r
74typedef struct {\r
75 UINT64 Timeout;\r
76 VOID *InDataBuffer;\r
77 VOID *OutDataBuffer;\r
78 VOID *SenseData;\r
79 VOID *Cdb;\r
80 UINT32 InTransferLength;\r
81 UINT32 OutTransferLength;\r
82 UINT8 CdbLength;\r
83 UINT8 DataDirection;\r
84 UINT8 HostAdapterStatus;\r
85 UINT8 TargetStatus;\r
86 UINT8 SenseDataLength;\r
87} EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET;\r
88\r
89/**\r
90 Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel. This function \r
91 supports both blocking I/O and nonblocking I/O. The blocking I/O functionality is required, and the\r
92 nonblocking I/O functionality is optional. \r
93\r
94 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
95 @param Target The Target is an array of size TARGET_MAX_BYTES and it represents\r
96 the id of the SCSI device to send the SCSI Request Packet. Each\r
97 transport driver may chose to utilize a subset of this size to suit the needs\r
98 of transport target representation. For example, a Fibre Channel driver\r
99 may use only 8 bytes (WWN) to represent an FC target.\r
100 @param Lun The LUN of the SCSI device to send the SCSI Request Packet.\r
101 @param Packet A pointer to the SCSI Request Packet to send to the SCSI device\r
102 specified by Target and Lun.\r
103 @param Event If nonblocking I/O is not supported then Event is ignored, and blocking\r
104 I/O is performed. If Event is NULL, then blocking I/O is performed. If\r
105 Event is not NULL and non blocking I/O is supported, then\r
106 nonblocking I/O is performed, and Event will be signaled when the\r
107 SCSI Request Packet completes.\r
108\r
109 @retval EFI_SUCCESS The SCSI Request Packet was sent by the host. For bi-directional\r
110 commands, InTransferLength bytes were transferred from\r
111 InDataBuffer. For write and bi-directional commands,\r
112 OutTransferLength bytes were transferred by\r
113 OutDataBuffer.\r
114 @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was not executed. The number of bytes that\r
115 could be transferred is returned in InTransferLength. For write\r
116 and bi-directional commands, OutTransferLength bytes were\r
117 transferred by OutDataBuffer.\r
118 @retval EFI_NOT_READY The SCSI Request Packet could not be sent because there are too many\r
119 SCSI Request Packets already queued. The caller may retry again later.\r
120 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the SCSI Request\r
121 Packet.\r
122 @retval EFI_INVALID_PARAMETER Target, Lun, or the contents of ScsiRequestPacket are invalid.\r
123 @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not supported\r
124 by the host adapter. This includes the case of Bi-directional SCSI\r
125 commands not supported by the implementation. The SCSI Request\r
126 Packet was not sent, so no additional status information is available.\r
127 @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request Packet to execute.\r
128\r
129**/\r
130typedef\r
131EFI_STATUS\r
8b13229b 132(EFIAPI *EFI_EXT_SCSI_PASS_THRU_PASSTHRU)(\r
d1f95000 133 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
134 IN UINT8 *Target,\r
135 IN UINT64 Lun,\r
136 IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,\r
137 IN EFI_EVENT Event OPTIONAL\r
138 )\r
139; \r
140\r
141/**\r
142 Used to retrieve the list of legal Target IDs and LUNs for SCSI devices on a SCSI channel. These \r
143 can either be the list SCSI devices that are actually present on the SCSI channel, or the list of legal\r
144 Target Ids and LUNs for the SCSI channel. Regardless, the caller of this function must probe the \r
145 Target ID and LUN returned to see if a SCSI device is actually present at that location on the SCSI \r
146 channel. \r
147\r
148 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
149 @param Target On input, a pointer to the Target ID (an array of size\r
150 TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.\r
151 On output, a pointer to the Target ID (an array of\r
152 TARGET_MAX_BYTES) of the next SCSI device present on a SCSI\r
153 channel. An input value of 0xF(all bytes in the array are 0xF) in the\r
154 Target array retrieves the Target ID of the first SCSI device present on a\r
155 SCSI channel.\r
156 @param Lun On input, a pointer to the LUN of a SCSI device present on the SCSI\r
157 channel. On output, a pointer to the LUN of the next SCSI device present\r
158 on a SCSI channel.\r
159\r
160 @retval EFI_SUCCESS The Target ID and LUN of the next SCSI device on the SCSI\r
161 channel was returned in Target and Lun.\r
162 @retval EFI_INVALID_PARAMETER Target array is not all 0xF, and Target and Lun were\r
163 not returned on a previous call to GetNextTargetLun().\r
164 @retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel.\r
165\r
166**/\r
167typedef\r
168EFI_STATUS\r
8b13229b 169(EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET_LUN)(\r
d1f95000 170 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
171 IN OUT UINT8 **Target,\r
172 IN OUT UINT64 *Lun\r
173 )\r
174; \r
175\r
176/**\r
177 Used to allocate and build a device path node for a SCSI device on a SCSI channel.\r
178\r
179 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
180 @param Target The Target is an array of size TARGET_MAX_BYTES and it specifies the\r
181 Target ID of the SCSI device for which a device path node is to be\r
182 allocated and built. Transport drivers may chose to utilize a subset of\r
183 this size to suit the representation of targets. For example, a Fibre\r
184 Channel driver may use only 8 bytes (WWN) in the array to represent a\r
185 FC target.\r
186 @param Lun The LUN of the SCSI device for which a device path node is to be\r
187 allocated and built.\r
188 @param DevicePath A pointer to a single device path node that describes the SCSI device\r
189 specified by Target and Lun. This function is responsible for\r
190 allocating the buffer DevicePath with the boot service\r
191 AllocatePool(). It is the caller's responsibility to free\r
192 DevicePath when the caller is finished with DevicePath.\r
193\r
194 @retval EFI_SUCCESS The device path node that describes the SCSI device specified by\r
195 Target and Lun was allocated and returned in\r
196 DevicePath.\r
197 @retval EFI_INVALID_PARAMETER DevicePath is NULL.\r
198 @retval EFI_NOT_FOUND The SCSI devices specified by Target and Lun does not exist\r
199 on the SCSI channel.\r
200 @retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate DevicePath.\r
201\r
202**/\r
203typedef\r
204EFI_STATUS\r
8b13229b 205(EFIAPI *EFI_EXT_SCSI_PASS_THRU_BUILD_DEVICE_PATH)(\r
d1f95000 206 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
207 IN UINT8 *Target,\r
208 IN UINT64 Lun,\r
209 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath\r
210 )\r
211; \r
212\r
213/**\r
214 Used to translate a device path node to a Target ID and LUN.\r
215\r
216 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
217 @param DevicePath A pointer to a single device path node that describes the SCSI device\r
218 on the SCSI channel.\r
219 @param Target A pointer to the Target Array which represents the ID of a SCSI device\r
220 on the SCSI channel.\r
221 @param Lun A pointer to the LUN of a SCSI device on the SCSI channel.\r
222\r
223 @retval EFI_SUCCESS DevicePath was successfully translated to a Target ID and\r
224 LUN, and they were returned in Target and Lun.\r
225 @retval EFI_INVALID_PARAMETER DevicePath or Target or Lun is NULL.\r
226 @retval EFI_NOT_FOUND A valid translation from DevicePath to a Target ID and LUN\r
227 does not exist.\r
228 @retval EFI_UNSUPPORTED This driver does not support the device path node type in\r
229 DevicePath.\r
230\r
231**/\r
232typedef\r
233EFI_STATUS\r
8b13229b 234(EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_TARGET_LUN)(\r
d1f95000 235 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
236 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
237 OUT UINT8 **Target,\r
238 OUT UINT64 *Lun\r
239 )\r
240; \r
241\r
242/**\r
243 Resets a SCSI channel. This operation resets all the SCSI devices connected to the SCSI channel.\r
244\r
245 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
246\r
247 @retval EFI_SUCCESS The SCSI channel was reset.\r
248 @retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the SCSI channel.\r
249 @retval EFI_TIMEOUT A timeout occurred while attempting to reset the SCSI channel.\r
250 @retval EFI_UNSUPPORTED The SCSI channel does not support a channel reset operation.\r
251\r
252**/\r
253typedef\r
254EFI_STATUS\r
8b13229b 255(EFIAPI *EFI_EXT_SCSI_PASS_THRU_RESET_CHANNEL)(\r
d1f95000 256 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This\r
257 )\r
258; \r
259 \r
260/**\r
261 Resets a SCSI logical unit that is connected to a SCSI channel.\r
262\r
263 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
264 @param Target The Target is an array of size TARGET_MAX_BYTE and it represents the\r
265 target port ID of the SCSI device containing the SCSI logical unit to\r
266 reset. Transport drivers may chose to utilize a subset of this array to suit\r
267 the representation of their targets.\r
268 @param Lun The LUN of the SCSI device to reset.\r
269\r
270 @retval EFI_SUCCESS The SCSI device specified by Target and Lun was reset.\r
271 @retval EFI_INVALID_PARAMETER Target or Lun is NULL.\r
272 @retval EFI_TIMEOUT A timeout occurred while attempting to reset the SCSI device\r
273 specified by Target and Lun.\r
274 @retval EFI_UNSUPPORTED The SCSI channel does not support a target reset operation.\r
275 @retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the SCSI device\r
276 specified by Target and Lun.\r
277\r
278**/\r
279typedef\r
280EFI_STATUS\r
8b13229b 281(EFIAPI *EFI_EXT_SCSI_PASS_THRU_RESET_TARGET_LUN)(\r
d1f95000 282 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
283 IN UINT8 *Target,\r
284 IN UINT64 Lun\r
285 )\r
286; \r
287\r
288/**\r
289 Used to retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. These can either \r
290 be the list SCSI devices that are actually present on the SCSI channel, or the list of legal Target IDs\r
291 for the SCSI channel. Regardless, the caller of this function must probe the Target ID returned to \r
292 see if a SCSI device is actually present at that location on the SCSI channel. \r
293\r
294 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
295 @param Target (TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.\r
296 On output, a pointer to the Target ID (an array of\r
297 TARGET_MAX_BYTES) of the next SCSI device present on a SCSI\r
298 channel. An input value of 0xF(all bytes in the array are 0xF) in the\r
299 Target array retrieves the Target ID of the first SCSI device present on a\r
300 SCSI channel.\r
301\r
302 @retval EFI_SUCCESS The Target ID of the next SCSI device on the SCSI\r
303 channel was returned in Target.\r
304 @retval EFI_INVALID_PARAMETER Target or Lun is NULL.\r
305 @retval EFI_TIMEOUT Target array is not all 0xF, and Target were not\r
306 returned on a previous call to GetNextTarget().\r
307 @retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel.\r
308\r
309**/\r
310typedef\r
311EFI_STATUS\r
8b13229b 312(EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET)(\r
d1f95000 313 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
314 IN OUT UINT8 **Target\r
315 )\r
316; \r
4ca9b6c4
LG
317\r
318/** \r
319 @par Protocol Description:\r
320 The EFI_EXT_SCSI_PASS_THRU_PROTOCOL provides information about a SCSI channel \r
321 and the ability to send SCI Request Packets to any SCSI device attached to \r
322 that SCSI channel. The information includes the Target ID of the host controller \r
323 on the SCSI channel and the attributes of the SCSI channel.\r
324\r
325 @param Mode \r
326 A pointer to the EFI_EXT_SCSI_PASS_THRU_MODE data for this SCSI channel. \r
327\r
328 @param PassThru \r
329 Sends a SCSI Request Packet to a SCSI device that is Connected to the SCSI channel. \r
330\r
331 @param GetNextTargetLun \r
332 Retrieves the list of legal Target IDs and LUNs for the SCSI devices on a SCSI channel. \r
333\r
334 @param BuildDevicePath \r
335 Allocates and builds a device path node for a SCSI Device on a SCSI channel. \r
336\r
337 @param GetTargetLun\r
338 Translates a device path node to a Target ID and LUN. \r
339\r
340 @param ResetChannel\r
341 Resets the SCSI channel. This operation resets all the SCSI devices connected to the SCSI channel. \r
342\r
343 @param ResetTargetLun\r
344 Resets a SCSI device that is connected to the SCSI channel. \r
345\r
346 @param GetNextTartget \r
347 Retrieves the list of legal Target IDs for the SCSI devices on a SCSI channel. \r
348**/ \r
d1f95000 349struct _EFI_EXT_SCSI_PASS_THRU_PROTOCOL {\r
350 EFI_EXT_SCSI_PASS_THRU_MODE *Mode;\r
351 EFI_EXT_SCSI_PASS_THRU_PASSTHRU PassThru;\r
352 EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET_LUN GetNextTargetLun;\r
353 EFI_EXT_SCSI_PASS_THRU_BUILD_DEVICE_PATH BuildDevicePath;\r
354 EFI_EXT_SCSI_PASS_THRU_GET_TARGET_LUN GetTargetLun;\r
355 EFI_EXT_SCSI_PASS_THRU_RESET_CHANNEL ResetChannel;\r
356 EFI_EXT_SCSI_PASS_THRU_RESET_TARGET_LUN ResetTargetLun;\r
357 EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET GetNextTarget;\r
358};\r
359\r
360extern EFI_GUID gEfiExtScsiPassThruProtocolGuid;\r
361\r
362#endif\r