29 IN EFI_STRING_ID StringId
34 if ((HiiHandle ==
NULL) || (StringId == 0)) {
36 return EFI_INVALID_PARAMETER;
72 if (FormsetPrivate ==
NULL) {
73 return EFI_INVALID_PARAMETER;
77 HiiFormLink =
GetFirstNode (&FormsetPrivate->HiiFormList);
78 while (!
IsNull (&FormsetPrivate->HiiFormList, HiiFormLink)) {
79 HiiFormPrivate = REDFISH_PLATFORM_CONFIG_FORM_FROM_LINK (HiiFormLink);
80 HiiNextFormLink =
GetNextNode (&FormsetPrivate->HiiFormList, HiiFormLink);
83 DumpHiiString (FormsetPrivate->HiiHandle, HiiFormPrivate->Title);
86 HiiStatementLink =
GetFirstNode (&HiiFormPrivate->StatementList);
87 while (!
IsNull (&HiiFormPrivate->StatementList, HiiStatementLink)) {
88 HiiStatementPrivate = REDFISH_PLATFORM_CONFIG_STATEMENT_FROM_LINK (HiiStatementLink);
89 HiiNextStatementLink =
GetNextNode (&HiiFormPrivate->StatementList, HiiStatementLink);
92 DumpHiiString (FormsetPrivate->HiiHandle, HiiStatementPrivate->Description);
95 HiiStatementLink = HiiNextStatementLink;
98 HiiFormLink = HiiNextFormLink;
123 if (FormsetList ==
NULL) {
124 return EFI_INVALID_PARAMETER;
134 while (!
IsNull (FormsetList, HiiFormsetLink)) {
135 HiiFormsetNextLink =
GetNextNode (FormsetList, HiiFormsetLink);
136 HiiFormsetPrivate = REDFISH_PLATFORM_CONFIG_FORMSET_FROM_LINK (HiiFormsetLink);
138 DEBUG ((
DEBUG_REDFISH_PLATFORM_CONFIG,
"[%d] HII Handle: 0x%x formset: %g at %s\n", ++Index, HiiFormsetPrivate->HiiHandle, &HiiFormsetPrivate->Guid, HiiFormsetPrivate->DevicePathStr));
141 HiiFormsetLink = HiiFormsetNextLink;
166 ASSERT (String !=
NULL);
168 for (Length = 0; *String != L
'\0'; String++, Length++) {
191 return (
HiiStrLen (String) + 1) *
sizeof (*String);
221 while ((*FirstString != L
'\0') && (*FirstString == *SecondString)) {
226 return *FirstString - *SecondString;
241 IN EFI_STRING_ID StringId,
247 if (StringId == 0x00) {
248 return EFI_INVALID_PARAMETER;
251 NullChar = CHAR_NULL;
278 IN EFI_STRING_ID StringId
286 if ((mRedfishPlatformConfigPrivate->
HiiString ==
NULL) || (HiiHandle ==
NULL) || (StringId == 0) || IS_EMPTY_STRING (Language)) {
295 Status = mRedfishPlatformConfigPrivate->
HiiString->GetString (
296 mRedfishPlatformConfigPrivate->
HiiString,
310 if (Status != EFI_BUFFER_TOO_SMALL) {
318 if (String ==
NULL) {
325 Status = mRedfishPlatformConfigPrivate->
HiiString->GetString (
326 mRedfishPlatformConfigPrivate->
HiiString,
334 if (EFI_ERROR (Status)) {
369 IN EFI_STRING_ID StringId
372 EFI_STRING HiiString;
376 if (HiiString ==
NULL) {
377 DEBUG ((DEBUG_ERROR,
"%a: Can not find string ID: 0x%x with %a\n", __func__, StringId, Language));
403 IN EFI_STRING_ID StringId
406 EFI_STRING HiiString;
410 if (HiiString ==
NULL) {
411 DEBUG ((DEBUG_ERROR,
"%a: Can not find string ID: 0x%x with %a\n", __func__, StringId, ENGLISH_LANGUAGE_CODE));
438 if ((SupportedSchema ==
NULL) || IS_EMPTY_STRING (Schema)) {
442 if (SupportedSchema->Count == 0) {
446 for (Index = 0; Index < SupportedSchema->Count; Index++) {
447 if (
AsciiStrCmp (SupportedSchema->SchemaList[Index], Schema) == 0) {
473 CHAR8 *SupportedLanguages;
480 if ((HiiHandle ==
NULL) || (SupportedSchema ==
NULL)) {
481 return EFI_INVALID_PARAMETER;
484 SupportedSchema->Count = 0;
487 if (SupportedLanguages ==
NULL) {
488 return EFI_NOT_FOUND;
495 if ((SupportedLanguages[Index] ==
';') || (SupportedLanguages[Index] ==
'\0')) {
496 if (
AsciiStrnCmp (&SupportedLanguages[LangIndex], X_UEFI_SCHEMA_PREFIX,
AsciiStrLen (X_UEFI_SCHEMA_PREFIX)) == 0) {
500 LangIndex = Index + 1;
503 if (SupportedLanguages[Index] ==
'\0') {
511 return EFI_NOT_FOUND;
514 SupportedSchema->Count = Count;
515 SupportedSchema->SchemaList =
AllocatePool (
sizeof (CHAR8 *) * Count);
516 if (SupportedSchema->SchemaList ==
NULL) {
517 return EFI_OUT_OF_RESOURCES;
524 if ((SupportedLanguages[Index] ==
';') || (SupportedLanguages[Index] ==
'\0')) {
525 if (
AsciiStrnCmp (&SupportedLanguages[LangIndex], X_UEFI_SCHEMA_PREFIX,
AsciiStrLen (X_UEFI_SCHEMA_PREFIX)) == 0) {
528 SupportedSchema->SchemaList[ListIndex][
StrSize] =
'\0';
532 LangIndex = Index + 1;
535 if (SupportedLanguages[Index] ==
'\0') {
567 IN EFI_STRING Pattern,
580 EFI_STRING TmpString;
586 if ((FormsetList ==
NULL) || IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Pattern) || (StatementList ==
NULL)) {
587 return EFI_INVALID_PARAMETER;
590 if (RegularExpressionProtocol ==
NULL) {
591 return EFI_NOT_READY;
594 StatementList->Count = 0;
598 return EFI_NOT_FOUND;
602 while (!
IsNull (FormsetList, HiiFormsetLink)) {
603 HiiFormsetNextLink =
GetNextNode (FormsetList, HiiFormsetLink);
604 HiiFormsetPrivate = REDFISH_PLATFORM_CONFIG_FORMSET_FROM_LINK (HiiFormsetLink);
611 HiiFormsetLink = HiiFormsetNextLink;
615 HiiFormLink =
GetFirstNode (&HiiFormsetPrivate->HiiFormList);
616 while (!
IsNull (&HiiFormsetPrivate->HiiFormList, HiiFormLink)) {
617 HiiNextFormLink =
GetNextNode (&HiiFormsetPrivate->HiiFormList, HiiFormLink);
618 HiiFormPrivate = REDFISH_PLATFORM_CONFIG_FORM_FROM_LINK (HiiFormLink);
620 HiiStatementLink =
GetFirstNode (&HiiFormPrivate->StatementList);
621 while (!
IsNull (&HiiFormPrivate->StatementList, HiiStatementLink)) {
622 HiiNextStatementLink =
GetNextNode (&HiiFormPrivate->StatementList, HiiStatementLink);
623 HiiStatementPrivate = REDFISH_PLATFORM_CONFIG_STATEMENT_FROM_LINK (HiiStatementLink);
625 if ((HiiStatementPrivate->Description != 0) &&
628 TmpString = HiiStatementPrivate->XuefiRedfishStr;
629 if (TmpString !=
NULL) {
630 Status = RegularExpressionProtocol->MatchString (
631 RegularExpressionProtocol,
634 &gEfiRegexSyntaxTypePerlGuid,
639 if (EFI_ERROR (Status)) {
640 DEBUG ((DEBUG_ERROR,
"%a: MatchString \"%s\" failed: %r\n", __func__, Pattern, Status));
650 if (StatementRef ==
NULL) {
651 return EFI_OUT_OF_RESOURCES;
654 StatementRef->Statement = HiiStatementPrivate;
655 InsertTailList (&StatementList->StatementList, &StatementRef->Link);
656 ++StatementList->Count;
660 DEBUG ((DEBUG_ERROR,
"%a: HiiStatementPrivate->XuefiRedfishStr is NULL, x-UEFI-string has something wrong.\n", __func__));
666 HiiStatementLink = HiiNextStatementLink;
669 HiiFormLink = HiiNextFormLink;
672 HiiFormsetLink = HiiFormsetNextLink;
692 IN EFI_STRING ConfigureLang
704 EFI_STRING TmpString;
707 if ((FormsetList ==
NULL) || IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (ConfigureLang)) {
717 while (!
IsNull (FormsetList, HiiFormsetLink)) {
718 HiiFormsetNextLink =
GetNextNode (FormsetList, HiiFormsetLink);
719 HiiFormsetPrivate = REDFISH_PLATFORM_CONFIG_FORMSET_FROM_LINK (HiiFormsetLink);
726 HiiFormsetLink = HiiFormsetNextLink;
730 HiiFormLink =
GetFirstNode (&HiiFormsetPrivate->HiiFormList);
731 while (!
IsNull (&HiiFormsetPrivate->HiiFormList, HiiFormLink)) {
732 HiiNextFormLink =
GetNextNode (&HiiFormsetPrivate->HiiFormList, HiiFormLink);
733 HiiFormPrivate = REDFISH_PLATFORM_CONFIG_FORM_FROM_LINK (HiiFormLink);
735 HiiStatementLink =
GetFirstNode (&HiiFormPrivate->StatementList);
736 while (!
IsNull (&HiiFormPrivate->StatementList, HiiStatementLink)) {
737 HiiNextStatementLink =
GetNextNode (&HiiFormPrivate->StatementList, HiiStatementLink);
738 HiiStatementPrivate = REDFISH_PLATFORM_CONFIG_STATEMENT_FROM_LINK (HiiStatementLink);
740 if ((HiiStatementPrivate->Description != 0) &&
743 TmpString = HiiStatementPrivate->XuefiRedfishStr;
744 if (TmpString !=
NULL) {
746 DEBUG_REDFISH_THIS_MODULE (
747 REDFISH_PLATFORM_CONFIG_DEBUG_CONFIG_LANG_SEARCH,
748 "%a: [%d] check %s in QID: 0x%x form: 0x%x formset: %g\n",
752 HiiStatementPrivate->QuestionId,
754 &HiiFormsetPrivate->Guid
756 if (
HiiStrCmp (TmpString, ConfigureLang) == 0) {
757 return HiiStatementPrivate;
761 DEBUG ((DEBUG_ERROR,
"%a: HiiStatementPrivate->XuefiRedfishStr is NULL, x-UEFI-string has something wrong.\n", __func__));
767 HiiStatementLink = HiiNextStatementLink;
770 HiiFormLink = HiiNextFormLink;
773 HiiFormsetLink = HiiFormsetNextLink;
798 if ((HiiHandle ==
NULL) || (FormsetList ==
NULL)) {
807 while (!
IsNull (FormsetList, HiiFormsetLink)) {
808 HiiFormsetNextLink =
GetNextNode (FormsetList, HiiFormsetLink);
809 HiiFormsetPrivate = REDFISH_PLATFORM_CONFIG_FORMSET_FROM_LINK (HiiFormsetLink);
811 if (HiiFormsetPrivate->HiiHandle == HiiHandle) {
812 return HiiFormsetPrivate;
815 HiiFormsetLink = HiiFormsetNextLink;
841 if (FormsetPrivate->HiiPackageListHeader !=
NULL) {
842 FreePool (FormsetPrivate->HiiPackageListHeader);
846 if (!
IsListEmpty (&FormsetPrivate->XuefiRedfishStringDatabase)) {
849 while (!EndDatabase) {
851 if (!
IsListEmpty (&ThisDatabase->XuefiRedfishStringArrays)) {
856 FreePool (ThisStringArray->ArrayEntryAddress);
857 EndArray =
IsNodeAtEnd (&ThisDatabase->XuefiRedfishStringArrays, &ThisStringArray->NextArray);
858 PreStringArray = ThisStringArray;
871 EndDatabase =
IsNodeAtEnd (&FormsetPrivate->XuefiRedfishStringDatabase, &ThisDatabase->NextXuefiRedfishLanguage);
872 PreDatabase = ThisDatabase;
906 if (FormsetPrivate ==
NULL) {
907 return EFI_INVALID_PARAMETER;
910 HiiFormLink =
GetFirstNode (&FormsetPrivate->HiiFormList);
911 while (!
IsNull (&FormsetPrivate->HiiFormList, HiiFormLink)) {
912 HiiFormPrivate = REDFISH_PLATFORM_CONFIG_FORM_FROM_LINK (HiiFormLink);
913 HiiNextFormLink =
GetNextNode (&FormsetPrivate->HiiFormList, HiiFormLink);
915 HiiStatementLink =
GetFirstNode (&HiiFormPrivate->StatementList);
916 while (!
IsNull (&HiiFormPrivate->StatementList, HiiStatementLink)) {
917 HiiStatementPrivate = REDFISH_PLATFORM_CONFIG_STATEMENT_FROM_LINK (HiiStatementLink);
918 HiiNextStatementLink =
GetNextNode (&HiiFormPrivate->StatementList, HiiStatementLink);
925 HiiStatementLink = HiiNextStatementLink;
934 HiiFormLink = HiiNextFormLink;
937 if (FormsetPrivate->HiiFormSet !=
NULL) {
939 FormsetPrivate->HiiFormSet =
NULL;
942 if (FormsetPrivate->DevicePathStr !=
NULL) {
943 FreePool (FormsetPrivate->DevicePathStr);
949 if (FormsetPrivate->SupportedSchema.SchemaList !=
NULL) {
950 for (Index = 0; Index < FormsetPrivate->SupportedSchema.Count; Index++) {
951 FreePool (FormsetPrivate->SupportedSchema.SchemaList[Index]);
954 FreePool (FormsetPrivate->SupportedSchema.SchemaList);
955 FormsetPrivate->SupportedSchema.SchemaList =
NULL;
956 FormsetPrivate->SupportedSchema.Count = 0;
1009 if (ArrayAddress ==
NULL) {
1010 DEBUG ((DEBUG_ERROR,
"%a: Failed to allocate REDFISH_X_UEFI_STRINGS_ARRAY.\n", __func__));
1011 return EFI_OUT_OF_RESOURCES;
1017 ArrayAddress->ArrayEntryAddress = \
1019 if (ArrayAddress->ArrayEntryAddress ==
NULL) {
1021 DEBUG ((DEBUG_ERROR,
"%a: Failed to allocate array for REDFISH_X_UEFI_STRINGS_ARRAY_ELEMENTs.\n", __func__));
1022 return EFI_OUT_OF_RESOURCES;
1025 XuefiRedfishStringDatabase->StringsArrayBlocks++;
1026 InsertTailList (&XuefiRedfishStringDatabase->XuefiRedfishStringArrays, &ArrayAddress->NextArray);
1047 BOOLEAN CreateNewOne;
1050 CreateNewOne =
TRUE;
1051 XuefiRedfishStringDatabase =
NULL;
1052 if (!
IsListEmpty (&FormsetPrivate->XuefiRedfishStringDatabase)) {
1056 if (
AsciiStriCmp (XuefiRedfishStringDatabase->XuefiRedfishLanguage, HiiStringPackageHeader->Language) == 0) {
1057 CreateNewOne =
FALSE;
1061 if (
IsNodeAtEnd (&FormsetPrivate->XuefiRedfishStringDatabase, &XuefiRedfishStringDatabase->NextXuefiRedfishLanguage)) {
1065 XuefiRedfishStringDatabase = \
1073 if (XuefiRedfishStringDatabase ==
NULL) {
1074 DEBUG ((DEBUG_ERROR,
" Failed to allocate REDFISH_X_UEFI_STRING_DATABASE.\n"));
1080 XuefiRedfishStringDatabase->StringsArrayBlocks = 0;
1081 XuefiRedfishStringDatabase->XuefiRedfishLanguage = HiiStringPackageHeader->Language;
1084 if (EFI_ERROR (Status)) {
1085 FreePool (XuefiRedfishStringDatabase);
1091 " x-UEFI-redfish (%a):\n String array is added to XuefiRedfishStringDatabase, total %d arrays now.\n",
1092 XuefiRedfishStringDatabase->XuefiRedfishLanguage,
1093 XuefiRedfishStringDatabase->StringsArrayBlocks
1097 InsertTailList (&FormsetPrivate->XuefiRedfishStringDatabase, &XuefiRedfishStringDatabase->NextXuefiRedfishLanguage);
1100 return XuefiRedfishStringDatabase;
1120 IN EFI_STRING_ID StringId
1125 while (((StringId + X_UEFI_REDFISH_STRING_ARRAY_ENTRY_NUMBER) / X_UEFI_REDFISH_STRING_ARRAY_ENTRY_NUMBER) > (UINT16)XuefiRedfishStringDatabase->StringsArrayBlocks) {
1127 if (EFI_ERROR (Status)) {
1128 DEBUG ((DEBUG_ERROR,
"%a: Failed to adjust x-UEFI-string array", __func__));
1153 IN EFI_STRING_ID StringId,
1154 IN CHAR16 *StringTextPtr
1158 UINTN StringIdOffset;
1163 if (XuefiRedfishStringDatabase ==
NULL) {
1164 DEBUG ((DEBUG_ERROR,
"%a: Failed to get REDFISH_X_UEFI_STRING_DATABASE of x-UEFI-redfish language %a.\n", __func__, HiiStringPackageHeader->Language));
1166 return EFI_LOAD_ERROR;
1170 if (EFI_ERROR (Status)) {
1171 DEBUG ((DEBUG_ERROR,
"%a: Failed to adjust x-UEFI-redfish string array.\n", __func__));
1173 return EFI_LOAD_ERROR;
1177 StringIdOffset = (
UINTN)StringId;
1179 while (StringIdOffset >= X_UEFI_REDFISH_STRING_ARRAY_ENTRY_NUMBER) {
1181 StringIdOffset -= X_UEFI_REDFISH_STRING_ARRAY_ENTRY_NUMBER;
1185 (ThisArray->ArrayEntryAddress + StringIdOffset)->StringId = StringId;
1186 (ThisArray->ArrayEntryAddress + StringIdOffset)->UcsString = StringTextPtr;
1188 DEBUG_REDFISH_THIS_MODULE (
1189 REDFISH_PLATFORM_CONFIG_DEBUG_STRING_DATABASE,
1190 " Insert string ID: (%d) to database\n x-UEFI-string: \"%s\"\n Language: %a.\n",
1193 HiiStringPackageHeader->Language
1218 EFI_STRING_ID CurrentStringId;
1221 UINT8 *StringTextPtr;
1228 UINT8 *StringBlockInfo;
1236 StringBlockInfo = (UINT8 *)((
UINTN)HiiStringPackageHeader + HiiStringPackageHeader->StringInfoOffset);
1237 BlockHdr = StringBlockInfo;
1240 CurrentStringId = 1;
1241 while (*BlockHdr != EFI_HII_SIBT_END) {
1242 switch (*BlockHdr) {
1243 case EFI_HII_SIBT_STRING_SCSU:
1245 StringTextPtr = BlockHdr + Offset;
1246 BlockSize += Offset +
AsciiStrSize ((CHAR8 *)StringTextPtr);
1250 case EFI_HII_SIBT_STRING_SCSU_FONT:
1252 StringTextPtr = BlockHdr + Offset;
1253 BlockSize += Offset +
AsciiStrSize ((CHAR8 *)StringTextPtr);
1257 case EFI_HII_SIBT_STRINGS_SCSU:
1260 BlockSize += StringTextPtr - BlockHdr;
1262 for (Index = 0; Index < StringCount; Index++) {
1264 StringTextPtr = StringTextPtr +
AsciiStrSize ((CHAR8 *)StringTextPtr);
1270 case EFI_HII_SIBT_STRINGS_SCSU_FONT:
1277 BlockSize += StringTextPtr - BlockHdr;
1279 for (Index = 0; Index < StringCount; Index++) {
1281 StringTextPtr = StringTextPtr +
AsciiStrSize ((CHAR8 *)StringTextPtr);
1287 case EFI_HII_SIBT_STRING_UCS2:
1289 StringTextPtr = BlockHdr + Offset;
1292 if (*StringTextPtr == (UINT16)
'/') {
1295 HiiStringPackageHeader,
1297 (CHAR16 *)StringTextPtr
1299 if (EFI_ERROR (Status)) {
1300 DEBUG ((DEBUG_ERROR,
"%a: Failed to insert x-UEFI-redfish string %s.\n", __func__, StringTextPtr));
1307 BlockSize += (Offset +
HiiStrSize ((CHAR16 *)StringTextPtr));
1311 case EFI_HII_SIBT_STRING_UCS2_FONT:
1313 StringTextPtr = BlockHdr + Offset;
1314 BlockSize += (Offset +
HiiStrSize ((CHAR16 *)StringTextPtr));
1318 case EFI_HII_SIBT_STRINGS_UCS2:
1320 StringTextPtr = BlockHdr + Offset;
1321 BlockSize += Offset;
1323 for (Index = 0; Index < StringCount; Index++) {
1324 BlockSize +=
HiiStrSize ((CHAR16 *)StringTextPtr);
1325 StringTextPtr = StringTextPtr +
HiiStrSize ((CHAR16 *)StringTextPtr);
1331 case EFI_HII_SIBT_STRINGS_UCS2_FONT:
1333 StringTextPtr = BlockHdr + Offset;
1334 BlockSize += Offset;
1340 for (Index = 0; Index < StringCount; Index++) {
1341 BlockSize +=
HiiStrSize ((CHAR16 *)StringTextPtr);
1342 StringTextPtr = StringTextPtr +
HiiStrSize ((CHAR16 *)StringTextPtr);
1348 case EFI_HII_SIBT_DUPLICATE:
1353 case EFI_HII_SIBT_SKIP1:
1355 CurrentStringId = (UINT16)(CurrentStringId + SkipCount);
1359 case EFI_HII_SIBT_SKIP2:
1361 CurrentStringId = (UINT16)(CurrentStringId + SkipCount);
1365 case EFI_HII_SIBT_EXT1:
1371 BlockSize += Length8;
1374 case EFI_HII_SIBT_EXT2:
1376 BlockSize += Ext2.Length;
1379 case EFI_HII_SIBT_EXT4:
1386 BlockSize += Length32;
1393 BlockHdr = (UINT8 *)(StringBlockInfo + BlockSize);
1396 *TotalStringAdded = StringsAdded;
1418 IN EFI_STRING_ID StringId,
1419 OUT CHAR16 **String OPTIONAL,
1420 OUT CHAR8 **Language OPTIONAL,
1428 if ((String ==
NULL) && (Language ==
NULL) && (XuefiStringDatabase ==
NULL)) {
1429 DEBUG ((DEBUG_ERROR,
"%a: Invalid parameters for this function.\n", __func__));
1430 return EFI_INVALID_PARAMETER;
1433 if (
IsListEmpty (&FormsetPrivate->XuefiRedfishStringDatabase)) {
1434 return EFI_NOT_FOUND;
1439 if (Language !=
NULL) {
1440 *Language = XuefiRedfishStringDatabase->XuefiRedfishLanguage;
1446 StringIndex = StringId;
1447 while (StringIndex >= X_UEFI_REDFISH_STRING_ARRAY_ENTRY_NUMBER) {
1448 if (
IsNodeAtEnd (&XuefiRedfishStringDatabase->XuefiRedfishStringArrays, &StringArray->NextArray)) {
1453 StringIndex -= X_UEFI_REDFISH_STRING_ARRAY_ENTRY_NUMBER;
1461 if ((StringArray->ArrayEntryAddress + StringIndex)->UcsString !=
NULL) {
1465 if (String !=
NULL) {
1466 *String = (StringArray->ArrayEntryAddress + StringIndex)->UcsString;
1469 if (XuefiStringDatabase !=
NULL) {
1470 *XuefiStringDatabase = XuefiRedfishStringDatabase;
1476 if (
IsNodeAtEnd (&FormsetPrivate->XuefiRedfishStringDatabase, &XuefiRedfishStringDatabase->NextXuefiRedfishLanguage)) {
1477 return EFI_NOT_FOUND;
1481 &FormsetPrivate->XuefiRedfishStringDatabase,
1482 &XuefiRedfishStringDatabase->NextXuefiRedfishLanguage
1488 return EFI_NOT_FOUND;
1505 UINTN EndingPackageAddress;
1507 UINTN SupportedSchemaLangCount;
1508 CHAR8 **SupportedSchemaLang;
1509 BOOLEAN StringIdMapIsBuilt;
1510 UINTN TotalStringsAdded;
1511 UINTN NumberPackageStrings;
1516 Status = mRedfishPlatformConfigPrivate->
HiiDatabase->ExportPackageLists (
1518 FormsetPrivate->HiiHandle,
1520 FormsetPrivate->HiiPackageListHeader
1522 if (Status != EFI_BUFFER_TOO_SMALL) {
1523 DEBUG ((DEBUG_ERROR,
" Failed to export package list.\n"));
1528 if (FormsetPrivate->HiiPackageListHeader ==
NULL) {
1529 DEBUG ((DEBUG_ERROR,
" Failed to allocate memory for the exported package list.\n"));
1533 Status = mRedfishPlatformConfigPrivate->
HiiDatabase->ExportPackageLists (
1535 FormsetPrivate->HiiHandle,
1537 FormsetPrivate->HiiPackageListHeader
1539 if (EFI_ERROR (Status)) {
1540 FreePool (FormsetPrivate->HiiPackageListHeader);
1541 FormsetPrivate->HiiPackageListHeader =
NULL;
1545 TotalStringsAdded = 0;
1549 EndingPackageAddress = (
UINTN)FormsetPrivate->HiiPackageListHeader + FormsetPrivate->HiiPackageListHeader->PackageLength;
1551 SupportedSchemaLang = FormsetPrivate->SupportedSchema.SchemaList;
1552 while ((
UINTN)PackageHeader < EndingPackageAddress) {
1553 switch (PackageHeader->Type) {
1554 case EFI_HII_PACKAGE_STRINGS:
1555 StringIdMapIsBuilt =
FALSE;
1559 for (SupportedSchemaLangCount = 0;
1560 SupportedSchemaLangCount < FormsetPrivate->SupportedSchema.Count;
1561 SupportedSchemaLangCount++
1565 *(SupportedSchemaLang + SupportedSchemaLangCount),
1566 HiiStringPackageHeader->Language,
1571 if (StringIdMapIsBuilt) {
1572 TotalStringsAdded += NumberPackageStrings;
1579 if (StringIdMapIsBuilt ==
FALSE) {
1580 if (
AsciiStrStr (HiiStringPackageHeader->Language, X_UEFI_SCHEMA_PREFIX) ==
NULL) {
1583 DEBUG ((DEBUG_ERROR,
" Failed to build x-UEFI-redfish string ID map of HII language %a\n", HiiStringPackageHeader->Language));
1620 EXPRESS_RESULT ExpressionResult;
1623 if ((HiiHandle ==
NULL) || (FormsetPrivate ==
NULL)) {
1624 return EFI_INVALID_PARAMETER;
1628 if (HiiFormSet ==
NULL) {
1629 DEBUG ((DEBUG_ERROR,
"%a: No memory resource for HII_FORMSET - %g\n", __func__, FormsetPrivate->Guid));
1630 return EFI_OUT_OF_RESOURCES;
1636 ZeroMem (&ZeroGuid,
sizeof (ZeroGuid));
1639 DEBUG ((DEBUG_ERROR,
"%a: Formset not found by HII handle - %g\n", __func__, FormsetPrivate->Guid));
1640 Status = EFI_NOT_FOUND;
1652 FormsetPrivate->HiiFormSet = HiiFormSet;
1656 Status =
GetSupportedSchema (FormsetPrivate->HiiHandle, &FormsetPrivate->SupportedSchema);
1657 if (EFI_ERROR (Status)) {
1664 return EFI_UNSUPPORTED;
1673 HiiForm = HII_FORM_FROM_LINK (HiiFormLink);
1676 if (HiiFormPrivate ==
NULL) {
1677 Status = EFI_OUT_OF_RESOURCES;
1678 DEBUG ((DEBUG_ERROR,
"%a: No memory resource for REDFISH_PLATFORM_CONFIG_FORM_PRIVATE.\n", __func__));
1685 HiiFormPrivate->HiiForm = HiiForm;
1686 HiiFormPrivate->Id = HiiForm->
FormId;
1687 HiiFormPrivate->Title = HiiForm->
FormTitle;
1688 HiiFormPrivate->ParentFormset = FormsetPrivate;
1689 HiiFormPrivate->Suppressed =
FALSE;
1695 HiiFormPrivate->Suppressed =
TRUE;
1700 HiiStatement = HII_STATEMENT_FROM_LINK (HiiStatementLink);
1703 if (HiiStatementPrivate ==
NULL) {
1704 DEBUG ((DEBUG_ERROR,
"%a: No memory resource for REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE.\n", __func__));
1705 Status = EFI_OUT_OF_RESOURCES;
1712 HiiStatementPrivate->HiiStatement = HiiStatement;
1713 HiiStatementPrivate->QuestionId = HiiStatement->
QuestionId;
1714 HiiStatementPrivate->Description = HiiStatement->
Prompt;
1715 HiiStatementPrivate->Help = HiiStatement->Help;
1716 HiiStatementPrivate->ParentForm = HiiFormPrivate;
1718 HiiStatementPrivate->StatementData.NumMaximum = HiiStatement->ExtraData.NumData.
Maximum;
1719 HiiStatementPrivate->StatementData.NumMinimum = HiiStatement->ExtraData.NumData.
Minimum;
1720 HiiStatementPrivate->StatementData.NumStep = HiiStatement->ExtraData.NumData.Step;
1721 HiiStatementPrivate->StatementData.StrMaxSize = HiiStatement->ExtraData.StrData.MaxSize;
1722 HiiStatementPrivate->StatementData.StrMinSize = HiiStatement->ExtraData.StrData.MinSize;
1723 HiiStatementPrivate->Suppressed =
FALSE;
1724 HiiStatementPrivate->GrayedOut =
FALSE;
1729 if (HiiFormPrivate->Suppressed) {
1730 HiiStatementPrivate->Suppressed =
TRUE;
1734 if (ExpressionResult == ExpressGrayOut) {
1735 HiiStatementPrivate->GrayedOut =
TRUE;
1736 }
else if (ExpressionResult == ExpressSuppress) {
1737 HiiStatementPrivate->Suppressed =
TRUE;
1744 if (!EFI_ERROR (Status)) {
1745 HiiStatementPrivate->XuefiRedfishStr = String;
1749 InsertTailList (&HiiFormPrivate->StatementList, &HiiStatementPrivate->Link);
1762 HiiStatementPrivate->XuefiRedfishStr =
NULL;
1766 InsertTailList (&HiiFormPrivate->StatementList, &HiiStatementPrivate->Link);
1776 InsertTailList (&FormsetPrivate->HiiFormList, &HiiFormPrivate->Link);
1787 if ((HiiFormSet !=
NULL) && (FormsetPrivate->HiiFormSet != HiiFormSet)) {
1817 if ((HiiHandle ==
NULL) || (FormsetList ==
NULL)) {
1818 return EFI_INVALID_PARAMETER;
1822 if (FormsetPrivate !=
NULL) {
1823 return EFI_ALREADY_STARTED;
1827 if (FormsetPrivate ==
NULL) {
1828 DEBUG ((DEBUG_ERROR,
"%a: out of resource\n", __func__));
1829 return EFI_OUT_OF_RESOURCES;
1836 if (EFI_ERROR (Status)) {
1837 DEBUG ((DEBUG_ERROR,
"%a: Formset is not loaded for edk2 redfish: %r\n", __func__, Status));
1875 if (FormsetList ==
NULL) {
1876 return EFI_INVALID_PARAMETER;
1884 while (!
IsNull (FormsetList, HiiFormsetLink)) {
1885 HiiFormsetNextLink =
GetNextNode (FormsetList, HiiFormsetLink);
1886 HiiFormsetPrivate = REDFISH_PLATFORM_CONFIG_FORMSET_FROM_LINK (HiiFormsetLink);
1894 HiiFormsetLink = HiiFormsetNextLink;
1918 if ((HiiHandle ==
NULL) || (PendingList ==
NULL)) {
1927 while (!
IsNull (PendingList, PendingListLink)) {
1928 Target = REDFISH_PLATFORM_CONFIG_PENDING_LIST_FROM_LINK (PendingListLink);
1930 if (Target->HiiHandle == HiiHandle) {
1934 PendingListLink =
GetNextNode (PendingList, PendingListLink);
1960 if ((HiiHandle ==
NULL) || (PendingList ==
NULL)) {
1961 return EFI_INVALID_PARAMETER;
1968 if (TargetPendingList !=
NULL) {
1969 TargetPendingList->IsDeleted =
FALSE;
1977 if (TargetPendingList ==
NULL) {
1978 return EFI_OUT_OF_RESOURCES;
1981 TargetPendingList->HiiHandle = HiiHandle;
1982 TargetPendingList->IsDeleted =
FALSE;
2013 if ((HiiHandle ==
NULL) || (PendingList ==
NULL)) {
2014 return EFI_INVALID_PARAMETER;
2021 if (TargetPendingList !=
NULL) {
2022 TargetPendingList->IsDeleted =
TRUE;
2030 if (TargetPendingList ==
NULL) {
2031 return EFI_OUT_OF_RESOURCES;
2034 TargetPendingList->HiiHandle = HiiHandle;
2035 TargetPendingList->IsDeleted =
TRUE;
2070 if ((FormsetList ==
NULL) || (PendingList ==
NULL)) {
2071 return EFI_INVALID_PARAMETER;
2079 while (!
IsNull (PendingList, PendingListLink)) {
2080 PendingListNextLink =
GetNextNode (PendingList, PendingListLink);
2081 Target = REDFISH_PLATFORM_CONFIG_PENDING_LIST_FROM_LINK (PendingListLink);
2083 if (Target->IsDeleted) {
2088 if (FormsetPrivate !=
NULL) {
2101 if (FormsetPrivate !=
NULL) {
2112 if (EFI_ERROR (Status)) {
2113 if (Status == EFI_UNSUPPORTED) {
2114 DEBUG ((DEBUG_ERROR,
" The formset has no x-UEFI-redfish configurations.\n"));
2116 DEBUG ((DEBUG_ERROR,
" load formset from HII handle: 0x%x failed: %r\n", Target->HiiHandle, Status));
2127 PendingListLink = PendingListNextLink;
2150 if (StatementList ==
NULL) {
2151 return EFI_INVALID_PARAMETER;
2154 if (
IsListEmpty (&StatementList->StatementList)) {
2158 NextLink =
GetFirstNode (&StatementList->StatementList);
2159 while (!
IsNull (&StatementList->StatementList, NextLink)) {
2160 StatementRef = REDFISH_PLATFORM_CONFIG_STATEMENT_REF_FROM_LINK (NextLink);
2161 NextLink =
GetNextNode (&StatementList->StatementList, NextLink);
INTN EFIAPI AsciiStriCmp(IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString)
BOOLEAN EFIAPI IsNull(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
LIST_ENTRY *EFIAPI GetNextNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
BOOLEAN EFIAPI IsNodeAtEnd(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
UINTN EFIAPI AsciiStrLen(IN CONST CHAR8 *String)
LIST_ENTRY *EFIAPI GetFirstNode(IN CONST LIST_ENTRY *List)
INTN EFIAPI AsciiStrCmp(IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString)
INTN EFIAPI AsciiStrnCmp(IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString, IN UINTN Length)
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
UINTN EFIAPI AsciiStrSize(IN CONST CHAR8 *String)
CHAR8 *EFIAPI AsciiStrStr(IN CONST CHAR8 *String, IN CONST CHAR8 *SearchString)
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
GUID *EFIAPI CopyGuid(OUT GUID *DestinationGuid, IN CONST GUID *SourceGuid)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
CHAR16 *EFIAPI ConvertDevicePathToText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
EXPRESS_RESULT EvaluateExpressionList(IN FORM_EXPRESSION_LIST *ExpList, IN BOOLEAN Evaluate, IN FORM_BROWSER_FORMSET *FormSet OPTIONAL, IN FORM_BROWSER_FORM *Form OPTIONAL)
EFI_STRING EFIAPI HiiGetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId, IN CONST CHAR8 *Language OPTIONAL)
CHAR8 *EFIAPI HiiGetSupportedLanguages(IN EFI_HII_HANDLE HiiHandle)
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)
EFI_STATUS CreateFormSetFromHiiHandle(IN EFI_HII_HANDLE Handle, IN OUT EFI_GUID *FormSetGuid, OUT HII_FORMSET *FormSet)
VOID DestroyFormSet(IN OUT FORM_BROWSER_FORMSET *FormSet)
#define DEBUG(Expression)
#define DEBUG_CODE(Expression)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
#define DEBUG_REDFISH_PLATFORM_CONFIG
Debug error level for Redfish Platform Configure Driver.
EFI_STATUS InitializeFormSet(IN EFI_HII_HANDLE Handle, IN OUT EFI_GUID *FormSetGuid, OUT FORM_BROWSER_FORMSET *FormSet)
UINT8 QuestionFlags
The flag of this Question.(Readonly, reset required, callback attribute....)
HII_EXPRESSION_LIST * ExpressionList
nesting inside of GrayedOutIf/DisableIf/SuppressIf
EFI_QUESTION_ID QuestionId
Question id, the value of zero is reserved.
LIST_ENTRY StatementListHead
List of Statements and Questions (HII_STATEMENT)
EFI_STRING_ID FormTitle
FormTile of normal form, or FormMapMethod title of formmap form.
HII_EXPRESSION_LIST * SuppressExpression
nesting inside of SuppressIf
UINT16 FormId
FormId of normal form or formmap form.
EFI_HII_HANDLE HiiHandle
Unique id for formset, HII Handle of this FormSet package.
LIST_ENTRY FormListHead
Form list (HII_FORM_BROWSER_FORM)
EFI_GUID Guid
Formset Guid.
EFI_HII_DATABASE_PROTOCOL * HiiDatabase
The HII database protocol.
EFI_HII_STRING_PROTOCOL * HiiString
HII String Protocol.
UINT64 Maximum
for EFI_IFR_STRING/EFI_IFR_PASSWORD, it's Min/Max length
UINT64 Minimum
for EFI_IFR_ONE_OF/EFI_IFR_NUMERIC, it's Min/Max value