]> git.proxmox.com Git - mirror_edk2.git/blob - NetworkPkg/IScsiDxe/IScsiDriver.h
Add IScsiDxe driver to NetworkPkg in order to support iSCSI over IPv6 stack and iSCSI...
[mirror_edk2.git] / NetworkPkg / IScsiDxe / IScsiDriver.h
1 /** @file
2 The header file of IScsiDriver.c.
3
4 Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef _ISCSI_DRIVER_H_
16 #define _ISCSI_DRIVER_H_
17
18 #define ISCSI_V4_PRIVATE_GUID \
19 { \
20 0xfa3cde4c, 0x87c2, 0x427d, { 0xae, 0xde, 0x7d, 0xd0, 0x96, 0xc8, 0x8c, 0x58 } \
21 }
22
23 #define ISCSI_V6_PRIVATE_GUID \
24 { \
25 0x28be27e5, 0x66cc, 0x4a31, { 0xa3, 0x15, 0xdb, 0x14, 0xc3, 0x74, 0x4d, 0x85 } \
26 }
27
28 #define ISCSI_INITIATOR_NAME_VAR_NAME L"I_NAME"
29
30 #define IP_MODE_AUTOCONFIG_IP4 3
31 #define IP_MODE_AUTOCONFIG_IP6 4
32 #define IP_MODE_AUTOCONFIG_SUCCESS 5
33
34 extern EFI_COMPONENT_NAME2_PROTOCOL gIScsiComponentName2;
35 extern EFI_COMPONENT_NAME_PROTOCOL gIScsiComponentName;
36 extern EFI_ISCSI_INITIATOR_NAME_PROTOCOL gIScsiInitiatorName;
37 extern EFI_AUTHENTICATION_INFO_PROTOCOL gIScsiAuthenticationInfo;
38 extern EFI_EXT_SCSI_PASS_THRU_PROTOCOL gIScsiExtScsiPassThruProtocolTemplate;
39
40 typedef struct {
41 CHAR16 PortString[ISCSI_NAME_IFR_MAX_SIZE];
42 LIST_ENTRY NicInfoList;
43 UINT8 NicCount;
44 UINT8 CurrentNic;
45 UINT8 MaxNic;
46 BOOLEAN Ipv6Flag;
47 BOOLEAN OneSessionEstablished;
48 BOOLEAN EnableMpio;
49 UINT8 MpioCount; // The number of attempts in MPIO.
50 UINT8 Krb5MpioCount; // The number of attempts login with KRB5 in MPIO.
51 UINT8 SinglePathCount; // The number of single path attempts.
52 UINT8 ValidSinglePathCount; // The number of valid single path attempts.
53 UINT8 BootSelectedIndex;
54 UINT8 AttemptCount;
55 LIST_ENTRY AttemptConfigs; // User configured Attempt list.
56 CHAR8 InitiatorName[ISCSI_NAME_MAX_SIZE];
57 UINTN InitiatorNameLength;
58 } ISCSI_PRIVATE_DATA;
59
60 extern ISCSI_PRIVATE_DATA *mPrivate;
61
62 typedef struct {
63 LIST_ENTRY Link;
64 UINT32 HwAddressSize;
65 EFI_MAC_ADDRESS PermanentAddress;
66 UINT8 NicIndex;
67 UINT16 VlanId;
68 UINTN BusNumber;
69 UINTN DeviceNumber;
70 UINTN FunctionNumber;
71 } ISCSI_NIC_INFO;
72
73 typedef struct _ISCSI_PRIVATE_PROTOCOL {
74 UINT32 Reserved;
75 } ISCSI_PRIVATE_PROTOCOL;
76
77 //
78 // EFI Driver Binding Protocol for iSCSI driver.
79 //
80
81 /**
82 Tests to see if this driver supports a given controller. If a child device is provided,
83 it tests to see if this driver supports creating a handle for the specified child device.
84
85 This function checks to see if the driver specified by This supports the device specified by
86 ControllerHandle. Drivers typically use the device path attached to
87 ControllerHandle and/or the services from the bus I/O abstraction attached to
88 ControllerHandle to determine if the driver supports ControllerHandle. This function
89 may be called many times during platform initialization. In order to reduce boot times, the tests
90 performed by this function must be very small and take as little time as possible to execute. This
91 function must not change the state of any hardware devices, and this function must be aware that the
92 device specified by ControllerHandle may already be managed by the same driver or a
93 different driver. This function must match its calls to AllocatePages() with FreePages(),
94 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
95 Since ControllerHandle may have been previously started by the same driver, if a protocol is
96 already in the opened state, then it must not be closed with CloseProtocol(). This is required
97 to guarantee the state of ControllerHandle is not modified by this function.
98
99 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
100 @param[in] ControllerHandle The handle of the controller to test. This handle
101 must support a protocol interface that supplies
102 an I/O abstraction to the driver.
103 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
104 parameter is ignored by device drivers, and is optional for bus
105 drivers. For bus drivers, if this parameter is not NULL, then
106 the bus driver must determine if the bus controller specified
107 by ControllerHandle and the child controller specified
108 by RemainingDevicePath are both supported by this
109 bus driver.
110
111 @retval EFI_SUCCESS The device specified by ControllerHandle and
112 RemainingDevicePath is supported by the driver specified by This.
113 @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and
114 RemainingDevicePath is already managed by the driver
115 specified by This.
116 @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and
117 RemainingDevicePath is already managed by a different
118 driver or an application that requires exclusive access.
119 Currently not implemented.
120 @retval EFI_UNSUPPORTED The device specified by ControllerHandle and
121 RemainingDevicePath is not supported by the driver specified by This.
122 **/
123 EFI_STATUS
124 EFIAPI
125 IScsiDriverBindingSupported (
126 IN EFI_DRIVER_BINDING_PROTOCOL *This,
127 IN EFI_HANDLE ControllerHandle,
128 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
129 );
130
131 /**
132 Starts a device controller or a bus controller.
133
134 The Start() function is designed to be invoked from the EFI boot service ConnectController().
135 As a result, much of the error checking on the parameters to Start() has been moved into this
136 common boot service. It is legal to call Start() from other locations,
137 but the following calling restrictions must be followed or the system behavior will not be deterministic.
138 1. ControllerHandle must be a valid EFI_HANDLE.
139 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
140 EFI_DEVICE_PATH_PROTOCOL.
141 3. Prior to calling Start(), the Supported() function for the driver specified by This must
142 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
143
144 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
145 @param[in] ControllerHandle The handle of the controller to start. This handle
146 must support a protocol interface that supplies
147 an I/O abstraction to the driver.
148 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
149 parameter is ignored by device drivers, and is optional for bus
150 drivers. For a bus driver, if this parameter is NULL, then handles
151 for all the children of Controller are created by this driver.
152 If this parameter is not NULL and the first Device Path Node is
153 not the End of Device Path Node, then only the handle for the
154 child device specified by the first Device Path Node of
155 RemainingDevicePath is created by this driver.
156 If the first Device Path Node of RemainingDevicePath is
157 the End of Device Path Node, no child handle is created by this
158 driver.
159
160 @retval EFI_SUCCESS The device was started.
161 @retval EFI_DEVICE_ERROR The device could not be started due to a device error. Currently not implemented.
162 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
163 @retval Others The driver failed to start the device.
164
165 **/
166 EFI_STATUS
167 EFIAPI
168 IScsiDriverBindingStart (
169 IN EFI_DRIVER_BINDING_PROTOCOL *This,
170 IN EFI_HANDLE ControllerHandle,
171 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
172 );
173
174 /**
175 Stops a device controller or a bus controller.
176
177 The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
178 As a result, much of the error checking on the parameters to Stop() has been moved
179 into this common boot service. It is legal to call Stop() from other locations,
180 but the following calling restrictions must be followed or the system behavior will not be deterministic.
181 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
182 same driver's Start() function.
183 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
184 EFI_HANDLE. In addition, all of these handles must have been created in this driver's
185 Start() function, and the Start() function must have called OpenProtocol() on
186 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
187
188 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
189 @param[in] ControllerHandle A handle to the device being stopped. The handle must
190 support a bus specific I/O protocol for the driver
191 to use to stop the device.
192 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
193 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
194 if NumberOfChildren is 0.
195
196 @retval EFI_SUCCESS The device was stopped.
197 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
198
199 **/
200 EFI_STATUS
201 EFIAPI
202 IScsiDriverBindingStop (
203 IN EFI_DRIVER_BINDING_PROTOCOL *This,
204 IN EFI_HANDLE ControllerHandle,
205 IN UINTN NumberOfChildren,
206 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
207 );
208
209 //
210 // EFI Component Name(2) Protocol for iSCSI driver.
211 //
212
213 /**
214 Retrieves a Unicode string that is the user readable name of the driver.
215
216 This function retrieves the user readable name of a driver in the form of a
217 Unicode string. If the driver specified by This has a user readable name in
218 the language specified by Language, then a pointer to the driver name is
219 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
220 by This does not support the language specified by Language,
221 then EFI_UNSUPPORTED is returned.
222
223 @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
224 EFI_COMPONENT_NAME_PROTOCOL instance.
225
226 @param[in] Language A pointer to a Null-terminated ASCII string
227 array indicating the language. This is the
228 language of the driver name that the caller is
229 requesting, and it must match one of the
230 languages specified in SupportedLanguages. The
231 number of languages supported by a driver is up
232 to the driver writer. Language is specified
233 in RFC 4646 or ISO 639-2 language code format.
234
235 @param[out] DriverName A pointer to the Unicode string to return.
236 This Unicode string is the name of the
237 driver specified by This in the language
238 specified by Language.
239
240 @retval EFI_SUCCESS The Unicode string for the Driver specified by
241 This and the language specified by Language was
242 returned in DriverName.
243
244 @retval EFI_INVALID_PARAMETER Language is NULL.
245
246 @retval EFI_INVALID_PARAMETER DriverName is NULL.
247
248 @retval EFI_UNSUPPORTED The driver specified by This does not support
249 the language specified by Language.
250
251 **/
252 EFI_STATUS
253 EFIAPI
254 IScsiComponentNameGetDriverName (
255 IN EFI_COMPONENT_NAME_PROTOCOL *This,
256 IN CHAR8 *Language,
257 OUT CHAR16 **DriverName
258 );
259
260 /**
261 Retrieves a Unicode string that is the user readable name of the controller
262 that is being managed by a driver.
263
264 This function retrieves the user readable name of the controller specified by
265 ControllerHandle and ChildHandle in the form of a Unicode string. If the
266 driver specified by This has a user readable name in the language specified by
267 Language, then a pointer to the controller name is returned in ControllerName,
268 and EFI_SUCCESS is returned. If the driver specified by This is not currently
269 managing the controller specified by ControllerHandle and ChildHandle,
270 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
271 support the language specified by Language, then EFI_UNSUPPORTED is returned.
272
273 @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
274 EFI_COMPONENT_NAME_PROTOCOL instance.
275
276 @param[in] ControllerHandle The handle of a controller that the driver
277 specified by This is managing. This handle
278 specifies the controller whose name is to be
279 returned.
280
281 @param[in] ChildHandle The handle of the child controller to retrieve
282 the name of. This is an optional parameter that
283 may be NULL. It will be NULL for device
284 drivers. It will also be NULL for a bus drivers
285 that wish to retrieve the name of the bus
286 controller. It will not be NULL for a bus
287 driver that wishes to retrieve the name of a
288 child controller.
289
290 @param[in] Language A pointer to a Null-terminated ASCII string
291 array indicating the language. This is the
292 language of the driver name that the caller is
293 requesting, and it must match one of the
294 languages specified in SupportedLanguages. The
295 number of languages supported by a driver is
296 determined by the driver writer. Language is
297 specified inRFC 4646 or ISO 639-2 language code
298 format.
299
300 @param[out] ControllerName A pointer to the Unicode string to return.
301 This Unicode string is the name of the
302 controller specified by ControllerHandle and
303 ChildHandle in the language specified by
304 Language from the point of view of the driver
305 specified by This.
306
307 @retval EFI_SUCCESS The Unicode string for the user readable name in
308 the language specified by Language for the
309 driver specified by This was returned in
310 DriverName.
311
312 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
313
314 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
315 EFI_HANDLE.
316
317 @retval EFI_INVALID_PARAMETER Language is NULL.
318
319 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
320
321 @retval EFI_UNSUPPORTED The driver specified by This is not currently
322 managing the controller specified by
323 ControllerHandle and ChildHandle.
324
325 @retval EFI_UNSUPPORTED The driver specified by This does not support
326 the language specified by Language.
327
328 **/
329 EFI_STATUS
330 EFIAPI
331 IScsiComponentNameGetControllerName (
332 IN EFI_COMPONENT_NAME_PROTOCOL *This,
333 IN EFI_HANDLE ControllerHandle,
334 IN EFI_HANDLE ChildHandle OPTIONAL,
335 IN CHAR8 *Language,
336 OUT CHAR16 **ControllerName
337 );
338
339 //
340 // EFI iSCSI Initiator Name Protocol for iSCSI driver.
341 //
342
343 /**
344 Retrieves the current set value of iSCSI Initiator Name.
345
346 @param[in] This Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL
347 instance.
348 @param[in, out] BufferSize Size of the buffer in bytes pointed to by Buffer /
349 Actual size of the variable data buffer.
350 @param[out] Buffer Pointer to the buffer for data to be read.
351
352 @retval EFI_SUCCESS Data was successfully retrieved into the provided
353 buffer and the BufferSize was sufficient to handle
354 the iSCSI initiator name.
355 @retval EFI_BUFFER_TOO_SMALL BufferSize is too small for the result. BufferSize
356 will be updated with the size required to complete
357 the request. Buffer will not be affected.
358 @retval EFI_INVALID_PARAMETER BufferSize is NULL. BufferSize and Buffer will not
359 be affected.
360 @retval EFI_INVALID_PARAMETER Buffer is NULL. BufferSize and Buffer will not be
361 affected.
362 @retval EFI_DEVICE_ERROR The iSCSI initiator name could not be retrieved
363 due to a hardware error.
364
365 **/
366 EFI_STATUS
367 EFIAPI
368 IScsiGetInitiatorName (
369 IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL *This,
370 IN OUT UINTN *BufferSize,
371 OUT VOID *Buffer
372 );
373
374 /**
375 Sets the iSSI Initiator Name.
376
377 @param[in] This Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL
378 instance.
379 @param[in, out] BufferSize Size of the buffer in bytes pointed to by Buffer.
380 @param[in] Buffer Pointer to the buffer for data to be written.
381
382 @retval EFI_SUCCESS Data was successfully stored by the protocol.
383 @retval EFI_UNSUPPORTED Platform policies do not allow for data to be
384 written.
385 @retval EFI_INVALID_PARAMETER BufferSize exceeds the maximum allowed limit.
386 BufferSize will be updated with the maximum size
387 required to complete the request.
388 @retval EFI_INVALID_PARAMETER Buffersize is NULL. BufferSize and Buffer will not
389 be affected.
390 @retval EFI_INVALID_PARAMETER Buffer is NULL. BufferSize and Buffer will not be
391 affected.
392 @retval EFI_DEVICE_ERROR The data could not be stored due to a hardware
393 error.
394 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the data
395 @retval EFI_PROTOCOL_ERROR Input iSCSI initiator name does not adhere to RFC
396 3720
397
398 **/
399 EFI_STATUS
400 EFIAPI
401 IScsiSetInitiatorName (
402 IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL *This,
403 IN OUT UINTN *BufferSize,
404 IN VOID *Buffer
405 );
406
407 //
408 // EFI_AUTHENTICATION_INFO_PROTOCOL for iSCSI driver.
409 //
410
411 /**
412 Retrieves the authentication information associated with a particular controller handle.
413
414 @param[in] This Pointer to the EFI_AUTHENTICATION_INFO_PROTOCOL.
415 @param[in] ControllerHandle Handle to the Controller.
416 @param[out] Buffer Pointer to the authentication information. This function is
417 responsible for allocating the buffer and it is the caller's
418 responsibility to free buffer when the caller is finished with buffer.
419
420 @retval EFI_DEVICE_ERROR The authentication information could not be
421 retrieved due to a hardware error.
422
423 **/
424 EFI_STATUS
425 EFIAPI
426 IScsiGetAuthenticationInfo (
427 IN EFI_AUTHENTICATION_INFO_PROTOCOL *This,
428 IN EFI_HANDLE ControllerHandle,
429 OUT VOID **Buffer
430 );
431
432 /**
433 Set the authentication information for a given controller handle.
434
435 @param[in] This Pointer to the EFI_AUTHENTICATION_INFO_PROTOCOL.
436 @param[in] ControllerHandle Handle to the Controller.
437 @param[in] Buffer Pointer to the authentication information.
438
439 @retval EFI_UNSUPPORTED If the platform policies do not allow setting of
440 the authentication information.
441
442 **/
443 EFI_STATUS
444 EFIAPI
445 IScsiSetAuthenticationInfo (
446 IN EFI_AUTHENTICATION_INFO_PROTOCOL *This,
447 IN EFI_HANDLE ControllerHandle,
448 IN VOID *Buffer
449 );
450
451 //
452 // EFI_EXT_SCSI_PASS_THRU_PROTOCOL for iSCSI driver.
453 //
454
455 /**
456 Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel.
457 This function supports both blocking I/O and nonblocking I/O. The blocking I/O
458 functionality is required, and the nonblocking I/O functionality is optional.
459
460 @param[in] This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
461 @param[in] Target The Target is an array of size TARGET_MAX_BYTES and it
462 represents the id of the SCSI device to send the SCSI
463 Request Packet. Each transport driver may choose to
464 utilize a subset of this size to suit the needs
465 of transport target representation. For example, a
466 Fibre Channel driver may use only 8 bytes (WWN)
467 to represent an FC target.
468 @param[in] Lun The LUN of the SCSI device to send the SCSI Request Packet.
469 @param[in, out] Packet A pointer to the SCSI Request Packet to send to the
470 SCSI device specified by Target and Lun.
471 @param[in] Event If nonblocking I/O is not supported then Event is ignored,
472 and blocking I/O is performed. If Event is NULL, then
473 blocking I/O is performed. If Event is not NULL and non
474 blocking I/O is supported, then nonblocking I/O is performed,
475 and Event will be signaled when the SCSI Request Packet
476 completes.
477
478 @retval EFI_SUCCESS The SCSI Request Packet was sent by the host. For
479 bi-directional commands, InTransferLength bytes
480 were transferred from InDataBuffer.
481 For write and bi-directional commands, OutTransferLength
482 bytes were transferred by OutDataBuffer.
483 @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was not executed.
484 The number of bytes that could be transferred is
485 returned in InTransferLength. For write and
486 bi-directional commands, OutTransferLength bytes
487 were transferred by OutDataBuffer.
488 @retval EFI_NOT_READY The SCSI Request Packet could not be sent because
489 there are too many SCSI Request Packets already
490 queued. The caller may retry later.
491 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send
492 the SCSI Request Packet.
493 @retval EFI_INVALID_PARAMETER Target, Lun, or the contents of ScsiRequestPacket
494 are invalid.
495 @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet
496 is not supported by the host adapter.
497 This includes the case of Bi-directional SCSI
498 commands not supported by the implementation.
499 The SCSI Request Packet was not sent,
500 so no additional status information is available.
501 @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI
502 Request Packet to execute.
503
504 **/
505 EFI_STATUS
506 EFIAPI
507 IScsiExtScsiPassThruFunction (
508 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
509 IN UINT8 *Target,
510 IN UINT64 Lun,
511 IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
512 IN EFI_EVENT Event OPTIONAL
513 );
514
515 /**
516 Used to retrieve the list of legal Target IDs and LUNs for SCSI devices on
517 a SCSI channel. These can either be the list SCSI devices that are actually
518 present on the SCSI channel, or the list of legal Target Ids and LUNs for the
519 SCSI channel. Regardless, the caller of this function must probe the Target ID
520 and LUN returned to see if a SCSI device is actually present at that location
521 on the SCSI channel.
522
523 @param[in] This The EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
524 @param[in, out] Target On input, a pointer to the Target ID of a SCSI
525 device present on the SCSI channel. On output, a
526 pointer to the Target ID of the next SCSI device
527 present on a SCSI channel. An input value of
528 0xFFFFFFFF retrieves the Target ID of the first
529 SCSI device present on a SCSI channel.
530 @param[in, out] Lun On input, a pointer to the LUN of a SCSI device
531 present on the SCSI channel. On output, a pointer
532 to the LUN of the next SCSI device present on a
533 SCSI channel.
534
535 @retval EFI_SUCCESS The Target ID and Lun of the next SCSI device on
536 the SCSI channel was returned in Target and Lun.
537 @retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI
538 channel.
539 @retval EFI_INVALID_PARAMETER Target is not 0xFFFFFFFF,and Target and Lun were
540 not returned on a previous call to
541 GetNextDevice().
542
543 **/
544 EFI_STATUS
545 EFIAPI
546 IScsiExtScsiPassThruGetNextTargetLun (
547 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
548 IN OUT UINT8 **Target,
549 IN OUT UINT64 *Lun
550 );
551
552 /**
553 Allocate and build a device path node for a SCSI device on a SCSI channel.
554
555 @param[in] This Protocol instance pointer.
556 @param[in] Target The Target ID of the SCSI device for which a
557 device path node is to be allocated and built.
558 @param[in] Lun The LUN of the SCSI device for which a device
559 path node is to be allocated and built.
560 @param[in, out] DevicePath A pointer to a single device path node that
561 describes the SCSI device specified by Target and
562 Lun. This function is responsible for allocating
563 the buffer DevicePath with the boot service
564 AllocatePool(). It is the caller's
565 responsibility to free DevicePath when the caller
566 is finished with DevicePath.
567
568 @retval EFI_SUCCESS The device path node that describes the SCSI
569 device specified by Target and Lun was allocated
570 and returned in DevicePath.
571 @retval EFI_NOT_FOUND The SCSI devices specified by Target and Lun does
572 not exist on the SCSI channel.
573 @retval EFI_INVALID_PARAMETER DevicePath is NULL.
574 @retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate
575 DevicePath.
576
577 **/
578 EFI_STATUS
579 EFIAPI
580 IScsiExtScsiPassThruBuildDevicePath (
581 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
582 IN UINT8 *Target,
583 IN UINT64 Lun,
584 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
585 );
586
587 /**
588 Translate a device path node to a Target ID and LUN.
589
590 @param[in] This Protocol instance pointer.
591 @param[in] DevicePath A pointer to the device path node that describes
592 a SCSI device on the SCSI channel.
593 @param[out] Target A pointer to the Target ID of a SCSI device on
594 the SCSI channel.
595 @param[out] Lun A pointer to the LUN of a SCSI device on the SCSI
596 channel.
597
598 @retval EFI_SUCCESS DevicePath was successfully translated to a
599 Target ID and LUN, and they were returned in
600 Target and Lun.
601 @retval EFI_INVALID_PARAMETER DevicePath/Target/Lun is NULL.
602 @retval EFI_UNSUPPORTED This driver does not support the device path node
603 type in DevicePath.
604 @retval EFI_NOT_FOUND A valid translation from DevicePath to a Target
605 ID and LUN does not exist.
606
607 **/
608 EFI_STATUS
609 EFIAPI
610 IScsiExtScsiPassThruGetTargetLun (
611 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
612 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
613 OUT UINT8 **Target,
614 OUT UINT64 *Lun
615 );
616
617 /**
618 Resets a SCSI channel.This operation resets all the SCSI devices connected to
619 the SCSI channel.
620
621 @param[in] This Protocol instance pointer.
622
623 @retval EFI_UNSUPPORTED It is not supported.
624
625 **/
626 EFI_STATUS
627 EFIAPI
628 IScsiExtScsiPassThruResetChannel (
629 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This
630 );
631
632 /**
633 Resets a SCSI device that is connected to a SCSI channel.
634
635 @param[in] This Protocol instance pointer.
636 @param[in] Target The Target ID of the SCSI device to reset.
637 @param[in] Lun The LUN of the SCSI device to reset.
638
639 @retval EFI_UNSUPPORTED It is not supported.
640
641 **/
642 EFI_STATUS
643 EFIAPI
644 IScsiExtScsiPassThruResetTargetLun (
645 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
646 IN UINT8 *Target,
647 IN UINT64 Lun
648 );
649
650 /**
651 Retrieve the list of legal Target IDs for SCSI devices on a SCSI channel.
652
653 @param[in] This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL
654 instance.
655 @param[in, out] Target (TARGET_MAX_BYTES) of a SCSI device present on
656 the SCSI channel. On output, a pointer to the
657 Target ID (an array of TARGET_MAX_BYTES) of the
658 next SCSI device present on a SCSI channel.
659 An input value of 0xF(all bytes in the array are 0xF)
660 in the Target array retrieves the Target ID of the
661 first SCSI device present on a SCSI channel.
662
663 @retval EFI_SUCCESS The Target ID of the next SCSI device on the SCSI
664 channel was returned in Target.
665 @retval EFI_INVALID_PARAMETER Target or Lun is NULL.
666 @retval EFI_TIMEOUT Target array is not all 0xF, and Target was not
667 returned on a previous call to GetNextTarget().
668 @retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel.
669
670 **/
671 EFI_STATUS
672 EFIAPI
673 IScsiExtScsiPassThruGetNextTarget (
674 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
675 IN OUT UINT8 **Target
676 );
677
678 #endif