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