2 Miscellaneous definitions for IScsi driver.
4 Copyright (c) 2004 - 2008, Intel Corporation
5 All rights reserved. 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
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.
19 Miscellaneous definitions for IScsi driver.
23 #ifndef _ISCSI_MISC_H_
24 #define _ISCSI_MISC_H_
27 typedef struct _ISCSI_SESSION_CONFIG_NVDATA
{
30 BOOLEAN InitiatorInfoFromDhcp
;
31 EFI_IPv4_ADDRESS LocalIp
;
32 EFI_IPv4_ADDRESS SubnetMask
;
33 EFI_IPv4_ADDRESS Gateway
;
35 BOOLEAN TargetInfoFromDhcp
;
36 CHAR8 TargetName
[ISCSI_NAME_MAX_SIZE
];
37 EFI_IPv4_ADDRESS TargetIp
;
40 } ISCSI_SESSION_CONFIG_NVDATA
;
43 struct _ISCSI_SESSION_CONFIG_DATA
{
44 ISCSI_SESSION_CONFIG_NVDATA NvData
;
46 EFI_IPv4_ADDRESS PrimaryDns
;
47 EFI_IPv4_ADDRESS SecondaryDns
;
48 EFI_IPv4_ADDRESS DhcpServer
;
52 Calculate the prefix length of the IPv4 subnet mask.
54 @param SubnetMask[in] The IPv4 subnet mask.
56 @retval UINT8 The prefix length of the subnet mask.
60 IScsiGetSubnetMaskPrefixLength (
61 IN EFI_IPv4_ADDRESS
*SubnetMask
65 Convert the hexadecimal encoded LUN string into the 64-bit LUN.
67 @param Str[in] The hexadecimal encoded LUN string.
69 @param Lun[out] Storage to return the 64-bit LUN.
71 @retval EFI_SUCCESS The 64-bit LUN is stored in Lun.
73 @retval EFI_INVALID_PARAMETER The string is malformatted.
83 Convert the 64-bit LUN into the hexadecimal encoded LUN string.
85 @param Lun[in] The 64-bit LUN.
87 @param Str[out] The storage to return the hexadecimal encoded LUN string.
93 IScsiLunToUnicodeStr (
99 Convert the ASCII string into a UNICODE string.
101 @param Source[out] The ASCII string.
103 @param Destination[out] The storage to return the UNICODE string.
105 @retval CHAR16 * Pointer to the UNICODE string.
109 IScsiAsciiStrToUnicodeStr (
111 OUT CHAR16
*Destination
115 Convert the UNICODE string into an ASCII string.
117 @param Source[in] The UNICODE string.
119 @param Destination[out] The storage to return the ASCII string.
121 @retval CHAR8 * Pointer to the ASCII string.
125 IScsiUnicodeStrToAsciiStr (
127 OUT CHAR8
*Destination
131 Convert the mac address into a hexadecimal encoded "-" seperated string.
133 @param Mac[in] The mac address.
135 @param Len[in] Length in bytes of the mac address.
137 @param Str[out] The storage to return the mac string.
144 IN EFI_MAC_ADDRESS
*Mac
,
150 Convert the decimal dotted IPv4 address into the binary IPv4 address.
152 @param Str[in] The UNICODE string.
154 @param Ip[out] The storage to return the ASCII string.
156 @retval EFI_SUCCESS The binary IP address is returned in Ip.
158 @retval EFI_INVALID_PARAMETER The IP string is malformatted.
164 OUT EFI_IPv4_ADDRESS
*Ip
168 Convert the binary encoded buffer into a hexadecimal encoded string.
170 @param BinBuffer[in] The buffer containing the binary data.
172 @param BinLength[in] Length of the binary buffer.
174 @param HexStr[in][out] Pointer to the string.
176 @param HexLength[in][out] The length of the string.
178 @retval EFI_SUCCESS The binary data is converted to the hexadecimal string
179 and the length of the string is updated.
181 @retval EFI_BUFFER_TOO_SMALL The string is too small.
188 IN OUT CHAR8
*HexStr
,
189 IN OUT UINT32
*HexLength
193 Convert the hexadecimal string into a binary encoded buffer.
195 @param BinBuffer[in][out] The binary buffer.
197 @param BinLength[in][out] Length of the binary buffer.
199 @param HexStr[in] The hexadecimal string.
201 @retval EFI_SUCCESS The hexadecimal string is converted into a binary
204 @retval EFI_BUFFER_TOO_SMALL The binary buffer is too small to hold the converted data.s
209 IN OUT UINT8
*BinBuffer
,
210 IN OUT UINT32
*BinLength
,
215 Generate random numbers.
217 @param Rand[in][out] The buffer to contain random numbers.
219 @param RandLength[in] The length of the Rand buffer.
231 Create the iSCSI driver data..
233 @param Image[in] The handle of the driver image.
235 @param Controller[in] The handle of the controller.
237 @retval The iSCSI driver data created.
241 IScsiCreateDriverData (
243 IN EFI_HANDLE Controller
247 Clean the iSCSI driver data.
249 @param Private[in] The iSCSI driver data.
255 IScsiCleanDriverData (
256 IN ISCSI_DRIVER_DATA
*Private
261 Get the various configuration data of this iSCSI instance.
263 @param Private[in] The iSCSI driver data.
265 @retval EFI_SUCCESS The configuration of this instance is got.
267 @retval EFI_NOT_FOUND This iSCSI instance is not configured yet.
272 IN ISCSI_DRIVER_DATA
*Private
276 Get the device path of the iSCSI tcp connection and update it.
278 @param Private[in] The iSCSI driver data.
280 @retval The updated device path.
283 EFI_DEVICE_PATH_PROTOCOL
*
284 IScsiGetTcpConnDevicePath (
285 IN ISCSI_DRIVER_DATA
*Private
289 Abort the session when the transition from BS to RT is initiated.
291 @param Event[in] The event signaled.
293 @param Context[in] The iSCSI driver data.
300 IScsiOnExitBootService (
305 extern CHAR16
NibbleToHexChar(UINT8 Nibble
);