NetworkPkg/IScsiDxe/IScsiMisc.h File Reference


Data Structures

struct  _ISCSI_SESSION_CONFIG_NVDATA

Defines

#define IP4_NODE_LEN_NEW_VERSIONS   27
#define IP6_NODE_LEN_OLD_VERSIONS   43
#define IP6_NODE_LEN_NEW_VERSIONS   60
#define IP6_OLD_IPADDRESS_OFFSET   42

Typedefs

typedef struct _ISCSI_DRIVER_DATA ISCSI_DRIVER_DATA
typedef struct
_ISCSI_SESSION_CONFIG_NVDATA 
ISCSI_SESSION_CONFIG_NVDATA

Functions

UINT8 IScsiGetSubnetMaskPrefixLength (IN EFI_IPv4_ADDRESS *SubnetMask)
EFI_STATUS IScsiAsciiStrToLun (IN CHAR8 *Str, OUT UINT8 *Lun)
VOID IScsiLunToUnicodeStr (IN UINT8 *Lun, OUT CHAR16 *String)
VOID IScsiMacAddrToStr (IN EFI_MAC_ADDRESS *Mac, IN UINT32 Len, IN UINT16 VlanId, OUT CHAR16 *Str)
EFI_STATUS IScsiAsciiStrToIp (IN CHAR8 *Str, IN UINT8 IpMode, OUT EFI_IP_ADDRESS *Ip)
EFI_STATUS IScsiBinToHex (IN UINT8 *BinBuffer, IN UINT32 BinLength, IN OUT CHAR8 *HexStr, IN OUT UINT32 *HexLength)
EFI_STATUS IScsiHexToBin (IN OUT UINT8 *BinBuffer, IN OUT UINT32 *BinLength, IN CHAR8 *HexStr)
UINTN IScsiNetNtoi (IN CHAR8 *Str)
VOID IScsiGenRandom (IN OUT UINT8 *Rand, IN UINTN RandLength)
EFI_STATUS IScsiAddNic (IN EFI_HANDLE Controller)
EFI_STATUS IScsiRemoveNic (IN EFI_HANDLE Controller)
ISCSI_NIC_INFOIScsiGetNicInfoByIndex (IN UINT8 NicIndex)
UINT16 IScsiGetNICPciLocation (IN EFI_HANDLE Controller, OUT UINTN *Bus, OUT UINTN *Device, OUT UINTN *Function)
VOID * IScsiGetVariableAndSize (IN CHAR16 *Name, IN EFI_GUID *VendorGuid, OUT UINTN *VariableSize)
ISCSI_DRIVER_DATAIScsiCreateDriverData (IN EFI_HANDLE Image, IN EFI_HANDLE Controller)
VOID IScsiCleanDriverData (IN ISCSI_DRIVER_DATA *Private)
BOOLEAN IScsiDhcpIsConfigured (IN EFI_HANDLE Controller, IN UINT8 IpVersion)
EFI_STATUS IScsiGetConfigData (IN ISCSI_DRIVER_DATA *Private)
EFI_DEVICE_PATH_PROTOCOL * IScsiGetTcpConnDevicePath (IN ISCSI_SESSION *Session)
VOID EFIAPI IScsiOnExitBootService (IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS EFIAPI IScsiTestManagedDevice (IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE DriverBindingHandle, IN EFI_GUID *ProtocolGuid)

Detailed Description

Miscellaneous definitions for iSCSI driver.

Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.


Define Documentation

#define IP4_NODE_LEN_NEW_VERSIONS   27

IPv4 Device Path Node Length

Referenced by IScsiGetTcpConnDevicePath().

#define IP6_NODE_LEN_NEW_VERSIONS   60

#define IP6_NODE_LEN_OLD_VERSIONS   43

IPv6 Device Path Node Length

Referenced by IScsiGetTcpConnDevicePath().

#define IP6_OLD_IPADDRESS_OFFSET   42

The ignored field StaticIpAddress's offset in old IPv6 Device Path

Referenced by IScsiGetTcpConnDevicePath().


Typedef Documentation


Function Documentation

EFI_STATUS IScsiAddNic ( IN EFI_HANDLE  Controller  ) 

Record the NIC information in a global structure.

Parameters:
[in] Controller The handle of the controller.
Return values:
EFI_SUCCESS The operation is completed.
EFI_OUT_OF_RESOURCES Do not have sufficient resource to finish this operation.
Record the NIC info in global structure.

Parameters:
[in] Controller The handle of the controller.
Return values:
EFI_SUCCESS The operation is completed.
EFI_OUT_OF_RESOURCES Do not have sufficient resources to finish this operation.

References ISCSI_NIC_INFO::BusNumber, ISCSI_PRIVATE_DATA::CurrentNic, ISCSI_NIC_INFO::DeviceNumber, ISCSI_NIC_INFO::FunctionNumber, ISCSI_NIC_INFO::HwAddressSize, IScsiGetNICPciLocation(), ISCSI_NIC_INFO::Link, ISCSI_PRIVATE_DATA::MaxNic, mPrivate, ISCSI_PRIVATE_DATA::NicCount, ISCSI_NIC_INFO::NicIndex, ISCSI_PRIVATE_DATA::NicInfoList, ISCSI_NIC_INFO::PermanentAddress, and ISCSI_NIC_INFO::VlanId.

Referenced by IScsiStart().

EFI_STATUS IScsiAsciiStrToIp ( IN CHAR8 *  Str,
IN UINT8  IpMode,
OUT EFI_IP_ADDRESS *  Ip 
)

Convert the formatted IP address into the binary IP address.

Parameters:
[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.
Return values:
EFI_SUCCESS The binary IP address is returned in Ip.
EFI_INVALID_PARAMETER The IP string is malformatted or IpMode is invalid.

References IP_MODE_AUTOCONFIG, IP_MODE_AUTOCONFIG_IP4, IP_MODE_AUTOCONFIG_IP6, IP_MODE_IP4, and IP_MODE_IP6.

Referenced by IScsiDhcp6ExtractRootPath(), IScsiDhcpExtractRootPath(), IScsiFormCallback(), and IScsiUpdateTargetAddress().

EFI_STATUS IScsiAsciiStrToLun ( IN CHAR8 *  Str,
OUT UINT8 *  Lun 
)

Convert the hexadecimal encoded LUN string into the 64-bit LUN.

Parameters:
[in] Str The hexadecimal encoded LUN string.
[out] Lun Storage to return the 64-bit LUN.
Return values:
EFI_SUCCESS The 64-bit LUN is stored in Lun.
EFI_INVALID_PARAMETER The string is malformatted.
Convert the hexadecimal encoded LUN string into the 64-bit LUN.

Parameters:
[in] Str The hexadecimal encoded LUN string.
[out] Lun Storage to return the 64-bit LUN.
Return values:
EFI_SUCCESS The 64-bit LUN is stored in Lun.
EFI_INVALID_PARAMETER The string is malformatted.

Referenced by IScsiDhcp6ExtractRootPath(), IScsiDhcpExtractRootPath(), and IScsiFormCallback().

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.

Parameters:
[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.
Return values:
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_INVALID_PARAMETER The IP string is malformatted.

References IScsiHexString.

Referenced by IScsiCHAPToSendReq().

VOID IScsiCleanDriverData ( IN ISCSI_DRIVER_DATA Private  ) 

Clean the iSCSI driver data.

Parameters:
[in] Private The iSCSI driver data.

References mPrivate, and ISCSI_PRIVATE_DATA::OneSessionEstablished.

Referenced by IScsiStart(), and IScsiStop().

ISCSI_DRIVER_DATA* IScsiCreateDriverData ( IN EFI_HANDLE  Image,
IN EFI_HANDLE  Controller 
)

Create the iSCSI driver data.

Parameters:
[in] Image The handle of the driver image.
[in] Controller The handle of the controller.
Returns:
The iSCSI driver data created.
Return values:
NULL Other errors as indicated.

References _ISCSI_DRIVER_DATA::Controller, _ISCSI_DRIVER_DATA::ExitBootServiceEvent, _ISCSI_DRIVER_DATA::ExtScsiPassThruHandle, _ISCSI_DRIVER_DATA::ExtScsiPassThruMode, gIScsiExtScsiPassThruProtocolTemplate, _ISCSI_DRIVER_DATA::Image, ISCSI_DRIVER_DATA_SIGNATURE, _ISCSI_DRIVER_DATA::IScsiExtScsiPassThru, IScsiOnExitBootService(), _ISCSI_DRIVER_DATA::Session, and _ISCSI_DRIVER_DATA::Signature.

Referenced by IScsiStart().

BOOLEAN IScsiDhcpIsConfigured ( IN EFI_HANDLE  Controller,
IN UINT8  IpVersion 
)

Check wheather the Controller handle is configured to use DHCP protocol.

Parameters:
[in] Controller The handle of the controller.
[in] IpVersion IP_VERSION_4 or IP_VERSION_6.
Return values:
TRUE The handle of the controller need the Dhcp protocol.
FALSE The handle of the controller does not need the Dhcp protocol.

References gIScsiConfigGuid, IP_MODE_AUTOCONFIG, IP_MODE_IP4, IP_MODE_IP6, ISCSI_DISABLED, ISCSI_MAX_MAC_STRING_LEN, ISCSI_NAME_IFR_MAX_SIZE, IScsiGetVariableAndSize(), and IScsiMacAddrToStr().

Referenced by IScsiSupported().

VOID IScsiGenRandom ( IN OUT UINT8 *  Rand,
IN UINTN  RandLength 
)

Generate random numbers.

Parameters:
[in,out] Rand The buffer to contain random numbers.
[in] RandLength The length of the Rand buffer.

Referenced by IScsiCHAPToSendReq().

EFI_STATUS IScsiGetConfigData ( IN ISCSI_DRIVER_DATA Private  ) 

Get the various configuration data of this iSCSI instance.

Parameters:
[in] Private The iSCSI driver data.
Return values:
EFI_SUCCESS Obtained the configuration of this instance.
EFI_ABORTED The operation was aborted.
Others Other errors as indicated.
Get the various configuration data.

Parameters:
[in] Private The iSCSI driver data.
Return values:
EFI_SUCCESS The configuration data is retrieved.
EFI_NOT_FOUND This iSCSI driver is not configured yet.

References _ISCSI_ATTEMPT_CONFIG_NVDATA::AttemptConfigIndex, ISCSI_PRIVATE_DATA::AttemptConfigs, ISCSI_PRIVATE_DATA::AttemptCount, _ISCSI_ATTEMPT_CONFIG_NVDATA::AutoConfigureMode, _ISCSI_ATTEMPT_CONFIG_NVDATA::AutoConfigureSuccess, ISCSI_NIC_INFO::BusNumber, ISCSI_PRIVATE_DATA::CurrentNic, ISCSI_NIC_INFO::DeviceNumber, _ISCSI_ATTEMPT_CONFIG_NVDATA::DhcpSuccess, _ISCSI_SESSION_CONFIG_NVDATA::Enabled, ISCSI_PRIVATE_DATA::EnableMpio, ISCSI_NIC_INFO::FunctionNumber, gIScsiConfigGuid, gIScsiInitiatorName, ISCSI_NIC_INFO::HwAddressSize, _ISCSI_SESSION_CONFIG_NVDATA::InitiatorInfoFromDhcp, ISCSI_PRIVATE_DATA::InitiatorName, ISCSI_PRIVATE_DATA::InitiatorNameLength, IP_MODE_AUTOCONFIG, IP_MODE_AUTOCONFIG_IP4, IP_MODE_AUTOCONFIG_IP6, IP_MODE_IP4, IP_MODE_IP6, _ISCSI_SESSION_CONFIG_NVDATA::IpMode, IpMode, ISCSI_PRIVATE_DATA::Ipv6Flag, ISCSI_AUTH_TYPE_KRB, ISCSI_CONFIG_VAR_ATTR, ISCSI_DISABLED, ISCSI_ENABLED, ISCSI_ENABLED_FOR_MPIO, ISCSI_MAX_MAC_STRING_LEN, ISCSI_NAME_IFR_MAX_SIZE, ISCSI_NAME_MAX_SIZE, IScsiConfigGetAttemptByConfigIndex(), IScsiConfigUpdateAttempt(), IScsiDoDhcp(), IScsiDoDhcp6(), IScsiGetNicInfoByIndex(), IScsiGetVariableAndSize(), IScsiMacAddrToStr(), ISCSI_PRIVATE_DATA::Krb5MpioCount, _ISCSI_ATTEMPT_CONFIG_NVDATA::Link, _ISCSI_ATTEMPT_CONFIG_NVDATA::MacString, mCallbackInfo, ISCSI_PRIVATE_DATA::MpioCount, mPrivate, ISCSI_NIC_INFO::NicIndex, ISCSI_NIC_INFO::PermanentAddress, ISCSI_PRIVATE_DATA::PortString, _ISCSI_FORM_CALLBACK_INFO::RegisteredHandle, _ISCSI_ATTEMPT_CONFIG_NVDATA::SessionConfigData, ISCSI_PRIVATE_DATA::SinglePathCount, _ISCSI_SESSION_CONFIG_NVDATA::TargetInfoFromDhcp, _ISCSI_ATTEMPT_CONFIG_NVDATA::ValidPath, ISCSI_PRIVATE_DATA::ValidSinglePathCount, and ISCSI_NIC_INFO::VlanId.

Referenced by IScsiStart().

ISCSI_NIC_INFO* IScsiGetNicInfoByIndex ( IN UINT8  NicIndex  ) 

Get the recorded NIC information from a global structure by the Index.

Parameters:
[in] NicIndex The index indicates the position of NIC info.
Returns:
Pointer to the NIC info or NULL if not found.
Get the recorded NIC info from global structure by the Index.

Parameters:
[in] NicIndex The index indicates the position of NIC info.
Returns:
Pointer to the NIC info, or NULL if not found.

References mPrivate, ISCSI_NIC_INFO::NicIndex, and ISCSI_PRIVATE_DATA::NicInfoList.

Referenced by IScsiConfigProcessDefault(), IScsiConvertIfrNvDataToAttemptConfigData(), IScsiFillNICAndTargetSections(), and IScsiGetConfigData().

UINT16 IScsiGetNICPciLocation ( IN EFI_HANDLE  Controller,
OUT UINTN *  Bus,
OUT UINTN *  Device,
OUT UINTN *  Function 
)

Get the NIC's PCI location and return it accroding to the composited format defined in iSCSI Boot Firmware Table.

Parameters:
[in] Controller The handle of the controller.
[out] Bus The bus number.
[out] Device The device number.
[out] Function The function number.
Returns:
The composited representation of the NIC PCI location.

Referenced by IScsiAddNic().

UINT8 IScsiGetSubnetMaskPrefixLength ( IN EFI_IPv4_ADDRESS *  SubnetMask  ) 

Calculate the prefix length of the IPv4 subnet mask.

Parameters:
[in] SubnetMask The IPv4 subnet mask.
Returns:
The prefix length of the subnet mask.
Return values:
0 Other errors as indicated.
Calculate the prefix length of the IPv4 subnet mask.

Parameters:
[in] SubnetMask The IPv4 subnet mask.
Returns:
The prefix length of the subnet mask.
Return values:
0 Other errors as indicated.

Referenced by IScsiFillNICAndTargetSections(), and IScsiFormCallback().

EFI_DEVICE_PATH_PROTOCOL* IScsiGetTcpConnDevicePath ( IN ISCSI_SESSION Session  ) 

Get the device path of the iSCSI tcp connection and update it.

Parameters:
[in] Session The iSCSI session data.
Returns:
The updated device path.
Return values:
NULL Other errors as indicated.
Get the device path of the iSCSI tcp connection and update it.

Parameters:
Session The iSCSI session.
Returns:
The updated device path.
Return values:
NULL Other errors as indicated.

References IP4_NODE_LEN_NEW_VERSIONS, IP6_NODE_LEN_NEW_VERSIONS, IP6_NODE_LEN_OLD_VERSIONS, IP6_OLD_IPADDRESS_OFFSET, _ISCSI_CONNECTION::Ipv6Flag, ISCSI_CONNECTION_SIGNATURE, SESSION_STATE_LOGGED_IN, and _ISCSI_CONNECTION::TcpIo.

Referenced by IScsiStart().

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.

Parameters:
[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.
Returns:
Dynamically allocated memory that contains a copy of the EFI variable.

Caller is responsible freeing the buffer.

Return values:
NULL Variable was not read.

Referenced by IScsiConfigDeleteAttempts(), IScsiConfigDisplayDeleteAttempts(), IScsiConfigOrderAttempts(), IScsiConfigProcessDefault(), IScsiConvertIfrNvDataToAttemptConfigData(), IScsiDhcpIsConfigured(), IScsiGetConfigData(), and IScsiStart().

EFI_STATUS IScsiHexToBin ( IN OUT UINT8 *  BinBuffer,
IN OUT UINT32 *  BinLength,
IN CHAR8 *  HexStr 
)

Convert the hexadecimal string into a binary encoded buffer.

Parameters:
[in,out] BinBuffer The binary buffer.
[in,out] BinLength Length of the binary buffer.
[in] HexStr The hexadecimal string.
Return values:
EFI_SUCCESS The hexadecimal string is converted into a binary encoded buffer.
EFI_BUFFER_TOO_SMALL The binary buffer is too small to hold the converted data.

Referenced by IScsiCHAPOnRspReceived().

VOID IScsiLunToUnicodeStr ( IN UINT8 *  Lun,
OUT CHAR16 *  Str 
)

Convert the 64-bit LUN into the hexadecimal encoded LUN string.

Parameters:
[in] Lun The 64-bit LUN.
[out] String The storage to return the hexadecimal encoded LUN string.
Convert the 64-bit LUN into the hexadecimal encoded LUN string.

Parameters:
[in] Lun The 64-bit LUN.
[out] Str The storage to return the hexadecimal encoded LUN string.

References IScsiHexString, and IScsiStrTrim().

Referenced by IScsiConvertAttemptConfigDataToIfrNvData().

VOID IScsiMacAddrToStr ( IN EFI_MAC_ADDRESS *  Mac,
IN UINT32  Len,
IN UINT16  VlanId,
OUT CHAR16 *  Str 
)

Convert the mac address into a hexadecimal encoded "-" seperated string.

Parameters:
[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.

References IScsiHexString.

Referenced by IScsiConfigAddAttempt(), IScsiConfigProcessDefault(), IScsiDhcpIsConfigured(), and IScsiGetConfigData().

UINTN IScsiNetNtoi ( IN CHAR8 *  Str  ) 

Convert the decimal-constant string or hex-constant string into a numerical value.

Parameters:
[in] Str String in decimal or hex.
Returns:
The numerical value.

Referenced by IScsiCHAPOnRspReceived(), and IScsiCheckOpParams().

VOID EFIAPI IScsiOnExitBootService ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Abort the session when the transition from BS to RT is initiated.

Parameters:
[in] Event The event signaled.
[in] Context The iSCSI driver data.

References _ISCSI_DRIVER_DATA::ExitBootServiceEvent, IScsiSessionAbort(), and _ISCSI_DRIVER_DATA::Session.

Referenced by IScsiCreateDriverData().

EFI_STATUS IScsiRemoveNic ( IN EFI_HANDLE  Controller  ) 

Delete the recorded NIC information from a global structure. Also delete corresponding attempts.

Parameters:
[in] Controller The handle of the controller.
Return values:
EFI_SUCCESS The operation completed.
EFI_NOT_FOUND The NIC information to be deleted is not recorded.
Delete the recorded NIC info from global structure. Also delete corresponding attempts.

Parameters:
[in] Controller The handle of the controller.
Return values:
EFI_SUCCESS The operation is completed.
EFI_NOT_FOUND The NIC info to be deleted is not recorded.

References ISCSI_PRIVATE_DATA::AttemptConfigs, ISCSI_PRIVATE_DATA::AttemptCount, _ISCSI_ATTEMPT_CONFIG_NVDATA::AuthenticationType, ISCSI_PRIVATE_DATA::CurrentNic, _ISCSI_SESSION_CONFIG_NVDATA::Enabled, ISCSI_PRIVATE_DATA::EnableMpio, ISCSI_NIC_INFO::HwAddressSize, ISCSI_AUTH_TYPE_KRB, ISCSI_ENABLED, ISCSI_ENABLED_FOR_MPIO, ISCSI_PRIVATE_DATA::Krb5MpioCount, _ISCSI_ATTEMPT_CONFIG_NVDATA::Link, ISCSI_NIC_INFO::Link, ISCSI_PRIVATE_DATA::MpioCount, mPrivate, ISCSI_PRIVATE_DATA::NewAttempt, ISCSI_PRIVATE_DATA::NicCount, _ISCSI_ATTEMPT_CONFIG_NVDATA::NicIndex, ISCSI_NIC_INFO::NicIndex, ISCSI_PRIVATE_DATA::NicInfoList, ISCSI_NIC_INFO::PermanentAddress, _ISCSI_ATTEMPT_CONFIG_NVDATA::SessionConfigData, ISCSI_PRIVATE_DATA::SinglePathCount, ISCSI_PRIVATE_DATA::ValidSinglePathCount, and ISCSI_NIC_INFO::VlanId.

Referenced by IScsiStart(), and IScsiStop().

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 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().

Parameters:
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.
Return values:
EFI_SUCCESS ControllerHandle is managed by the driver specified by DriverBindingHandle.
EFI_UNSUPPORTED ControllerHandle is not managed by the driver specified by DriverBindingHandle.

Referenced by IScsiUnload().


Generated on Mon Sep 28 08:49:06 2015 for NetworkPkg[ALL] by  doxygen 1.5.7.1