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