TianoCore EDK2 master
Loading...
Searching...
No Matches
HiiIfrParse.c
Go to the documentation of this file.
1
12#include "HiiInternal.h"
13
26 IN UINT8 *OpCodeData,
27 IN OUT HII_FORMSET *FormSet,
28 IN OUT HII_FORM *Form
29 )
30{
31 HII_STATEMENT *Statement;
32 EFI_IFR_STATEMENT_HEADER *StatementHdr;
33 INTN ConditionalExprCount;
34
35 if (Form == NULL) {
36 //
37 // Only guid op may out side the form level.
38 //
39 if (((EFI_IFR_OP_HEADER *)OpCodeData)->OpCode != EFI_IFR_GUID_OP) {
40 return NULL;
41 }
42 }
43
44 Statement = (HII_STATEMENT *)AllocateZeroPool (sizeof (HII_STATEMENT));
45 if (Statement == NULL) {
46 return NULL;
47 }
48
54
55 Statement->Signature = HII_STATEMENT_SIGNATURE;
56 Statement->Operand = ((EFI_IFR_OP_HEADER *)OpCodeData)->OpCode;
57 Statement->OpCode = (EFI_IFR_OP_HEADER *)OpCodeData;
58 Statement->QuestionReferToBitField = FALSE;
59
60 StatementHdr = (EFI_IFR_STATEMENT_HEADER *)(OpCodeData + sizeof (EFI_IFR_OP_HEADER));
61 CopyMem (&Statement->Prompt, &StatementHdr->Prompt, sizeof (EFI_STRING_ID));
62 CopyMem (&Statement->Help, &StatementHdr->Help, sizeof (EFI_STRING_ID));
63
64 ConditionalExprCount = GetConditionalExpressionCount (ExpressStatement);
65 if (ConditionalExprCount > 0) {
66 //
67 // Form is inside of suppressif
68 //
70 (UINTN)(sizeof (HII_EXPRESSION_LIST) + ((ConditionalExprCount - 1) * sizeof (HII_EXPRESSION *)))
71 );
72 if (Statement->ExpressionList == NULL) {
73 return NULL;
74 }
75
76 Statement->ExpressionList->Count = (UINTN)ConditionalExprCount;
77 Statement->ExpressionList->Signature = HII_EXPRESSION_LIST_SIGNATURE;
78 CopyMem (
79 Statement->ExpressionList->Expression,
80 GetConditionalExpressionList (ExpressStatement),
81 (UINTN)(sizeof (HII_EXPRESSION *) * ConditionalExprCount)
82 );
83 }
84
85 //
86 // Insert this Statement into current Form
87 //
88 if (Form == NULL) {
89 InsertTailList (&FormSet->StatementListOSF, &Statement->Link);
90 } else {
91 InsertTailList (&Form->StatementListHead, &Statement->Link);
92 }
93
94 return Statement;
95}
96
109 IN UINT8 *OpCodeData,
110 IN OUT HII_FORMSET *FormSet,
111 IN OUT HII_FORM *Form
112 )
113{
114 HII_STATEMENT *Statement;
115 EFI_IFR_QUESTION_HEADER *QuestionHdr;
116 LIST_ENTRY *Link;
117 HII_FORMSET_STORAGE *Storage;
118 HII_NAME_VALUE_NODE *NameValueNode;
119 BOOLEAN Find;
120
121 Statement = CreateStatement (OpCodeData, FormSet, Form);
122 if (Statement == NULL) {
123 return NULL;
124 }
125
126 QuestionHdr = (EFI_IFR_QUESTION_HEADER *)(OpCodeData + sizeof (EFI_IFR_OP_HEADER));
127 CopyMem (&Statement->QuestionId, &QuestionHdr->QuestionId, sizeof (EFI_QUESTION_ID));
128 CopyMem (&Statement->VarStoreId, &QuestionHdr->VarStoreId, sizeof (EFI_VARSTORE_ID));
129 CopyMem (&Statement->VarStoreInfo.VarOffset, &QuestionHdr->VarStoreInfo.VarOffset, sizeof (UINT16));
130
131 Statement->QuestionFlags = QuestionHdr->Flags;
132
133 if (Statement->VarStoreId == 0) {
134 //
135 // VarStoreId of zero indicates no variable storage
136 //
137 return Statement;
138 }
139
140 //
141 // Find Storage for this Question
142 //
143 Link = GetFirstNode (&FormSet->StorageListHead);
144 while (!IsNull (&FormSet->StorageListHead, Link)) {
145 Storage = HII_STORAGE_FROM_LINK (Link);
146
147 if (Statement->VarStoreId == Storage->VarStoreId) {
148 Statement->Storage = Storage;
149 break;
150 }
151
152 Link = GetNextNode (&FormSet->StorageListHead, Link);
153 }
154
155 if (Statement->Storage == NULL) {
156 return NULL;
157 }
158
159 //
160 // Initialize varname for Name/Value or EFI Variable
161 //
162 if ((Statement->Storage->Type == EFI_HII_VARSTORE_NAME_VALUE) ||
163 (Statement->Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE))
164 {
165 Statement->VariableName = GetTokenString (Statement->VarStoreInfo.VarName, FormSet->HiiHandle);
166 if (Statement->VariableName == NULL) {
167 return NULL;
168 }
169
170 if (Statement->Storage->Type == EFI_HII_VARSTORE_NAME_VALUE) {
171 //
172 // Check whether old string node already exist.
173 //
174 Find = FALSE;
175 if (!IsListEmpty (&Statement->Storage->NameValueList)) {
176 Link = GetFirstNode (&Statement->Storage->NameValueList);
177 while (!IsNull (&Statement->Storage->NameValueList, Link)) {
178 NameValueNode = HII_NAME_VALUE_NODE_FROM_LINK (Link);
179
180 if (StrCmp (Statement->VariableName, NameValueNode->Name) == 0) {
181 Find = TRUE;
182 break;
183 }
184
185 Link = GetNextNode (&Statement->Storage->NameValueList, Link);
186 }
187 }
188
189 if (!Find) {
190 //
191 // Insert to Name/Value varstore list
192 //
193 NameValueNode = AllocateZeroPool (sizeof (HII_NAME_VALUE_NODE));
194 if (NameValueNode == NULL) {
195 return NULL;
196 }
197
198 NameValueNode->Signature = HII_NAME_VALUE_NODE_SIGNATURE;
199 NameValueNode->Name = AllocateCopyPool (StrSize (Statement->VariableName), Statement->VariableName);
200 if (NameValueNode->Name == NULL) {
201 FreePool (NameValueNode);
202 return NULL;
203 }
204
205 NameValueNode->Value = AllocateZeroPool (0x10);
206 if (NameValueNode->Value == NULL) {
207 FreePool (NameValueNode->Name);
208 FreePool (NameValueNode);
209 return NULL;
210 }
211
212 InsertTailList (&Statement->Storage->NameValueList, &NameValueNode->Link);
213 }
214 }
215 }
216
217 return Statement;
218}
219
231 IN OUT HII_FORM *Form,
232 IN UINT8 *OpCode
233 )
234{
235 HII_EXPRESSION *Expression;
236
237 Expression = AllocateZeroPool (sizeof (HII_EXPRESSION));
238 if (Expression == NULL) {
239 return NULL;
240 }
241
242 Expression->Signature = HII_EXPRESSION_SIGNATURE;
243 InitializeListHead (&Expression->OpCodeListHead);
244 Expression->OpCode = (EFI_IFR_OP_HEADER *)OpCode;
245
246 return Expression;
247}
248
260 IN HII_FORMSET *FormSet,
261 IN OUT HII_FORMSET_STORAGE *Storage
262 )
263{
264 CHAR16 *Name;
265
266 if ((Storage->Type == EFI_HII_VARSTORE_BUFFER) ||
267 (Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER))
268 {
269 Name = Storage->Name;
270 } else {
271 Name = NULL;
272 }
273
274 Storage->ConfigHdr = HiiConstructConfigHdr (
275 &Storage->Guid,
276 Name,
277 FormSet->DriverHandle
278 );
279
280 if (Storage->ConfigHdr == NULL) {
281 return EFI_NOT_FOUND;
282 }
283
284 return EFI_SUCCESS;
285}
286
296VOID
298 IN CHAR8 *AsciiString,
299 OUT CHAR16 *UnicodeString
300 )
301{
302 UINT8 Index;
303
304 Index = 0;
305 while (AsciiString[Index] != 0) {
306 UnicodeString[Index] = (CHAR16)AsciiString[Index];
307 Index++;
308 }
309
310 UnicodeString[Index] = L'\0';
311}
312
325 IN HII_FORMSET *FormSet,
326 IN UINT8 StorageType,
327 IN UINT8 *OpCodeData
328 )
329{
330 HII_FORMSET_STORAGE *Storage;
331 CHAR8 *AsciiStorageName;
332
333 AsciiStorageName = NULL;
334
335 Storage = AllocateZeroPool (sizeof (HII_FORMSET_STORAGE));
336 if (Storage == NULL) {
337 return NULL;
338 }
339
340 Storage->Signature = HII_STORAGE_SIGNATURE;
341 Storage->Type = StorageType;
342
343 switch (StorageType) {
344 case EFI_HII_VARSTORE_BUFFER:
345
346 CopyMem (&Storage->Guid, &((EFI_IFR_VARSTORE *)OpCodeData)->Guid, sizeof (EFI_GUID));
347 CopyMem (&Storage->Size, &((EFI_IFR_VARSTORE *)OpCodeData)->Size, sizeof (UINT16));
348
349 Storage->Buffer = AllocateZeroPool (Storage->Size);
350 if (Storage->Buffer == NULL) {
351 FreePool (Storage);
352 return NULL;
353 }
354
355 AsciiStorageName = (CHAR8 *)((EFI_IFR_VARSTORE *)OpCodeData)->Name;
356 Storage->Name = AllocatePool (sizeof (CHAR16) * (AsciiStrLen (AsciiStorageName) + 1));
357 if (Storage->Name == NULL) {
358 FreePool (Storage);
359 return NULL;
360 }
361
362 AsciiToUnicode (AsciiStorageName, Storage->Name);
363
364 break;
365
366 case EFI_HII_VARSTORE_EFI_VARIABLE:
367 case EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER:
368 CopyMem (&Storage->Guid, &((EFI_IFR_VARSTORE_EFI *)OpCodeData)->Guid, sizeof (EFI_GUID));
369 CopyMem (&Storage->Attributes, &((EFI_IFR_VARSTORE_EFI *)OpCodeData)->Attributes, sizeof (UINT32));
370 CopyMem (&Storage->Size, &((EFI_IFR_VARSTORE_EFI *)OpCodeData)->Size, sizeof (UINT16));
371
372 if (StorageType == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER) {
373 Storage->Buffer = AllocateZeroPool (Storage->Size);
374 if (Storage->Buffer == NULL) {
375 FreePool (Storage);
376 return NULL;
377 }
378 }
379
380 AsciiStorageName = (CHAR8 *)((EFI_IFR_VARSTORE_EFI *)OpCodeData)->Name;
381 Storage->Name = AllocatePool (sizeof (CHAR16) * (AsciiStrLen (AsciiStorageName) + 1));
382 if (Storage->Name == NULL) {
383 FreePool (Storage);
384 return NULL;
385 }
386
387 AsciiToUnicode (AsciiStorageName, Storage->Name);
388
389 break;
390
391 case EFI_HII_VARSTORE_NAME_VALUE:
392 CopyMem (&Storage->Guid, &((EFI_IFR_VARSTORE_NAME_VALUE *)OpCodeData)->Guid, sizeof (EFI_GUID));
394
395 break;
396
397 default:
398 break;
399 }
400
401 InitializeConfigHdr (FormSet, Storage);
402 InsertTailList (&FormSet->StorageListHead, &Storage->Link);
403
404 return Storage;
405}
406
418 IN HII_FORMSET *FormSet,
419 IN EFI_VARSTORE_ID VarStoreId
420 )
421{
422 HII_FORMSET_STORAGE *Storage;
423 LIST_ENTRY *Link;
424 BOOLEAN Found;
425
426 Found = FALSE;
427 Storage = NULL;
428 //
429 // Find Formset Storage for this Question
430 //
431 Link = GetFirstNode (&FormSet->StorageListHead);
432 while (!IsNull (&FormSet->StorageListHead, Link)) {
433 Storage = HII_STORAGE_FROM_LINK (Link);
434
435 if (Storage->VarStoreId == VarStoreId) {
436 Found = TRUE;
437 break;
438 }
439
440 Link = GetNextNode (&FormSet->StorageListHead, Link);
441 }
442
443 return Found ? Storage : NULL;
444}
445
459 IN OUT HII_FORMSET *FormSet,
460 IN OUT HII_STATEMENT *Question,
461 IN OUT HII_FORM *Form
462 )
463{
464 HII_FORMSET_STORAGE *Storage;
465 HII_FORM_CONFIG_REQUEST *ConfigInfo;
467 UINTN StringSize;
468 CHAR16 *NewStr;
469 CHAR16 RequestElement[30];
470 LIST_ENTRY *Link;
471 BOOLEAN Find;
472 UINTN MaxLen;
473
474 Storage = Question->Storage;
475 if (Storage == NULL) {
476 return EFI_INVALID_PARAMETER;
477 }
478
479 if (Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE) {
480 //
481 // <ConfigRequest> is unnecessary for EFI variable storage,
482 // GetVariable()/SetVariable() will be used to retrieve/save values
483 //
484 return EFI_SUCCESS;
485 }
486
487 //
488 // Prepare <RequestElement>
489 //
490 if ((Storage->Type == EFI_HII_VARSTORE_BUFFER) ||
491 (Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER))
492 {
494 RequestElement,
495 30 * sizeof (CHAR16),
496 L"&OFFSET=%04x&WIDTH=%04x",
497 Question->VarStoreInfo.VarOffset,
498 Question->StorageWidth
499 );
500 HiiStringToLowercase (RequestElement);
501 Question->BlockName = AllocateCopyPool ((StrLen + 1) * sizeof (CHAR16), RequestElement);
502 if (Question->BlockName == NULL) {
503 return EFI_OUT_OF_RESOURCES;
504 }
505 } else {
506 StrLen = UnicodeSPrint (RequestElement, 30 * sizeof (CHAR16), L"&%s", Question->VariableName);
507 }
508
509 if ((Question->Operand == EFI_IFR_PASSWORD_OP) &&
510 ((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) == EFI_IFR_FLAG_CALLBACK))
511 {
512 //
513 // Password with CALLBACK flag is stored in encoded format,
514 // so don't need to append it to <ConfigRequest>
515 //
516 return EFI_SUCCESS;
517 }
518
519 StringSize = (Storage->ConfigRequest != NULL) ? StrSize (Storage->ConfigRequest) : sizeof (CHAR16);
520 MaxLen = StringSize / sizeof (CHAR16) + Storage->SpareStrLen;
521
522 //
523 // Append <RequestElement> to <ConfigRequest>
524 //
525 if (StrLen > Storage->SpareStrLen) {
526 //
527 // Old String buffer is not sufficient for RequestElement, allocate a new one
528 //
529 MaxLen = StringSize / sizeof (CHAR16) + CONFIG_REQUEST_STRING_INCREMENTAL;
530 NewStr = AllocatePool (MaxLen * sizeof (CHAR16));
531 if (NewStr == NULL) {
532 return EFI_OUT_OF_RESOURCES;
533 }
534
535 if (Storage->ConfigRequest != NULL) {
536 CopyMem (NewStr, Storage->ConfigRequest, StringSize);
537 FreePool (Storage->ConfigRequest);
538 } else {
539 NewStr[0] = L'\0';
540 }
541
542 Storage->ConfigRequest = NewStr;
543 Storage->SpareStrLen = CONFIG_REQUEST_STRING_INCREMENTAL;
544 }
545
546 StrCatS (Storage->ConfigRequest, MaxLen, RequestElement);
547 Storage->ElementCount++;
548 Storage->SpareStrLen -= StrLen;
549
550 //
551 // Update the Config Request info saved in the form.
552 //
553 ConfigInfo = NULL;
554 Find = FALSE;
555 Link = GetFirstNode (&Form->ConfigRequestHead);
556 while (!IsNull (&Form->ConfigRequestHead, Link)) {
557 ConfigInfo = HII_FORM_CONFIG_REQUEST_FROM_LINK (Link);
558 if ((ConfigInfo != NULL) && (ConfigInfo->Storage == Storage)) {
559 Find = TRUE;
560 break;
561 }
562
563 Link = GetNextNode (&Form->ConfigRequestHead, Link);
564 }
565
566 if (!Find) {
567 ConfigInfo = AllocateZeroPool (sizeof (HII_FORM_CONFIG_REQUEST));
568 if (ConfigInfo == NULL) {
569 return EFI_OUT_OF_RESOURCES;
570 }
571
572 ConfigInfo->Signature = HII_FORM_CONFIG_REQUEST_SIGNATURE;
573 ConfigInfo->ConfigRequest = AllocateCopyPool (StrSize (Storage->ConfigHdr), Storage->ConfigHdr);
574 if (ConfigInfo->ConfigRequest == NULL) {
575 FreePool (ConfigInfo);
576 return EFI_OUT_OF_RESOURCES;
577 }
578
579 ConfigInfo->SpareStrLen = 0;
580 ConfigInfo->Storage = Storage;
581 InsertTailList (&Form->ConfigRequestHead, &ConfigInfo->Link);
582 }
583
584 StringSize = (ConfigInfo->ConfigRequest != NULL) ? StrSize (ConfigInfo->ConfigRequest) : sizeof (CHAR16);
585 MaxLen = StringSize / sizeof (CHAR16) + ConfigInfo->SpareStrLen;
586
587 //
588 // Append <RequestElement> to <ConfigRequest>
589 //
590 if (StrLen > ConfigInfo->SpareStrLen) {
591 //
592 // Old String buffer is not sufficient for RequestElement, allocate a new one
593 //
594 MaxLen = StringSize / sizeof (CHAR16) + CONFIG_REQUEST_STRING_INCREMENTAL;
595 NewStr = AllocatePool (MaxLen * sizeof (CHAR16));
596 if (NewStr == NULL) {
597 return EFI_OUT_OF_RESOURCES;
598 }
599
600 if (ConfigInfo->ConfigRequest != NULL) {
601 CopyMem (NewStr, ConfigInfo->ConfigRequest, StringSize);
602 FreePool (ConfigInfo->ConfigRequest);
603 } else {
604 NewStr[0] = L'\0';
605 }
606
607 ConfigInfo->ConfigRequest = NewStr;
608 ConfigInfo->SpareStrLen = CONFIG_REQUEST_STRING_INCREMENTAL;
609 }
610
611 StrCatS (ConfigInfo->ConfigRequest, MaxLen, RequestElement);
612 ConfigInfo->ElementCount++;
613 ConfigInfo->SpareStrLen -= StrLen;
614
615 return EFI_SUCCESS;
616}
617
624VOID
626 IN HII_EXPRESSION *Expression
627 )
628{
629 LIST_ENTRY *Link;
630 HII_EXPRESSION_OPCODE *OpCode;
631 LIST_ENTRY *SubExpressionLink;
632 HII_EXPRESSION *SubExpression;
633
634 while (!IsListEmpty (&Expression->OpCodeListHead)) {
635 Link = GetFirstNode (&Expression->OpCodeListHead);
636 OpCode = HII_EXPRESSION_OPCODE_FROM_LINK (Link);
637
638 RemoveEntryList (&OpCode->Link);
639 if ((OpCode->Operand == EFI_IFR_EQ_ID_VAL_LIST_OP) && (OpCode->ExtraData.EqIdListData.ValueList != NULL)) {
640 FreePool (OpCode->ExtraData.EqIdListData.ValueList);
641 }
642
643 if (((OpCode->Operand == EFI_IFR_GET_OP) || (OpCode->Operand == EFI_IFR_SET_OP)) &&
644 (OpCode->ExtraData.GetSetData.ValueName != NULL))
645 {
646 FreePool (OpCode->ExtraData.GetSetData.ValueName);
647 }
648
649 if (OpCode->MapExpressionList.ForwardLink != NULL) {
650 while (!IsListEmpty (&OpCode->MapExpressionList)) {
651 SubExpressionLink = GetFirstNode (&OpCode->MapExpressionList);
652 SubExpression = HII_EXPRESSION_FROM_LINK (SubExpressionLink);
653 RemoveEntryList (&SubExpression->Link);
654 DestroyExpression (SubExpression);
655 }
656 }
657 }
658
659 //
660 // Free this Expression
661 //
662 FreePool (Expression);
663}
664
676 IN EFI_STRING_ID StringId,
677 IN EFI_HII_HANDLE HiiHandle
678 )
679{
680 CHAR16 NullChar;
681
682 NullChar = CHAR_NULL;
683 HiiSetString (HiiHandle, StringId, &NullChar, NULL);
684 return EFI_SUCCESS;
685}
686
694VOID
696 IN HII_FORMSET *FormSet,
697 IN OUT HII_STATEMENT *Statement
698 )
699{
700 LIST_ENTRY *Link;
701 HII_QUESTION_DEFAULT *Default;
702 HII_QUESTION_OPTION *Option;
703 HII_EXPRESSION *Expression;
704
705 //
706 // Free Default value List
707 //
708 while (!IsListEmpty (&Statement->DefaultListHead)) {
709 Link = GetFirstNode (&Statement->DefaultListHead);
710 Default = HII_QUESTION_DEFAULT_FROM_LINK (Link);
711 RemoveEntryList (&Default->Link);
712
713 if (Default->Value.Buffer != NULL) {
714 FreePool (Default->Value.Buffer);
715 }
716
717 FreePool (Default);
718 }
719
720 //
721 // Free Options List
722 //
723 while (!IsListEmpty (&Statement->OptionListHead)) {
724 Link = GetFirstNode (&Statement->OptionListHead);
725 Option = HII_QUESTION_OPTION_FROM_LINK (Link);
726
727 if (Option->SuppressExpression != NULL) {
729 }
730
731 RemoveEntryList (&Option->Link);
732
733 FreePool (Option);
734 }
735
736 //
737 // Free Inconsistent List
738 //
739 while (!IsListEmpty (&Statement->InconsistentListHead)) {
740 Link = GetFirstNode (&Statement->InconsistentListHead);
741 Expression = HII_EXPRESSION_FROM_LINK (Link);
742 RemoveEntryList (&Expression->Link);
743
744 DestroyExpression (Expression);
745 }
746
747 //
748 // Free NoSubmit List
749 //
750 while (!IsListEmpty (&Statement->NoSubmitListHead)) {
751 Link = GetFirstNode (&Statement->NoSubmitListHead);
752 Expression = HII_EXPRESSION_FROM_LINK (Link);
753 RemoveEntryList (&Expression->Link);
754
755 DestroyExpression (Expression);
756 }
757
758 //
759 // Free WarningIf List
760 //
761 while (!IsListEmpty (&Statement->WarningListHead)) {
762 Link = GetFirstNode (&Statement->WarningListHead);
763 Expression = HII_EXPRESSION_FROM_LINK (Link);
764 RemoveEntryList (&Expression->Link);
765
766 DestroyExpression (Expression);
767 }
768
769 if (Statement->ExpressionList != NULL) {
770 FreePool (Statement->ExpressionList);
771 }
772
773 if (Statement->VariableName != NULL) {
774 FreePool (Statement->VariableName);
775 }
776
777 if (Statement->BlockName != NULL) {
778 FreePool (Statement->BlockName);
779 }
780
781 if (Statement->Value.Buffer != NULL) {
782 FreePool (Statement->Value.Buffer);
783 }
784
785 if ((Statement->Operand == EFI_IFR_STRING_OP) || (Statement->Operand == EFI_IFR_PASSWORD_OP)) {
786 DeleteString (Statement->Value.Value.string, FormSet->HiiHandle);
787 }
788}
789
797VOID
799 IN HII_FORMSET *FormSet,
800 IN OUT HII_FORM *Form
801 )
802{
803 LIST_ENTRY *Link;
804 HII_EXPRESSION *Expression;
805 HII_STATEMENT *Statement;
806 HII_FORM_CONFIG_REQUEST *ConfigInfo;
807
808 //
809 // Free Rule Expressions
810 //
811 while (!IsListEmpty (&Form->RuleListHead)) {
812 Link = GetFirstNode (&Form->RuleListHead);
813 Expression = HII_EXPRESSION_FROM_LINK (Link);
814 RemoveEntryList (&Expression->Link);
815 DestroyExpression (Expression);
816 }
817
818 //
819 // Free Statements/Questions
820 //
821 while (!IsListEmpty (&Form->StatementListHead)) {
822 Link = GetFirstNode (&Form->StatementListHead);
823 Statement = HII_STATEMENT_FROM_LINK (Link);
824 RemoveEntryList (&Statement->Link);
825 DestroyStatement (FormSet, Statement);
826 }
827
828 //
829 // Free ConfigRequest string.
830 //
831 while (!IsListEmpty (&Form->ConfigRequestHead)) {
832 Link = GetFirstNode (&Form->ConfigRequestHead);
833 ConfigInfo = HII_FORM_CONFIG_REQUEST_FROM_LINK (Link);
834
835 RemoveEntryList (&ConfigInfo->Link);
836
837 FreePool (ConfigInfo->ConfigRequest);
838 FreePool (ConfigInfo);
839 }
840
841 if (Form->SuppressExpression != NULL) {
842 FreePool (Form->SuppressExpression);
843 }
844
845 //
846 // Free this Form
847 //
848 FreePool (Form);
849}
850
860BOOLEAN
862 IN UINT8 Operand
863 )
864{
865 if (((Operand >= EFI_IFR_EQ_ID_VAL_OP) && (Operand <= EFI_IFR_NOT_OP)) ||
866 ((Operand >= EFI_IFR_MATCH_OP) && (Operand <= EFI_IFR_SET_OP)) ||
867 ((Operand >= EFI_IFR_EQUAL_OP) && (Operand <= EFI_IFR_SPAN_OP)) ||
868 (Operand == EFI_IFR_CATENATE_OP) ||
869 (Operand == EFI_IFR_TO_LOWER_OP) ||
870 (Operand == EFI_IFR_TO_UPPER_OP) ||
871 (Operand == EFI_IFR_MAP_OP) ||
872 (Operand == EFI_IFR_VERSION_OP) ||
873 (Operand == EFI_IFR_SECURITY_OP) ||
874 (Operand == EFI_IFR_MATCH2_OP))
875 {
876 return TRUE;
877 } else {
878 return FALSE;
879 }
880}
881
891BOOLEAN
893 IN UINT8 Operand
894 )
895{
896 if ((Operand == EFI_IFR_SUBTITLE_OP) ||
897 (Operand == EFI_IFR_TEXT_OP) ||
898 (Operand == EFI_IFR_RESET_BUTTON_OP) ||
899 (Operand == EFI_IFR_REF_OP) ||
900 (Operand == EFI_IFR_ACTION_OP) ||
901 (Operand == EFI_IFR_NUMERIC_OP) ||
902 (Operand == EFI_IFR_ORDERED_LIST_OP) ||
903 (Operand == EFI_IFR_CHECKBOX_OP) ||
904 (Operand == EFI_IFR_STRING_OP) ||
905 (Operand == EFI_IFR_PASSWORD_OP) ||
906 (Operand == EFI_IFR_DATE_OP) ||
907 (Operand == EFI_IFR_TIME_OP) ||
908 (Operand == EFI_IFR_GUID_OP) ||
909 (Operand == EFI_IFR_ONE_OF_OP))
910 {
911 return TRUE;
912 } else {
913 return FALSE;
914 }
915}
916
926BOOLEAN
928 IN UINT8 Operand
929 )
930{
931 return Operand > EFI_IFR_MATCH2_OP ? TRUE : FALSE;
932}
933
942VOID
944 IN HII_FORMSET *FormSet,
945 IN OUT UINT16 *NumberOfStatement,
946 IN OUT UINT16 *NumberOfExpression
947 )
948{
949 UINT16 StatementCount;
950 UINT16 ExpressionCount;
951 UINT8 *OpCodeData;
952 UINTN Offset;
953 UINTN OpCodeLen;
954
955 Offset = 0;
956 StatementCount = 0;
957 ExpressionCount = 0;
958
959 while (Offset < FormSet->IfrBinaryLength) {
960 OpCodeData = FormSet->IfrBinaryData + Offset;
961 OpCodeLen = ((EFI_IFR_OP_HEADER *)OpCodeData)->Length;
962 Offset += OpCodeLen;
963
964 if (IsExpressionOpCode (((EFI_IFR_OP_HEADER *)OpCodeData)->OpCode)) {
965 ExpressionCount++;
966 } else {
967 StatementCount++;
968 }
969 }
970
971 *NumberOfStatement = StatementCount;
972 *NumberOfExpression = ExpressionCount;
973}
974
986 IN HII_FORMSET *FormSet
987 )
988{
989 EFI_STATUS Status;
990 HII_FORM *CurrentForm;
991 HII_STATEMENT *CurrentStatement;
992 HII_STATEMENT *ParentStatement;
993 HII_EXPRESSION_OPCODE *ExpressionOpCode;
994 HII_EXPRESSION *CurrentExpression;
995 UINT8 Operand;
996 UINT8 Scope;
997 UINTN OpCodeOffset;
998 UINTN OpCodeLength;
999 UINT8 *OpCodeData;
1000 UINT8 ScopeOpCode;
1001 HII_FORMSET_DEFAULTSTORE *DefaultStore;
1002 HII_QUESTION_DEFAULT *CurrentDefault;
1003 HII_QUESTION_OPTION *CurrentOption;
1004 UINT8 Width;
1005 UINT16 NumberOfStatement;
1006 UINT16 NumberOfExpression;
1007 EFI_IMAGE_ID *ImageId;
1008 BOOLEAN SuppressForQuestion;
1009 BOOLEAN SuppressForOption;
1010 UINT16 DepthOfDisable;
1011 BOOLEAN OpCodeDisabled;
1012 BOOLEAN SingleOpCodeExpression;
1013 BOOLEAN InScopeDefault;
1014 EFI_HII_VALUE *ExpressionValue;
1015 HII_STATEMENT_VALUE *StatementValue;
1016 EFI_IFR_FORM_MAP_METHOD *MapMethod;
1017 UINT8 MapScopeDepth;
1018 LIST_ENTRY *Link;
1019 HII_FORMSET_STORAGE *Storage;
1020 LIST_ENTRY *MapExpressionList;
1021 EFI_VARSTORE_ID TempVarstoreId;
1022 BOOLEAN InScopeDisable;
1023 INTN ConditionalExprCount;
1024 BOOLEAN InUnknownScope;
1025 UINT8 UnknownDepth;
1026 HII_FORMSET_DEFAULTSTORE *PreDefaultStore;
1027 LIST_ENTRY *DefaultLink;
1028 BOOLEAN HaveInserted;
1029 UINT16 TotalBits;
1030 BOOLEAN QuestionReferBitField;
1031
1032 SuppressForQuestion = FALSE;
1033 SuppressForOption = FALSE;
1034 InScopeDisable = FALSE;
1035 DepthOfDisable = 0;
1036 OpCodeDisabled = FALSE;
1037 SingleOpCodeExpression = FALSE;
1038 InScopeDefault = FALSE;
1039 CurrentExpression = NULL;
1040 CurrentDefault = NULL;
1041 CurrentOption = NULL;
1042 ImageId = NULL;
1043 MapMethod = NULL;
1044 MapScopeDepth = 0;
1045 Link = NULL;
1046 MapExpressionList = NULL;
1047 TempVarstoreId = 0;
1048 ConditionalExprCount = 0;
1049 InUnknownScope = FALSE;
1050 UnknownDepth = 0;
1051 QuestionReferBitField = FALSE;
1052
1053 //
1054 // Get the number of Statements and Expressions
1055 //
1056 CountOpCodes (FormSet, &NumberOfStatement, &NumberOfExpression);
1057
1058 InitializeListHead (&FormSet->StatementListOSF);
1059 InitializeListHead (&FormSet->StorageListHead);
1060 InitializeListHead (&FormSet->DefaultStoreListHead);
1061 InitializeListHead (&FormSet->FormListHead);
1064
1065 CurrentForm = NULL;
1066 CurrentStatement = NULL;
1067 ParentStatement = NULL;
1068
1069 ResetScopeStack ();
1070
1071 OpCodeOffset = 0;
1072 while (OpCodeOffset < FormSet->IfrBinaryLength) {
1073 OpCodeData = FormSet->IfrBinaryData + OpCodeOffset;
1074
1075 OpCodeLength = ((EFI_IFR_OP_HEADER *)OpCodeData)->Length;
1076 OpCodeOffset += OpCodeLength;
1077 Operand = ((EFI_IFR_OP_HEADER *)OpCodeData)->OpCode;
1078 Scope = ((EFI_IFR_OP_HEADER *)OpCodeData)->Scope;
1079 if (InUnknownScope) {
1080 if (Operand == EFI_IFR_END_OP) {
1081 UnknownDepth--;
1082
1083 if (UnknownDepth == 0) {
1084 InUnknownScope = FALSE;
1085 }
1086 } else {
1087 if (Scope != 0) {
1088 UnknownDepth++;
1089 }
1090 }
1091
1092 continue;
1093 }
1094
1095 if (IsUnKnownOpCode (Operand)) {
1096 if (Scope != 0) {
1097 InUnknownScope = TRUE;
1098 UnknownDepth++;
1099 }
1100
1101 continue;
1102 }
1103
1104 //
1105 // If scope bit set, push onto scope stack
1106 //
1107 if (Scope != 0) {
1108 PushScope (Operand);
1109 }
1110
1111 if (OpCodeDisabled) {
1112 //
1113 // DisableIf Expression is evaluated to be TRUE, try to find its end.
1114 // Here only cares the EFI_IFR_DISABLE_IF and EFI_IFR_END
1115 //
1116 if (Operand == EFI_IFR_DISABLE_IF_OP) {
1117 DepthOfDisable++;
1118 } else if (Operand == EFI_IFR_END_OP) {
1119 Status = PopScope (&ScopeOpCode);
1120 if (EFI_ERROR (Status)) {
1121 return Status;
1122 }
1123
1124 if (ScopeOpCode == EFI_IFR_DISABLE_IF_OP) {
1125 if (DepthOfDisable == 0) {
1126 InScopeDisable = FALSE;
1127 OpCodeDisabled = FALSE;
1128 } else {
1129 DepthOfDisable--;
1130 }
1131 }
1132 }
1133
1134 continue;
1135 }
1136
1137 if (IsExpressionOpCode (Operand)) {
1138 ExpressionOpCode = (HII_EXPRESSION_OPCODE *)AllocateZeroPool (sizeof (HII_EXPRESSION_OPCODE));
1139 if (ExpressionOpCode == NULL) {
1140 return EFI_OUT_OF_RESOURCES;
1141 }
1142
1143 ExpressionOpCode->Signature = HII_EXPRESSION_OPCODE_SIGNATURE;
1144 ExpressionOpCode->Operand = Operand;
1145
1146 switch (Operand) {
1147 case EFI_IFR_EQ_ID_VAL_OP:
1148
1149 CopyMem (&ExpressionOpCode->ExtraData.EqIdValData.QuestionId, &((EFI_IFR_EQ_ID_VAL *)OpCodeData)->QuestionId, sizeof (EFI_QUESTION_ID));
1150
1151 ExpressionValue = &ExpressionOpCode->ExtraData.EqIdValData.Value;
1152 ExpressionValue->Type = EFI_IFR_TYPE_NUM_SIZE_16;
1153 CopyMem (&ExpressionValue->Value.u16, &((EFI_IFR_EQ_ID_VAL *)OpCodeData)->Value, sizeof (UINT16));
1154 break;
1155
1156 case EFI_IFR_EQ_ID_ID_OP:
1157 CopyMem (&ExpressionOpCode->ExtraData.EqIdIdData.QuestionId1, &((EFI_IFR_EQ_ID_ID *)OpCodeData)->QuestionId1, sizeof (EFI_QUESTION_ID));
1158 CopyMem (&ExpressionOpCode->ExtraData.EqIdIdData.QuestionId2, &((EFI_IFR_EQ_ID_ID *)OpCodeData)->QuestionId2, sizeof (EFI_QUESTION_ID));
1159 break;
1160
1161 case EFI_IFR_EQ_ID_VAL_LIST_OP:
1162
1163 CopyMem (&ExpressionOpCode->ExtraData.EqIdListData.QuestionId, &((EFI_IFR_EQ_ID_VAL_LIST *)OpCodeData)->QuestionId, sizeof (EFI_QUESTION_ID));
1164 CopyMem (&ExpressionOpCode->ExtraData.EqIdListData.ListLength, &((EFI_IFR_EQ_ID_VAL_LIST *)OpCodeData)->ListLength, sizeof (UINT16));
1165 ExpressionOpCode->ExtraData.EqIdListData.ValueList = AllocateCopyPool (
1166 ExpressionOpCode->ExtraData.EqIdListData.ListLength * sizeof (UINT16),
1167 &((EFI_IFR_EQ_ID_VAL_LIST *)OpCodeData)->ValueList
1168 );
1169 if (ExpressionOpCode->ExtraData.EqIdListData.ValueList == NULL) {
1170 return EFI_OUT_OF_RESOURCES;
1171 }
1172
1173 break;
1174
1175 case EFI_IFR_TO_STRING_OP:
1176 case EFI_IFR_FIND_OP:
1177
1178 ExpressionOpCode->ExtraData.Format = ((EFI_IFR_TO_STRING *)OpCodeData)->Format;
1179 break;
1180
1181 case EFI_IFR_STRING_REF1_OP:
1182
1183 ExpressionValue = &ExpressionOpCode->ExtraData.Value;
1184 ExpressionValue->Type = EFI_IFR_TYPE_STRING;
1185 CopyMem (&ExpressionValue->Value.string, &((EFI_IFR_STRING_REF1 *)OpCodeData)->StringId, sizeof (EFI_STRING_ID));
1186 break;
1187
1188 case EFI_IFR_RULE_REF_OP:
1189
1190 ExpressionOpCode->ExtraData.RuleId = ((EFI_IFR_RULE_REF *)OpCodeData)->RuleId;
1191 break;
1192
1193 case EFI_IFR_SPAN_OP:
1194
1195 ExpressionOpCode->ExtraData.Flags = ((EFI_IFR_SPAN *)OpCodeData)->Flags;
1196 break;
1197
1198 case EFI_IFR_THIS_OP:
1199
1200 if (ParentStatement != NULL) {
1201 ExpressionOpCode->ExtraData.QuestionRef1Data.QuestionId = ParentStatement->QuestionId;
1202 }
1203
1204 break;
1205
1206 case EFI_IFR_SECURITY_OP:
1207
1208 CopyMem (&ExpressionOpCode->ExtraData.Guid, &((EFI_IFR_SECURITY *)OpCodeData)->Permissions, sizeof (EFI_GUID));
1209 break;
1210
1211 case EFI_IFR_MATCH2_OP:
1212
1213 CopyMem (&ExpressionOpCode->ExtraData.Guid, &((EFI_IFR_MATCH2 *)OpCodeData)->SyntaxType, sizeof (EFI_GUID));
1214 break;
1215
1216 case EFI_IFR_GET_OP:
1217 case EFI_IFR_SET_OP:
1218
1219 CopyMem (&TempVarstoreId, &((EFI_IFR_GET *)OpCodeData)->VarStoreId, sizeof (TempVarstoreId));
1220 if (TempVarstoreId != 0) {
1221 if (FormSet->StorageListHead.ForwardLink != NULL) {
1222 Link = GetFirstNode (&FormSet->StorageListHead);
1223 while (!IsNull (&FormSet->StorageListHead, Link)) {
1224 Storage = HII_STORAGE_FROM_LINK (Link);
1225 if (Storage->VarStoreId == ((EFI_IFR_GET *)OpCodeData)->VarStoreId) {
1226 ExpressionOpCode->ExtraData.GetSetData.VarStorage = Storage;
1227 break;
1228 }
1229
1230 Link = GetNextNode (&FormSet->StorageListHead, Link);
1231 }
1232 }
1233
1234 if (ExpressionOpCode->ExtraData.GetSetData.VarStorage == NULL) {
1235 //
1236 // VarStorage is not found.
1237 //
1238 return EFI_INVALID_PARAMETER;
1239 }
1240 }
1241
1242 ExpressionOpCode->ExtraData.GetSetData.ValueType = ((EFI_IFR_GET *)OpCodeData)->VarStoreType;
1243 switch (ExpressionOpCode->ExtraData.GetSetData.ValueType) {
1244 case EFI_IFR_TYPE_BOOLEAN:
1245 case EFI_IFR_TYPE_NUM_SIZE_8:
1246 ExpressionOpCode->ExtraData.GetSetData.ValueWidth = 1;
1247 break;
1248
1249 case EFI_IFR_TYPE_NUM_SIZE_16:
1250 case EFI_IFR_TYPE_STRING:
1251 ExpressionOpCode->ExtraData.GetSetData.ValueWidth = 2;
1252 break;
1253
1254 case EFI_IFR_TYPE_NUM_SIZE_32:
1255 ExpressionOpCode->ExtraData.GetSetData.ValueWidth = 4;
1256 break;
1257
1258 case EFI_IFR_TYPE_NUM_SIZE_64:
1259 ExpressionOpCode->ExtraData.GetSetData.ValueWidth = 8;
1260 break;
1261
1262 case EFI_IFR_TYPE_DATE:
1263 ExpressionOpCode->ExtraData.GetSetData.ValueWidth = (UINT8)sizeof (EFI_IFR_DATE);
1264 break;
1265
1266 case EFI_IFR_TYPE_TIME:
1267 ExpressionOpCode->ExtraData.GetSetData.ValueWidth = (UINT8)sizeof (EFI_IFR_TIME);
1268 break;
1269
1270 case EFI_IFR_TYPE_REF:
1271 ExpressionOpCode->ExtraData.GetSetData.ValueWidth = (UINT8)sizeof (EFI_IFR_REF);
1272 break;
1273
1274 case EFI_IFR_TYPE_OTHER:
1275 case EFI_IFR_TYPE_UNDEFINED:
1276 case EFI_IFR_TYPE_ACTION:
1277 case EFI_IFR_TYPE_BUFFER:
1278 default:
1279 //
1280 // Invalid value type for Get/Set opcode.
1281 //
1282 return EFI_INVALID_PARAMETER;
1283 }
1284
1285 CopyMem (
1286 &ExpressionOpCode->ExtraData.GetSetData.VarStoreInfo.VarName,
1287 &((EFI_IFR_GET *)OpCodeData)->VarStoreInfo.VarName,
1288 sizeof (EFI_STRING_ID)
1289 );
1290 CopyMem (
1291 &ExpressionOpCode->ExtraData.GetSetData.VarStoreInfo.VarOffset,
1292 &((EFI_IFR_GET *)OpCodeData)->VarStoreInfo.VarOffset,
1293 sizeof (UINT16)
1294 );
1295 if ((ExpressionOpCode->ExtraData.GetSetData.VarStorage != NULL) &&
1296 ((ExpressionOpCode->ExtraData.GetSetData.VarStorage->Type == EFI_HII_VARSTORE_NAME_VALUE) ||
1297 (ExpressionOpCode->ExtraData.GetSetData.VarStorage->Type == EFI_HII_VARSTORE_EFI_VARIABLE)))
1298 {
1299 ExpressionOpCode->ExtraData.GetSetData.ValueName = GetTokenString (ExpressionOpCode->ExtraData.GetSetData.VarStoreInfo.VarName, FormSet->HiiHandle);
1300 if (ExpressionOpCode->ExtraData.GetSetData.ValueName == NULL) {
1301 //
1302 // String ID is invalid.
1303 //
1304 return EFI_INVALID_PARAMETER;
1305 }
1306 }
1307
1308 break;
1309
1310 case EFI_IFR_QUESTION_REF1_OP:
1311
1312 CopyMem (&ExpressionOpCode->ExtraData.QuestionRef1Data.QuestionId, &((EFI_IFR_EQ_ID_VAL_LIST *)OpCodeData)->QuestionId, sizeof (EFI_QUESTION_ID));
1313 break;
1314
1315 case EFI_IFR_QUESTION_REF3_OP:
1316
1317 if (OpCodeLength >= sizeof (EFI_IFR_QUESTION_REF3_2)) {
1318 CopyMem (&ExpressionOpCode->ExtraData.QuestionRef3Data.DevicePath, &((EFI_IFR_QUESTION_REF3_2 *)OpCodeData)->DevicePath, sizeof (EFI_STRING_ID));
1319
1320 if (OpCodeLength >= sizeof (EFI_IFR_QUESTION_REF3_3)) {
1321 CopyMem (&ExpressionOpCode->ExtraData.QuestionRef3Data.Guid, &((EFI_IFR_QUESTION_REF3_3 *)OpCodeData)->Guid, sizeof (EFI_GUID));
1322 }
1323 }
1324
1325 break;
1326
1327 //
1328 // constant
1329 //
1330 case EFI_IFR_TRUE_OP:
1331
1332 ExpressionValue = &ExpressionOpCode->ExtraData.Value;
1333 ExpressionValue->Type = EFI_IFR_TYPE_BOOLEAN;
1334 ExpressionValue->Value.b = TRUE;
1335 break;
1336
1337 case EFI_IFR_FALSE_OP:
1338
1339 ExpressionValue = &ExpressionOpCode->ExtraData.Value;
1340 ExpressionValue->Type = EFI_IFR_TYPE_BOOLEAN;
1341 ExpressionValue->Value.b = FALSE;
1342 break;
1343
1344 case EFI_IFR_ONE_OP:
1345
1346 ExpressionValue = &ExpressionOpCode->ExtraData.Value;
1347 ExpressionValue->Type = EFI_IFR_TYPE_NUM_SIZE_8;
1348 ExpressionValue->Value.u8 = 1;
1349 break;
1350
1351 case EFI_IFR_ZERO_OP:
1352
1353 ExpressionValue = &ExpressionOpCode->ExtraData.Value;
1354 ExpressionValue->Type = EFI_IFR_TYPE_NUM_SIZE_8;
1355 ExpressionValue->Value.u8 = 0;
1356 break;
1357
1358 case EFI_IFR_ONES_OP:
1359
1360 ExpressionValue = &ExpressionOpCode->ExtraData.Value;
1361 ExpressionValue->Type = EFI_IFR_TYPE_NUM_SIZE_64;
1362 ExpressionValue->Value.u64 = 0xffffffffffffffffULL;
1363 break;
1364
1365 case EFI_IFR_UINT8_OP:
1366
1367 ExpressionValue = &ExpressionOpCode->ExtraData.Value;
1368 ExpressionValue->Type = EFI_IFR_TYPE_NUM_SIZE_8;
1369 ExpressionValue->Value.u8 = ((EFI_IFR_UINT8 *)OpCodeData)->Value;
1370 break;
1371
1372 case EFI_IFR_UINT16_OP:
1373
1374 ExpressionValue = &ExpressionOpCode->ExtraData.Value;
1375 ExpressionValue->Type = EFI_IFR_TYPE_NUM_SIZE_16;
1376 CopyMem (&ExpressionValue->Value.u16, &((EFI_IFR_UINT16 *)OpCodeData)->Value, sizeof (UINT16));
1377 break;
1378
1379 case EFI_IFR_UINT32_OP:
1380
1381 ExpressionValue = &ExpressionOpCode->ExtraData.Value;
1382 ExpressionValue->Type = EFI_IFR_TYPE_NUM_SIZE_32;
1383 CopyMem (&ExpressionValue->Value.u32, &((EFI_IFR_UINT32 *)OpCodeData)->Value, sizeof (UINT32));
1384 break;
1385
1386 case EFI_IFR_UINT64_OP:
1387
1388 ExpressionValue = &ExpressionOpCode->ExtraData.Value;
1389 ExpressionValue->Type = EFI_IFR_TYPE_NUM_SIZE_64;
1390 CopyMem (&ExpressionValue->Value.u64, &((EFI_IFR_UINT64 *)OpCodeData)->Value, sizeof (UINT64));
1391 break;
1392
1393 case EFI_IFR_UNDEFINED_OP:
1394 ExpressionValue = &ExpressionOpCode->ExtraData.Value;
1395 ExpressionValue->Type = EFI_IFR_TYPE_UNDEFINED;
1396 break;
1397
1398 case EFI_IFR_VERSION_OP:
1399 ExpressionValue = &ExpressionOpCode->ExtraData.Value;
1400 ExpressionValue->Type = EFI_IFR_TYPE_NUM_SIZE_16;
1401 ExpressionValue->Value.u16 = EFI_IFR_SPECIFICATION_VERSION;
1402 break;
1403
1404 default:
1405 break;
1406 }
1407
1408 //
1409 // Create sub expression nested in MAP opcode
1410 //
1411 if ((CurrentExpression == NULL) && (MapScopeDepth > 0)) {
1412 CurrentExpression = CreateExpression (CurrentForm, OpCodeData);
1413 if (CurrentExpression == NULL) {
1414 continue;
1415 }
1416
1417 InsertTailList (MapExpressionList, &CurrentExpression->Link);
1418 if (Scope == 0) {
1419 SingleOpCodeExpression = TRUE;
1420 }
1421 }
1422
1423 InsertTailList (&CurrentExpression->OpCodeListHead, &ExpressionOpCode->Link);
1424 if (Operand == EFI_IFR_MAP_OP) {
1425 //
1426 // Store current Map Expression List.
1427 //
1428 if (MapExpressionList != NULL) {
1429 PushMapExpressionList (MapExpressionList);
1430 }
1431
1432 //
1433 // Initialize new Map Expression List.
1434 //
1435 MapExpressionList = &ExpressionOpCode->MapExpressionList;
1436 InitializeListHead (MapExpressionList);
1437 //
1438 // Store current expression.
1439 //
1440 PushCurrentExpression (CurrentExpression);
1441 CurrentExpression = NULL;
1442 MapScopeDepth++;
1443 } else if (SingleOpCodeExpression) {
1444 //
1445 // There are two cases to indicate the end of an Expression:
1446 // for single OpCode expression: one Expression OpCode
1447 // for expression consists of more than one OpCode: EFI_IFR_END
1448 //
1449 SingleOpCodeExpression = FALSE;
1450
1451 if (InScopeDisable && (CurrentForm == NULL)) {
1452 //
1453 // This is DisableIf expression for Form, it should be a constant expression
1454 //
1455 Status = EvaluateHiiExpression (FormSet, CurrentForm, CurrentExpression);
1456 if (EFI_ERROR (Status)) {
1457 return Status;
1458 }
1459
1460 OpCodeDisabled = IsHiiValueTrue (&CurrentExpression->Result);
1461 }
1462
1463 CurrentExpression = NULL;
1464 }
1465
1466 continue;
1467 }
1468
1469 //
1470 // Parse the Opcode
1471 //
1472 switch (Operand) {
1473 case EFI_IFR_FORM_SET_OP:
1474 //
1475 // Check the formset GUID
1476 //
1477
1478 if (CompareMem (&FormSet->Guid, &((EFI_IFR_FORM_SET *)OpCodeData)->Guid, sizeof (EFI_GUID)) != 0) {
1479 return EFI_INVALID_PARAMETER;
1480 }
1481
1482 CopyMem (&FormSet->FormSetTitle, &((EFI_IFR_FORM_SET *)OpCodeData)->FormSetTitle, sizeof (EFI_STRING_ID));
1483 CopyMem (&FormSet->Help, &((EFI_IFR_FORM_SET *)OpCodeData)->Help, sizeof (EFI_STRING_ID));
1484
1485 if (OpCodeLength > OFFSET_OF (EFI_IFR_FORM_SET, Flags)) {
1486 //
1487 // The formset OpCode contains ClassGuid
1488 //
1489 FormSet->NumberOfClassGuid = (UINT8)(((EFI_IFR_FORM_SET *)OpCodeData)->Flags & 0x3);
1490 CopyMem (FormSet->ClassGuid, OpCodeData + sizeof (EFI_IFR_FORM_SET), FormSet->NumberOfClassGuid * sizeof (EFI_GUID));
1491 }
1492
1493 break;
1494
1495 case EFI_IFR_FORM_OP:
1496
1497 //
1498 // Create a new Form for this FormSet
1499 //
1500 CurrentForm = AllocateZeroPool (sizeof (HII_FORM));
1501 if (CurrentForm == NULL) {
1502 break;
1503 }
1504
1505 CurrentForm->Signature = HII_FORM_SIGNATURE;
1506 InitializeListHead (&CurrentForm->StatementListHead);
1507 InitializeListHead (&CurrentForm->ConfigRequestHead);
1508 InitializeListHead (&CurrentForm->RuleListHead);
1509
1510 CurrentForm->FormType = STANDARD_MAP_FORM_TYPE;
1511 CopyMem (&CurrentForm->FormId, &((EFI_IFR_FORM *)OpCodeData)->FormId, sizeof (UINT16));
1512 CopyMem (&CurrentForm->FormTitle, &((EFI_IFR_FORM *)OpCodeData)->FormTitle, sizeof (EFI_STRING_ID));
1513
1514 ConditionalExprCount = GetConditionalExpressionCount (ExpressForm);
1515 if ( ConditionalExprCount > 0) {
1516 //
1517 // Form is inside of suppressif
1518 //
1520 (UINTN)(sizeof (HII_EXPRESSION_LIST) + ((ConditionalExprCount -1) * sizeof (HII_EXPRESSION *)))
1521 );
1522 if (CurrentForm->SuppressExpression == NULL) {
1523 break;
1524 }
1525
1526 CurrentForm->SuppressExpression->Count = (UINTN)ConditionalExprCount;
1527 CurrentForm->SuppressExpression->Signature = HII_EXPRESSION_LIST_SIGNATURE;
1528 CopyMem (CurrentForm->SuppressExpression->Expression, GetConditionalExpressionList (ExpressForm), (UINTN)(sizeof (HII_EXPRESSION *) * ConditionalExprCount));
1529 }
1530
1531 if (Scope != 0) {
1532 //
1533 // Enter scope of a Form, suppressif will be used for Question or Option
1534 //
1535 SuppressForQuestion = TRUE;
1536 }
1537
1538 //
1539 // Insert into Form list of this FormSet
1540 //
1541 InsertTailList (&FormSet->FormListHead, &CurrentForm->Link);
1542 break;
1543
1544 case EFI_IFR_FORM_MAP_OP:
1545
1546 //
1547 // Create a new Form for this FormSet
1548 //
1549 CurrentForm = AllocateZeroPool (sizeof (HII_FORM));
1550 if (CurrentForm == NULL) {
1551 return EFI_OUT_OF_RESOURCES;
1552 }
1553
1554 CurrentForm->Signature = HII_FORM_SIGNATURE;
1555 InitializeListHead (&CurrentForm->StatementListHead);
1556 InitializeListHead (&CurrentForm->ConfigRequestHead);
1557 InitializeListHead (&CurrentForm->RuleListHead);
1558
1559 CopyMem (&CurrentForm->FormId, &((EFI_IFR_FORM *)OpCodeData)->FormId, sizeof (UINT16));
1560
1561 MapMethod = (EFI_IFR_FORM_MAP_METHOD *)(OpCodeData + sizeof (EFI_IFR_FORM_MAP));
1562 //
1563 // FormMap Form must contain at least one Map Method.
1564 //
1565 if (((EFI_IFR_OP_HEADER *)OpCodeData)->Length < ((UINTN)(UINT8 *)(MapMethod + 1) - (UINTN)OpCodeData)) {
1566 return EFI_INVALID_PARAMETER;
1567 }
1568
1569 //
1570 // Try to find the standard form map method.
1571 //
1572 while (((UINTN)(UINT8 *)MapMethod - (UINTN)OpCodeData) < ((EFI_IFR_OP_HEADER *)OpCodeData)->Length) {
1573 if (CompareGuid ((EFI_GUID *)(VOID *)&MapMethod->MethodIdentifier, &gEfiHiiStandardFormGuid)) {
1574 CopyMem (&CurrentForm->FormTitle, &MapMethod->MethodTitle, sizeof (EFI_STRING_ID));
1575 CurrentForm->FormType = STANDARD_MAP_FORM_TYPE;
1576 break;
1577 }
1578
1579 MapMethod++;
1580 }
1581
1582 //
1583 // If the standard form map method is not found, the first map method title will be used.
1584 //
1585 if (CurrentForm->FormTitle == 0) {
1586 MapMethod = (EFI_IFR_FORM_MAP_METHOD *)(OpCodeData + sizeof (EFI_IFR_FORM_MAP));
1587 CopyMem (&CurrentForm->FormTitle, &MapMethod->MethodTitle, sizeof (EFI_STRING_ID));
1588 }
1589
1590 ConditionalExprCount = GetConditionalExpressionCount (ExpressForm);
1591 if ( ConditionalExprCount > 0) {
1592 //
1593 // Form is inside of suppressif
1594 //
1596 (UINTN)(sizeof (HII_EXPRESSION_LIST) + ((ConditionalExprCount -1) * sizeof (HII_EXPRESSION *)))
1597 );
1598 if (CurrentForm->SuppressExpression == NULL) {
1599 FreePool (CurrentForm);
1600 return EFI_OUT_OF_RESOURCES;
1601 }
1602
1603 CurrentForm->SuppressExpression->Count = (UINTN)ConditionalExprCount;
1604 CurrentForm->SuppressExpression->Signature = HII_EXPRESSION_LIST_SIGNATURE;
1605 CopyMem (CurrentForm->SuppressExpression->Expression, GetConditionalExpressionList (ExpressForm), (UINTN)(sizeof (HII_EXPRESSION *) * ConditionalExprCount));
1606 }
1607
1608 if (Scope != 0) {
1609 //
1610 // Enter scope of a Form, suppressif will be used for Question or Option
1611 //
1612 SuppressForQuestion = TRUE;
1613 }
1614
1615 //
1616 // Insert into Form list of this FormSet
1617 //
1618 InsertTailList (&FormSet->FormListHead, &CurrentForm->Link);
1619 break;
1620
1621 //
1622 // Storage
1623 //
1624 case EFI_IFR_VARSTORE_OP:
1625
1626 //
1627 // Create a buffer Storage for this FormSet
1628 //
1629 Storage = CreateStorage (FormSet, EFI_HII_VARSTORE_BUFFER, OpCodeData);
1630 CopyMem (&Storage->VarStoreId, &((EFI_IFR_VARSTORE *)OpCodeData)->VarStoreId, sizeof (EFI_VARSTORE_ID));
1631 break;
1632
1633 case EFI_IFR_VARSTORE_NAME_VALUE_OP:
1634
1635 //
1636 // Create a name/value Storage for this FormSet
1637 //
1638 Storage = CreateStorage (FormSet, EFI_HII_VARSTORE_NAME_VALUE, OpCodeData);
1639 CopyMem (&Storage->VarStoreId, &((EFI_IFR_VARSTORE_NAME_VALUE *)OpCodeData)->VarStoreId, sizeof (EFI_VARSTORE_ID));
1640 break;
1641
1642 case EFI_IFR_VARSTORE_EFI_OP:
1643
1644 //
1645 // Create a EFI variable Storage for this FormSet
1646 //
1647 if (OpCodeLength < sizeof (EFI_IFR_VARSTORE_EFI)) {
1648 //
1649 // Create efi varstore with format follow UEFI spec before 2.3.1.
1650 //
1651 Storage = CreateStorage (FormSet, EFI_HII_VARSTORE_EFI_VARIABLE, OpCodeData);
1652 } else {
1653 //
1654 // Create efi varstore with format follow UEFI spec 2.3.1 and later.
1655 //
1656 Storage = CreateStorage (FormSet, EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER, OpCodeData);
1657 }
1658
1659 CopyMem (&Storage->VarStoreId, &((EFI_IFR_VARSTORE_EFI *)OpCodeData)->VarStoreId, sizeof (EFI_VARSTORE_ID));
1660 break;
1661
1662 //
1663 // DefaultStore
1664 //
1665 case EFI_IFR_DEFAULTSTORE_OP:
1666
1667 HaveInserted = FALSE;
1668 DefaultStore = AllocateZeroPool (sizeof (HII_FORMSET_DEFAULTSTORE));
1669 if (DefaultStore == NULL) {
1670 return EFI_OUT_OF_RESOURCES;
1671 }
1672
1673 DefaultStore->Signature = HII_FORMSET_DEFAULTSTORE_SIGNATURE;
1674
1675 CopyMem (&DefaultStore->DefaultId, &((EFI_IFR_DEFAULTSTORE *)OpCodeData)->DefaultId, sizeof (UINT16));
1676 CopyMem (&DefaultStore->DefaultName, &((EFI_IFR_DEFAULTSTORE *)OpCodeData)->DefaultName, sizeof (EFI_STRING_ID));
1677 //
1678 // Insert it to the DefaultStore list of this Formset with ascending order.
1679 //
1680 if (!IsListEmpty (&FormSet->DefaultStoreListHead)) {
1681 DefaultLink = GetFirstNode (&FormSet->DefaultStoreListHead);
1682 while (!IsNull (&FormSet->DefaultStoreListHead, DefaultLink)) {
1683 PreDefaultStore = HII_FORMSET_DEFAULTSTORE_FROM_LINK (DefaultLink);
1684 DefaultLink = GetNextNode (&FormSet->DefaultStoreListHead, DefaultLink);
1685 if (DefaultStore->DefaultId < PreDefaultStore->DefaultId) {
1686 InsertTailList (&PreDefaultStore->Link, &DefaultStore->Link);
1687 HaveInserted = TRUE;
1688 break;
1689 }
1690 }
1691 }
1692
1693 if (!HaveInserted) {
1694 InsertTailList (&FormSet->DefaultStoreListHead, &DefaultStore->Link);
1695 }
1696
1697 break;
1698
1699 //
1700 // Statements
1701 //
1702 case EFI_IFR_SUBTITLE_OP:
1703
1704 CurrentStatement = CreateStatement (OpCodeData, FormSet, CurrentForm);
1705 break;
1706
1707 case EFI_IFR_TEXT_OP:
1708
1709 CurrentStatement = CreateStatement (OpCodeData, FormSet, CurrentForm);
1710 CopyMem (&CurrentStatement->ExtraData.TextTwo, &((EFI_IFR_TEXT *)OpCodeData)->TextTwo, sizeof (EFI_STRING_ID));
1711 break;
1712
1713 case EFI_IFR_RESET_BUTTON_OP:
1714
1715 CurrentStatement = CreateStatement (OpCodeData, FormSet, CurrentForm);
1716 CopyMem (&CurrentStatement->ExtraData.DefaultId, &((EFI_IFR_RESET_BUTTON *)OpCodeData)->DefaultId, sizeof (EFI_DEFAULT_ID));
1717 break;
1718
1719 //
1720 // Questions
1721 //
1722 case EFI_IFR_ACTION_OP:
1723
1724 CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
1725 CurrentStatement->Value.Type = EFI_IFR_TYPE_ACTION;
1726
1727 if (OpCodeLength == sizeof (EFI_IFR_ACTION_1)) {
1728 //
1729 // No QuestionConfig present, so no configuration string will be processed
1730 //
1731 CurrentStatement->ExtraData.QuestionConfig = 0;
1732 } else {
1733 CopyMem (&CurrentStatement->ExtraData.QuestionConfig, &((EFI_IFR_ACTION *)OpCodeData)->QuestionConfig, sizeof (EFI_STRING_ID));
1734 }
1735
1736 break;
1737
1738 case EFI_IFR_REF_OP:
1739
1740 CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
1741 StatementValue = &CurrentStatement->Value;
1742 StatementValue->Type = EFI_IFR_TYPE_REF;
1743 if (OpCodeLength >= sizeof (EFI_IFR_REF)) {
1744 CopyMem (&StatementValue->Value.ref.FormId, &((EFI_IFR_REF *)OpCodeData)->FormId, sizeof (EFI_FORM_ID));
1745
1746 if (OpCodeLength >= sizeof (EFI_IFR_REF2)) {
1747 CopyMem (&StatementValue->Value.ref.QuestionId, &((EFI_IFR_REF2 *)OpCodeData)->QuestionId, sizeof (EFI_QUESTION_ID));
1748
1749 if (OpCodeLength >= sizeof (EFI_IFR_REF3)) {
1750 CopyMem (&StatementValue->Value.ref.FormSetGuid, &((EFI_IFR_REF3 *)OpCodeData)->FormSetId, sizeof (EFI_GUID));
1751
1752 if (OpCodeLength >= sizeof (EFI_IFR_REF4)) {
1753 CopyMem (&StatementValue->Value.ref.DevicePath, &((EFI_IFR_REF4 *)OpCodeData)->DevicePath, sizeof (EFI_STRING_ID));
1754 }
1755 }
1756 }
1757 }
1758
1759 CurrentStatement->StorageWidth = (UINT16)sizeof (EFI_HII_REF);
1760 InitializeRequestElement (FormSet, CurrentStatement, CurrentForm);
1761 break;
1762
1763 case EFI_IFR_ONE_OF_OP:
1764 case EFI_IFR_NUMERIC_OP:
1765
1766 CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
1767 CurrentStatement->ExtraData.NumData.Flags = ((EFI_IFR_ONE_OF *)OpCodeData)->Flags;
1768 StatementValue = &CurrentStatement->Value;
1769
1770 if (QuestionReferBitField) {
1771 //
1772 // Get the bit var store info (bit/byte offset, bit/byte offset)
1773 //
1774 CurrentStatement->QuestionReferToBitField = TRUE;
1775 CurrentStatement->BitStorageWidth = CurrentStatement->ExtraData.NumData.Flags & EDKII_IFR_NUMERIC_SIZE_BIT;
1776 CurrentStatement->BitVarOffset = CurrentStatement->VarStoreInfo.VarOffset;
1777 CurrentStatement->VarStoreInfo.VarOffset = CurrentStatement->BitVarOffset / 8;
1778 TotalBits = CurrentStatement->BitVarOffset % 8 + CurrentStatement->BitStorageWidth;
1779 CurrentStatement->StorageWidth = (TotalBits % 8 == 0 ? TotalBits / 8 : TotalBits / 8 + 1);
1780
1781 //
1782 // Get the Minimum/Maximum/Step value(Note: bit field type has been stored as UINT32 type)
1783 //
1784 CurrentStatement->ExtraData.NumData.Minimum = ((EFI_IFR_NUMERIC *)OpCodeData)->data.u32.MinValue;
1785 CurrentStatement->ExtraData.NumData.Maximum = ((EFI_IFR_NUMERIC *)OpCodeData)->data.u32.MaxValue;
1786 CurrentStatement->ExtraData.NumData.Step = ((EFI_IFR_NUMERIC *)OpCodeData)->data.u32.Step;
1787
1788 //
1789 // Update the Flag and type of Minimum/Maximum/Step according to the actual width of bit field,
1790 // in order to make Browser handle these question with bit varstore correctly.
1791 //
1792 ((EFI_IFR_NUMERIC *)OpCodeData)->Flags &= EDKII_IFR_DISPLAY_BIT;
1793 ((EFI_IFR_NUMERIC *)OpCodeData)->Flags >>= 2;
1794 switch (CurrentStatement->StorageWidth) {
1795 case 1:
1796 ((EFI_IFR_NUMERIC *)OpCodeData)->Flags |= EFI_IFR_TYPE_NUM_SIZE_8;
1797 ((EFI_IFR_NUMERIC *)OpCodeData)->data.u8.MinValue = (UINT8)CurrentStatement->ExtraData.NumData.Minimum;
1798 ((EFI_IFR_NUMERIC *)OpCodeData)->data.u8.MaxValue = (UINT8)CurrentStatement->ExtraData.NumData.Maximum;
1799 ((EFI_IFR_NUMERIC *)OpCodeData)->data.u8.Step = (UINT8)CurrentStatement->ExtraData.NumData.Step;
1800 StatementValue->Type = EFI_IFR_TYPE_NUM_SIZE_8;
1801 break;
1802 case 2:
1803 ((EFI_IFR_NUMERIC *)OpCodeData)->Flags |= EFI_IFR_TYPE_NUM_SIZE_16;
1804 ((EFI_IFR_NUMERIC *)OpCodeData)->data.u16.MinValue = (UINT16)CurrentStatement->ExtraData.NumData.Minimum;
1805 ((EFI_IFR_NUMERIC *)OpCodeData)->data.u16.MaxValue = (UINT16)CurrentStatement->ExtraData.NumData.Maximum;
1806 ((EFI_IFR_NUMERIC *)OpCodeData)->data.u16.Step = (UINT16)CurrentStatement->ExtraData.NumData.Step;
1807 StatementValue->Type = EFI_IFR_TYPE_NUM_SIZE_16;
1808 break;
1809 case 3:
1810 case 4:
1811 ((EFI_IFR_NUMERIC *)OpCodeData)->Flags |= EFI_IFR_TYPE_NUM_SIZE_32;
1812 ((EFI_IFR_NUMERIC *)OpCodeData)->data.u32.MinValue = (UINT32)CurrentStatement->ExtraData.NumData.Minimum;
1813 ((EFI_IFR_NUMERIC *)OpCodeData)->data.u32.MaxValue = (UINT32)CurrentStatement->ExtraData.NumData.Maximum;
1814 ((EFI_IFR_NUMERIC *)OpCodeData)->data.u32.Step = (UINT32)CurrentStatement->ExtraData.NumData.Step;
1815 StatementValue->Type = EFI_IFR_TYPE_NUM_SIZE_32;
1816 break;
1817 default:
1818 break;
1819 }
1820 } else {
1821 switch (CurrentStatement->ExtraData.NumData.Flags & EFI_IFR_NUMERIC_SIZE) {
1822 case EFI_IFR_NUMERIC_SIZE_1:
1823 CurrentStatement->ExtraData.NumData.Minimum = ((EFI_IFR_NUMERIC *)OpCodeData)->data.u8.MinValue;
1824 CurrentStatement->ExtraData.NumData.Maximum = ((EFI_IFR_NUMERIC *)OpCodeData)->data.u8.MaxValue;
1825 CurrentStatement->ExtraData.NumData.Step = ((EFI_IFR_NUMERIC *)OpCodeData)->data.u8.Step;
1826 CurrentStatement->StorageWidth = (UINT16)sizeof (UINT8);
1827 StatementValue->Type = EFI_IFR_TYPE_NUM_SIZE_8;
1828
1829 break;
1830
1831 case EFI_IFR_NUMERIC_SIZE_2:
1832 CopyMem (&CurrentStatement->ExtraData.NumData.Minimum, &((EFI_IFR_NUMERIC *)OpCodeData)->data.u16.MinValue, sizeof (UINT16));
1833 CopyMem (&CurrentStatement->ExtraData.NumData.Maximum, &((EFI_IFR_NUMERIC *)OpCodeData)->data.u16.MaxValue, sizeof (UINT16));
1834 CopyMem (&CurrentStatement->ExtraData.NumData.Step, &((EFI_IFR_NUMERIC *)OpCodeData)->data.u16.Step, sizeof (UINT16));
1835 CurrentStatement->StorageWidth = (UINT16)sizeof (UINT16);
1836 StatementValue->Type = EFI_IFR_TYPE_NUM_SIZE_16;
1837
1838 break;
1839
1840 case EFI_IFR_NUMERIC_SIZE_4:
1841 CopyMem (&CurrentStatement->ExtraData.NumData.Minimum, &((EFI_IFR_NUMERIC *)OpCodeData)->data.u32.MinValue, sizeof (UINT32));
1842 CopyMem (&CurrentStatement->ExtraData.NumData.Maximum, &((EFI_IFR_NUMERIC *)OpCodeData)->data.u32.MaxValue, sizeof (UINT32));
1843 CopyMem (&CurrentStatement->ExtraData.NumData.Step, &((EFI_IFR_NUMERIC *)OpCodeData)->data.u32.Step, sizeof (UINT32));
1844 CurrentStatement->StorageWidth = (UINT16)sizeof (UINT32);
1845 StatementValue->Type = EFI_IFR_TYPE_NUM_SIZE_32;
1846
1847 break;
1848
1849 case EFI_IFR_NUMERIC_SIZE_8:
1850 CopyMem (&CurrentStatement->ExtraData.NumData.Minimum, &((EFI_IFR_NUMERIC *)OpCodeData)->data.u64.MinValue, sizeof (UINT64));
1851 CopyMem (&CurrentStatement->ExtraData.NumData.Maximum, &((EFI_IFR_NUMERIC *)OpCodeData)->data.u64.MaxValue, sizeof (UINT64));
1852 CopyMem (&CurrentStatement->ExtraData.NumData.Step, &((EFI_IFR_NUMERIC *)OpCodeData)->data.u64.Step, sizeof (UINT64));
1853 CurrentStatement->StorageWidth = (UINT16)sizeof (UINT64);
1854 StatementValue->Type = EFI_IFR_TYPE_NUM_SIZE_64;
1855
1856 break;
1857
1858 default:
1859
1860 break;
1861 }
1862 }
1863
1864 InitializeRequestElement (FormSet, CurrentStatement, CurrentForm);
1865
1866 if ((Operand == EFI_IFR_ONE_OF_OP) && (Scope != 0)) {
1867 SuppressForOption = TRUE;
1868 }
1869
1870 break;
1871
1872 case EFI_IFR_ORDERED_LIST_OP:
1873
1874 CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
1875 CurrentStatement->ExtraData.OrderListData.Flags = ((EFI_IFR_ORDERED_LIST *)OpCodeData)->Flags;
1876 CurrentStatement->ExtraData.OrderListData.MaxContainers = ((EFI_IFR_ORDERED_LIST *)OpCodeData)->MaxContainers;
1877 CurrentStatement->Value.Type = EFI_IFR_TYPE_BUFFER;
1878 CurrentStatement->Value.Buffer = NULL;
1879
1880 if (Scope != 0) {
1881 SuppressForOption = TRUE;
1882 }
1883
1884 break;
1885
1886 case EFI_IFR_CHECKBOX_OP:
1887
1888 CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
1889 CurrentStatement->ExtraData.Flags = ((EFI_IFR_CHECKBOX *)OpCodeData)->Flags;
1890 CurrentStatement->StorageWidth = (UINT16)sizeof (BOOLEAN);
1891 CurrentStatement->Value.Type = EFI_IFR_TYPE_BOOLEAN;
1892
1893 if (QuestionReferBitField) {
1894 //
1895 // Get the bit var store info (bit/byte offset, bit/byte offset)
1896 //
1897 CurrentStatement->QuestionReferToBitField = TRUE;
1898 CurrentStatement->BitStorageWidth = 1;
1899 CurrentStatement->BitVarOffset = CurrentStatement->VarStoreInfo.VarOffset;
1900 CurrentStatement->VarStoreInfo.VarOffset = CurrentStatement->BitVarOffset / 8;
1901 TotalBits = CurrentStatement->BitVarOffset % 8 + CurrentStatement->BitStorageWidth;
1902 CurrentStatement->StorageWidth = (TotalBits % 8 == 0 ? TotalBits / 8 : TotalBits / 8 + 1);
1903 }
1904
1905 InitializeRequestElement (FormSet, CurrentStatement, CurrentForm);
1906
1907 break;
1908
1909 case EFI_IFR_STRING_OP:
1910
1911 CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
1912
1913 //
1914 // MinSize is the minimum number of characters that can be accepted for this opcode,
1915 // MaxSize is the maximum number of characters that can be accepted for this opcode.
1916 // The characters are stored as Unicode, so the storage width should multiply 2.
1917 //
1918 CurrentStatement->ExtraData.StrData.MinSize = ((EFI_IFR_STRING *)OpCodeData)->MinSize;
1919 CurrentStatement->ExtraData.StrData.MaxSize = ((EFI_IFR_STRING *)OpCodeData)->MaxSize;
1920 CurrentStatement->ExtraData.StrData.Flags = ((EFI_IFR_STRING *)OpCodeData)->Flags;
1921 CurrentStatement->StorageWidth = (UINT16)((UINTN)CurrentStatement->ExtraData.StrData.MaxSize * sizeof (CHAR16));
1922
1923 CurrentStatement->Value.Type = EFI_IFR_TYPE_STRING;
1924 CurrentStatement->Value.Buffer = AllocateZeroPool (CurrentStatement->StorageWidth + sizeof (CHAR16));
1925 if (CurrentStatement->Value.Buffer == NULL) {
1926 return EFI_OUT_OF_RESOURCES;
1927 }
1928
1929 CurrentStatement->Value.Value.string = NewHiiString ((CHAR16 *)CurrentStatement->Value.Buffer, FormSet->HiiHandle);
1930
1931 InitializeRequestElement (FormSet, CurrentStatement, CurrentForm);
1932 break;
1933
1934 case EFI_IFR_PASSWORD_OP:
1935
1936 CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
1937
1938 //
1939 // MinSize is the minimum number of characters that can be accepted for this opcode,
1940 // MaxSize is the maximum number of characters that can be accepted for this opcode.
1941 // The characters are stored as Unicode, so the storage width should multiply 2.
1942 //
1943 CopyMem (&CurrentStatement->ExtraData.PwdData.MinSize, &((EFI_IFR_PASSWORD *)OpCodeData)->MinSize, sizeof (UINT16));
1944 CopyMem (&CurrentStatement->ExtraData.PwdData.MaxSize, &((EFI_IFR_PASSWORD *)OpCodeData)->MaxSize, sizeof (UINT16));
1945 CurrentStatement->StorageWidth = (UINT16)((UINTN)CurrentStatement->ExtraData.PwdData.MaxSize * sizeof (CHAR16));
1946
1947 CurrentStatement->Value.Type = EFI_IFR_TYPE_STRING;
1948 CurrentStatement->Value.Buffer = AllocateZeroPool ((CurrentStatement->StorageWidth + sizeof (CHAR16)));
1949 if (CurrentStatement->Value.Buffer == NULL) {
1950 return EFI_OUT_OF_RESOURCES;
1951 }
1952
1953 CurrentStatement->Value.Value.string = NewHiiString ((CHAR16 *)CurrentStatement->Value.Buffer, FormSet->HiiHandle);
1954
1955 InitializeRequestElement (FormSet, CurrentStatement, CurrentForm);
1956 break;
1957
1958 case EFI_IFR_DATE_OP:
1959
1960 CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
1961 CurrentStatement->ExtraData.Flags = ((EFI_IFR_DATE *)OpCodeData)->Flags;
1962 CurrentStatement->Value.Type = EFI_IFR_TYPE_DATE;
1963
1964 if ((CurrentStatement->ExtraData.Flags & EFI_QF_DATE_STORAGE) == QF_DATE_STORAGE_NORMAL) {
1965 CurrentStatement->StorageWidth = (UINT16)sizeof (EFI_HII_DATE);
1966
1967 InitializeRequestElement (FormSet, CurrentStatement, CurrentForm);
1968 } else {
1969 //
1970 // Don't assign storage for RTC type of date/time
1971 //
1972 CurrentStatement->Storage = NULL;
1973 CurrentStatement->StorageWidth = 0;
1974 }
1975
1976 break;
1977
1978 case EFI_IFR_TIME_OP:
1979
1980 CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
1981 CurrentStatement->ExtraData.Flags = ((EFI_IFR_TIME *)OpCodeData)->Flags;
1982 CurrentStatement->Value.Type = EFI_IFR_TYPE_TIME;
1983
1984 if ((CurrentStatement->ExtraData.Flags & QF_TIME_STORAGE) == QF_TIME_STORAGE_NORMAL) {
1985 CurrentStatement->StorageWidth = (UINT16)sizeof (EFI_HII_TIME);
1986
1987 InitializeRequestElement (FormSet, CurrentStatement, CurrentForm);
1988 } else {
1989 //
1990 // Don't assign storage for RTC type of date/time
1991 //
1992 CurrentStatement->Storage = NULL;
1993 CurrentStatement->StorageWidth = 0;
1994 }
1995
1996 break;
1997
1998 //
1999 // Default
2000 //
2001 case EFI_IFR_DEFAULT_OP:
2002
2003 //
2004 // EFI_IFR_DEFAULT appear in scope of a Question,
2005 // It creates a default value for the current question.
2006 // A Question may have more than one Default value which have different default types.
2007 //
2008 CurrentDefault = AllocateZeroPool (sizeof (HII_QUESTION_DEFAULT));
2009 if (CurrentDefault == NULL) {
2010 return EFI_OUT_OF_RESOURCES;
2011 }
2012
2013 CurrentDefault->Signature = HII_QUESTION_DEFAULT_SIGNATURE;
2014
2015 CurrentDefault->Value.Type = ((EFI_IFR_DEFAULT *)OpCodeData)->Type;
2016 CopyMem (&CurrentDefault->DefaultId, &((EFI_IFR_DEFAULT *)OpCodeData)->DefaultId, sizeof (UINT16));
2017 if (CurrentDefault->Value.Type == EFI_IFR_TYPE_BUFFER) {
2018 CurrentDefault->Value.BufferLen = (UINT16)(OpCodeLength - OFFSET_OF (EFI_IFR_DEFAULT, Value));
2019 CurrentDefault->Value.Buffer = AllocateCopyPool (CurrentDefault->Value.BufferLen, &((EFI_IFR_DEFAULT *)OpCodeData)->Value);
2020 if (CurrentDefault->Value.Buffer == NULL) {
2021 FreePool (CurrentDefault);
2022 return EFI_OUT_OF_RESOURCES;
2023 }
2024
2025 if (ParentStatement->Operand == EFI_IFR_ORDERED_LIST_OP) {
2026 ParentStatement->Value.BufferLen = CurrentDefault->Value.BufferLen;
2027 CopyMem (ParentStatement->Value.Buffer, CurrentDefault->Value.Buffer, ParentStatement->Value.BufferLen);
2028 }
2029 } else {
2030 CopyMem (&CurrentDefault->Value.Value, &((EFI_IFR_DEFAULT *)OpCodeData)->Value, OpCodeLength - OFFSET_OF (EFI_IFR_DEFAULT, Value));
2031 ExtendValueToU64 (&CurrentDefault->Value);
2032
2033 CopyMem (&ParentStatement->Value.Value, &((EFI_IFR_DEFAULT *)OpCodeData)->Value, OpCodeLength - OFFSET_OF (EFI_IFR_DEFAULT, Value));
2034 ExtendValueToU64 (&ParentStatement->Value);
2035 }
2036
2037 //
2038 // Insert to Default Value list of current Question
2039 //
2040 InsertTailList (&ParentStatement->DefaultListHead, &CurrentDefault->Link);
2041
2042 if (Scope != 0) {
2043 InScopeDefault = TRUE;
2044 }
2045
2046 break;
2047
2048 //
2049 // Option
2050 //
2051 case EFI_IFR_ONE_OF_OPTION_OP:
2052
2053 if (ParentStatement == NULL) {
2054 break;
2055 }
2056
2057 CurrentDefault = NULL;
2058 if (((ParentStatement->Operand == EFI_IFR_ORDERED_LIST_OP) || (ParentStatement->Operand == EFI_IFR_ONE_OF_OP)) &&
2059 ((((EFI_IFR_ONE_OF_OPTION *)OpCodeData)->Flags & (EFI_IFR_OPTION_DEFAULT | EFI_IFR_OPTION_DEFAULT_MFG)) != 0))
2060 {
2061 CurrentDefault = AllocateZeroPool (sizeof (HII_QUESTION_DEFAULT));
2062 if (CurrentDefault == NULL) {
2063 return EFI_OUT_OF_RESOURCES;
2064 }
2065
2066 CurrentDefault->Signature = HII_QUESTION_DEFAULT_SIGNATURE;
2067 if ((((EFI_IFR_ONE_OF_OPTION *)OpCodeData)->Flags & EFI_IFR_OPTION_DEFAULT) != 0) {
2068 CurrentDefault->DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;
2069 } else {
2070 CurrentDefault->DefaultId = EFI_HII_DEFAULT_CLASS_MANUFACTURING;
2071 }
2072
2073 if (ParentStatement->Operand == EFI_IFR_ORDERED_LIST_OP) {
2074 CurrentDefault->Value.Type = EFI_IFR_TYPE_BUFFER;
2075 CurrentDefault->Value.BufferLen = (UINT16)(OpCodeLength - OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value));
2076 CurrentDefault->Value.Buffer = AllocateCopyPool (CurrentDefault->Value.BufferLen, &((EFI_IFR_ONE_OF_OPTION *)OpCodeData)->Value);
2077 if (CurrentDefault->Value.Buffer == NULL) {
2078 FreePool (CurrentDefault);
2079 return EFI_OUT_OF_RESOURCES;
2080 }
2081 } else {
2082 CurrentDefault->Value.Type = ((EFI_IFR_ONE_OF_OPTION *)OpCodeData)->Type;
2083 CopyMem (&CurrentDefault->Value.Value, &((EFI_IFR_ONE_OF_OPTION *)OpCodeData)->Value, sizeof (EFI_IFR_TYPE_VALUE));
2084 ExtendValueToU64 (&CurrentDefault->Value);
2085 }
2086
2087 //
2088 // Insert to Default Value list of current Question
2089 //
2090 InsertTailList (&ParentStatement->DefaultListHead, &CurrentDefault->Link);
2091 }
2092
2093 //
2094 // EFI_IFR_ONE_OF_OPTION appear in scope of a Question.
2095 // It create a selection for use in current Question.
2096 //
2097 CurrentOption = AllocateZeroPool (sizeof (HII_QUESTION_OPTION));
2098 if (CurrentOption == NULL) {
2099 return EFI_OUT_OF_RESOURCES;
2100 }
2101
2102 CurrentOption->Signature = HII_QUESTION_OPTION_SIGNATURE;
2103 CurrentOption->OpCode = (EFI_IFR_ONE_OF_OPTION *)OpCodeData;
2104 CurrentOption->Flags = ((EFI_IFR_ONE_OF_OPTION *)OpCodeData)->Flags;
2105 CurrentOption->Value.Type = ((EFI_IFR_ONE_OF_OPTION *)OpCodeData)->Type;
2106 CopyMem (&CurrentOption->Text, &((EFI_IFR_ONE_OF_OPTION *)OpCodeData)->Option, sizeof (EFI_STRING_ID));
2107 CopyMem (&CurrentOption->Value.Value, &((EFI_IFR_ONE_OF_OPTION *)OpCodeData)->Value, OpCodeLength - OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value));
2108 ExtendValueToU64 (&CurrentOption->Value);
2109
2110 ConditionalExprCount = GetConditionalExpressionCount (ExpressOption);
2111 if ( ConditionalExprCount > 0) {
2112 //
2113 // Form is inside of suppressif
2114 //
2116 (UINTN)(sizeof (HII_EXPRESSION_LIST) + ((ConditionalExprCount -1) * sizeof (HII_EXPRESSION *)))
2117 );
2118 if (CurrentOption->SuppressExpression == NULL) {
2119 FreePool (CurrentOption);
2120 return EFI_OUT_OF_RESOURCES;
2121 }
2122
2123 CurrentOption->SuppressExpression->Count = (UINTN)ConditionalExprCount;
2124 CurrentOption->SuppressExpression->Signature = HII_EXPRESSION_LIST_SIGNATURE;
2125 CopyMem (CurrentOption->SuppressExpression->Expression, GetConditionalExpressionList (ExpressOption), (UINTN)(sizeof (HII_EXPRESSION *) * ConditionalExprCount));
2126 }
2127
2128 //
2129 // Insert to Option list of current Question
2130 //
2131 InsertTailList (&ParentStatement->OptionListHead, &CurrentOption->Link);
2132
2133 //
2134 // Now we know the Storage width of nested Ordered List
2135 //
2136 if ((ParentStatement->Operand == EFI_IFR_ORDERED_LIST_OP) && (ParentStatement->Value.Buffer == NULL)) {
2137 Width = 1;
2138 switch (CurrentOption->Value.Type) {
2139 case EFI_IFR_TYPE_NUM_SIZE_8:
2140 Width = 1;
2141 break;
2142
2143 case EFI_IFR_TYPE_NUM_SIZE_16:
2144 Width = 2;
2145 break;
2146
2147 case EFI_IFR_TYPE_NUM_SIZE_32:
2148 Width = 4;
2149 break;
2150
2151 case EFI_IFR_TYPE_NUM_SIZE_64:
2152 Width = 8;
2153 break;
2154
2155 default:
2156 //
2157 // Invalid type for Ordered List
2158 //
2159 break;
2160 }
2161
2162 ParentStatement->StorageWidth = (UINT16)(ParentStatement->ExtraData.OrderListData.MaxContainers * Width);
2163 ParentStatement->Value.Buffer = AllocateZeroPool (ParentStatement->StorageWidth);
2164 if (ParentStatement->Value.Buffer == NULL) {
2165 return EFI_OUT_OF_RESOURCES;
2166 }
2167
2168 ParentStatement->Value.BufferLen = 0;
2169 ParentStatement->Value.BufferValueType = CurrentOption->Value.Type;
2170 InitializeRequestElement (FormSet, ParentStatement, CurrentForm);
2171 }
2172
2173 break;
2174
2175 //
2176 // Conditional
2177 //
2178 case EFI_IFR_NO_SUBMIT_IF_OP:
2179 case EFI_IFR_INCONSISTENT_IF_OP:
2180
2181 //
2182 // Create an Expression node
2183 //
2184 CurrentExpression = CreateExpression (CurrentForm, OpCodeData);
2185 CopyMem (&CurrentExpression->ExtraData.Error, &((EFI_IFR_INCONSISTENT_IF *)OpCodeData)->Error, sizeof (EFI_STRING_ID));
2186
2187 if (Operand == EFI_IFR_NO_SUBMIT_IF_OP) {
2188 CurrentExpression->Type = EFI_HII_EXPRESSION_NO_SUBMIT_IF;
2189 InsertTailList (&ParentStatement->NoSubmitListHead, &CurrentExpression->Link);
2190 } else {
2191 CurrentExpression->Type = EFI_HII_EXPRESSION_INCONSISTENT_IF;
2192 InsertTailList (&ParentStatement->InconsistentListHead, &CurrentExpression->Link);
2193 }
2194
2195 //
2196 // Take a look at next OpCode to see whether current expression consists
2197 // of single OpCode
2198 //
2199 if (((EFI_IFR_OP_HEADER *)(OpCodeData + OpCodeLength))->Scope == 0) {
2200 SingleOpCodeExpression = TRUE;
2201 }
2202
2203 break;
2204
2205 case EFI_IFR_WARNING_IF_OP:
2206
2207 //
2208 // Create an Expression node
2209 //
2210 CurrentExpression = CreateExpression (CurrentForm, OpCodeData);
2211 CopyMem (&CurrentExpression->ExtraData.WarningIfData.WarningIfError, &((EFI_IFR_WARNING_IF *)OpCodeData)->Warning, sizeof (EFI_STRING_ID));
2212 CurrentExpression->ExtraData.WarningIfData.TimeOut = ((EFI_IFR_WARNING_IF *)OpCodeData)->TimeOut;
2213 CurrentExpression->Type = EFI_HII_EXPRESSION_WARNING_IF;
2214 InsertTailList (&ParentStatement->WarningListHead, &CurrentExpression->Link);
2215
2216 //
2217 // Take a look at next OpCode to see whether current expression consists
2218 // of single OpCode
2219 //
2220 if (((EFI_IFR_OP_HEADER *)(OpCodeData + OpCodeLength))->Scope == 0) {
2221 SingleOpCodeExpression = TRUE;
2222 }
2223
2224 break;
2225
2226 case EFI_IFR_SUPPRESS_IF_OP:
2227
2228 //
2229 // Question and Option will appear in scope of this OpCode
2230 //
2231 CurrentExpression = CreateExpression (CurrentForm, OpCodeData);
2232 CurrentExpression->Type = EFI_HII_EXPRESSION_SUPPRESS_IF;
2233
2234 if (SuppressForOption) {
2235 PushConditionalExpression (CurrentExpression, ExpressOption);
2236 } else if (SuppressForQuestion) {
2237 PushConditionalExpression (CurrentExpression, ExpressStatement);
2238 } else {
2239 PushConditionalExpression (CurrentExpression, ExpressForm);
2240 }
2241
2242 //
2243 // Take a look at next OpCode to see whether current expression consists
2244 // of single OpCode
2245 //
2246 if (((EFI_IFR_OP_HEADER *)(OpCodeData + OpCodeLength))->Scope == 0) {
2247 SingleOpCodeExpression = TRUE;
2248 }
2249
2250 break;
2251
2252 case EFI_IFR_GRAY_OUT_IF_OP:
2253
2254 //
2255 // Questions will appear in scope of this OpCode
2256 //
2257 CurrentExpression = CreateExpression (CurrentForm, OpCodeData);
2258 CurrentExpression->Type = EFI_HII_EXPRESSION_GRAY_OUT_IF;
2259 PushConditionalExpression (CurrentExpression, ExpressStatement);
2260
2261 //
2262 // Take a look at next OpCode to see whether current expression consists
2263 // of single OpCode
2264 //
2265 if (((EFI_IFR_OP_HEADER *)(OpCodeData + OpCodeLength))->Scope == 0) {
2266 SingleOpCodeExpression = TRUE;
2267 }
2268
2269 break;
2270
2271 case EFI_IFR_DISABLE_IF_OP:
2272
2273 //
2274 // The DisableIf expression should only rely on constant, so it could be
2275 // evaluated at initialization and it will not be queued
2276 //
2277 CurrentExpression = AllocateZeroPool (sizeof (HII_EXPRESSION));
2278 if (CurrentExpression == NULL) {
2279 return EFI_OUT_OF_RESOURCES;
2280 }
2281
2282 CurrentExpression->Signature = HII_EXPRESSION_SIGNATURE;
2283 CurrentExpression->Type = EFI_HII_EXPRESSION_DISABLE_IF;
2284 InitializeListHead (&CurrentExpression->OpCodeListHead);
2285
2286 if (CurrentForm != NULL) {
2287 //
2288 // This is DisableIf for Question, enqueue it to Form expression list
2289 //
2290 PushConditionalExpression (CurrentExpression, ExpressStatement);
2291 }
2292
2293 OpCodeDisabled = FALSE;
2294 InScopeDisable = TRUE;
2295 //
2296 // Take a look at next OpCode to see whether current expression consists
2297 // of single OpCode
2298 //
2299 if (((EFI_IFR_OP_HEADER *)(OpCodeData + OpCodeLength))->Scope == 0) {
2300 SingleOpCodeExpression = TRUE;
2301 }
2302
2303 break;
2304
2305 //
2306 // Expression
2307 //
2308 case EFI_IFR_VALUE_OP:
2309
2310 CurrentExpression = CreateExpression (CurrentForm, OpCodeData);
2311 CurrentExpression->Type = EFI_HII_EXPRESSION_VALUE;
2312
2313 if (InScopeDefault) {
2314 //
2315 // Used for default (EFI_IFR_DEFAULT)
2316 //
2317 CurrentDefault->ValueExpression = CurrentExpression;
2318 } else {
2319 //
2320 // If used for a question, then the question will be read-only
2321 //
2322 // Make sure CurrentStatement is not NULL.
2323 // If it is NULL, 1) ParseOpCodes functions may parse the IFR wrongly. Or 2) the IFR
2324 // file is wrongly generated by tools such as VFR Compiler. There may be a bug in VFR Compiler.
2325 //
2326 if (ParentStatement == NULL) {
2327 break;
2328 }
2329
2330 ParentStatement->ValueExpression = CurrentExpression;
2331 }
2332
2333 //
2334 // Take a look at next OpCode to see whether current expression consists
2335 // of single OpCode
2336 //
2337 if (((EFI_IFR_OP_HEADER *)(OpCodeData + OpCodeLength))->Scope == 0) {
2338 SingleOpCodeExpression = TRUE;
2339 }
2340
2341 break;
2342
2343 case EFI_IFR_RULE_OP:
2344
2345 CurrentExpression = CreateExpression (CurrentForm, OpCodeData);
2346 CurrentExpression->Type = EFI_HII_EXPRESSION_RULE;
2347
2348 CurrentExpression->ExtraData.RuleId = ((EFI_IFR_RULE *)OpCodeData)->RuleId;
2349 InsertTailList (&CurrentForm->RuleListHead, &CurrentExpression->Link);
2350
2351 //
2352 // Take a look at next OpCode to see whether current expression consists
2353 // of single OpCode
2354 //
2355 if (((EFI_IFR_OP_HEADER *)(OpCodeData + OpCodeLength))->Scope == 0) {
2356 SingleOpCodeExpression = TRUE;
2357 }
2358
2359 break;
2360
2361 case EFI_IFR_READ_OP:
2362
2363 CurrentExpression = CreateExpression (CurrentForm, OpCodeData);
2364 CurrentExpression->Type = EFI_HII_EXPRESSION_READ;
2365
2366 //
2367 // Make sure CurrentStatement is not NULL.
2368 // If it is NULL, 1) ParseOpCodes functions may parse the IFR wrongly. Or 2) the IFR
2369 // file is wrongly generated by tools such as VFR Compiler. There may be a bug in VFR Compiler.
2370 //
2371 if (ParentStatement == NULL) {
2372 break;
2373 }
2374
2375 ParentStatement->ReadExpression = CurrentExpression;
2376
2377 //
2378 // Take a look at next OpCode to see whether current expression consists
2379 // of single OpCode
2380 //
2381 if (((EFI_IFR_OP_HEADER *)(OpCodeData + OpCodeLength))->Scope == 0) {
2382 SingleOpCodeExpression = TRUE;
2383 }
2384
2385 break;
2386
2387 case EFI_IFR_WRITE_OP:
2388
2389 CurrentExpression = CreateExpression (CurrentForm, OpCodeData);
2390 CurrentExpression->Type = EFI_HII_EXPRESSION_WRITE;
2391
2392 //
2393 // Make sure CurrentStatement is not NULL.
2394 // If it is NULL, 1) ParseOpCodes functions may parse the IFR wrongly. Or 2) the IFR
2395 // file is wrongly generated by tools such as VFR Compiler. There may be a bug in VFR Compiler.
2396 //
2397 if (ParentStatement == NULL) {
2398 break;
2399 }
2400
2401 ParentStatement->WriteExpression = CurrentExpression;
2402
2403 //
2404 // Take a look at next OpCode to see whether current expression consists
2405 // of single OpCode
2406 //
2407 if (((EFI_IFR_OP_HEADER *)(OpCodeData + OpCodeLength))->Scope == 0) {
2408 SingleOpCodeExpression = TRUE;
2409 }
2410
2411 break;
2412
2413 //
2414 // Image
2415 //
2416 case EFI_IFR_IMAGE_OP:
2417 //
2418 // Get ScopeOpcode from top of stack
2419 //
2420 PopScope (&ScopeOpCode);
2421 PushScope (ScopeOpCode);
2422
2423 switch (ScopeOpCode) {
2424 case EFI_IFR_FORM_SET_OP:
2425
2426 ImageId = &FormSet->ImageId;
2427 break;
2428
2429 case EFI_IFR_FORM_OP:
2430 case EFI_IFR_FORM_MAP_OP:
2431
2432 if (CurrentForm != NULL) {
2433 ImageId = &CurrentForm->ImageId;
2434 }
2435
2436 break;
2437
2438 case EFI_IFR_ONE_OF_OPTION_OP:
2439
2440 if (CurrentOption != NULL) {
2441 ImageId = &CurrentOption->ImageId;
2442 }
2443
2444 break;
2445
2446 default:
2447
2448 //
2449 // Make sure CurrentStatement is not NULL.
2450 // If it is NULL, 1) ParseOpCodes functions may parse the IFR wrongly. Or 2) the IFR
2451 // file is wrongly generated by tools such as VFR Compiler.
2452 //
2453 if (ParentStatement != NULL) {
2454 ImageId = &ParentStatement->ImageId;
2455 }
2456
2457 break;
2458 }
2459
2460 CopyMem (ImageId, &((EFI_IFR_IMAGE *)OpCodeData)->Id, sizeof (EFI_IMAGE_ID));
2461 break;
2462
2463 //
2464 // Refresh
2465 //
2466 case EFI_IFR_REFRESH_OP:
2467
2468 if (ParentStatement != NULL) {
2469 ParentStatement->RefreshInterval = ((EFI_IFR_REFRESH *)OpCodeData)->RefreshInterval;
2470 }
2471
2472 break;
2473
2474 //
2475 // Refresh guid.
2476 //
2477 case EFI_IFR_REFRESH_ID_OP:
2478 //
2479 // Get ScopeOpcode from top of stack
2480 //
2481 PopScope (&ScopeOpCode);
2482 PushScope (ScopeOpCode);
2483
2484 switch (ScopeOpCode) {
2485 case EFI_IFR_FORM_OP:
2486 case EFI_IFR_FORM_MAP_OP:
2487
2488 if (CurrentForm != NULL) {
2489 CopyMem (&CurrentForm->RefreshGuid, &((EFI_IFR_REFRESH_ID *)OpCodeData)->RefreshEventGroupId, sizeof (EFI_GUID));
2490 }
2491
2492 break;
2493
2494 default:
2495
2496 if (ParentStatement != NULL) {
2497 if (ParentStatement->Operand == EFI_IFR_NUMERIC_OP) {
2498 CopyMem (&ParentStatement->ExtraData.NumData.Guid, &((EFI_IFR_REFRESH_ID *)OpCodeData)->RefreshEventGroupId, sizeof (EFI_GUID));
2499 }
2500 }
2501
2502 break;
2503 }
2504
2505 break;
2506
2507 //
2508 // Modal tag
2509 //
2510 case EFI_IFR_MODAL_TAG_OP:
2511
2512 if (CurrentForm != NULL) {
2513 CurrentForm->ModalForm = TRUE;
2514 }
2515
2516 break;
2517
2518 //
2519 // Lock tag, used by form and statement.
2520 //
2521 case EFI_IFR_LOCKED_OP:
2522 //
2523 // Get ScopeOpcode from top of stack
2524 //
2525 PopScope (&ScopeOpCode);
2526 PushScope (ScopeOpCode);
2527
2528 switch (ScopeOpCode) {
2529 case EFI_IFR_FORM_OP:
2530 case EFI_IFR_FORM_MAP_OP:
2531
2532 if (CurrentForm != NULL) {
2533 CurrentForm->Locked = TRUE;
2534 }
2535
2536 break;
2537
2538 default:
2539
2540 if (ParentStatement != NULL) {
2541 ParentStatement->Locked = TRUE;
2542 }
2543 }
2544
2545 break;
2546
2547 //
2548 // Vendor specific
2549 //
2550 case EFI_IFR_GUID_OP:
2551 CurrentStatement = CreateStatement (OpCodeData, FormSet, CurrentForm);
2552 if (CompareGuid ((EFI_GUID *)(OpCodeData + sizeof (EFI_IFR_OP_HEADER)), &gEdkiiIfrBitVarstoreGuid)) {
2553 Scope = 0;
2554 QuestionReferBitField = TRUE;
2555 }
2556
2557 break;
2558
2559 //
2560 // Scope End
2561 //
2562 case EFI_IFR_END_OP:
2563 QuestionReferBitField = FALSE;
2564 Status = PopScope (&ScopeOpCode);
2565 if (EFI_ERROR (Status)) {
2566 ResetScopeStack ();
2567 return Status;
2568 }
2569
2570 //
2571 // Parent statement end tag found, update ParentStatement info.
2572 //
2573 if (IsStatementOpCode (ScopeOpCode) && (ParentStatement != NULL) && (ParentStatement->Operand == ScopeOpCode)) {
2574 ParentStatement = ParentStatement->ParentStatement;
2575 }
2576
2577 switch (ScopeOpCode) {
2578 case EFI_IFR_FORM_SET_OP:
2579 //
2580 // End of FormSet, update FormSet IFR binary length
2581 // to stop parsing substantial OpCodes
2582 //
2583 FormSet->IfrBinaryLength = OpCodeOffset;
2584 break;
2585
2586 case EFI_IFR_FORM_OP:
2587 case EFI_IFR_FORM_MAP_OP:
2588 //
2589 // End of Form
2590 //
2591 CurrentForm = NULL;
2592 SuppressForQuestion = FALSE;
2593 break;
2594
2595 case EFI_IFR_ONE_OF_OPTION_OP:
2596 //
2597 // End of Option
2598 //
2599 CurrentOption = NULL;
2600 break;
2601
2602 case EFI_IFR_NO_SUBMIT_IF_OP:
2603 case EFI_IFR_INCONSISTENT_IF_OP:
2604 case EFI_IFR_WARNING_IF_OP:
2605 //
2606 // Ignore end of EFI_IFR_NO_SUBMIT_IF and EFI_IFR_INCONSISTENT_IF
2607 //
2608 break;
2609
2610 case EFI_IFR_SUPPRESS_IF_OP:
2611 if (SuppressForOption) {
2612 PopConditionalExpression (ExpressOption);
2613 } else if (SuppressForQuestion) {
2614 PopConditionalExpression (ExpressStatement);
2615 } else {
2616 PopConditionalExpression (ExpressForm);
2617 }
2618
2619 break;
2620
2621 case EFI_IFR_GRAY_OUT_IF_OP:
2622 PopConditionalExpression (ExpressStatement);
2623 break;
2624
2625 case EFI_IFR_DISABLE_IF_OP:
2626 if (CurrentForm != NULL) {
2627 PopConditionalExpression (ExpressStatement);
2628 }
2629
2630 InScopeDisable = FALSE;
2631 OpCodeDisabled = FALSE;
2632 break;
2633
2634 case EFI_IFR_ONE_OF_OP:
2635 case EFI_IFR_ORDERED_LIST_OP:
2636 SuppressForOption = FALSE;
2637 break;
2638
2639 case EFI_IFR_DEFAULT_OP:
2640 InScopeDefault = FALSE;
2641 break;
2642
2643 case EFI_IFR_MAP_OP:
2644
2645 //
2646 // Get current Map Expression List.
2647 //
2648 Status = PopMapExpressionList ((VOID **)&MapExpressionList);
2649 if (Status == EFI_ACCESS_DENIED) {
2650 MapExpressionList = NULL;
2651 }
2652
2653 //
2654 // Get current expression.
2655 //
2656 Status = PopCurrentExpression ((VOID **)&CurrentExpression);
2657 if (EFI_ERROR (Status)) {
2658 return Status;
2659 }
2660
2661 if (MapScopeDepth > 0) {
2662 MapScopeDepth--;
2663 }
2664
2665 break;
2666
2667 default:
2668
2669 if (IsExpressionOpCode (ScopeOpCode)) {
2670 if (InScopeDisable && (CurrentForm == NULL)) {
2671 //
2672 // This is DisableIf expression for Form, it should be a constant expression
2673 //
2674 Status = EvaluateHiiExpression (FormSet, CurrentForm, CurrentExpression);
2675 if (EFI_ERROR (Status)) {
2676 return Status;
2677 }
2678
2679 OpCodeDisabled = IsHiiValueTrue (&CurrentExpression->Result);
2680
2681 //
2682 // DisableIf Expression is only used once and not queued, free it
2683 //
2684 DestroyExpression (CurrentExpression);
2685 }
2686
2687 //
2688 // End of current Expression
2689 //
2690 CurrentExpression = NULL;
2691 }
2692
2693 break;
2694 }
2695
2696 break;
2697
2698 default:
2699 break;
2700 }
2701
2702 if (IsStatementOpCode (Operand)) {
2703 CurrentStatement->ParentStatement = ParentStatement;
2704 if (Scope != 0) {
2705 //
2706 // Scope != 0, other statements or options may nest in this statement.
2707 // Update the ParentStatement info.
2708 //
2709 ParentStatement = CurrentStatement;
2710 }
2711 }
2712 }
2713
2714 return EFI_SUCCESS;
2715}
UINT64 UINTN
INT64 INTN
BOOLEAN EFIAPI IsNull(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
Definition: LinkedList.c:443
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
Definition: String.c:72
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
Definition: LinkedList.c:403
LIST_ENTRY *EFIAPI GetNextNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
Definition: LinkedList.c:333
INTN EFIAPI StrCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString)
Definition: String.c:109
UINTN EFIAPI AsciiStrLen(IN CONST CHAR8 *String)
Definition: String.c:641
LIST_ENTRY *EFIAPI GetFirstNode(IN CONST LIST_ENTRY *List)
Definition: LinkedList.c:298
RETURN_STATUS EFIAPI StrCatS(IN OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source)
Definition: SafeString.c:405
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
Definition: LinkedList.c:590
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
Definition: LinkedList.c:182
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
Definition: String.c:30
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
Definition: LinkedList.c:259
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)
Definition: MemLibGuid.c:73
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
EFI_STATUS PopMapExpressionList(OUT VOID **Pointer)
Definition: Expression.c:594
VOID ResetScopeStack(VOID)
Definition: Expression.c:617
VOID ExtendValueToU64(IN EFI_HII_VALUE *Value)
Definition: Expression.c:2096
EFI_STATUS PushCurrentExpression(IN VOID *Pointer)
Definition: Expression.c:216
VOID ResetCurrentExpressionStack(VOID)
Definition: Expression.c:196
EFI_STATUS PushConditionalExpression(IN FORM_EXPRESSION *Pointer, IN EXPRESS_LEVEL Level)
Definition: Expression.c:479
EFI_STATUS PushScope(IN UINT8 Operand)
Definition: Expression.c:635
EFI_STATUS PopConditionalExpression(IN EXPRESS_LEVEL Level)
Definition: Expression.c:523
INTN GetConditionalExpressionCount(IN EXPRESS_LEVEL Level)
Definition: Expression.c:423
EFI_STATUS PopCurrentExpression(OUT VOID **Pointer)
Definition: Expression.c:243
EFI_STATUS PushMapExpressionList(IN VOID *Pointer)
Definition: Expression.c:567
EFI_STATUS PopScope(OUT UINT8 *Operand)
Definition: Expression.c:663
FORM_EXPRESSION ** GetConditionalExpressionList(IN EXPRESS_LEVEL Level)
Definition: Expression.c:450
VOID ResetMapExpressionListStack(VOID)
Definition: Expression.c:266
VOID AsciiToUnicode(IN CHAR8 *AsciiString, OUT CHAR16 *UnicodeString)
Definition: HiiIfrParse.c:297
BOOLEAN IsStatementOpCode(IN UINT8 Operand)
Definition: HiiIfrParse.c:892
VOID CountOpCodes(IN HII_FORMSET *FormSet, IN OUT UINT16 *NumberOfStatement, IN OUT UINT16 *NumberOfExpression)
Definition: HiiIfrParse.c:943
HII_EXPRESSION * CreateExpression(IN OUT HII_FORM *Form, IN UINT8 *OpCode)
Definition: HiiIfrParse.c:230
EFI_STATUS DeleteString(IN EFI_STRING_ID StringId, IN EFI_HII_HANDLE HiiHandle)
Definition: HiiIfrParse.c:675
HII_FORMSET_STORAGE * GetFstStgFromVarId(IN HII_FORMSET *FormSet, IN EFI_VARSTORE_ID VarStoreId)
Definition: HiiIfrParse.c:417
BOOLEAN IsExpressionOpCode(IN UINT8 Operand)
Definition: HiiIfrParse.c:861
VOID DestroyExpression(IN HII_EXPRESSION *Expression)
Definition: HiiIfrParse.c:625
BOOLEAN IsUnKnownOpCode(IN UINT8 Operand)
Definition: HiiIfrParse.c:927
HII_FORMSET_STORAGE * CreateStorage(IN HII_FORMSET *FormSet, IN UINT8 StorageType, IN UINT8 *OpCodeData)
Definition: HiiIfrParse.c:324
EFI_STATUS InitializeConfigHdr(IN HII_FORMSET *FormSet, IN OUT HII_FORMSET_STORAGE *Storage)
Definition: HiiIfrParse.c:259
VOID DestroyForm(IN HII_FORMSET *FormSet, IN OUT HII_FORM *Form)
Definition: HiiIfrParse.c:798
HII_STATEMENT * CreateStatement(IN UINT8 *OpCodeData, IN OUT HII_FORMSET *FormSet, IN OUT HII_FORM *Form)
Definition: HiiIfrParse.c:25
EFI_STATUS ParseOpCodes(IN HII_FORMSET *FormSet)
Definition: HiiIfrParse.c:985
HII_STATEMENT * CreateQuestion(IN UINT8 *OpCodeData, IN OUT HII_FORMSET *FormSet, IN OUT HII_FORM *Form)
Definition: HiiIfrParse.c:108
VOID DestroyStatement(IN HII_FORMSET *FormSet, IN OUT HII_STATEMENT *Statement)
Definition: HiiIfrParse.c:695
EFI_STATUS InitializeRequestElement(IN OUT HII_FORMSET *FormSet, IN OUT HII_STATEMENT *Question, IN OUT HII_FORM *Form)
Definition: HiiIfrParse.c:458
VOID EFIAPI HiiStringToLowercase(IN EFI_STRING ConfigString)
EFI_STRING_ID NewHiiString(IN CHAR16 *String, IN EFI_HII_HANDLE HiiHandle)
CHAR16 * GetTokenString(IN EFI_STRING_ID Token, IN EFI_HII_HANDLE HiiHandle)
BOOLEAN IsHiiValueTrue(IN EFI_HII_VALUE *Result)
EFI_STRING EFIAPI HiiConstructConfigHdr(IN CONST EFI_GUID *Guid OPTIONAL, IN CONST CHAR16 *Name OPTIONAL, IN EFI_HANDLE DriverHandle)
Definition: HiiLib.c:723
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)
Definition: HiiString.c:52
EFI_STATUS EvaluateHiiExpression(IN HII_FORMSET *FormSet, IN HII_FORM *Form, IN OUT HII_EXPRESSION *Expression)
#define EDKII_IFR_DISPLAY_BIT
Definition: MdeModuleHii.h:218
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
Definition: PrintLib.c:408
#define NULL
Definition: Base.h:319
#define TRUE
Definition: Base.h:301
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
#define OFFSET_OF(TYPE, Field)
Definition: Base.h:758
#define OUT
Definition: Base.h:284
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
VOID * EFI_HII_HANDLE
UINT8 RefreshInterval
nested EFI_IFR_REFRESH, refresh interval(in seconds) for Question value, 0 means no refresh
HII_VAR_STORE_INFO VarStoreInfo
EFI_STRING_ID Prompt
UINT8 QuestionFlags
The flag of this Question.(Readonly, reset required, callback attribute....)
HII_EXPRESSION * ReadExpression
nested EFI_IFR_READ, provide this question value by read expression.
LIST_ENTRY InconsistentListHead
nested inconsistent expression list (HII_EXPRESSION)
HII_FORMSET_STORAGE * Storage
Point to the storage that store this question.
HII_EXPRESSION_LIST * ExpressionList
nesting inside of GrayedOutIf/DisableIf/SuppressIf
EFI_QUESTION_ID QuestionId
Question id, the value of zero is reserved.
UINT8 Operand
The operand (first byte) of this Statement or Question.
BOOLEAN Locked
Whether this statement is locked.
UINT16 BitStorageWidth
The Storage width of this Question in bit level.
UINT16 BitVarOffset
The storage offset of this Question in bit level.
LIST_ENTRY WarningListHead
nested warning expression list (HII_EXPRESSION)
BOOLEAN QuestionReferToBitField
Whether the question is stored in a bit field.
HII_EXPRESSION * ValueExpression
nested EFI_IFR_VALUE, provide Question value and indicate Question is ReadOnly
EFI_VARSTORE_ID VarStoreId
VarStore id, a value of zero indicates no variable storage.
CHAR16 * VariableName
Name/Value or EFI Variable name.
HII_EXPRESSION * WriteExpression
nested EFI_IFR_WRITE, evaluate write expression after this question value is set.
LIST_ENTRY DefaultListHead
nested EFI_IFR_DEFAULT list (HII_QUESTION_DEFAULT), provide default values
LIST_ENTRY OptionListHead
nested EFI_IFR_ONE_OF_OPTION list (HII_QUESTION_OPTION)
HII_STATEMENT * ParentStatement
Parent Statement of current statement.
EFI_IMAGE_ID ImageId
nested EFI_IFR_IMAGE
UINT16 StorageWidth
The storage width of this Question.
LIST_ENTRY NoSubmitListHead
nested nosubmit expression list (HII_EXPRESSION)
Definition: Base.h:213
HII_EXPRESSION * Expression[1]
Array[Count] of expressions.
LIST_ENTRY MapExpressionList
nested expressions inside of Map opcode.
EFI_IFR_OP_HEADER * OpCode
Save the opcode buffer.
LIST_ENTRY OpCodeListHead
OpCodes consist of this expression (HII_EXPRESSION_OPCODE)
EFI_HII_VALUE Result
Expression evaluation result.
UINT8 Type
Type for this expression.
Definition of HII_FORM_CONFIG_REQUEST.
Definition: HiiInternal.h:48
CHAR16 * ConfigRequest
<ConfigRequest> = <ConfigHdr> + <RequestElement>
Definition: HiiInternal.h:52
UINTN ElementCount
Number of <RequestElement> in the <ConfigRequest>
Definition: HiiInternal.h:54
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
EFI_IMAGE_ID ImageId
The image id.
UINT16 FormId
FormId of normal form or formmap form.
BOOLEAN ModalForm
Whether this is a modal form.
EFI_GUID RefreshGuid
Form refresh event guid.
LIST_ENTRY ConfigRequestHead
List of configrequest for all storage.
LIST_ENTRY RuleListHead
nested EFI_IFR_RULE list, pre-defined expressions attached to the form.
UINT16 FormType
Specific form type for the different form.
BOOLEAN Locked
Whether this form is locked.
UINT16 VarStoreId
VarStore ID.
Definition: HiiUtilityLib.h:71
UINT8 * Buffer
Buffer storage.
Definition: HiiUtilityLib.h:79
UINT16 Size
VarStore size.
Definition: HiiDatabase.h:146
EFI_GUID Guid
VarStore Guid.
Definition: HiiDatabase.h:144
CHAR16 * Name
VarStore name.
Definition: HiiDatabase.h:145
LIST_ENTRY NameValueList
List of NAME_VALUE_NODE.
Definition: HiiUtilityLib.h:90
UINTN ElementCount
Number of <RequestElement> in the <ConfigRequest>
Definition: HiiUtilityLib.h:94
UINTN SpareStrLen
Spare length of ConfigRequest string buffer.
Definition: HiiUtilityLib.h:95
UINT8 Type
Storage type.
Definition: HiiDatabase.h:143
CHAR16 * ConfigRequest
<ConfigRequest> = <ConfigHdr> + <RequestElement>
Definition: HiiUtilityLib.h:93
CHAR16 * ConfigHdr
<ConfigHdr>
Definition: HiiUtilityLib.h:92
HII_EXPRESSION * ValueExpression
Not-NULL indicates default value is provided by EFI_IFR_VALUE.
HII_STATEMENT_VALUE Value
Default value.
EFI_IFR_ONE_OF_OPTION * OpCode
OneOfOption Data.
HII_EXPRESSION_LIST * SuppressExpression
Non-NULL indicates nested inside of SuppressIf.
UINT8 BufferValueType
Data type for buffer internal data, currently only for orderedlist.
EFI_STRING_ID string
EFI_IFR_TYPE_STRING, EFI_IFR_TYPE_ACTION.
EFI_HII_REF ref
EFI_IFR_TYPE_REF.
EFI_HII_VALUE Value
EFI_IFR_UINT64, EFI_IFR_UINT32, EFI_IFR_UINT16, EFI_IFR_UINT8, EFI_IFR_STRING_REF1.
EFI_GUID Guid
For EFI_IFR_SECURITY, EFI_IFR_MATCH2.
UINT8 RuleId
For EFI_IFR_RULE_REF.
UINT8 Flags
For EFI_IFR_SPAN.
EFI_STRING_ID DevicePath
For EFI_IFR_QUESTION_REF3_3.
EFI_QUESTION_ID QuestionId
For EFI_IFR_EQ_ID_VAL_LIST.
UINT8 Format
For EFI_IFR_TO_STRING, EFI_IFR_FIND.
UINT8 RuleId
For EFI_IFR_RULE only.
EFI_STRING_ID Error
For EFI_IFR_NO_SUBMIT_IF, EFI_IFR_INCONSISTENT_IF only.
UINT64 Maximum
for EFI_IFR_STRING/EFI_IFR_PASSWORD, it's Min/Max length
UINT8 MaxContainers
for EFI_IFR_ORDERED_LIST
UINT64 Minimum
for EFI_IFR_ONE_OF/EFI_IFR_NUMERIC, it's Min/Max value