]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/C/FCE/IfrParse.h
BaseTools/FCE: Add a tool FCE
[mirror_edk2.git] / BaseTools / Source / C / FCE / IfrParse.h
1 /** @file
2
3 Parser for IFR binary encoding.
4
5 Copyright (c) 2011-2019, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #ifndef _IFR_PARSE_H_
11 #define _IFR_PARSE_H_
12
13 #include "Common.h"
14 #include <Common/UefiInternalFormRepresentation.h>
15 #include <Common/MdeModuleHii.h>
16
17 //
18 // Scope for Browser action. It may be Form, FormSet or System level.
19 //
20 typedef enum {
21 FormLevel,
22 FormSetLevel,
23 SystemLevel,
24 MaxLevel
25 } BROWSER_SETTING_SCOPE;
26
27 ///
28 ///Old EFI_IFR_VARSTORE_EFI structure to complible with UEFI 2.3
29 ///
30 typedef struct _EFI_IFR_VARSTORE_EFI_OLD {
31 EFI_IFR_OP_HEADER Header;
32 EFI_VARSTORE_ID VarStoreId;
33 EFI_GUID Guid;
34 UINT32 Attributes;
35 } EFI_IFR_VARSTORE_EFI_OLD;
36
37 ///
38 /// The languages used in HII DB
39 ///
40 typedef enum {
41 UQI,
42 EN_US,
43 ENG
44 } LANGUAGE;
45
46 ///
47 /// Define the structure for the parameters of Uqi and Uqi List
48 ///
49 typedef struct _FORM_BROWSER_STATEMENT FORM_BROWSER_STATEMENT;
50
51 typedef enum {
52 ONE_OF,
53 NUMERIC,
54 CHECKBOX,
55 STRING,
56 ORDERED_LIST
57 } QUEST_TYPE;
58
59 typedef struct {
60 UINT16 *DefaultId;
61 UINT64 *PlatformId;
62 UINT32 IdNum;
63 UINT32 HexNum;
64 QUEST_TYPE Type;
65 CHAR16 *Data;
66 UINT8 *Value;
67 UINT8 *DiffValue;
68 UINT32 ScriptsLine;
69 FORM_BROWSER_STATEMENT *Question;
70 } UQI_HEADER;
71
72 typedef struct _UQI_PARAM_LIST {
73 struct _UQI_PARAM_LIST *Next;
74 UQI_HEADER Header;
75 BOOLEAN ParseOrNot;
76 BOOLEAN SameOrNot;
77 BOOLEAN ErrorOrNot;
78 CHAR8 *Error;
79 } UQI_PARAM_LIST;
80
81 //
82 // Incremental size of stack for expression
83 //
84 #define EXPRESSION_STACK_SIZE_INCREMENT 0x100
85
86 //
87 // IFR relative definition
88 //
89 #define EFI_HII_EXPRESSION_INCONSISTENT_IF 0
90 #define EFI_HII_EXPRESSION_NO_SUBMIT_IF 1
91 #define EFI_HII_EXPRESSION_GRAY_OUT_IF 2
92 #define EFI_HII_EXPRESSION_SUPPRESS_IF 3
93 #define EFI_HII_EXPRESSION_DISABLE_IF 4
94 #define EFI_HII_EXPRESSION_VALUE 5
95 #define EFI_HII_EXPRESSION_RULE 6
96 #define EFI_HII_EXPRESSION_READ 7
97 #define EFI_HII_EXPRESSION_WRITE 8
98 #define EFI_HII_EXPRESSION_WARNING_IF 9
99
100 #define EFI_HII_VARSTORE_BUFFER 0
101 #define EFI_HII_VARSTORE_NAME_VALUE 1
102 #define EFI_HII_VARSTORE_EFI_VARIABLE 2
103 #define EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER 3
104
105 #define FORM_INCONSISTENT_VALIDATION 0
106 #define FORM_NO_SUBMIT_VALIDATION 1
107
108 typedef struct {
109 //
110 // HII Data Type
111 //
112 UINT8 Type;
113 //
114 // Buffer Data and Length if Type is EFI_IFR_TYPE_BUFFER or EFI_IFR_TYPE_STRING
115 //
116 UINT8 *Buffer;
117 UINT16 BufferLen;
118 EFI_IFR_TYPE_VALUE Value;
119 } EFI_HII_VALUE;
120
121 #define NAME_VALUE_NODE_SIGNATURE SIGNATURE_32 ('N', 'V', 'S', 'T')
122
123 typedef struct {
124 UINTN Signature;
125 LIST_ENTRY Link;
126 CHAR16 *Name;
127 CHAR16 *Value;
128 CHAR16 *EditValue;
129 } NAME_VALUE_NODE;
130
131 #define NAME_VALUE_NODE_FROM_LINK(a) CR (a, NAME_VALUE_NODE, Link, NAME_VALUE_NODE_SIGNATURE)
132
133 #define FORMSET_STORAGE_SIGNATURE SIGNATURE_32 ('F', 'S', 'T', 'G')
134
135 typedef struct {
136 UINTN Signature;
137 LIST_ENTRY Link;
138
139 UINT16 DefaultId[MAX_PLATFORM_DEFAULT_ID_NUM];
140 UINT64 PlatformId[MAX_PLATFORM_DEFAULT_ID_NUM];
141 UINT32 DefaultPlatformIdNum;
142 UINT32 FormSetOrder;
143
144 BOOLEAN NewEfiVarstore; //EfiVarStore for UEFI 2.31 or not
145 BOOLEAN Skip; //Flag for sorting out the variables
146
147 UINT8 Type; // Storage type
148
149 UINT16 VarStoreId;
150 EFI_GUID Guid;
151
152 CHAR16 *Name; // For EFI_IFR_VARSTORE
153 UINT16 Size;
154 UINT8 *Buffer;
155
156 LIST_ENTRY NameValueListHead; // List of NAME_VALUE_NODE
157
158 UINT32 Attributes; // For EFI_IFR_VARSTORE_EFI: EFI Variable attribute
159 } FORMSET_STORAGE;
160
161 #define FORMSET_STORAGE_FROM_LINK(a) CR (a, FORMSET_STORAGE, Link, FORMSET_STORAGE_SIGNATURE)
162
163 typedef union {
164 EFI_STRING_ID VarName;
165 UINT16 VarOffset;
166 } VAR_STORE_INFO;
167
168 #define EXPRESSION_OPCODE_SIGNATURE SIGNATURE_32 ('E', 'X', 'O', 'P')
169
170 typedef struct {
171 UINTN Signature;
172 LIST_ENTRY Link;
173
174 UINT8 Operand;
175
176 UINT8 Format; // For EFI_IFR_TO_STRING, EFI_IFR_FIND
177 UINT8 Flags; // For EFI_IFR_SPAN
178 UINT8 RuleId; // For EFI_IFR_RULE_REF
179
180 EFI_HII_VALUE Value; // For EFI_IFR_EQ_ID_VAL, EFI_IFR_UINT64, EFI_IFR_UINT32, EFI_IFR_UINT16, EFI_IFR_UINT8, EFI_IFR_STRING_REF1
181
182 EFI_QUESTION_ID QuestionId; // For EFI_IFR_EQ_ID_ID, EFI_IFR_EQ_ID_VAL_LIST, EFI_IFR_QUESTION_REF1
183 EFI_QUESTION_ID QuestionId2;
184
185 UINT16 ListLength; // For EFI_IFR_EQ_ID_VAL_LIST
186 UINT16 *ValueList;
187
188 EFI_STRING_ID DevicePath; // For EFI_IFR_QUESTION_REF3_2, EFI_IFR_QUESTION_REF3_3
189 EFI_GUID Guid;
190
191 FORMSET_STORAGE *VarStorage; // For EFI_IFR_SET, EFI_IFR_GET
192 VAR_STORE_INFO VarStoreInfo;// For EFI_IFR_SET, EFI_IFR_GET
193 UINT8 ValueType; // For EFI_IFR_SET, EFI_IFR_GET
194 UINT8 ValueWidth; // For EFI_IFR_SET, EFI_IFR_GET
195 CHAR16 *ValueName; // For EFI_IFR_SET, EFI_IFR_GET
196 LIST_ENTRY MapExpressionList; // nested expressions inside of Map opcode.
197 } EXPRESSION_OPCODE;
198
199 #define EXPRESSION_OPCODE_FROM_LINK(a) CR (a, EXPRESSION_OPCODE, Link, EXPRESSION_OPCODE_SIGNATURE)
200
201 #define FORM_EXPRESSION_SIGNATURE SIGNATURE_32 ('F', 'E', 'X', 'P')
202
203 typedef struct {
204 UINTN Signature;
205 LIST_ENTRY Link;
206
207 UINT8 Type; // Type for this expression
208
209 UINT8 RuleId; // For EFI_IFR_RULE only
210 EFI_STRING_ID Error; // For EFI_IFR_NO_SUBMIT_IF, EFI_IFR_INCONSISTENT_IF only
211
212 EFI_HII_VALUE Result; // Expression evaluation result
213 UINT8 TimeOut; // For EFI_IFR_WARNING_IF
214
215 LIST_ENTRY OpCodeListHead; // OpCodes consist of this expression (EXPRESSION_OPCODE)
216 } FORM_EXPRESSION;
217
218 #define FORM_EXPRESSION_FROM_LINK(a) CR (a, FORM_EXPRESSION, Link, FORM_EXPRESSION_SIGNATURE)
219
220 #define QUESTION_DEFAULT_SIGNATURE SIGNATURE_32 ('Q', 'D', 'F', 'T')
221
222 typedef struct {
223 UINTN Signature;
224 LIST_ENTRY Link;
225
226 UINT16 DefaultId;
227 EFI_HII_VALUE Value; // Default value
228
229 FORM_EXPRESSION *ValueExpression; // Not-NULL indicates default value is provided by EFI_IFR_VALUE
230 } QUESTION_DEFAULT;
231
232 #define QUESTION_DEFAULT_FROM_LINK(a) CR (a, QUESTION_DEFAULT, Link, QUESTION_DEFAULT_SIGNATURE)
233
234 #define QUESTION_OPTION_SIGNATURE SIGNATURE_32 ('Q', 'O', 'P', 'T')
235
236 typedef struct {
237 UINTN Signature;
238 LIST_ENTRY Link;
239
240 EFI_STRING_ID Text;
241 UINT8 Flags;
242 EFI_HII_VALUE Value;
243
244 FORM_EXPRESSION *SuppressExpression; // Non-NULL indicates nested inside of SuppressIf
245 } QUESTION_OPTION;
246
247 #define QUESTION_OPTION_FROM_LINK(a) CR (a, QUESTION_OPTION, Link, QUESTION_OPTION_SIGNATURE)
248
249 #define FORM_BROWSER_STATEMENT_SIGNATURE SIGNATURE_32 ('F', 'S', 'T', 'A')
250
251 struct _FORM_BROWSER_STATEMENT {
252 UINTN Signature;
253 LIST_ENTRY Link;
254 UINT8 Operand; // The operand (first byte) of this Statement or Question
255
256 UQI_HEADER Uqi;
257 UINT32 FormSetOrder;
258 EFI_GUID Guid;
259 UINT8 Type; // Storage type
260 BOOLEAN NewEfiVarstore; //EfiVarStore for UEFI 2.31 or not
261 UINT32 Attributes; // For EFI_IFR_VARSTORE_EFI: EFI Variable attribute
262 BOOLEAN QuestionReferToBitField;// Whether the question is stored in a bit field.
263 //
264 // Statement Header
265 //
266 EFI_STRING_ID Prompt;
267 EFI_STRING_ID Help;
268 EFI_STRING_ID TextTwo; // For EFI_IFR_TEXT
269
270 //
271 // Question Header
272 //
273 EFI_QUESTION_ID QuestionId; // The value of zero is reserved
274 EFI_VARSTORE_ID VarStoreId; // A value of zero indicates no variable storage
275 FORMSET_STORAGE *Storage;
276 VAR_STORE_INFO VarStoreInfo;
277 UINT16 StorageWidth;
278 UINT16 BitStorageWidth;
279 UINT16 BitVarOffset;
280 UINT8 QuestionFlags;
281 CHAR16 *VariableName; // Name/Value or EFI Variable name
282
283 EFI_HII_VALUE HiiValue; // Edit copy for checkbox, numberic, oneof
284 UINT8 *BufferValue; // Edit copy for string, password, orderedlist
285 UINT8 ValueType; // Data type for orderedlist value array
286
287 //
288 // OpCode specific members
289 //
290 UINT8 Flags; // for EFI_IFR_CHECKBOX, EFI_IFR_DATE, EFI_IFR_NUMERIC, EFI_IFR_ONE_OF,
291 // EFI_IFR_ORDERED_LIST, EFI_IFR_STRING,EFI_IFR_SUBTITLE,EFI_IFR_TIME, EFI_IFR_BANNER
292 UINT8 MaxContainers; // for EFI_IFR_ORDERED_LIST
293
294 UINT16 BannerLineNumber; // for EFI_IFR_BANNER, 1-based line number
295
296 UINT64 Minimum; // for EFI_IFR_ONE_OF/EFI_IFR_NUMERIC, it's Min/Max value
297 UINT64 Maximum; // for EFI_IFR_STRING/EFI_IFR_PASSWORD, it's Min/Max length
298 UINT64 Step;
299
300 EFI_DEFAULT_ID DefaultId; // for EFI_IFR_RESET_BUTTON
301 EFI_GUID RefreshGuid; // for EFI_IFR_REFRESH_ID
302
303 //
304 // Get from IFR parsing
305 //
306 FORM_EXPRESSION *ValueExpression; // nested EFI_IFR_VALUE, provide Question value and indicate Question is ReadOnly
307 LIST_ENTRY DefaultListHead; // nested EFI_IFR_DEFAULT list (QUESTION_DEFAULT), provide default values
308 LIST_ENTRY OptionListHead; // nested EFI_IFR_ONE_OF_OPTION list (QUESTION_OPTION)
309
310 EFI_IMAGE_ID ImageId; // nested EFI_IFR_IMAGE
311 UINT8 RefreshInterval; // nested EFI_IFR_REFRESH, refresh interval(in seconds) for Question value, 0 means no refresh
312 BOOLEAN InSubtitle; // nesting inside of EFI_IFR_SUBTITLE
313
314 LIST_ENTRY InconsistentListHead;// nested inconsistent expression list (FORM_EXPRESSION)
315 LIST_ENTRY NoSubmitListHead; // nested nosubmit expression list (FORM_EXPRESSION)
316 LIST_ENTRY WarningListHead; // nested warning expression list (FORM_EXPRESSION)
317 FORM_EXPRESSION *GrayOutExpression; // nesting inside of GrayOutIf
318 FORM_EXPRESSION *SuppressExpression; // nesting inside of SuppressIf
319 FORM_EXPRESSION *DisableExpression; // nesting inside of DisableIf
320
321 FORM_EXPRESSION *ReadExpression; // nested EFI_IFR_READ, provide this question value by read expression.
322 FORM_EXPRESSION *WriteExpression; // nested EFI_IFR_WRITE, evaluate write expression after this question value is set.
323 };
324
325 #define FORM_BROWSER_STATEMENT_FROM_LINK(a) CR (a, FORM_BROWSER_STATEMENT, Link, FORM_BROWSER_STATEMENT_SIGNATURE)
326
327 #define FORM_BROWSER_FORM_SIGNATURE SIGNATURE_32 ('F', 'F', 'R', 'M')
328 #define STANDARD_MAP_FORM_TYPE 0x01
329
330 typedef struct {
331 UINTN Signature;
332 LIST_ENTRY Link;
333
334 UINT16 FormId; // FormId of normal form or formmap form.
335 EFI_STRING_ID FormTitle; // FormTile of normal form, or FormMapMethod title of formmap form.
336 UINT16 FormType; // Specific form type for the different form.
337
338 BOOLEAN ModalForm; // Whether this is a modal form.
339 LIST_ENTRY ExpressionListHead; // List of Expressions (FORM_EXPRESSION)
340 LIST_ENTRY StatementListHead; // List of Statements and Questions (FORM_BROWSER_STATEMENT)
341 FORM_EXPRESSION *SuppressExpression; // nesting inside of SuppressIf
342 } FORM_BROWSER_FORM;
343
344 #define FORM_BROWSER_FORM_FROM_LINK(a) CR (a, FORM_BROWSER_FORM, Link, FORM_BROWSER_FORM_SIGNATURE)
345
346 #define FORMSET_DEFAULTSTORE_SIGNATURE SIGNATURE_32 ('F', 'D', 'F', 'S')
347
348 typedef struct {
349 UINTN Signature;
350 LIST_ENTRY Link;
351
352 UINT16 DefaultId;
353 EFI_STRING_ID DefaultName;
354 } FORMSET_DEFAULTSTORE;
355
356 #define STRING_NUMBER 100
357
358 typedef struct {
359 EFI_STRING_ID StringId;
360 CHAR16 *String;
361 } STRING_INFO;
362
363 typedef struct {
364 EFI_STRING_ID CachedIdNum;
365 EFI_STRING_ID MaxIdNum;
366 STRING_INFO *StringInfoList;
367 } FORMSET_STRING_LIST;
368
369 #define FORMSET_DEFAULTSTORE_FROM_LINK(a) CR (a, FORMSET_DEFAULTSTORE, Link, FORMSET_DEFAULTSTORE_SIGNATURE)
370
371 #define FORM_BROWSER_FORMSET_SIGNATURE SIGNATURE_32 ('F', 'B', 'F', 'S')
372
373 typedef struct {
374 UINTN Signature;
375 LIST_ENTRY Link;
376
377 UINT32 FormSetOrder;
378
379 UINTN IfrBinaryLength;
380 UINT8 *IfrBinaryData;
381 UINT8 *UnicodeBinary;
382
383 EFI_GUID Guid;
384 EFI_STRING_ID FormSetTitle;
385 EFI_STRING_ID Help;
386 UINT8 NumberOfClassGuid;
387 EFI_GUID ClassGuid[3]; // Up to three ClassGuid
388 UINT16 Class; // Tiano extended Class code
389 UINT16 SubClass; // Tiano extended Subclass code
390
391 FORM_BROWSER_STATEMENT *StatementBuffer; // Buffer for all Statements and Questions
392 EXPRESSION_OPCODE *ExpressionBuffer; // Buffer for all Expression OpCode
393
394 LIST_ENTRY *StorageListHead; // Storage list (FORMSET_STORAGE)
395 LIST_ENTRY DefaultStoreListHead; // DefaultStore list (FORMSET_DEFAULTSTORE)
396 LIST_ENTRY FormListHead; // Form list (FORM_BROWSER_FORM)
397 LIST_ENTRY ExpressionListHead; // List of Expressions (FORM_EXPRESSION)
398 FORMSET_STRING_LIST EnUsStringList; // Cache EN_US English list
399 FORMSET_STRING_LIST UqiStringList; // Cache EN_US English list
400 } FORM_BROWSER_FORMSET;
401
402 #define FORM_BROWSER_FORMSET_FROM_LINK(a) CR (a, FORM_BROWSER_FORMSET, Link, FORM_BROWSER_FORMSET_SIGNATURE)
403
404 ///
405 /// Structure for multi-platform support
406 ///
407 typedef struct {
408 UINT16 DefaultId[MAX_PLATFORM_DEFAULT_ID_NUM];
409 UINT16 DefaultIdNum;
410 UINT64 PlatformId[MAX_PLATFORM_DEFAULT_ID_NUM];
411 UINT16 PlatformIdNum;
412 UINT16 KeyDefaultId[MAX_PLATFORM_DEFAULT_ID_NUM];
413 UINT64 KeyPlatformId[MAX_PLATFORM_DEFAULT_ID_NUM];
414 UINT16 KeyIdNum;
415 FORM_BROWSER_STATEMENT PlatformIdQuestion;
416 FORM_BROWSER_STATEMENT *Question;
417 UINT16 PlatformIdWidth;
418 UQI_HEADER Uqi;
419 BOOLEAN MultiPlatformOrNot;
420 BOOLEAN ExistStorageFfsInBfv;
421 BOOLEAN SizeOptimized;
422 BOOLEAN SizeOptimizedParam;
423 } MULTI_PLATFORM_PARAMETERS;
424
425 /**
426 Search the variable list according to the variable Guid and name, and return the pointer
427 of that Node.
428
429 @param HiiObjList The pointer to the Question
430 @param VarName The EFI variable name need to be updated to VarList
431 @param Offset The offset of the variable
432 @param StorageListHead The pointer to the LIST_ENTRY of Storage
433 @param Vaue The value in that value offset of the variable
434 @param VarList The dual pointer of Varlist
435
436 @return EFI_SUCCESS
437 **/
438 EFI_STATUS
439 SearchVarStorage (
440 IN FORM_BROWSER_STATEMENT *Question,
441 IN CHAR16* VarName,
442 IN UINT32 Offset,
443 IN LIST_ENTRY *StorageListHead,
444 IN OUT CHAR8 **Value,
445 IN OUT FORMSET_STORAGE **VarList
446 );
447
448 /**
449 Get the string based on the StringId and HII Package List Handle.
450
451 @param Token The String's ID.
452 @param HiiHandle The package list in the HII database to search for
453 the specified string.
454
455 @return The output string.
456
457 **/
458 CHAR16 *
459 GetToken (
460 IN EFI_STRING_ID Token,
461 IN UINT8 *UniPackge
462 );
463
464 /**
465 Free resources allocated for all Storage in an LIST_ENTRY.
466
467 @param FormSet Pointer of the FormSet
468
469 **/
470 VOID
471 DestroyAllStorage (
472 IN LIST_ENTRY *StorageEntryListHead
473 );
474
475
476 /**
477 Free resources allocated for a FormSet.
478
479 @param FormSet Pointer of the FormSet
480
481 **/
482 VOID
483 DestroyFormSet (
484 IN FORM_BROWSER_FORMSET *FormSet
485 );
486
487
488 /**
489 Free resources allocated for all FormSet in an LIST_ENTRY.
490
491 @param FormSet Pointer of the FormSet
492
493 **/
494 VOID
495 DestroyAllFormSet (
496 IN LIST_ENTRY *FormSetEntryListHead
497 );
498
499 /**
500 Parse opcodes in the formset IFR binary.
501
502 @param FormSet Pointer of the FormSet data structure.
503
504 @retval EFI_SUCCESS Opcode parse success.
505 @retval Other Opcode parse fail.
506
507 **/
508 EFI_STATUS
509 ParseOpCodes (
510 IN FORM_BROWSER_FORMSET *FormSet
511 );
512
513 /**
514 Set the value to the variable of platformId question.
515
516 @param PlatformId The form set.
517
518 @retval EFI_SUCCESS Set successfully.
519
520 **/
521 EFI_STATUS
522 AssignThePlatformId (
523 IN UINT64 PlatformId
524 );
525
526
527 /**
528 Reset Questions to their default value in a Form, Formset or System.
529
530 @param FormSet FormSet data structure.
531 @param Form Form data structure.
532 @param DefaultId The default Id
533 @param PlatformId The platform Id
534 @param SettingScope Setting Scope for Default action.
535
536 @retval EFI_SUCCESS The function completed successfully.
537 @retval EFI_UNSUPPORTED Unsupport SettingScope.
538
539 **/
540 EFI_STATUS
541 ExtractDefault (
542 IN FORM_BROWSER_FORMSET *FormSet,
543 IN FORM_BROWSER_FORM *Form,
544 IN UINT16 DefaultId,
545 IN UINT64 PlatformId,
546 IN BROWSER_SETTING_SCOPE SettingScope
547 );
548
549
550 /**
551 Reset stack pointer to begin of the stack.
552
553 **/
554 VOID
555 ResetCurrentExpressionStack (
556 VOID
557 );
558
559
560 /**
561 Push current expression onto the Stack
562
563 @param Pointer Pointer to current expression.
564
565 @retval EFI_SUCCESS The value was pushed onto the stack.
566 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.
567
568 **/
569 EFI_STATUS
570 PushCurrentExpression (
571 IN VOID *Pointer
572 );
573
574
575 /**
576 Pop current expression from the Stack
577
578 @param Pointer Pointer to current expression to be pop.
579
580 @retval EFI_SUCCESS The value was pushed onto the stack.
581 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.
582
583 **/
584 EFI_STATUS
585 PopCurrentExpression (
586 OUT VOID **Pointer
587 );
588
589 /**
590 Reset stack pointer to begin of the stack.
591
592 **/
593 VOID
594 ResetMapExpressionListStack (
595 VOID
596 );
597
598
599 /**
600 Push the list of map expression onto the Stack
601
602 @param Pointer Pointer to the list of map expression to be pushed.
603
604 @retval EFI_SUCCESS The value was pushed onto the stack.
605 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.
606
607 **/
608 EFI_STATUS
609 PushMapExpressionList (
610 IN VOID *Pointer
611 );
612
613
614 /**
615 Pop the list of map expression from the Stack
616
617 @param Pointer Pointer to the list of map expression to be pop.
618
619 @retval EFI_SUCCESS The value was pushed onto the stack.
620 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the stack.
621
622 **/
623 EFI_STATUS
624 PopMapExpressionList (
625 OUT VOID **Pointer
626 );
627
628 /**
629 Reset stack pointer to begin of the stack.
630
631 **/
632 VOID
633 ResetScopeStack (
634 VOID
635 );
636
637
638 /**
639 Push an Operand onto the Stack
640
641 @param Operand Operand to push.
642
643 @retval EFI_SUCCESS The value was pushed onto the stack.
644 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the
645 stack.
646
647 **/
648 EFI_STATUS
649 PushScope (
650 IN UINT8 Operand
651 );
652
653
654 /**
655 Pop an Operand from the Stack
656
657 @param Operand Operand to pop.
658
659 @retval EFI_SUCCESS The value was pushed onto the stack.
660 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the
661 stack.
662
663 **/
664 EFI_STATUS
665 PopScope (
666 OUT UINT8 *Operand
667 );
668
669
670 /**
671 Zero extend integer/boolean/date/time to UINT64 for comparing.
672
673 @param Value HII Value to be converted.
674
675 **/
676 VOID
677 ExtendValueToU64 (
678 IN EFI_HII_VALUE *Value
679 );
680
681
682 /**
683 Compare two Hii value.
684
685 @param Value1 Expression value to compare on left-hand.
686 @param Value2 Expression value to compare on right-hand.
687
688 @retval EFI_INVALID_PARAMETER Could not perform compare on two values.
689 @retval 0 Two operators equal.
690 @return Positive value if Value1 is greater than Value2.
691 @retval Negative value if Value1 is less than Value2.
692
693 **/
694 INTN
695 CompareHiiValue (
696 IN EFI_HII_VALUE *Value1,
697 IN EFI_HII_VALUE *Value2,
698 IN FORM_BROWSER_FORMSET *FormSet
699 );
700
701 /**
702 Evaluate the result of a HII expression.
703
704 If Expression is NULL, then ASSERT.
705
706 @param FormSet FormSet associated with this expression.
707 @param Form Form associated with this expression.
708 @param Expression Expression to be evaluated.
709 @param ConstantExpression The pointer to the flag of constant expression. If constant, will return TRUE.
710
711 @retval EFI_SUCCESS The expression evaluated successfuly
712 @retval EFI_NOT_FOUND The Question which referenced by a QuestionId
713 could not be found.
714 @retval EFI_OUT_OF_RESOURCES There is not enough system memory to grow the
715 stack.
716 @retval EFI_ACCESS_DENIED The pop operation underflowed the stack
717 @retval EFI_INVALID_PARAMETER Syntax error with the Expression
718
719 **/
720 EFI_STATUS
721 EvaluateExpression (
722 IN FORM_BROWSER_FORMSET *FormSet,
723 IN FORM_BROWSER_FORM *Form,
724 IN OUT FORM_EXPRESSION *Expression,
725 IN OUT BOOLEAN *ConstantExpression
726 );
727
728 /**
729 Compare two Uqi parameters
730
731 @param UqiParm1 The pointer to the first Uqi parameter.
732 @param UqiParm2 The pointer to the second Uqi parameter.
733
734 @retval TRUE If these two Uqi parameters are the same, return TRUE;
735 @return FALSE Otherwise, return FALSE;
736 **/
737 BOOLEAN
738 CompareUqiHeader (
739 IN CONST UQI_HEADER *UqiParm1,
740 IN CONST UQI_HEADER *UqiParm2
741 );
742
743
744 /**
745 Print all ONE_OF ORDER_LIST NUMERIC STRING and CHECKBOX in all fromsets.
746
747 @param Formset The pointer to the entry of the fromset list
748 @param Formset The pointer to the entry of the storage list
749
750 @retval EFI_SUCCESS It was complete successfully
751 @return EFI_ABORTED An error occurred
752 **/
753 EFI_STATUS
754 PrintInfoInAllFormset (
755 IN LIST_ENTRY *FormSetEntryListHead,
756 IN LIST_ENTRY *StorageEntryListHead
757 );
758
759 /**
760 Get the question value with bit field from the buffer.
761
762 @param Question The question refer to bit field.
763 @param Buffer The buffer which the question value get from.
764 @param Value Retun the value.
765
766 **/
767 VOID
768 GetBitsQuestionValue(
769 IN FORM_BROWSER_STATEMENT *Question,
770 IN UINT8 *Buffer,
771 OUT UINT32 *Value
772 );
773
774 /**
775 Set the question value with bit field to the buffer.
776
777 @param Question The question refer to bit field.
778 @param Buffer The buffer which the question value set to.
779 @param Value The value need to set.
780
781 **/
782 VOID
783 SetBitsQuestionValue (
784 IN FORM_BROWSER_STATEMENT *Question,
785 IN UINT8 *Buffer,
786 IN UINT32 Value
787 );
788
789 #endif