878ddf1f |
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 |
13 | Module Name: ScsiPassThruExt.h\r |
14 | \r |
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 |
25 | typedef 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 |
68 | typedef struct {\r |
69 | UINT32 AdapterId;\r |
70 | UINT32 Attributes;\r |
71 | UINT32 IoAlign;\r |
72 | } EFI_EXT_SCSI_PASS_THRU_MODE;\r |
73 | \r |
74 | typedef 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 |
130 | typedef\r |
131 | EFI_STATUS\r |
132 | (EFIAPI *EFI_EXT_SCSI_PASS_THRU_PASSTHRU) (\r |
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 |
167 | typedef\r |
168 | EFI_STATUS\r |
169 | (EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET_LUN) (\r |
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 |
878ddf1f |
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 |
203 | typedef\r |
204 | EFI_STATUS\r |
205 | (EFIAPI *EFI_EXT_SCSI_PASS_THRU_BUILD_DEVICE_PATH) (\r |
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 |
232 | typedef\r |
233 | EFI_STATUS\r |
234 | (EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_TARGET_LUN) (\r |
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 |
253 | typedef\r |
254 | EFI_STATUS\r |
255 | (EFIAPI *EFI_EXT_SCSI_PASS_THRU_RESET_CHANNEL) (\r |
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 |
279 | typedef\r |
280 | EFI_STATUS\r |
281 | (EFIAPI *EFI_EXT_SCSI_PASS_THRU_RESET_TARGET_LUN) (\r |
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 |
310 | typedef\r |
311 | EFI_STATUS\r |
312 | (EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET) (\r |
313 | IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r |
314 | IN OUT UINT8 **Target\r |
315 | )\r |
316 | ; \r |
317 | \r |
318 | struct _EFI_EXT_SCSI_PASS_THRU_PROTOCOL {\r |
319 | EFI_EXT_SCSI_PASS_THRU_MODE *Mode;\r |
320 | EFI_EXT_SCSI_PASS_THRU_PASSTHRU PassThru;\r |
321 | EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET_LUN GetNextTargetLun;\r |
322 | EFI_EXT_SCSI_PASS_THRU_BUILD_DEVICE_PATH BuildDevicePath;\r |
323 | EFI_EXT_SCSI_PASS_THRU_GET_TARGET_LUN GetTargetLun;\r |
324 | EFI_EXT_SCSI_PASS_THRU_RESET_CHANNEL ResetChannel;\r |
325 | EFI_EXT_SCSI_PASS_THRU_RESET_TARGET_LUN ResetTargetLun;\r |
326 | EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET GetNextTarget;\r |
327 | };\r |
328 | \r |
329 | extern EFI_GUID gEfiExtScsiPassThruProtocolGuid;\r |
330 | \r |
331 | #endif\r |