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