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