39 for (Pointer1 = Str; (*Pointer1 != 0) && (*Pointer1 == CharC); Pointer1++) {
43 if (Pointer2 == Pointer1) {
44 while (*Pointer1 != 0) {
49 while (*Pointer1 != 0) {
50 *Pointer2 = *Pointer1;
58 for (Pointer1 = Str +
StrLen (Str) - 1; Pointer1 >= Str && *Pointer1 == CharC; Pointer1--) {
61 if (Pointer1 != Str +
StrLen (Str) - 1) {
86 ReverseMask = (SubnetMask->Addr[0] << 24) | (SubnetMask->Addr[1] << 16) | (SubnetMask->Addr[2] << 8) | (SubnetMask->Addr[3]);
91 ReverseMask = ~ReverseMask;
93 if ((ReverseMask & (ReverseMask + 1)) != 0) {
99 while (ReverseMask != 0) {
100 ReverseMask = ReverseMask >> 1;
104 return (UINT8)(32 - Len);
123 UINTN Index, IndexValue, IndexNum, SizeStr;
130 ZeroMem ((UINT8 *)Value,
sizeof (Value));
135 for (Index = 0; Index < SizeStr; Index++) {
136 TemStr[0] = Str[Index];
138 if ((TemValue == 0) && (TemStr[0] !=
'0')) {
139 if ((TemStr[0] !=
'-') || (IndexNum == 0)) {
143 return EFI_INVALID_PARAMETER;
147 if ((TemValue == 0) && (TemStr[0] ==
'-')) {
151 if (++IndexValue >= 4) {
155 return EFI_INVALID_PARAMETER;
165 if (++IndexNum > 4) {
169 return EFI_INVALID_PARAMETER;
175 Value[IndexValue] = (UINT16)((Value[IndexValue] << 4) + TemValue);
178 for (Index = 0; Index <= IndexValue; Index++) {
179 *((UINT16 *)&Lun[Index * 2]) = HTONS (Value[Index]);
203 for (Index = 0; Index < 4; Index++) {
204 if ((Lun[2 * Index] | Lun[2 * Index + 1]) == 0) {
205 CopyMem (TempStr, L
"0-",
sizeof (L
"0-"));
207 TempStr[0] = (CHAR16)IScsiHexString[Lun[2 * Index] >> 4];
208 TempStr[1] = (CHAR16)IScsiHexString[Lun[2 * Index] & 0x0F];
209 TempStr[2] = (CHAR16)IScsiHexString[Lun[2 * Index + 1] >> 4];
210 TempStr[3] = (CHAR16)IScsiHexString[Lun[2 * Index + 1] & 0x0F];
217 TempStr +=
StrLen (TempStr);
223 ASSERT (
StrLen (Str) >= 1);
224 Str[
StrLen (Str) - 1] = 0;
226 for (Index =
StrLen (Str) - 1; Index > 1; Index = Index - 2) {
227 if ((Str[Index] == L
'0') && (Str[Index - 1] == L
'-')) {
256 if ((IpMode == IP_MODE_IP4) || (IpMode == IP_MODE_AUTOCONFIG_IP4)) {
258 }
else if ((IpMode == IP_MODE_IP6) || (IpMode == IP_MODE_AUTOCONFIG_IP6)) {
260 }
else if (IpMode == IP_MODE_AUTOCONFIG) {
262 if (!EFI_ERROR (Status)) {
269 return EFI_INVALID_PARAMETER;
292 for (Index = 0; Index < Len; Index++) {
293 Str[3 * Index] = (CHAR16)IScsiHexString[(Mac->Addr[Index] >> 4) & 0x0F];
294 Str[3 * Index + 1] = (CHAR16)IScsiHexString[Mac->Addr[Index] & 0x0F];
295 Str[3 * Index + 2] = L
':';
298 String = &Str[3 * Index - 1];
325 IN OUT CHAR8 *HexStr,
326 IN OUT UINT32 *HexLength
330 UINT32 HexLengthProvided;
333 if ((HexStr ==
NULL) || (BinBuffer ==
NULL) || (BinLength == 0)) {
334 return EFI_INVALID_PARAMETER;
343 return EFI_BAD_BUFFER_SIZE;
346 HexLengthProvided = *HexLength;
347 *HexLength = HexLengthMin;
348 if (HexLengthProvided < HexLengthMin) {
349 return EFI_BUFFER_TOO_SMALL;
358 for (Index = 0; Index < BinLength; Index++) {
359 HexStr[Index * 2 + 2] = IScsiHexString[BinBuffer[Index] >> 4];
360 HexStr[Index * 2 + 3] = IScsiHexString[BinBuffer[Index] & 0xf];
363 HexStr[Index * 2 + 2] =
'\0';
386 IN OUT UINT8 *BinBuffer,
387 IN OUT UINT32 *BinLength,
392 UINT32 BinLengthProvided;
398 ZeroMem (TemStr,
sizeof (TemStr));
403 if ((HexStr[0] ==
'0') && ((HexStr[1] ==
'x') || (HexStr[1] ==
'X'))) {
412 if ((Length == 0) || (Length % 2 != 0)) {
413 return EFI_INVALID_PARAMETER;
419 BinLengthMin = Length / 2;
420 if (BinLengthMin > MAX_UINT32) {
421 return EFI_BAD_BUFFER_SIZE;
424 BinLengthProvided = *BinLength;
425 *BinLength = (UINT32)BinLengthMin;
426 if (BinLengthProvided < BinLengthMin) {
427 return EFI_BUFFER_TOO_SMALL;
430 for (Index = 0; Index < Length; Index++) {
431 TemStr[0] = HexStr[Index];
433 if ((Digit == 0) && (TemStr[0] !=
'0')) {
437 return EFI_INVALID_PARAMETER;
440 if ((Index & 1) == 0) {
441 BinBuffer[Index/2] = Digit;
443 BinBuffer[Index/2] = (UINT8)((BinBuffer[Index/2] << 4) + Digit);
463 if ((Str[0] ==
'0') && ((Str[1] ==
'x') || (Str[1] ==
'X'))) {
506 OUT BOOLEAN *Ipv6Support
513 UINTN InfoTypeBufferCount;
521 ASSERT (Ipv6Support !=
NULL);
526 Status =
gBS->OpenProtocol (
528 &gEfiNetworkInterfaceIdentifierProtocolGuid_31,
532 EFI_OPEN_PROTOCOL_GET_PROTOCOL
543 if (Handle ==
NULL) {
544 return EFI_NOT_FOUND;
548 Status =
gBS->HandleProtocol (
550 &gEfiAdapterInformationProtocolGuid,
553 if (EFI_ERROR (Status) || (Aip ==
NULL)) {
554 return EFI_NOT_FOUND;
557 InfoTypesBuffer =
NULL;
558 InfoTypeBufferCount = 0;
559 Status = Aip->GetSupportedTypes (Aip, &InfoTypesBuffer, &InfoTypeBufferCount);
560 if (EFI_ERROR (Status) || (InfoTypesBuffer ==
NULL)) {
562 return EFI_NOT_FOUND;
566 for (TypeIndex = 0; TypeIndex < InfoTypeBufferCount; TypeIndex++) {
567 if (
CompareGuid (&InfoTypesBuffer[TypeIndex], &gEfiAdapterInfoUndiIpv6SupportGuid)) {
575 return EFI_NOT_FOUND;
583 Status = Aip->GetInformation (Aip, &gEfiAdapterInfoUndiIpv6SupportGuid, &InfoBlock, &InfoBlockSize);
584 if (EFI_ERROR (Status) || (InfoBlock ==
NULL)) {
586 return EFI_NOT_FOUND;
623 if (EFI_ERROR (Status)) {
635 NET_LIST_FOR_EACH (Entry, &mPrivate->NicInfoList) {
637 if ((NicInfo->HwAddressSize == HwAddressSize) &&
638 (
CompareMem (&NicInfo->PermanentAddress, MacAddr.Addr, HwAddressSize) == 0) &&
639 (NicInfo->VlanId == VlanId))
641 mPrivate->CurrentNic = NicInfo->NicIndex;
647 if (EFI_ERROR (Status)) {
652 NicInfo->Ipv6Available =
TRUE;
658 if (mPrivate->MaxNic < NicInfo->NicIndex) {
659 mPrivate->MaxNic = NicInfo->NicIndex;
667 if (NicInfo ==
NULL) {
668 return EFI_OUT_OF_RESOURCES;
671 CopyMem (&NicInfo->PermanentAddress, MacAddr.Addr, HwAddressSize);
672 NicInfo->HwAddressSize = (UINT32)HwAddressSize;
673 NicInfo->VlanId = VlanId;
674 NicInfo->NicIndex = (UINT8)(mPrivate->MaxNic + 1);
675 mPrivate->MaxNic = NicInfo->NicIndex;
681 if (EFI_ERROR (Status)) {
686 NicInfo->Ipv6Available =
TRUE;
695 &NicInfo->DeviceNumber,
696 &NicInfo->FunctionNumber
700 mPrivate->NicCount++;
702 mPrivate->CurrentNic = NicInfo->NicIndex;
735 if (EFI_ERROR (Status)) {
749 NET_LIST_FOR_EACH (Entry, &mPrivate->NicInfoList) {
751 if ((NicInfo->HwAddressSize == HwAddressSize) &&
752 (
CompareMem (&NicInfo->PermanentAddress, MacAddr.Addr, HwAddressSize) == 0) &&
753 (NicInfo->VlanId == VlanId))
760 if (ThisNic ==
NULL) {
761 return EFI_NOT_FOUND;
764 mPrivate->CurrentNic = ThisNic->NicIndex;
768 mPrivate->NicCount--;
773 NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &mPrivate->AttemptConfigs) {
775 if (AttemptConfigData->NicIndex == mPrivate->CurrentNic) {
777 mPrivate->AttemptCount--;
779 if ((AttemptConfigData->SessionConfigData.Enabled == ISCSI_ENABLED_FOR_MPIO) && (mPrivate->MpioCount > 0)) {
780 if (--mPrivate->MpioCount == 0) {
781 mPrivate->EnableMpio =
FALSE;
784 if ((AttemptConfigData->AuthenticationType == ISCSI_AUTH_TYPE_KRB) && (mPrivate->Krb5MpioCount > 0)) {
785 mPrivate->Krb5MpioCount--;
787 }
else if ((AttemptConfigData->SessionConfigData.Enabled == ISCSI_ENABLED) && (mPrivate->SinglePathCount > 0)) {
788 mPrivate->SinglePathCount--;
790 if (mPrivate->ValidSinglePathCount > 0) {
791 mPrivate->ValidSinglePathCount--;
818 UINT8 *AttemptConfigOrder;
819 UINTN AttemptConfigOrderSize;
820 UINT8 *AttemptOrderTmp;
825 for (Index = 1; Index <= AttemptNum; Index++) {
830 L
"InitialAttemptOrder",
832 &AttemptConfigOrderSize
834 TotalNumber = AttemptConfigOrderSize /
sizeof (UINT8);
835 if (TotalNumber == AttemptNum) {
846 if (AttemptOrderTmp ==
NULL) {
847 if (AttemptConfigOrder !=
NULL) {
851 return EFI_OUT_OF_RESOURCES;
854 if (AttemptConfigOrder !=
NULL) {
855 CopyMem (AttemptOrderTmp, AttemptConfigOrder, AttemptConfigOrderSize);
859 AttemptOrderTmp[TotalNumber - 1] = Index;
860 AttemptConfigOrder = AttemptOrderTmp;
861 AttemptConfigOrderSize = TotalNumber *
sizeof (UINT8);
863 Status =
gRT->SetVariable (
864 L
"InitialAttemptOrder",
867 AttemptConfigOrderSize,
871 if (EFI_ERROR (Status)) {
874 "%a: Failed to set 'InitialAttemptOrder' with Guid (%g): "
887 if (AttemptConfigData ==
NULL) {
888 return EFI_OUT_OF_RESOURCES;
891 ConfigData = &AttemptConfigData->SessionConfigData;
892 ConfigData->TargetPort = ISCSI_WELL_KNOWN_PORT;
894 ConfigData->ConnectRetryCount = CONNECT_MIN_RETRY;
896 AttemptConfigData->AuthenticationType = ISCSI_AUTH_TYPE_CHAP;
897 AttemptConfigData->AuthConfigData.CHAP.CHAPType = ISCSI_CHAP_UNI;
901 AttemptConfigData->AttemptConfigIndex = Index;
907 mPrivate->PortString,
908 (
UINTN)ISCSI_NAME_IFR_MAX_SIZE,
910 (
UINTN)AttemptConfigData->AttemptConfigIndex
914 Status =
gRT->SetVariable (
915 mPrivate->PortString,
916 &gEfiIScsiInitiatorNameProtocolGuid,
917 ISCSI_CONFIG_VAR_ATTR,
922 if (EFI_ERROR (Status)) {
925 "%a: Failed to set variable (mPrivate->PortString) with Guid (%g): "
928 &gEfiIScsiInitiatorNameProtocolGuid,
953 VOID *StartOpCodeHandle;
955 VOID *EndOpCodeHandle;
958 EFI_STRING_ID StringToken;
960 CHAR16 KeywordId[32];
970 if (EFI_ERROR (Status)) {
971 return EFI_OUT_OF_RESOURCES;
974 for (Index = 1; Index <= KeywordNum; Index++) {
978 UnicodeSPrint (StringId,
sizeof (StringId), L
"STR_ISCSI_ATTEMPTT_NAME_PROMPT%d", Index);
980 mCallbackInfo->RegisteredHandle,
985 UnicodeSPrint (KeywordId,
sizeof (KeywordId), L
"iSCSIAttemptName:%d", Index);
986 HiiSetString (mCallbackInfo->RegisteredHandle, StringToken, KeywordId,
"x-UEFI-ns");
989 (EFI_QUESTION_ID)(ATTEMPT_ATTEMPT_NAME_QUESTION_ID + (Index - 1)),
990 CONFIGURATION_VARSTORE_ID,
991 (UINT16)(ATTEMPT_ATTEMPT_NAME_VAR_OFFSET + ATTEMPT_NAME_SIZE * (Index - 1) *
sizeof (CHAR16)),
994 EFI_IFR_FLAG_READ_ONLY,
1004 UnicodeSPrint (StringId,
sizeof (StringId), L
"STR_ISCSI_MODE_PROMPT%d", Index);
1006 mCallbackInfo->RegisteredHandle,
1011 UnicodeSPrint (KeywordId,
sizeof (KeywordId), L
"iSCSIBootEnable:%d", Index);
1012 HiiSetString (mCallbackInfo->RegisteredHandle, StringToken, KeywordId,
"x-UEFI-ns");
1015 (EFI_QUESTION_ID)(ATTEMPT_BOOTENABLE_QUESTION_ID + (Index - 1)),
1016 CONFIGURATION_VARSTORE_ID,
1017 (UINT16)(ATTEMPT_BOOTENABLE_VAR_OFFSET + (Index - 1)),
1021 EFI_IFR_NUMERIC_SIZE_1,
1031 UnicodeSPrint (StringId,
sizeof (StringId), L
"STR_ISCSI_IP_MODE_PROMPT%d", Index);
1033 mCallbackInfo->RegisteredHandle,
1038 UnicodeSPrint (KeywordId,
sizeof (KeywordId), L
"iSCSIIpAddressType:%d", Index);
1039 HiiSetString (mCallbackInfo->RegisteredHandle, StringToken, KeywordId,
"x-UEFI-ns");
1042 (EFI_QUESTION_ID)(ATTEMPT_ADDRESS_TYPE_QUESTION_ID + (Index - 1)),
1043 CONFIGURATION_VARSTORE_ID,
1044 (UINT16)(ATTEMPT_ADDRESS_TYPE_VAR_OFFSET + (Index - 1)),
1048 EFI_IFR_NUMERIC_SIZE_1,
1058 UnicodeSPrint (StringId,
sizeof (StringId), L
"STR_ISCSI_CONNECT_RETRY_PROMPT%d", Index);
1060 mCallbackInfo->RegisteredHandle,
1065 UnicodeSPrint (KeywordId,
sizeof (KeywordId), L
"iSCSIConnectRetry:%d", Index);
1066 HiiSetString (mCallbackInfo->RegisteredHandle, StringToken, KeywordId,
"x-UEFI-ns");
1069 (EFI_QUESTION_ID)(ATTEMPT_CONNECT_RETRY_QUESTION_ID + (Index - 1)),
1070 CONFIGURATION_VARSTORE_ID,
1071 (UINT16)(ATTEMPT_CONNECT_RETRY_VAR_OFFSET + (Index - 1)),
1075 EFI_IFR_NUMERIC_SIZE_1,
1085 UnicodeSPrint (StringId,
sizeof (StringId), L
"STR_ISCSI_CONNECT_TIMEOUT_PROMPT%d", Index);
1087 mCallbackInfo->RegisteredHandle,
1092 UnicodeSPrint (KeywordId,
sizeof (KeywordId), L
"iSCSIConnectTimeout:%d", Index);
1093 HiiSetString (mCallbackInfo->RegisteredHandle, StringToken, KeywordId,
"x-UEFI-ns");
1096 (EFI_QUESTION_ID)(ATTEMPT_CONNECT_TIMEOUT_QUESTION_ID + (Index - 1)),
1097 CONFIGURATION_VARSTORE_ID,
1098 (UINT16)(ATTEMPT_CONNECT_TIMEOUT_VAR_OFFSET + 2 * (Index - 1)),
1102 EFI_IFR_NUMERIC_SIZE_2,
1103 CONNECT_MIN_TIMEOUT,
1104 CONNECT_MAX_TIMEOUT,
1112 UnicodeSPrint (StringId,
sizeof (StringId), L
"STR_ISCSI_ISID_PROMPT%d", Index);
1114 mCallbackInfo->RegisteredHandle,
1119 UnicodeSPrint (KeywordId,
sizeof (KeywordId), L
"iSCSIISID:%d", Index);
1120 HiiSetString (mCallbackInfo->RegisteredHandle, StringToken, KeywordId,
"x-UEFI-ns");
1123 (EFI_QUESTION_ID)(ATTEMPT_ISID_QUESTION_ID + (Index - 1)),
1124 CONFIGURATION_VARSTORE_ID,
1125 (UINT16)(ATTEMPT_ISID_VAR_OFFSET +
sizeof (
KEYWORD_STR) * (Index - 1)),
1130 ISID_CONFIGURABLE_MIN_LEN,
1131 ISID_CONFIGURABLE_STORAGE,
1138 UnicodeSPrint (StringId,
sizeof (StringId), L
"STR_ISCSI_INITIATOR_VIA_DHCP_PROMPT%d", Index);
1140 mCallbackInfo->RegisteredHandle,
1145 UnicodeSPrint (KeywordId,
sizeof (KeywordId), L
"iSCSIInitiatorInfoViaDHCP:%d", Index);
1146 HiiSetString (mCallbackInfo->RegisteredHandle, StringToken, KeywordId,
"x-UEFI-ns");
1149 (EFI_QUESTION_ID)(ATTEMPT_INITIATOR_VIA_DHCP_QUESTION_ID + (Index - 1)),
1150 CONFIGURATION_VARSTORE_ID,
1151 (UINT16)(ATTEMPT_INITIATOR_VIA_DHCP_VAR_OFFSET + (Index - 1)),
1165 UnicodeSPrint (StringId,
sizeof (StringId), L
"STR_ISCSI_INITIATOR_IP_ADDRESS_PROMPT%d", Index);
1167 mCallbackInfo->RegisteredHandle,
1172 UnicodeSPrint (KeywordId,
sizeof (KeywordId), L
"iSCSIInitiatorIpAddress:%d", Index);
1173 HiiSetString (mCallbackInfo->RegisteredHandle, StringToken, KeywordId,
"x-UEFI-ns");
1176 (EFI_QUESTION_ID)(ATTEMPT_INITIATOR_IP_ADDRESS_QUESTION_ID + (Index - 1)),
1177 CONFIGURATION_VARSTORE_ID,
1178 (UINT16)(ATTEMPT_INITIATOR_IP_ADDRESS_VAR_OFFSET +
sizeof (
KEYWORD_STR) * (Index - 1)),
1191 UnicodeSPrint (StringId,
sizeof (StringId), L
"STR_ISCSI_INITIATOR_NET_MASK_PROMPT%d", Index);
1193 mCallbackInfo->RegisteredHandle,
1198 UnicodeSPrint (KeywordId,
sizeof (KeywordId), L
"iSCSIInitiatorNetmask:%d", Index);
1199 HiiSetString (mCallbackInfo->RegisteredHandle, StringToken, KeywordId,
"x-UEFI-ns");
1202 (EFI_QUESTION_ID)(ATTEMPT_INITIATOR_NET_MASK_QUESTION_ID + (Index - 1)),
1203 CONFIGURATION_VARSTORE_ID,
1204 (UINT16)(ATTEMPT_INITIATOR_NET_MASK_VAR_OFFSET +
sizeof (
KEYWORD_STR) * (Index - 1)),
1217 UnicodeSPrint (StringId,
sizeof (StringId), L
"STR_ISCSI_INITIATOR_GATE_PROMPT%d", Index);
1219 mCallbackInfo->RegisteredHandle,
1224 UnicodeSPrint (KeywordId,
sizeof (KeywordId), L
"iSCSIInitiatorGateway:%d", Index);
1225 HiiSetString (mCallbackInfo->RegisteredHandle, StringToken, KeywordId,
"x-UEFI-ns");
1228 (EFI_QUESTION_ID)(ATTEMPT_INITIATOR_GATE_WAY_QUESTION_ID + (Index - 1)),
1229 CONFIGURATION_VARSTORE_ID,
1230 (UINT16)(ATTEMPT_INITIATOR_GATE_WAY_VAR_OFFSET +
sizeof (
KEYWORD_STR) * (Index - 1)),
1243 UnicodeSPrint (StringId,
sizeof (StringId), L
"STR_ISCSI_TARGET_VIA_DHCP_PROMPT%d", Index);
1245 mCallbackInfo->RegisteredHandle,
1250 UnicodeSPrint (KeywordId,
sizeof (KeywordId), L
"iSCSITargetInfoViaDHCP:%d", Index);
1251 HiiSetString (mCallbackInfo->RegisteredHandle, StringToken, KeywordId,
"x-UEFI-ns");
1254 (EFI_QUESTION_ID)(ATTEMPT_TARGET_VIA_DHCP_QUESTION_ID + (Index - 1)),
1255 CONFIGURATION_VARSTORE_ID,
1256 (UINT16)(ATTEMPT_TARGET_VIA_DHCP_VAR_OFFSET + (Index - 1)),
1270 UnicodeSPrint (StringId,
sizeof (StringId), L
"STR_ISCSI_TARGET_TCP_PORT_PROMPT%d", Index);
1272 mCallbackInfo->RegisteredHandle,
1277 UnicodeSPrint (KeywordId,
sizeof (KeywordId), L
"iSCSITargetTcpPort:%d", Index);
1278 HiiSetString (mCallbackInfo->RegisteredHandle, StringToken, KeywordId,
"x-UEFI-ns");
1281 (EFI_QUESTION_ID)(ATTEMPT_TARGET_TCP_PORT_QUESTION_ID + (Index - 1)),
1282 CONFIGURATION_VARSTORE_ID,
1283 (UINT16)(ATTEMPT_TARGET_TCP_PORT_VAR_OFFSET + 2 * (Index - 1)),
1287 EFI_IFR_NUMERIC_SIZE_2,
1288 TARGET_PORT_MIN_NUM,
1289 TARGET_PORT_MAX_NUM,
1297 UnicodeSPrint (StringId,
sizeof (StringId), L
"STR_ISCSI_TARGET_NAME_PROMPT%d", Index);
1299 mCallbackInfo->RegisteredHandle,
1304 UnicodeSPrint (KeywordId,
sizeof (KeywordId), L
"iSCSITargetName:%d", Index);
1305 HiiSetString (mCallbackInfo->RegisteredHandle, StringToken, KeywordId,
"x-UEFI-ns");
1308 (EFI_QUESTION_ID)(ATTEMPT_TARGET_NAME_QUESTION_ID + (Index - 1)),
1309 CONFIGURATION_VARSTORE_ID,
1310 (UINT16)(ATTEMPT_TARGET_NAME_VAR_OFFSET +
sizeof (
KEYWORD_STR) * (Index - 1)),
1315 ISCSI_NAME_IFR_MIN_SIZE,
1316 ISCSI_NAME_IFR_MAX_SIZE,
1323 UnicodeSPrint (StringId,
sizeof (StringId), L
"STR_ISCSI_TARGET_IP_ADDRESS_PROMPT%d", Index);
1325 mCallbackInfo->RegisteredHandle,
1330 UnicodeSPrint (KeywordId,
sizeof (KeywordId), L
"iSCSITargetIpAddress:%d", Index);
1331 HiiSetString (mCallbackInfo->RegisteredHandle, StringToken, KeywordId,
"x-UEFI-ns");
1334 (EFI_QUESTION_ID)(ATTEMPT_TARGET_IP_ADDRESS_QUESTION_ID + (Index - 1)),
1335 CONFIGURATION_VARSTORE_ID,
1336 (UINT16)(ATTEMPT_TARGET_IP_ADDRESS_VAR_OFFSET +
sizeof (
KEYWORD_STR) * (Index - 1)),
1349 UnicodeSPrint (StringId,
sizeof (StringId), L
"STR_ISCSI_LUN_PROMPT%d", Index);
1351 mCallbackInfo->RegisteredHandle,
1356 UnicodeSPrint (KeywordId,
sizeof (KeywordId), L
"iSCSILUN:%d", Index);
1357 HiiSetString (mCallbackInfo->RegisteredHandle, StringToken, KeywordId,
"x-UEFI-ns");
1360 (EFI_QUESTION_ID)(ATTEMPT_LUN_QUESTION_ID + (Index - 1)),
1361 CONFIGURATION_VARSTORE_ID,
1362 (UINT16)(ATTEMPT_LUN_VAR_OFFSET +
sizeof (
KEYWORD_STR) * (Index - 1)),
1375 UnicodeSPrint (StringId,
sizeof (StringId), L
"STR_ISCSI_AUTHENTICATION_METHOD_PROMPT%d", Index);
1377 mCallbackInfo->RegisteredHandle,
1382 UnicodeSPrint (KeywordId,
sizeof (KeywordId), L
"iSCSIAuthenticationMethod:%d", Index);
1383 HiiSetString (mCallbackInfo->RegisteredHandle, StringToken, KeywordId,
"x-UEFI-ns");
1386 (EFI_QUESTION_ID)(ATTEMPT_AUTHENTICATION_METHOD_QUESTION_ID + (Index - 1)),
1387 CONFIGURATION_VARSTORE_ID,
1388 (UINT16)(ATTEMPT_AUTHENTICATION_METHOD_VAR_OFFSET + (Index - 1)),
1402 UnicodeSPrint (StringId,
sizeof (StringId), L
"STR_ISCSI_CHARTYPE_PROMPT%d", Index);
1404 mCallbackInfo->RegisteredHandle,
1409 UnicodeSPrint (KeywordId,
sizeof (KeywordId), L
"iSCSIChapType:%d", Index);
1410 HiiSetString (mCallbackInfo->RegisteredHandle, StringToken, KeywordId,
"x-UEFI-ns");
1413 (EFI_QUESTION_ID)(ATTEMPT_CHARTYPE_QUESTION_ID + (Index - 1)),
1414 CONFIGURATION_VARSTORE_ID,
1415 (UINT16)(ATTEMPT_CHARTYPE_VAR_OFFSET + (Index - 1)),
1429 UnicodeSPrint (StringId,
sizeof (StringId), L
"STR_ISCSI_CHAR_USER_NAME_PROMPT%d", Index);
1431 mCallbackInfo->RegisteredHandle,
1436 UnicodeSPrint (KeywordId,
sizeof (KeywordId), L
"iSCSIChapUsername:%d", Index);
1437 HiiSetString (mCallbackInfo->RegisteredHandle, StringToken, KeywordId,
"x-UEFI-ns");
1440 (EFI_QUESTION_ID)(ATTEMPT_CHAR_USER_NAME_QUESTION_ID + (Index - 1)),
1441 CONFIGURATION_VARSTORE_ID,
1442 (UINT16)(ATTEMPT_CHAR_USER_NAME_VAR_OFFSET +
sizeof (
KEYWORD_STR) * (Index - 1)),
1448 ISCSI_CHAP_NAME_MAX_LEN,
1455 UnicodeSPrint (StringId,
sizeof (StringId), L
"STR_ISCSI_CHAR_SECRET_PROMPT%d", Index);
1457 mCallbackInfo->RegisteredHandle,
1462 UnicodeSPrint (KeywordId,
sizeof (KeywordId), L
"iSCSIChapSecret:%d", Index);
1463 HiiSetString (mCallbackInfo->RegisteredHandle, StringToken, KeywordId,
"x-UEFI-ns");
1466 (EFI_QUESTION_ID)(ATTEMPT_CHAR_SECRET_QUESTION_ID + (Index - 1)),
1467 CONFIGURATION_VARSTORE_ID,
1468 (UINT16)(ATTEMPT_CHAR_SECRET_VAR_OFFSET +
sizeof (
KEYWORD_STR) * (Index - 1)),
1473 ISCSI_CHAP_SECRET_MIN_LEN,
1474 ISCSI_CHAP_SECRET_MAX_LEN,
1481 UnicodeSPrint (StringId,
sizeof (StringId), L
"STR_ISCSI_CHAR_REVERSE_USER_NAME_PROMPT%d", Index);
1483 mCallbackInfo->RegisteredHandle,
1488 UnicodeSPrint (KeywordId,
sizeof (KeywordId), L
"iSCSIReverseChapUsername:%d", Index);
1489 HiiSetString (mCallbackInfo->RegisteredHandle, StringToken, KeywordId,
"x-UEFI-ns");
1492 (EFI_QUESTION_ID)(ATTEMPT_CHAR_REVERSE_USER_NAME_QUESTION_ID + (Index - 1)),
1493 CONFIGURATION_VARSTORE_ID,
1494 (UINT16)(ATTEMPT_CHAR_REVERSE_USER_NAME_VAR_OFFSET +
sizeof (
KEYWORD_STR) * (Index - 1)),
1500 ISCSI_CHAP_NAME_MAX_LEN,
1507 UnicodeSPrint (StringId,
sizeof (StringId), L
"STR_ISCSI_CHAR_REVERSE_SECRET_PROMPT%d", Index);
1509 mCallbackInfo->RegisteredHandle,
1514 UnicodeSPrint (KeywordId,
sizeof (KeywordId), L
"iSCSIReverseChapSecret:%d", Index);
1515 HiiSetString (mCallbackInfo->RegisteredHandle, StringToken, KeywordId,
"x-UEFI-ns");
1518 (EFI_QUESTION_ID)(ATTEMPT_CHAR_REVERSE_SECRET_QUESTION_ID + (Index - 1)),
1519 CONFIGURATION_VARSTORE_ID,
1520 (UINT16)(ATTEMPT_CHAR_REVERSE_SECRET_VAR_OFFSET +
sizeof (
KEYWORD_STR) * (Index - 1)),
1525 ISCSI_CHAP_SECRET_MIN_LEN,
1526 ISCSI_CHAP_SECRET_MAX_LEN,
1532 mCallbackInfo->RegisteredHandle,
1534 FORMID_ATTEMPT_FORM,
1556 UINT8 *AttemptConfigOrder;
1557 UINTN AttemptConfigOrderSize;
1564 L
"InitialAttemptOrder",
1566 &AttemptConfigOrderSize
1568 if ((AttemptConfigOrder ==
NULL) || (AttemptConfigOrderSize == 0)) {
1572 for (Index = 1; Index < AttemptConfigOrderSize /
sizeof (UINT8); Index++) {
1574 mPrivate->PortString,
1575 (
UINTN)ISCSI_NAME_IFR_MAX_SIZE,
1581 mPrivate->PortString,
1582 &gEfiIScsiInitiatorNameProtocolGuid,
1583 (VOID **)&AttemptConfigData,
1587 if (AttemptConfigData !=
NULL) {
1589 mPrivate->PortString,
1590 &gEfiIScsiInitiatorNameProtocolGuid,
1617 NET_LIST_FOR_EACH (Entry, &mPrivate->NicInfoList) {
1619 if (NicInfo->NicIndex == NicIndex) {
1653 Status =
gBS->HandleProtocol (
1655 &gEfiDevicePathProtocolGuid,
1656 (VOID **)&DevicePath
1658 if (EFI_ERROR (Status)) {
1662 Status =
gBS->LocateDevicePath (
1663 &gEfiPciIoProtocolGuid,
1667 if (EFI_ERROR (Status)) {
1671 Status =
gBS->HandleProtocol (PciIoHandle, &gEfiPciIoProtocolGuid, (VOID **)&PciIo);
1672 if (EFI_ERROR (Status)) {
1676 Status = PciIo->GetLocation (PciIo, &Segment, Bus, Device, Function);
1677 if (EFI_ERROR (Status)) {
1681 return (UINT16)((*Bus << 8) | (*Device << 3) | *Function);
1714 Status =
gRT->GetVariable (Name, VendorGuid,
NULL, &BufferSize, Buffer);
1715 if (Status == EFI_BUFFER_TOO_SMALL) {
1720 if (Buffer ==
NULL) {
1727 Status =
gRT->GetVariable (Name, VendorGuid,
NULL, &BufferSize, Buffer);
1728 if (EFI_ERROR (Status)) {
1733 *VariableSize = BufferSize;
1757 if (Private ==
NULL) {
1761 Private->Signature = ISCSI_DRIVER_DATA_SIGNATURE;
1762 Private->Image = Image;
1763 Private->Controller = Controller;
1764 Private->Session =
NULL;
1770 Status =
gBS->CreateEventEx (
1775 &gEfiEventExitBootServicesGuid,
1776 &Private->ExitBootServiceEvent
1778 if (EFI_ERROR (Status)) {
1783 Private->ExtScsiPassThruHandle =
NULL;
1789 Private->ExtScsiPassThruMode.
AdapterId = 2;
1790 Private->ExtScsiPassThruMode.
Attributes = EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL | EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL;
1791 Private->ExtScsiPassThruMode.
IoAlign = 4;
1792 Private->IScsiExtScsiPassThru.
Mode = &Private->ExtScsiPassThruMode;
1815 if (Private->DevicePath !=
NULL) {
1816 Status =
gBS->UninstallProtocolInterface (
1817 Private->ExtScsiPassThruHandle,
1818 &gEfiDevicePathProtocolGuid,
1821 if (EFI_ERROR (Status)) {
1828 if (Private->ExtScsiPassThruHandle !=
NULL) {
1829 Status =
gBS->UninstallProtocolInterface (
1830 Private->ExtScsiPassThruHandle,
1831 &gEfiExtScsiPassThruProtocolGuid,
1832 &Private->IScsiExtScsiPassThru
1834 if (!EFI_ERROR (Status)) {
1835 mPrivate->OneSessionEstablished =
FALSE;
1840 if (Private->ExitBootServiceEvent !=
NULL) {
1841 gBS->CloseEvent (Private->ExitBootServiceEvent);
1844 mCallbackInfo->Current =
NULL;
1867 UINT8 *AttemptConfigOrder;
1868 UINTN AttemptConfigOrderSize;
1872 UINTN HwAddressSize;
1874 CHAR16 MacString[ISCSI_MAX_MAC_STRING_LEN];
1875 CHAR16 AttemptMacString[ISCSI_MAX_MAC_STRING_LEN];
1876 CHAR16 AttemptName[ISCSI_NAME_IFR_MAX_SIZE];
1881 &AttemptConfigOrderSize
1883 if ((AttemptConfigOrder ==
NULL) || (AttemptConfigOrderSize == 0)) {
1891 if (EFI_ERROR (Status)) {
1901 for (Index = 0; Index < AttemptConfigOrderSize /
sizeof (UINT8); Index++) {
1906 (
UINTN)AttemptConfigOrder[Index]
1910 &gEfiIScsiInitiatorNameProtocolGuid,
1911 (VOID **)&AttemptTmp,
1914 if ((AttemptTmp ==
NULL) || EFI_ERROR (Status)) {
1918 ASSERT (AttemptConfigOrder[Index] == AttemptTmp->AttemptConfigIndex);
1920 if (AttemptTmp->SessionConfigData.Enabled == ISCSI_DISABLED) {
1925 if ((AttemptTmp->SessionConfigData.IpMode != IP_MODE_AUTOCONFIG) &&
1926 (AttemptTmp->SessionConfigData.IpMode != ((IpVersion == IP_VERSION_4) ? IP_MODE_IP4 : IP_MODE_IP6)))
1932 AsciiStrToUnicodeStrS (AttemptTmp->MacString, AttemptMacString, sizeof (AttemptMacString) /
sizeof (AttemptMacString[0]));
1934 if ((AttemptTmp->Actived == ISCSI_ACTIVE_DISABLED) ||
StrCmp (MacString, AttemptMacString)) {
1938 if ((AttemptTmp->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG) ||
1939 (AttemptTmp->SessionConfigData.InitiatorInfoFromDhcp ==
TRUE) ||
1940 (AttemptTmp->SessionConfigData.TargetInfoFromDhcp ==
TRUE))
1969 UINT8 *AttemptConfigOrder;
1970 UINTN AttemptConfigOrderSize;
1974 UINTN HwAddressSize;
1976 CHAR16 AttemptMacString[ISCSI_MAX_MAC_STRING_LEN];
1977 CHAR16 MacString[ISCSI_MAX_MAC_STRING_LEN];
1978 CHAR16 AttemptName[ISCSI_NAME_IFR_MAX_SIZE];
1983 &AttemptConfigOrderSize
1985 if ((AttemptConfigOrder ==
NULL) || (AttemptConfigOrderSize == 0)) {
1993 if (EFI_ERROR (Status)) {
2003 for (Index = 0; Index < AttemptConfigOrderSize /
sizeof (UINT8); Index++) {
2008 (
UINTN)AttemptConfigOrder[Index]
2013 &gEfiIScsiInitiatorNameProtocolGuid,
2014 (VOID **)&AttemptTmp,
2017 if ((AttemptTmp ==
NULL) || EFI_ERROR (Status)) {
2021 ASSERT (AttemptConfigOrder[Index] == AttemptTmp->AttemptConfigIndex);
2023 AsciiStrToUnicodeStrS (AttemptTmp->MacString, AttemptMacString, sizeof (AttemptMacString) /
sizeof (AttemptMacString[0]));
2025 if ((AttemptTmp->SessionConfigData.Enabled == ISCSI_DISABLED) ||
StrCmp (MacString, AttemptMacString)) {
2030 if (AttemptTmp->SessionConfigData.DnsMode || AttemptTmp->SessionConfigData.TargetInfoFromDhcp) {
2060 CHAR16 MacString[ISCSI_MAX_MAC_STRING_LEN];
2061 CHAR16 AttemptMacString[ISCSI_MAX_MAC_STRING_LEN];
2066 UINT8 *AttemptConfigOrder;
2067 UINTN AttemptConfigOrderSize;
2068 CHAR16 IScsiMode[64];
2077 &AttemptConfigOrderSize
2079 if ((AttemptConfigOrder ==
NULL) || (AttemptConfigOrderSize == 0)) {
2080 return EFI_NOT_FOUND;
2086 mPrivate->InitiatorNameLength = ISCSI_NAME_MAX_SIZE;
2087 Status = gIScsiInitiatorName.Get (
2088 &gIScsiInitiatorName,
2089 &mPrivate->InitiatorNameLength,
2090 mPrivate->InitiatorName
2092 if (EFI_ERROR (Status)) {
2099 for (Index = 0; Index < AttemptConfigOrderSize /
sizeof (UINT8); Index++) {
2104 if ((AttemptTmp !=
NULL) && (AttemptTmp->SessionConfigData.Enabled == ISCSI_DISABLED)) {
2106 }
else if ((AttemptTmp !=
NULL) && (AttemptTmp->SessionConfigData.Enabled != ISCSI_DISABLED)) {
2110 if ((AttemptTmp->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG) &&
2111 !AttemptTmp->AutoConfigureSuccess)
2113 if (mPrivate->Ipv6Flag &&
2114 (AttemptTmp->AutoConfigureMode == IP_MODE_AUTOCONFIG_IP6))
2120 }
else if (!mPrivate->Ipv6Flag &&
2121 (AttemptTmp->AutoConfigureMode == IP_MODE_AUTOCONFIG_IP4))
2131 AttemptTmp->AutoConfigureMode =
2132 (UINT8)(mPrivate->Ipv6Flag ? IP_MODE_AUTOCONFIG_IP6 : IP_MODE_AUTOCONFIG_IP4);
2133 AttemptTmp->SessionConfigData.InitiatorInfoFromDhcp =
TRUE;
2134 AttemptTmp->SessionConfigData.TargetInfoFromDhcp =
TRUE;
2135 AttemptTmp->DhcpSuccess =
FALSE;
2140 if (!mPrivate->Ipv6Flag) {
2141 Status =
IScsiDoDhcp (Private->Image, Private->Controller, AttemptTmp);
2142 if (!EFI_ERROR (Status)) {
2143 AttemptTmp->DhcpSuccess =
TRUE;
2146 Status =
IScsiDoDhcp6 (Private->Image, Private->Controller, AttemptTmp);
2147 if (!EFI_ERROR (Status)) {
2148 AttemptTmp->DhcpSuccess =
TRUE;
2156 mPrivate->PortString,
2157 (
UINTN)ISCSI_NAME_IFR_MAX_SIZE,
2159 (
UINTN)AttemptTmp->AttemptConfigIndex
2163 mPrivate->PortString,
2164 &gEfiIScsiInitiatorNameProtocolGuid,
2165 ISCSI_CONFIG_VAR_ATTR,
2172 }
else if (AttemptTmp->SessionConfigData.InitiatorInfoFromDhcp &&
2173 !AttemptTmp->ValidPath &&
2174 (AttemptTmp->NicIndex == mPrivate->CurrentNic))
2180 AttemptTmp->DhcpSuccess =
FALSE;
2181 if (!mPrivate->Ipv6Flag && (AttemptTmp->SessionConfigData.IpMode == IP_MODE_IP4)) {
2182 Status =
IScsiDoDhcp (Private->Image, Private->Controller, AttemptTmp);
2183 if (!EFI_ERROR (Status)) {
2184 AttemptTmp->DhcpSuccess =
TRUE;
2186 }
else if (mPrivate->Ipv6Flag && (AttemptTmp->SessionConfigData.IpMode == IP_MODE_IP6)) {
2187 Status =
IScsiDoDhcp6 (Private->Image, Private->Controller, AttemptTmp);
2188 if (!EFI_ERROR (Status)) {
2189 AttemptTmp->DhcpSuccess =
TRUE;
2197 mPrivate->PortString,
2198 (
UINTN)ISCSI_NAME_IFR_MAX_SIZE,
2200 (
UINTN)AttemptTmp->AttemptConfigIndex
2204 mPrivate->PortString,
2205 &gEfiIScsiInitiatorNameProtocolGuid,
2206 ISCSI_CONFIG_VAR_ATTR,
2222 ASSERT (NicInfo !=
NULL);
2223 IScsiMacAddrToStr (&NicInfo->PermanentAddress, NicInfo->HwAddressSize, NicInfo->VlanId, MacString);
2225 mPrivate->PortString,
2226 (
UINTN)ISCSI_NAME_IFR_MAX_SIZE,
2228 (
UINTN)AttemptConfigOrder[Index]
2232 mPrivate->PortString,
2233 &gEfiIScsiInitiatorNameProtocolGuid,
2234 (VOID **)&AttemptConfigData,
2237 AsciiStrToUnicodeStrS (AttemptConfigData->MacString, AttemptMacString, sizeof (AttemptMacString) /
sizeof (AttemptMacString[0]));
2239 if ((AttemptConfigData ==
NULL) || (AttemptConfigData->Actived == ISCSI_ACTIVE_DISABLED) ||
2240 StrCmp (MacString, AttemptMacString))
2245 ASSERT (AttemptConfigOrder[Index] == AttemptConfigData->AttemptConfigIndex);
2247 AttemptConfigData->NicIndex = NicInfo->NicIndex;
2248 AttemptConfigData->DhcpSuccess =
FALSE;
2249 AttemptConfigData->ValidiBFTPath = (BOOLEAN)(mPrivate->EnableMpio ?
TRUE :
FALSE);
2250 AttemptConfigData->ValidPath =
FALSE;
2252 if (AttemptConfigData->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG) {
2253 AttemptConfigData->SessionConfigData.InitiatorInfoFromDhcp =
TRUE;
2254 AttemptConfigData->SessionConfigData.TargetInfoFromDhcp =
TRUE;
2256 AttemptConfigData->AutoConfigureMode =
2257 (UINT8)(mPrivate->Ipv6Flag ? IP_MODE_AUTOCONFIG_IP6 : IP_MODE_AUTOCONFIG_IP4);
2258 AttemptConfigData->AutoConfigureSuccess =
FALSE;
2264 if ((AttemptConfigData->SessionConfigData.Enabled != ISCSI_DISABLED) &&
2265 AttemptConfigData->SessionConfigData.InitiatorInfoFromDhcp)
2267 if (!mPrivate->Ipv6Flag &&
2268 ((AttemptConfigData->SessionConfigData.IpMode == IP_MODE_IP4) ||
2269 (AttemptConfigData->AutoConfigureMode == IP_MODE_AUTOCONFIG_IP4)))
2271 Status =
IScsiDoDhcp (Private->Image, Private->Controller, AttemptConfigData);
2272 if (!EFI_ERROR (Status)) {
2273 AttemptConfigData->DhcpSuccess =
TRUE;
2275 }
else if (mPrivate->Ipv6Flag &&
2276 ((AttemptConfigData->SessionConfigData.IpMode == IP_MODE_IP6) ||
2277 (AttemptConfigData->AutoConfigureMode == IP_MODE_AUTOCONFIG_IP6)))
2279 Status =
IScsiDoDhcp6 (Private->Image, Private->Controller, AttemptConfigData);
2280 if (!EFI_ERROR (Status)) {
2281 AttemptConfigData->DhcpSuccess =
TRUE;
2289 mPrivate->PortString,
2290 (
UINTN)ISCSI_NAME_IFR_MAX_SIZE,
2292 (
UINTN)AttemptConfigData->AttemptConfigIndex
2296 mPrivate->PortString,
2297 &gEfiIScsiInitiatorNameProtocolGuid,
2298 ISCSI_CONFIG_VAR_ATTR,
2308 if (AttemptConfigData->SessionConfigData.Enabled == ISCSI_DISABLED) {
2310 }
else if (AttemptConfigData->SessionConfigData.Enabled == ISCSI_ENABLED) {
2312 }
else if (AttemptConfigData->SessionConfigData.Enabled == ISCSI_ENABLED_FOR_MPIO) {
2316 if (AttemptConfigData->SessionConfigData.IpMode == IP_MODE_IP4) {
2318 }
else if (AttemptConfigData->SessionConfigData.IpMode == IP_MODE_IP6) {
2320 }
else if (AttemptConfigData->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG) {
2325 mPrivate->PortString,
2326 (
UINTN)ISCSI_NAME_IFR_MAX_SIZE,
2327 L
"MAC: %s, PFA: Bus %d | Dev %d | Func %d, iSCSI mode: %s, IP version: %s",
2330 NicInfo->DeviceNumber,
2331 NicInfo->FunctionNumber,
2336 AttemptConfigData->AttemptTitleHelpToken =
HiiSetString (
2337 mCallbackInfo->RegisteredHandle,
2339 mPrivate->PortString,
2342 if (AttemptConfigData->AttemptTitleHelpToken == 0) {
2343 return EFI_OUT_OF_RESOURCES;
2349 InsertTailList (&mPrivate->AttemptConfigs, &AttemptConfigData->Link);
2350 mPrivate->AttemptCount++;
2352 if (AttemptConfigData->SessionConfigData.Enabled == ISCSI_ENABLED_FOR_MPIO) {
2353 mPrivate->MpioCount++;
2354 mPrivate->EnableMpio =
TRUE;
2356 if (AttemptConfigData->AuthenticationType == ISCSI_AUTH_TYPE_KRB) {
2357 mPrivate->Krb5MpioCount++;
2359 }
else if (AttemptConfigData->SessionConfigData.Enabled == ISCSI_ENABLED) {
2360 mPrivate->SinglePathCount++;
2367 for (Index = 0; Index < AttemptConfigOrderSize /
sizeof (UINT8); Index++) {
2369 if (AttemptConfigData ==
NULL) {
2374 InsertTailList (&mPrivate->AttemptConfigs, &AttemptConfigData->Link);
2387 if (!mPrivate->EnableMpio) {
2388 if (mPrivate->SinglePathCount == 0) {
2389 return EFI_NOT_FOUND;
2392 mPrivate->ValidSinglePathCount = mPrivate->SinglePathCount;
2418 if (Session->State != SESSION_STATE_LOGGED_IN) {
2422 Conn = NET_LIST_USER_STRUCT_S (
2423 Session->Conns.ForwardLink,
2426 ISCSI_CONNECTION_SIGNATURE
2429 Status =
gBS->HandleProtocol (
2431 &gEfiDevicePathProtocolGuid,
2432 (VOID **)&DevicePath
2434 if (EFI_ERROR (Status)) {
2442 if (DevicePath ==
NULL) {
2454 (BOOLEAN)(!Session->ConfigData->SessionConfigData.InitiatorInfoFromDhcp);
2468 &Session->ConfigData->SessionConfigData.Gateway
2473 &Session->ConfigData->SessionConfigData.SubnetMask
2491 if (PathLen == IP6_NODE_LEN_NEW_VERSIONS ) {
2501 (BOOLEAN)(!Session->ConfigData->SessionConfigData.InitiatorInfoFromDhcp);
2532 gBS->CloseEvent (Private->ExitBootServiceEvent);
2533 Private->ExitBootServiceEvent =
NULL;
2535 if (Private->Session !=
NULL) {
2572 VOID *ManagedInterface;
2575 ASSERT (ProtocolGuid !=
NULL);
2578 if (NicControllerHandle ==
NULL) {
2579 return EFI_UNSUPPORTED;
2582 Status =
gBS->OpenProtocol (
2586 DriverBindingHandle,
2587 NicControllerHandle,
2588 EFI_OPEN_PROTOCOL_BY_DRIVER
2590 if (!EFI_ERROR (Status)) {
2591 gBS->CloseProtocol (
2594 DriverBindingHandle,
2597 return EFI_UNSUPPORTED;
2600 if (Status != EFI_ALREADY_STARTED) {
2601 return EFI_UNSUPPORTED;
INTN EFIAPI StrCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString)
UINTN EFIAPI AsciiStrLen(IN CONST CHAR8 *String)
RETURN_STATUS EFIAPI UnicodeStrToAsciiStrS(IN CONST CHAR16 *Source, OUT CHAR8 *Destination, IN UINTN DestMax)
UINTN EFIAPI AsciiStrDecimalToUintn(IN CONST CHAR8 *String)
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
UINTN EFIAPI AsciiStrHexToUintn(IN CONST CHAR8 *String)
RETURN_STATUS EFIAPI AsciiStrToUnicodeStrS(IN CONST CHAR8 *Source, OUT CHAR16 *Destination, IN UINTN DestMax)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
UINT64 EFIAPI AsciiStrHexToUint64(IN CONST CHAR8 *String)
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
INTN EFIAPI CompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
#define MESSAGING_DEVICE_PATH
UINT8 EFIAPI DevicePathType(IN CONST VOID *Node)
UINTN EFIAPI DevicePathNodeLength(IN CONST VOID *Node)
UINT8 EFIAPI DevicePathSubType(IN CONST VOID *Node)
BOOLEAN EFIAPI IsDevicePathEnd(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI NextDevicePathNode(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI DuplicateDevicePath(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
UINT8 *EFIAPI HiiCreateNumericOpCode(IN VOID *OpCodeHandle, IN EFI_QUESTION_ID QuestionId, IN EFI_VARSTORE_ID VarStoreId, IN UINT16 VarOffset, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN UINT8 QuestionFlags, IN UINT8 NumericFlags, IN UINT64 Minimum, IN UINT64 Maximum, IN UINT64 Step, IN VOID *DefaultsOpCodeHandle OPTIONAL)
VOID EFIAPI HiiFreeOpCodeHandle(VOID *OpCodeHandle)
UINT8 *EFIAPI HiiCreateStringOpCode(IN VOID *OpCodeHandle, IN EFI_QUESTION_ID QuestionId, IN EFI_VARSTORE_ID VarStoreId, IN UINT16 VarOffset, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN UINT8 QuestionFlags, IN UINT8 StringFlags, IN UINT8 MinSize, IN UINT8 MaxSize, IN VOID *DefaultsOpCodeHandle OPTIONAL)
EFI_STATUS EFIAPI HiiUpdateForm(IN EFI_HII_HANDLE HiiHandle, IN EFI_GUID *FormSetGuid OPTIONAL, IN EFI_FORM_ID FormId, IN VOID *StartOpCodeHandle, IN VOID *EndOpCodeHandle OPTIONAL)
EFI_STRING_ID EFIAPI HiiSetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId OPTIONAL, IN CONST EFI_STRING String, IN CONST CHAR8 *SupportedLanguages OPTIONAL)
ISCSI_ATTEMPT_CONFIG_NVDATA * IScsiConfigGetAttemptByConfigIndex(IN UINT8 AttemptConfigIndex)
VOID IScsiConfigUpdateAttempt(VOID)
EFI_STATUS IScsiCreateOpCode(IN UINT16 StartLabelNumber, OUT VOID **StartOpCodeHandle, OUT EFI_IFR_GUID_LABEL **StartLabel, OUT VOID **EndOpCodeHandle, OUT EFI_IFR_GUID_LABEL **EndLabel)
EFI_STATUS IScsiDoDhcp6(IN EFI_HANDLE Image, IN EFI_HANDLE Controller, IN OUT ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData)
EFI_STATUS IScsiDoDhcp(IN EFI_HANDLE Image, IN EFI_HANDLE Controller, IN OUT ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData)
UINTN IScsiNetNtoi(IN CHAR8 *Str)
VOID * IScsiGetVariableAndSize(IN CHAR16 *Name, IN EFI_GUID *VendorGuid, OUT UINTN *VariableSize)
ISCSI_DRIVER_DATA * IScsiCreateDriverData(IN EFI_HANDLE Image, IN EFI_HANDLE Controller)
UINT16 IScsiGetNICPciLocation(IN EFI_HANDLE Controller, OUT UINTN *Bus, OUT UINTN *Device, OUT UINTN *Function)
EFI_STATUS IScsiCreateKeywords(IN UINTN KeywordNum)
VOID IScsiStrTrim(IN OUT CHAR16 *Str, IN CHAR16 CharC)
EFI_STATUS EFIAPI IScsiTestManagedDevice(IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE DriverBindingHandle, IN EFI_GUID *ProtocolGuid)
EFI_STATUS IScsiCleanDriverData(IN ISCSI_DRIVER_DATA *Private)
EFI_STATUS IScsiRemoveNic(IN EFI_HANDLE Controller)
VOID IScsiCleanAttemptVariable(IN VOID)
EFI_STATUS IScsiHexToBin(IN OUT UINT8 *BinBuffer, IN OUT UINT32 *BinLength, IN CHAR8 *HexStr)
EFI_STATUS IScsiAddNic(IN EFI_HANDLE Controller, IN EFI_HANDLE Image)
EFI_STATUS IScsiCreateAttempts(IN UINTN AttemptNum)
EFI_DEVICE_PATH_PROTOCOL * IScsiGetTcpConnDevicePath(IN ISCSI_SESSION *Session)
EFI_STATUS IScsiGetConfigData(IN ISCSI_DRIVER_DATA *Private)
BOOLEAN IScsiDnsIsConfigured(IN EFI_HANDLE Controller)
EFI_STATUS IScsiAsciiStrToIp(IN CHAR8 *Str, IN UINT8 IpMode, OUT EFI_IP_ADDRESS *Ip)
VOID EFIAPI IScsiOnExitBootService(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS IScsiGenRandom(IN OUT UINT8 *Rand, IN UINTN RandLength)
EFI_STATUS IScsiBinToHex(IN UINT8 *BinBuffer, IN UINT32 BinLength, IN OUT CHAR8 *HexStr, IN OUT UINT32 *HexLength)
UINT8 IScsiGetSubnetMaskPrefixLength(IN EFI_IPv4_ADDRESS *SubnetMask)
EFI_STATUS IScsiCheckIpv6Support(IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE Image, OUT BOOLEAN *Ipv6Support)
BOOLEAN IScsiDhcpIsConfigured(IN EFI_HANDLE Controller, IN UINT8 IpVersion)
ISCSI_NIC_INFO * IScsiGetNicInfoByIndex(IN UINT8 NicIndex)
VOID IScsiLunToUnicodeStr(IN UINT8 *Lun, OUT CHAR16 *Str)
VOID IScsiMacAddrToStr(IN EFI_MAC_ADDRESS *Mac, IN UINT32 Len, IN UINT16 VlanId, OUT CHAR16 *Str)
EFI_STATUS IScsiAsciiStrToLun(IN CHAR8 *Str, OUT UINT8 *Lun)
#define IP4_NODE_LEN_NEW_VERSIONS
#define IP6_OLD_IPADDRESS_OFFSET
#define IP6_NODE_LEN_OLD_VERSIONS
VOID IScsiSessionAbort(IN OUT ISCSI_SESSION *Session)
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
EFI_RUNTIME_SERVICES * gRT
#define RETURN_ERROR(StatusCode)
#define GLOBAL_REMOVE_IF_UNREFERENCED
#define DEBUG(Expression)
EFI_STATUS EFIAPI NetLibGetMacAddress(IN EFI_HANDLE ServiceHandle, OUT EFI_MAC_ADDRESS *MacAddress, OUT UINTN *AddressSize)
EFI_STATUS EFIAPI NetLibAsciiStrToIp4(IN CONST CHAR8 *String, OUT EFI_IPv4_ADDRESS *Ip4Address)
EFI_HANDLE EFIAPI NetLibGetSnpHandle(IN EFI_HANDLE ServiceHandle, OUT EFI_SIMPLE_NETWORK_PROTOCOL **Snp OPTIONAL)
EFI_STATUS EFIAPI NetLibAsciiStrToIp6(IN CONST CHAR8 *String, OUT EFI_IPv6_ADDRESS *Ip6Address)
EFI_HANDLE EFIAPI NetLibGetNicHandle(IN EFI_HANDLE Controller, IN EFI_GUID *ProtocolGuid)
EFI_STATUS EFIAPI PseudoRandom(OUT VOID *Output, IN UINTN OutputLength)
UINT16 EFIAPI NetLibGetVlanId(IN EFI_HANDLE ServiceHandle)
RETURN_STATUS EFIAPI SafeUint32Add(IN UINT32 Augend, IN UINT32 Addend, OUT UINT32 *Result)
RETURN_STATUS EFIAPI SafeUint32Mult(IN UINT32 Multiplicand, IN UINT32 Multiplier, OUT UINT32 *Result)
EFI_STATUS EFIAPI GetVariable2(IN CONST CHAR16 *Name, IN CONST EFI_GUID *Guid, OUT VOID **Value, OUT UINTN *Size OPTIONAL)
#define EFI_VARIABLE_NON_VOLATILE
EFI_EXT_SCSI_PASS_THRU_MODE * Mode
BOOLEAN Ipv6Supported
TRUE if the network interface supports IPv6; otherwise FALSE.
UINT16 ConnectTimeout
timeout value in milliseconds.
EFI_IPv4_ADDRESS GatewayIpAddress
EFI_IPv4_ADDRESS SubnetMask
EFI_IPv6_ADDRESS GatewayIpAddress