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