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