/** @file\r
Miscellaneous definitions for iSCSI driver.\r
\r
-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
///\r
/// IPv4 Device Path Node Length\r
///\r
-#define IP4_NODE_LEN_NEW_VERSIONS 27\r
+#define IP4_NODE_LEN_NEW_VERSIONS 27\r
\r
///\r
/// IPv6 Device Path Node Length\r
///\r
-#define IP6_NODE_LEN_OLD_VERSIONS 43\r
-#define IP6_NODE_LEN_NEW_VERSIONS 60\r
+#define IP6_NODE_LEN_OLD_VERSIONS 43\r
+#define IP6_NODE_LEN_NEW_VERSIONS 60\r
\r
///\r
/// The ignored field StaticIpAddress's offset in old IPv6 Device Path\r
///\r
-#define IP6_OLD_IPADDRESS_OFFSET 42\r
+#define IP6_OLD_IPADDRESS_OFFSET 42\r
\r
#pragma pack(1)\r
typedef struct _ISCSI_SESSION_CONFIG_NVDATA {\r
- UINT16 TargetPort;\r
- UINT8 Enabled;\r
- UINT8 IpMode;\r
-\r
- EFI_IP_ADDRESS LocalIp;\r
- EFI_IPv4_ADDRESS SubnetMask;\r
- EFI_IP_ADDRESS Gateway;\r
-\r
- BOOLEAN InitiatorInfoFromDhcp;\r
- BOOLEAN TargetInfoFromDhcp;\r
- CHAR8 TargetName[ISCSI_NAME_MAX_SIZE];\r
- EFI_IP_ADDRESS TargetIp;\r
- UINT8 PrefixLength;\r
- UINT8 BootLun[8];\r
-\r
- UINT16 ConnectTimeout; ///< timout value in milliseconds\r
- UINT8 ConnectRetryCount;\r
- UINT8 IsId[6];\r
+ UINT16 TargetPort;\r
+ UINT8 Enabled;\r
+ UINT8 IpMode;\r
+\r
+ EFI_IP_ADDRESS LocalIp;\r
+ EFI_IPv4_ADDRESS SubnetMask;\r
+ EFI_IP_ADDRESS Gateway;\r
+\r
+ BOOLEAN InitiatorInfoFromDhcp;\r
+ BOOLEAN TargetInfoFromDhcp;\r
+\r
+ CHAR8 TargetName[ISCSI_NAME_MAX_SIZE];\r
+ EFI_IP_ADDRESS TargetIp;\r
+ UINT8 PrefixLength;\r
+ UINT8 BootLun[8];\r
+\r
+ UINT16 ConnectTimeout; ///< timeout value in milliseconds.\r
+ UINT8 ConnectRetryCount;\r
+ UINT8 IsId[6];\r
+\r
+ BOOLEAN RedirectFlag;\r
+ UINT16 OriginalTargetPort; // The port of proxy/virtual target.\r
+ EFI_IP_ADDRESS OriginalTargetIp; // The address of proxy/virtual target.\r
+\r
+ BOOLEAN DnsMode; // Flag indicate whether the Target address is expressed as URL format.\r
+ CHAR8 TargetUrl[ISCSI_TARGET_URI_MAX_SIZE];\r
} ISCSI_SESSION_CONFIG_NVDATA;\r
#pragma pack()\r
\r
);\r
\r
/**\r
- Convert the hexadecimal encoded LUN string into the 64-bit LUN. \r
+ Convert the hexadecimal encoded LUN string into the 64-bit LUN.\r
\r
@param[in] Str The hexadecimal encoded LUN string.\r
@param[out] Lun Storage to return the 64-bit LUN.\r
);\r
\r
/**\r
- Convert the mac address into a hexadecimal encoded "-" seperated string.\r
+ Convert the mac address into a hexadecimal encoded "-" separated string.\r
\r
@param[in] Mac The mac address.\r
@param[in] Len Length in bytes of the mac address.\r
**/\r
EFI_STATUS\r
IScsiAsciiStrToIp (\r
- IN CHAR8 *Str,\r
- IN UINT8 IpMode,\r
- OUT EFI_IP_ADDRESS *Ip\r
+ IN CHAR8 *Str,\r
+ IN UINT8 IpMode,\r
+ OUT EFI_IP_ADDRESS *Ip\r
);\r
\r
/**\r
@param[in, out] HexStr Pointer to the string.\r
@param[in, out] HexLength The length of the string.\r
\r
- @retval EFI_SUCCESS The binary data is converted to the hexadecimal string \r
+ @retval EFI_SUCCESS The binary data is converted to the hexadecimal string\r
and the length of the string is updated.\r
@retval EFI_BUFFER_TOO_SMALL The string is too small.\r
+ @retval EFI_BAD_BUFFER_SIZE BinLength is too large for hex encoding.\r
@retval EFI_INVALID_PARAMETER The IP string is malformatted.\r
\r
**/\r
EFI_STATUS\r
IScsiBinToHex (\r
- IN UINT8 *BinBuffer,\r
- IN UINT32 BinLength,\r
- IN OUT CHAR8 *HexStr,\r
- IN OUT UINT32 *HexLength\r
+ IN UINT8 *BinBuffer,\r
+ IN UINT32 BinLength,\r
+ IN OUT CHAR8 *HexStr,\r
+ IN OUT UINT32 *HexLength\r
);\r
\r
/**\r
Convert the hexadecimal string into a binary encoded buffer.\r
\r
- @param[in, out] BinBuffer The binary buffer.\r
- @param[in, out] BinLength Length of the binary buffer.\r
- @param[in] HexStr The hexadecimal string.\r
-\r
- @retval EFI_SUCCESS The hexadecimal string is converted into a binary\r
- encoded buffer.\r
- @retval EFI_BUFFER_TOO_SMALL The binary buffer is too small to hold the converted data.\r
-\r
+ @param[in, out] BinBuffer The binary buffer.\r
+ @param[in, out] BinLength Length of the binary buffer.\r
+ @param[in] HexStr The hexadecimal string.\r
+\r
+ @retval EFI_SUCCESS The hexadecimal string is converted into a\r
+ binary encoded buffer.\r
+ @retval EFI_INVALID_PARAMETER Invalid hex encoding found in HexStr.\r
+ @retval EFI_BAD_BUFFER_SIZE The length of HexStr is too large for decoding:\r
+ the decoded size cannot be expressed in\r
+ BinLength on output.\r
+ @retval EFI_BUFFER_TOO_SMALL The binary buffer is too small to hold the\r
+ converted data.\r
**/\r
EFI_STATUS\r
IScsiHexToBin (\r
- IN OUT UINT8 *BinBuffer,\r
- IN OUT UINT32 *BinLength,\r
- IN CHAR8 *HexStr\r
+ IN OUT UINT8 *BinBuffer,\r
+ IN OUT UINT32 *BinLength,\r
+ IN CHAR8 *HexStr\r
);\r
\r
-\r
/**\r
Convert the decimal-constant string or hex-constant string into a numerical value.\r
\r
Record the NIC information in a global structure.\r
\r
@param[in] Controller The handle of the controller.\r
+ @param[in] Image Handle of the image.\r
\r
@retval EFI_SUCCESS The operation is completed.\r
@retval EFI_OUT_OF_RESOURCES Do not have sufficient resource to finish this\r
**/\r
EFI_STATUS\r
IScsiAddNic (\r
- IN EFI_HANDLE Controller\r
+ IN EFI_HANDLE Controller,\r
+ IN EFI_HANDLE Image\r
);\r
\r
/**\r
IN EFI_HANDLE Controller\r
);\r
\r
+/**\r
+ Create and initialize the Attempts.\r
+\r
+ @param[in] AttemptNum The number of Attempts will be created.\r
+\r
+ @retval EFI_SUCCESS The Attempts have been created successfully.\r
+ @retval Others Failed to create the Attempt.\r
+\r
+**/\r
+EFI_STATUS\r
+IScsiCreateAttempts (\r
+ IN UINTN AttemptNum\r
+ );\r
+\r
+/**\r
+ Create the iSCSI configuration Keywords for each attempt.\r
+\r
+ @param[in] KeywordNum The number Sets of Keywords will be created.\r
+\r
+ @retval EFI_SUCCESS The operation is completed.\r
+ @retval Others Failed to create the Keywords.\r
+\r
+**/\r
+EFI_STATUS\r
+IScsiCreateKeywords (\r
+ IN UINTN KeywordNum\r
+ );\r
+\r
+/**\r
+\r
+ Free the attempt configure data variable.\r
+\r
+**/\r
+VOID\r
+IScsiCleanAttemptVariable (\r
+ IN VOID\r
+ );\r
+\r
/**\r
Get the recorded NIC information from a global structure by the Index.\r
\r
**/\r
ISCSI_NIC_INFO *\r
IScsiGetNicInfoByIndex (\r
- IN UINT8 NicIndex\r
+ IN UINT8 NicIndex\r
);\r
\r
-\r
/**\r
Get the NIC's PCI location and return it according to the composited\r
format defined in iSCSI Boot Firmware Table.\r
**/\r
VOID *\r
IScsiGetVariableAndSize (\r
- IN CHAR16 *Name,\r
- IN EFI_GUID *VendorGuid,\r
- OUT UINTN *VariableSize\r
+ IN CHAR16 *Name,\r
+ IN EFI_GUID *VendorGuid,\r
+ OUT UINTN *VariableSize\r
);\r
\r
/**\r
/**\r
Clean the iSCSI driver data.\r
\r
- @param[in] Private The iSCSI driver data.\r
+ @param[in] Private The iSCSI driver data.\r
+\r
+ @retval EFI_SUCCESS The clean operation is successful.\r
+ @retval Others Other errors as indicated.\r
\r
**/\r
-VOID\r
+EFI_STATUS\r
IScsiCleanDriverData (\r
IN ISCSI_DRIVER_DATA *Private\r
);\r
\r
@param[in] Controller The handle of the controller.\r
@param[in] IpVersion IP_VERSION_4 or IP_VERSION_6.\r
- \r
+\r
@retval TRUE The handle of the controller need the Dhcp protocol.\r
@retval FALSE The handle of the controller does not need the Dhcp protocol.\r
- \r
+\r
**/\r
BOOLEAN\r
IScsiDhcpIsConfigured (\r
IN UINT8 IpVersion\r
);\r
\r
+/**\r
+ Check wheather the Controller handle is configured to use DNS protocol.\r
+\r
+ @param[in] Controller The handle of the controller.\r
+\r
+ @retval TRUE The handle of the controller need the DNS protocol.\r
+ @retval FALSE The handle of the controller does not need the DNS protocol.\r
+\r
+**/\r
+BOOLEAN\r
+IScsiDnsIsConfigured (\r
+ IN EFI_HANDLE Controller\r
+ );\r
+\r
/**\r
Get the various configuration data of this iSCSI instance.\r
\r
**/\r
EFI_DEVICE_PATH_PROTOCOL *\r
IScsiGetTcpConnDevicePath (\r
- IN ISCSI_SESSION *Session\r
+ IN ISCSI_SESSION *Session\r
);\r
\r
/**\r
\r
This function tests whether the driver specified by DriverBindingHandle is\r
currently managing the controller specified by ControllerHandle. This test\r
- is performed by evaluating if the the protocol specified by ProtocolGuid is\r
+ is performed by evaluating if the protocol specified by ProtocolGuid is\r
present on ControllerHandle and is was opened by DriverBindingHandle and Nic\r
- Device handle with an attribute of EFI_OPEN_PROTOCOL_BY_DRIVER. \r
+ Device handle with an attribute of EFI_OPEN_PROTOCOL_BY_DRIVER.\r
If ProtocolGuid is NULL, then ASSERT().\r
\r
@param ControllerHandle A handle for a controller to test.\r
EFI_STATUS\r
EFIAPI\r
IScsiTestManagedDevice (\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_HANDLE DriverBindingHandle,\r
- IN EFI_GUID *ProtocolGuid\r
+ IN EFI_HANDLE ControllerHandle,\r
+ IN EFI_HANDLE DriverBindingHandle,\r
+ IN EFI_GUID *ProtocolGuid\r
);\r
+\r
#endif\r