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