TianoCore EDK2 master
|
#include "IScsiImpl.h"
Go to the source code of this file.
Variables | |
GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 | IScsiHexString [] = "0123456789ABCDEFabcdef" |
Miscellaneous routines for iSCSI driver.
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
Copyright (c) Microsoft Corporation SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file IScsiMisc.c.
EFI_STATUS IScsiAddNic | ( | IN EFI_HANDLE | Controller, |
IN EFI_HANDLE | Image | ||
) |
Record the NIC info in global structure.
[in] | Controller | The handle of the controller. |
[in] | Image | Handle of the image. |
EFI_SUCCESS | The operation is completed. |
EFI_OUT_OF_RESOURCES | Do not have sufficient resources to finish this operation. |
Definition at line 607 of file IScsiMisc.c.
EFI_STATUS IScsiAsciiStrToIp | ( | IN CHAR8 * | Str, |
IN UINT8 | IpMode, | ||
OUT EFI_IP_ADDRESS * | Ip | ||
) |
Convert the formatted IP address into the binary IP address.
[in] | Str | The UNICODE string. |
[in] | IpMode | Indicates whether the IP address is v4 or v6. |
[out] | Ip | The storage to return the ASCII string. |
EFI_SUCCESS | The binary IP address is returned in Ip. |
EFI_INVALID_PARAMETER | The IP string is malformatted or IpMode is invalid. |
Definition at line 248 of file IScsiMisc.c.
EFI_STATUS IScsiAsciiStrToLun | ( | IN CHAR8 * | Str, |
OUT UINT8 * | Lun | ||
) |
Convert the hexadecimal encoded LUN string into the 64-bit LUN.
[in] | Str | The hexadecimal encoded LUN string. |
[out] | Lun | Storage to return the 64-bit LUN. |
EFI_SUCCESS | The 64-bit LUN is stored in Lun. |
EFI_INVALID_PARAMETER | The string is malformatted. |
Definition at line 118 of file IScsiMisc.c.
EFI_STATUS IScsiBinToHex | ( | IN UINT8 * | BinBuffer, |
IN UINT32 | BinLength, | ||
IN OUT CHAR8 * | HexStr, | ||
IN OUT UINT32 * | HexLength | ||
) |
Convert the binary encoded buffer into a hexadecimal encoded string.
[in] | BinBuffer | The buffer containing the binary data. |
[in] | BinLength | Length of the binary buffer. |
[in,out] | HexStr | Pointer to the string. |
[in,out] | HexLength | The length of the string. |
EFI_SUCCESS | The binary data is converted to the hexadecimal string and the length of the string is updated. |
EFI_BUFFER_TOO_SMALL | The string is too small. |
EFI_BAD_BUFFER_SIZE | BinLength is too large for hex encoding. |
EFI_INVALID_PARAMETER | The IP string is malformatted. |
Definition at line 322 of file IScsiMisc.c.
EFI_STATUS IScsiCheckIpv6Support | ( | IN EFI_HANDLE | ControllerHandle, |
IN EFI_HANDLE | Image, | ||
OUT BOOLEAN * | Ipv6Support | ||
) |
Check whether UNDI protocol supports IPv6.
[in] | ControllerHandle | Controller handle. |
[in] | Image | Handle of the image. |
[out] | Ipv6Support | TRUE if UNDI supports IPv6. |
EFI_SUCCESS | Get the result whether UNDI supports IPv6 by NII or AIP protocol successfully. |
EFI_NOT_FOUND | Don't know whether UNDI supports IPv6 since NII or AIP is not available. |
Definition at line 503 of file IScsiMisc.c.
VOID IScsiCleanAttemptVariable | ( | IN | VOID | ) |
Free the attempt configure data variable.
Definition at line 1551 of file IScsiMisc.c.
EFI_STATUS IScsiCleanDriverData | ( | IN ISCSI_DRIVER_DATA * | Private | ) |
Clean the iSCSI driver data.
[in] | Private | The iSCSI driver data. |
EFI_SUCCESS | The clean operation is successful. |
Others | Other errors as indicated. |
Definition at line 1807 of file IScsiMisc.c.
EFI_STATUS IScsiCreateAttempts | ( | IN UINTN | AttemptNum | ) |
Create and initialize the Attempts.
[in] | AttemptNum | The number of Attempts will be created. |
EFI_SUCCESS | The Attempts have been created successfully. |
Others | Failed to create the Attempt. |
Definition at line 812 of file IScsiMisc.c.
ISCSI_DRIVER_DATA * IScsiCreateDriverData | ( | IN EFI_HANDLE | Image, |
IN EFI_HANDLE | Controller | ||
) |
Create the iSCSI driver data.
[in] | Image | The handle of the driver image. |
[in] | Controller | The handle of the controller. |
NULL | Other errors as indicated. |
Definition at line 1748 of file IScsiMisc.c.
EFI_STATUS IScsiCreateKeywords | ( | IN UINTN | KeywordNum | ) |
Create the iSCSI configuration Keywords for each attempt. You can find the keywords defined in the "x-UEFI-ns" namespace (http://www.uefi.org/confignamespace).
[in] | KeywordNum | The number Sets of Keywords will be created. |
EFI_SUCCESS | The operation is completed. |
Others | Failed to create the Keywords. |
Definition at line 949 of file IScsiMisc.c.
BOOLEAN IScsiDhcpIsConfigured | ( | IN EFI_HANDLE | Controller, |
IN UINT8 | IpVersion | ||
) |
Check wheather the Controller handle is configured to use DHCP protocol.
[in] | Controller | The handle of the controller. |
[in] | IpVersion | IP_VERSION_4 or IP_VERSION_6. |
TRUE | The handle of the controller need the Dhcp protocol. |
FALSE | The handle of the controller does not need the Dhcp protocol. |
Definition at line 1861 of file IScsiMisc.c.
BOOLEAN IScsiDnsIsConfigured | ( | IN EFI_HANDLE | Controller | ) |
Check whether the Controller handle is configured to use DNS protocol.
[in] | Controller | The handle of the controller. |
TRUE | The handle of the controller need the Dns protocol. |
FALSE | The handle of the controller does not need the Dns protocol. |
Definition at line 1964 of file IScsiMisc.c.
EFI_STATUS IScsiGenRandom | ( | IN OUT UINT8 * | Rand, |
IN UINTN | RandLength | ||
) |
Generate random numbers.
[in,out] | Rand | The buffer to contain random numbers. |
[in] | RandLength | The length of the Rand buffer. |
EFI_SUCCESS | on success |
others | on error |
Definition at line 483 of file IScsiMisc.c.
EFI_STATUS IScsiGetConfigData | ( | IN ISCSI_DRIVER_DATA * | Private | ) |
Get the various configuration data.
[in] | Private | The iSCSI driver data. |
EFI_SUCCESS | The configuration data is retrieved. |
EFI_NOT_FOUND | This iSCSI driver is not configured yet. |
EFI_OUT_OF_RESOURCES | Failed to allocate memory. |
Definition at line 2055 of file IScsiMisc.c.
ISCSI_NIC_INFO * IScsiGetNicInfoByIndex | ( | IN UINT8 | NicIndex | ) |
Get the recorded NIC info from global structure by the Index.
[in] | NicIndex | The index indicates the position of NIC info. |
Definition at line 1610 of file IScsiMisc.c.
UINT16 IScsiGetNICPciLocation | ( | IN EFI_HANDLE | Controller, |
OUT UINTN * | Bus, | ||
OUT UINTN * | Device, | ||
OUT UINTN * | Function | ||
) |
Get the NIC's PCI location and return it according to the composited format defined in iSCSI Boot Firmware Table.
[in] | Controller | The handle of the controller. |
[out] | Bus | The bus number. |
[out] | Device | The device number. |
[out] | Function | The function number. |
Definition at line 1640 of file IScsiMisc.c.
UINT8 IScsiGetSubnetMaskPrefixLength | ( | IN EFI_IPv4_ADDRESS * | SubnetMask | ) |
Calculate the prefix length of the IPv4 subnet mask.
[in] | SubnetMask | The IPv4 subnet mask. |
0 | Other errors as indicated. |
Definition at line 76 of file IScsiMisc.c.
EFI_DEVICE_PATH_PROTOCOL * IScsiGetTcpConnDevicePath | ( | IN ISCSI_SESSION * | Session | ) |
Get the device path of the iSCSI tcp connection and update it.
Session | The iSCSI session. |
NULL | Other errors as indicated. |
Definition at line 2408 of file IScsiMisc.c.
VOID * IScsiGetVariableAndSize | ( | IN CHAR16 * | Name, |
IN EFI_GUID * | VendorGuid, | ||
OUT UINTN * | VariableSize | ||
) |
Read the EFI variable (VendorGuid/Name) and return a dynamically allocated buffer, and the size of the buffer. If failure, return NULL.
[in] | Name | String part of EFI variable name. |
[in] | VendorGuid | GUID part of EFI variable name. |
[out] | VariableSize | Returns the size of the EFI variable that was read. |
NULL | Variable was not read. |
Definition at line 1698 of file IScsiMisc.c.
Convert the hexadecimal string into a binary encoded buffer.
[in,out] | BinBuffer | The binary buffer. |
[in,out] | BinLength | Length of the binary buffer. |
[in] | HexStr | The hexadecimal string. |
EFI_SUCCESS | The hexadecimal string is converted into a binary encoded buffer. |
EFI_INVALID_PARAMETER | Invalid hex encoding found in HexStr. |
EFI_BAD_BUFFER_SIZE | The length of HexStr is too large for decoding: the decoded size cannot be expressed in BinLength on output. |
EFI_BUFFER_TOO_SMALL | The binary buffer is too small to hold the converted data. |
Definition at line 385 of file IScsiMisc.c.
Convert the 64-bit LUN into the hexadecimal encoded LUN string.
[in] | Lun | The 64-bit LUN. |
[out] | Str | The storage to return the hexadecimal encoded LUN string. |
Definition at line 193 of file IScsiMisc.c.
VOID IScsiMacAddrToStr | ( | IN EFI_MAC_ADDRESS * | Mac, |
IN UINT32 | Len, | ||
IN UINT16 | VlanId, | ||
OUT CHAR16 * | Str | ||
) |
Convert the mac address into a hexadecimal encoded "-" separated string.
[in] | Mac | The mac address. |
[in] | Len | Length in bytes of the mac address. |
[in] | VlanId | VLAN ID of the network device. |
[out] | Str | The storage to return the mac string. |
Definition at line 282 of file IScsiMisc.c.
Convert the decimal-constant string or hex-constant string into a numerical value.
[in] | Str | String in decimal or hex. |
Definition at line 459 of file IScsiMisc.c.
Abort the session when the transition from BS to RT is initiated.
[in] | Event | The event signaled. |
[in] | Context | The iSCSI driver data. |
Definition at line 2523 of file IScsiMisc.c.
EFI_STATUS IScsiRemoveNic | ( | IN EFI_HANDLE | Controller | ) |
Delete the recorded NIC info from global structure. Also delete corresponding attempts.
[in] | Controller | The handle of the controller. |
EFI_SUCCESS | The operation is completed. |
EFI_NOT_FOUND | The NIC info to be deleted is not recorded. |
Definition at line 717 of file IScsiMisc.c.
Removes (trims) specified leading and trailing characters from a string.
[in,out] | Str | Pointer to the null-terminated string to be trimmed. On return, Str will hold the trimmed string. |
[in] | CharC | Character will be trimmed from str. |
Definition at line 24 of file IScsiMisc.c.
EFI_STATUS EFIAPI IScsiTestManagedDevice | ( | IN EFI_HANDLE | ControllerHandle, |
IN EFI_HANDLE | DriverBindingHandle, | ||
IN EFI_GUID * | ProtocolGuid | ||
) |
Tests whether a controller handle is being managed by IScsi driver.
This function tests whether the driver specified by DriverBindingHandle is currently managing the controller specified by ControllerHandle. This test is performed by evaluating if the protocol specified by ProtocolGuid is present on ControllerHandle and is was opened by DriverBindingHandle and Nic Device handle with an attribute of EFI_OPEN_PROTOCOL_BY_DRIVER. If ProtocolGuid is NULL, then ASSERT().
ControllerHandle | A handle for a controller to test. |
DriverBindingHandle | Specifies the driver binding handle for the driver. |
ProtocolGuid | Specifies the protocol that the driver specified by DriverBindingHandle opens in its Start() function. |
EFI_SUCCESS | ControllerHandle is managed by the driver specified by DriverBindingHandle. |
EFI_UNSUPPORTED | ControllerHandle is not managed by the driver specified by DriverBindingHandle. |
Definition at line 2565 of file IScsiMisc.c.
GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 IScsiHexString[] = "0123456789ABCDEFabcdef" |
Definition at line 12 of file IScsiMisc.c.