]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/ScsiPassThruExt.h
add a error macro to prevent this file from included for now #error "UEFI 2.1 HII...
[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
3\r
4 Copyright (c) 2006, Intel Corporation \r
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
d1f95000 13**/\r
14\r
15#ifndef __EXT_SCSI_PASS_THROUGH_PROTOCOL_H__\r
16#define __EXT_SCSI_PASS_THROUGH_PROTOCOL_H__\r
17\r
18#define EFI_EXT_SCSI_PASS_THRU_PROTOCOL_GUID \\r
19 { \\r
20 0x1d3de7f0, 0x0807, 0x424f, {0xaa, 0x69, 0x11, 0xa5, 0x4e, 0x19, 0xa4, 0x6f } \\r
21 }\r
22\r
23typedef struct _EFI_EXT_SCSI_PASS_THRU_PROTOCOL EFI_EXT_SCSI_PASS_THRU_PROTOCOL;\r
24\r
25#define TARGET_MAX_BYTES 0x10\r
26\r
27#define EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL 0x0001\r
28#define EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL 0x0002\r
29#define EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_NONBLOCKIO 0x0004\r
30\r
31//\r
32// DataDirection\r
33//\r
34#define EFI_EXT_SCSI_DATA_DIRECTION_READ 0\r
35#define EFI_EXT_SCSI_DATA_DIRECTION_WRITE 1\r
36#define EFI_EXT_SCSI_DATA_DIRECTION_BIDIRECTIONAL 2\r
37//\r
38// HostAdapterStatus\r
39//\r
40#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OK 0x00\r
41#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND 0x09\r
42#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_TIMEOUT 0x0b\r
43#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_MESSAGE_REJECT 0x0d\r
44#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_BUS_RESET 0x0e\r
45#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_PARITY_ERROR 0x0f\r
46#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_REQUEST_SENSE_FAILED 0x10\r
47#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_SELECTION_TIMEOUT 0x11\r
48#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN 0x12\r
49#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_BUS_FREE 0x13\r
50#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_PHASE_ERROR 0x14\r
51#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OTHER 0x7f\r
52//\r
53// TargetStatus\r
54//\r
55#define EFI_EXT_SCSI_STATUS_TARGET_GOOD 0x00\r
56#define EFI_EXT_SCSI_STATUS_TARGET_CHECK_CONDITION 0x02\r
57#define EFI_EXT_SCSI_STATUS_TARGET_CONDITION_MET 0x04\r
58#define EFI_EXT_SCSI_STATUS_TARGET_BUSY 0x08\r
59#define EFI_EXT_SCSI_STATUS_TARGET_INTERMEDIATE 0x10\r
60#define EFI_EXT_SCSI_STATUS_TARGET_INTERMEDIATE_CONDITION_MET 0x14\r
61#define EFI_EXT_SCSI_STATUS_TARGET_RESERVATION_CONFLICT 0x18\r
62#define EFI_EXT_SCSI_STATUS_TARGET_TASK_SET_FULL 0x28\r
63#define EFI_EXT_SCSI_STATUS_TARGET_ACA_ACTIVE 0x30\r
64#define EFI_EXT_SCSI_STATUS_TARGET_TASK_ABORTED 0x40\r
65\r
66typedef struct {\r
67 UINT32 AdapterId;\r
68 UINT32 Attributes;\r
69 UINT32 IoAlign;\r
70} EFI_EXT_SCSI_PASS_THRU_MODE;\r
71\r
72typedef struct {\r
73 UINT64 Timeout;\r
74 VOID *InDataBuffer;\r
75 VOID *OutDataBuffer;\r
76 VOID *SenseData;\r
77 VOID *Cdb;\r
78 UINT32 InTransferLength;\r
79 UINT32 OutTransferLength;\r
80 UINT8 CdbLength;\r
81 UINT8 DataDirection;\r
82 UINT8 HostAdapterStatus;\r
83 UINT8 TargetStatus;\r
84 UINT8 SenseDataLength;\r
85} EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET;\r
86\r
87/**\r
88 Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel. This function \r
89 supports both blocking I/O and nonblocking I/O. The blocking I/O functionality is required, and the\r
90 nonblocking I/O functionality is optional. \r
91\r
92 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
93 @param Target The Target is an array of size TARGET_MAX_BYTES and it represents\r
94 the id of the SCSI device to send the SCSI Request Packet. Each\r
95 transport driver may chose to utilize a subset of this size to suit the needs\r
96 of transport target representation. For example, a Fibre Channel driver\r
97 may use only 8 bytes (WWN) to represent an FC target.\r
98 @param Lun The LUN of the SCSI device to send the SCSI Request Packet.\r
99 @param Packet A pointer to the SCSI Request Packet to send to the SCSI device\r
100 specified by Target and Lun.\r
101 @param Event If nonblocking I/O is not supported then Event is ignored, and blocking\r
102 I/O is performed. If Event is NULL, then blocking I/O is performed. If\r
103 Event is not NULL and non blocking I/O is supported, then\r
104 nonblocking I/O is performed, and Event will be signaled when the\r
105 SCSI Request Packet completes.\r
106\r
107 @retval EFI_SUCCESS The SCSI Request Packet was sent by the host. For bi-directional\r
108 commands, InTransferLength bytes were transferred from\r
109 InDataBuffer. For write and bi-directional commands,\r
110 OutTransferLength bytes were transferred by\r
111 OutDataBuffer.\r
112 @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was not executed. The number of bytes that\r
113 could be transferred is returned in InTransferLength. For write\r
114 and bi-directional commands, OutTransferLength bytes were\r
115 transferred by OutDataBuffer.\r
116 @retval EFI_NOT_READY The SCSI Request Packet could not be sent because there are too many\r
117 SCSI Request Packets already queued. The caller may retry again later.\r
118 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the SCSI Request\r
119 Packet.\r
120 @retval EFI_INVALID_PARAMETER Target, Lun, or the contents of ScsiRequestPacket are invalid.\r
121 @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not supported\r
122 by the host adapter. This includes the case of Bi-directional SCSI\r
123 commands not supported by the implementation. The SCSI Request\r
124 Packet was not sent, so no additional status information is available.\r
125 @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request Packet to execute.\r
126\r
127**/\r
128typedef\r
129EFI_STATUS\r
130(EFIAPI *EFI_EXT_SCSI_PASS_THRU_PASSTHRU) (\r
131 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
132 IN UINT8 *Target,\r
133 IN UINT64 Lun,\r
134 IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,\r
135 IN EFI_EVENT Event OPTIONAL\r
136 )\r
137; \r
138\r
139/**\r
140 Used to retrieve the list of legal Target IDs and LUNs for SCSI devices on a SCSI channel. These \r
141 can either be the list SCSI devices that are actually present on the SCSI channel, or the list of legal\r
142 Target Ids and LUNs for the SCSI channel. Regardless, the caller of this function must probe the \r
143 Target ID and LUN returned to see if a SCSI device is actually present at that location on the SCSI \r
144 channel. \r
145\r
146 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
147 @param Target On input, a pointer to the Target ID (an array of size\r
148 TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.\r
149 On output, a pointer to the Target ID (an array of\r
150 TARGET_MAX_BYTES) of the next SCSI device present on a SCSI\r
151 channel. An input value of 0xF(all bytes in the array are 0xF) in the\r
152 Target array retrieves the Target ID of the first SCSI device present on a\r
153 SCSI channel.\r
154 @param Lun On input, a pointer to the LUN of a SCSI device present on the SCSI\r
155 channel. On output, a pointer to the LUN of the next SCSI device present\r
156 on a SCSI channel.\r
157\r
158 @retval EFI_SUCCESS The Target ID and LUN of the next SCSI device on the SCSI\r
159 channel was returned in Target and Lun.\r
160 @retval EFI_INVALID_PARAMETER Target array is not all 0xF, and Target and Lun were\r
161 not returned on a previous call to GetNextTargetLun().\r
162 @retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel.\r
163\r
164**/\r
165typedef\r
166EFI_STATUS\r
167(EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET_LUN) (\r
168 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
169 IN OUT UINT8 **Target,\r
170 IN OUT UINT64 *Lun\r
171 )\r
172; \r
173\r
174/**\r
175 Used to allocate and build a device path node for a SCSI device on a SCSI channel.\r
176\r
177 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
178 @param Target The Target is an array of size TARGET_MAX_BYTES and it specifies the\r
179 Target ID of the SCSI device for which a device path node is to be\r
180 allocated and built. Transport drivers may chose to utilize a subset of\r
181 this size to suit the representation of targets. For example, a Fibre\r
182 Channel driver may use only 8 bytes (WWN) in the array to represent a\r
183 FC target.\r
184 @param Lun The LUN of the SCSI device for which a device path node is to be\r
185 allocated and built.\r
186 @param DevicePath A pointer to a single device path node that describes the SCSI device\r
187 specified by Target and Lun. This function is responsible for\r
188 allocating the buffer DevicePath with the boot service\r
189 AllocatePool(). It is the caller's responsibility to free\r
190 DevicePath when the caller is finished with DevicePath.\r
191\r
192 @retval EFI_SUCCESS The device path node that describes the SCSI device specified by\r
193 Target and Lun was allocated and returned in\r
194 DevicePath.\r
195 @retval EFI_INVALID_PARAMETER DevicePath is NULL.\r
196 @retval EFI_NOT_FOUND The SCSI devices specified by Target and Lun does not exist\r
197 on the SCSI channel.\r
198 @retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate DevicePath.\r
199\r
200**/\r
201typedef\r
202EFI_STATUS\r
203(EFIAPI *EFI_EXT_SCSI_PASS_THRU_BUILD_DEVICE_PATH) (\r
204 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
205 IN UINT8 *Target,\r
206 IN UINT64 Lun,\r
207 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath\r
208 )\r
209; \r
210\r
211/**\r
212 Used to translate a device path node to a Target ID and LUN.\r
213\r
214 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
215 @param DevicePath A pointer to a single device path node that describes the SCSI device\r
216 on the SCSI channel.\r
217 @param Target A pointer to the Target Array which represents the ID of a SCSI device\r
218 on the SCSI channel.\r
219 @param Lun A pointer to the LUN of a SCSI device on the SCSI channel.\r
220\r
221 @retval EFI_SUCCESS DevicePath was successfully translated to a Target ID and\r
222 LUN, and they were returned in Target and Lun.\r
223 @retval EFI_INVALID_PARAMETER DevicePath or Target or Lun is NULL.\r
224 @retval EFI_NOT_FOUND A valid translation from DevicePath to a Target ID and LUN\r
225 does not exist.\r
226 @retval EFI_UNSUPPORTED This driver does not support the device path node type in\r
227 DevicePath.\r
228\r
229**/\r
230typedef\r
231EFI_STATUS\r
232(EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_TARGET_LUN) (\r
233 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
234 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
235 OUT UINT8 **Target,\r
236 OUT UINT64 *Lun\r
237 )\r
238; \r
239\r
240/**\r
241 Resets a SCSI channel. This operation resets all the SCSI devices connected to the SCSI channel.\r
242\r
243 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
244\r
245 @retval EFI_SUCCESS The SCSI channel was reset.\r
246 @retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the SCSI channel.\r
247 @retval EFI_TIMEOUT A timeout occurred while attempting to reset the SCSI channel.\r
248 @retval EFI_UNSUPPORTED The SCSI channel does not support a channel reset operation.\r
249\r
250**/\r
251typedef\r
252EFI_STATUS\r
253(EFIAPI *EFI_EXT_SCSI_PASS_THRU_RESET_CHANNEL) (\r
254 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This\r
255 )\r
256; \r
257 \r
258/**\r
259 Resets a SCSI logical unit that is connected to a SCSI channel.\r
260\r
261 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
262 @param Target The Target is an array of size TARGET_MAX_BYTE and it represents the\r
263 target port ID of the SCSI device containing the SCSI logical unit to\r
264 reset. Transport drivers may chose to utilize a subset of this array to suit\r
265 the representation of their targets.\r
266 @param Lun The LUN of the SCSI device to reset.\r
267\r
268 @retval EFI_SUCCESS The SCSI device specified by Target and Lun was reset.\r
269 @retval EFI_INVALID_PARAMETER Target or Lun is NULL.\r
270 @retval EFI_TIMEOUT A timeout occurred while attempting to reset the SCSI device\r
271 specified by Target and Lun.\r
272 @retval EFI_UNSUPPORTED The SCSI channel does not support a target reset operation.\r
273 @retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the SCSI device\r
274 specified by Target and Lun.\r
275\r
276**/\r
277typedef\r
278EFI_STATUS\r
279(EFIAPI *EFI_EXT_SCSI_PASS_THRU_RESET_TARGET_LUN) (\r
280 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
281 IN UINT8 *Target,\r
282 IN UINT64 Lun\r
283 )\r
284; \r
285\r
286/**\r
287 Used to retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. These can either \r
288 be the list SCSI devices that are actually present on the SCSI channel, or the list of legal Target IDs\r
289 for the SCSI channel. Regardless, the caller of this function must probe the Target ID returned to \r
290 see if a SCSI device is actually present at that location on the SCSI channel. \r
291\r
292 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
293 @param Target (TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.\r
294 On output, a pointer to the Target ID (an array of\r
295 TARGET_MAX_BYTES) of the next SCSI device present on a SCSI\r
296 channel. An input value of 0xF(all bytes in the array are 0xF) in the\r
297 Target array retrieves the Target ID of the first SCSI device present on a\r
298 SCSI channel.\r
299\r
300 @retval EFI_SUCCESS The Target ID of the next SCSI device on the SCSI\r
301 channel was returned in Target.\r
302 @retval EFI_INVALID_PARAMETER Target or Lun is NULL.\r
303 @retval EFI_TIMEOUT Target array is not all 0xF, and Target were not\r
304 returned on a previous call to GetNextTarget().\r
305 @retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel.\r
306\r
307**/\r
308typedef\r
309EFI_STATUS\r
310(EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET) (\r
311 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
312 IN OUT UINT8 **Target\r
313 )\r
314; \r
315 \r
316struct _EFI_EXT_SCSI_PASS_THRU_PROTOCOL {\r
317 EFI_EXT_SCSI_PASS_THRU_MODE *Mode;\r
318 EFI_EXT_SCSI_PASS_THRU_PASSTHRU PassThru;\r
319 EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET_LUN GetNextTargetLun;\r
320 EFI_EXT_SCSI_PASS_THRU_BUILD_DEVICE_PATH BuildDevicePath;\r
321 EFI_EXT_SCSI_PASS_THRU_GET_TARGET_LUN GetTargetLun;\r
322 EFI_EXT_SCSI_PASS_THRU_RESET_CHANNEL ResetChannel;\r
323 EFI_EXT_SCSI_PASS_THRU_RESET_TARGET_LUN ResetTargetLun;\r
324 EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET GetNextTarget;\r
325};\r
326\r
327extern EFI_GUID gEfiExtScsiPassThruProtocolGuid;\r
328\r
329#endif\r