TianoCore EDK2 master
|
#include "Setup.h"
Go to the source code of this file.
Utility functions for expression evaluation.
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file Expression.c.
Check if current user has the privilege specified by the permissions GUID.
[in] | Guid | A GUID specifying setup access permissions. |
TRUE | Current user has the privilege. |
FALSE | Current user does not have the privilege. |
If the system does not support user management, then it is assumed that all users have admin privilege and evaluation of each EFI_IFR_SECURITY op-code is always TRUE.
Enumerate all user information of the current user profile to look for any EFI_USER_INFO_ACCESS_SETUP record.
Check if current user has the privilege specified by the permissions GUID.
Definition at line 2302 of file Expression.c.
EFI_STATUS CompareHiiValue | ( | IN EFI_HII_VALUE * | Value1, |
IN EFI_HII_VALUE * | Value2, | ||
OUT INTN * | Result, | ||
IN EFI_HII_HANDLE HiiHandle | OPTIONAL | ||
) |
Compare two Hii value.
Value1 | Expression value to compare on left-hand. |
Value2 | Expression value to compare on right-hand. |
Result | Return value after compare. retval 0 Two operators equal. return Positive value if Value1 is greater than Value2. retval Negative value if Value1 is less than Value2. |
HiiHandle | Only required for string compare. |
other | Could not perform compare on two values. |
EFI_SUCCESS | Compare the value success. |
Definition at line 2201 of file Expression.c.
EFI_STATUS EvaluateExpression | ( | IN FORM_BROWSER_FORMSET * | FormSet, |
IN FORM_BROWSER_FORM * | Form, | ||
IN OUT FORM_EXPRESSION * | Expression | ||
) |
Evaluate the result of a HII expression.
If Expression is NULL, then ASSERT.
FormSet | FormSet associated with this expression. |
Form | Form associated with this expression. |
Expression | Expression to be evaluated. |
EFI_SUCCESS | The expression evaluated successfuly |
EFI_NOT_FOUND | The Question which referenced by a QuestionId could not be found. |
EFI_OUT_OF_RESOURCES | There is not enough system memory to grow the stack. |
EFI_ACCESS_DENIED | The pop operation underflowed the stack |
EFI_INVALID_PARAMETER | Syntax error with the Expression |
Definition at line 2536 of file Expression.c.
EXPRESS_RESULT EvaluateExpressionList | ( | IN FORM_EXPRESSION_LIST * | ExpList, |
IN BOOLEAN | Evaluate, | ||
IN FORM_BROWSER_FORMSET *FormSet | OPTIONAL, | ||
IN FORM_BROWSER_FORM *Form | OPTIONAL | ||
) |
Return the result of the expression list. Check the expression list and return the highest priority express result. Priority: DisableIf > SuppressIf > GrayOutIf > FALSE
ExpList | The input expression list. |
Evaluate | Whether need to evaluate the expression first. |
FormSet | FormSet associated with this expression. |
Form | Form associated with this expression. |
EXPRESS_RESULT | Return the higher priority express result. DisableIf > SuppressIf > GrayOutIf > FALSE |
Definition at line 3732 of file Expression.c.
VOID ExtendValueToU64 | ( | IN EFI_HII_VALUE * | Value | ) |
Zero extend integer/boolean/date/time to UINT64 for comparing.
Value | HII Value to be converted. |
Definition at line 2096 of file Expression.c.
UINT8 * GetBufferForValue | ( | IN EFI_HII_VALUE * | Value | ) |
Return the buffer pointer for this value.
EFI_IFR_TYPE_REF, EFI_IFR_TYPE_DATE and EFI_IFR_TYPE_TIME are converted to EFI_IFR_TYPE_BUFFER when do the value compare.
Value | Expression value to compare on. |
Buf | Return the buffer pointer. |
Definition at line 1070 of file Expression.c.
Get the expression list count.
Level | Which type this expression belong to. Form, statement or option? |
>=0 | The expression count |
-1 | Input parameter error. |
Definition at line 423 of file Expression.c.
FORM_EXPRESSION ** GetConditionalExpressionList | ( | IN EXPRESS_LEVEL | Level | ) |
Get the expression Buffer pointer.
Level | Which type this expression belong to. Form, statement or option? |
The | start pointer of the expression buffer or NULL. |
Definition at line 450 of file Expression.c.
UINT16 GetLengthForValue | ( | IN EFI_HII_VALUE * | Value | ) |
Return the buffer length for this value.
EFI_IFR_TYPE_REF, EFI_IFR_TYPE_DATE and EFI_IFR_TYPE_TIME are converted to EFI_IFR_TYPE_BUFFER when do the value compare.
Value | Expression value to compare on. |
BufLen | Return the buffer length. |
Definition at line 1036 of file Expression.c.
BOOLEAN GetQuestionValueFromForm | ( | IN EFI_DEVICE_PATH_PROTOCOL * | DevicePath, |
IN EFI_HII_HANDLE | InputHiiHandle, | ||
IN EFI_GUID * | FormSetGuid, | ||
IN EFI_QUESTION_ID | QuestionId, | ||
OUT EFI_HII_VALUE * | Value | ||
) |
Get question value from the predefined formset.
DevicePath | The driver's device path which produece the formset data. |
InputHiiHandle | The hii handle associate with the formset data. |
FormSetGuid | The formset guid which include the question. |
QuestionId | The question id which need to get value from. |
Value | The return data about question's value. |
TRUE | Get the question value success. |
FALSE | Get the question value failed. |
Definition at line 2414 of file Expression.c.
EFI_STATUS GrowConditionalStack | ( | IN OUT FORM_EXPRESSION *** | Stack, |
IN OUT FORM_EXPRESSION *** | StackPtr, | ||
IN OUT FORM_EXPRESSION *** | StackEnd, | ||
IN UINTN | MemberSize | ||
) |
Grow size of the stack.
This is an internal function.
Stack | On input: old stack; On output: new stack |
StackPtr | On input: old stack pointer; On output: new stack pointer |
StackEnd | On input: old stack end; On output: new stack end |
MemberSize | The stack member size. |
EFI_SUCCESS | Grow stack success. |
EFI_OUT_OF_RESOURCES | No enough memory for stack space. |
Definition at line 289 of file Expression.c.
EFI_STATUS GrowStack | ( | IN OUT EFI_HII_VALUE ** | Stack, |
IN OUT EFI_HII_VALUE ** | StackPtr, | ||
IN OUT EFI_HII_VALUE ** | StackEnd | ||
) |
Grow size of the stack.
This is an internal function.
Stack | On input: old stack; On output: new stack |
StackPtr | On input: old stack pointer; On output: new stack pointer |
StackEnd | On input: old stack end; On output: new stack end |
EFI_SUCCESS | Grow stack success. |
EFI_OUT_OF_RESOURCES | No enough memory for stack space. |
Definition at line 64 of file Expression.c.
UINT64 HiiValueToUINT64 | ( | IN EFI_HII_VALUE * | Value | ) |
Get UINT64 type value.
Value | Input Hii value. |
UINT64 | Return the UINT64 type value. |
Definition at line 2144 of file Expression.c.
FORM_BROWSER_FORM * IdToForm | ( | IN FORM_BROWSER_FORMSET * | FormSet, |
IN UINT16 | FormId | ||
) |
Get Form given its FormId.
FormSet | The formset which contains this form. |
FormId | Id of this form. |
Pointer | The form. |
NULL | Specified Form is not found in the formset. |
Definition at line 767 of file Expression.c.
FORM_BROWSER_STATEMENT * IdToQuestion | ( | IN FORM_BROWSER_FORMSET * | FormSet, |
IN FORM_BROWSER_FORM * | Form, | ||
IN UINT16 | QuestionId | ||
) |
Search a Question in Formset scope using its QuestionId.
FormSet | The formset which contains this form. |
Form | The form which contains this Question. |
QuestionId | Id of this Question. |
Pointer | The Question. |
NULL | Specified Question not found in the form. |
Definition at line 841 of file Expression.c.
FORM_BROWSER_STATEMENT * IdToQuestion2 | ( | IN FORM_BROWSER_FORM * | Form, |
IN UINT16 | QuestionId | ||
) |
Search a Question in Form scope using its QuestionId.
Form | The form which contains this Question. |
QuestionId | Id of this Question. |
Pointer | The Question. |
NULL | Specified Question not found in the form. |
Definition at line 800 of file Expression.c.
EFI_STATUS IfrCatenate | ( | IN FORM_BROWSER_FORMSET * | FormSet, |
OUT EFI_HII_VALUE * | Result | ||
) |
Evaluate opcode EFI_IFR_CATENATE.
FormSet | Formset which contains this opcode. |
Result | Evaluation result for this opcode. |
EFI_SUCCESS | Opcode evaluation success. |
Other | Opcode evaluation failed. |
Definition at line 1296 of file Expression.c.
EFI_STATUS IfrFind | ( | IN FORM_BROWSER_FORMSET * | FormSet, |
IN UINT8 | Format, | ||
OUT EFI_HII_VALUE * | Result | ||
) |
Evaluate opcode EFI_IFR_FIND.
FormSet | Formset which contains this opcode. |
Format | Case sensitive or insensitive. |
Result | Evaluation result for this opcode. |
EFI_SUCCESS | Opcode evaluation success. |
Other | Opcode evaluation failed. |
Definition at line 1662 of file Expression.c.
EFI_STATUS IfrMatch | ( | IN FORM_BROWSER_FORMSET * | FormSet, |
OUT EFI_HII_VALUE * | Result | ||
) |
Evaluate opcode EFI_IFR_MATCH.
FormSet | Formset which contains this opcode. |
Result | Evaluation result for this opcode. |
EFI_SUCCESS | Opcode evaluation success. |
Other | Opcode evaluation failed. |
Definition at line 1410 of file Expression.c.
EFI_STATUS IfrMatch2 | ( | IN FORM_BROWSER_FORMSET * | FormSet, |
IN EFI_GUID * | SyntaxType, | ||
OUT EFI_HII_VALUE * | Result | ||
) |
Evaluate opcode EFI_IFR_MATCH2.
FormSet | Formset which contains this opcode. |
SyntaxType | Syntax type for match2. |
Result | Evaluation result for this opcode. |
EFI_SUCCESS | Opcode evaluation success. |
Other | Opcode evaluation failed. |
Definition at line 1480 of file Expression.c.
EFI_STATUS IfrMid | ( | IN FORM_BROWSER_FORMSET * | FormSet, |
OUT EFI_HII_VALUE * | Result | ||
) |
Evaluate opcode EFI_IFR_MID.
FormSet | Formset which contains this opcode. |
Result | Evaluation result for this opcode. |
EFI_SUCCESS | Opcode evaluation success. |
Other | Opcode evaluation failed. |
Definition at line 1761 of file Expression.c.
EFI_STATUS IfrSpan | ( | IN FORM_BROWSER_FORMSET * | FormSet, |
IN UINT8 | Flags, | ||
OUT EFI_HII_VALUE * | Result | ||
) |
Evaluate opcode EFI_IFR_SPAN.
FormSet | Formset which contains this opcode. |
Flags | FIRST_MATCHING or FIRST_NON_MATCHING. |
Result | Evaluation result for this opcode. |
EFI_SUCCESS | Opcode evaluation success. |
Other | Opcode evaluation failed. |
Definition at line 1980 of file Expression.c.
VOID IfrStrToUpper | ( | IN CHAR16 * | String | ) |
Convert the input Unicode character to upper.
String | Th Unicode character to be converted. |
Definition at line 955 of file Expression.c.
EFI_STATUS IfrToken | ( | IN FORM_BROWSER_FORMSET * | FormSet, |
OUT EFI_HII_VALUE * | Result | ||
) |
Evaluate opcode EFI_IFR_TOKEN.
FormSet | Formset which contains this opcode. |
Result | Evaluation result for this opcode. |
EFI_SUCCESS | Opcode evaluation success. |
Other | Opcode evaluation failed. |
Definition at line 1864 of file Expression.c.
EFI_STATUS IfrToString | ( | IN FORM_BROWSER_FORMSET * | FormSet, |
IN UINT8 | Format, | ||
OUT EFI_HII_VALUE * | Result | ||
) |
Evaluate opcode EFI_IFR_TO_STRING.
FormSet | Formset which contains this opcode. |
Format | String format in EFI_IFR_TO_STRING. |
Result | Evaluation result for this opcode. |
EFI_SUCCESS | Opcode evaluation success. |
Other | Opcode evaluation failed. |
Definition at line 1104 of file Expression.c.
EFI_STATUS IfrToUint | ( | IN FORM_BROWSER_FORMSET * | FormSet, |
OUT EFI_HII_VALUE * | Result | ||
) |
Evaluate opcode EFI_IFR_TO_UINT.
FormSet | Formset which contains this opcode. |
Result | Evaluation result for this opcode. |
EFI_SUCCESS | Opcode evaluation success. |
Other | Opcode evaluation failed. |
Definition at line 1219 of file Expression.c.
EFI_STATUS InitializeUnicodeCollationProtocol | ( | VOID | ) |
Locate the Unicode Collation Protocol interface for later use.
EFI_SUCCESS | Protocol interface initialize success. |
Other | Protocol interface initialize failed. |
Definition at line 925 of file Expression.c.
BOOLEAN IsTrue | ( | IN EFI_HII_VALUE * | Result | ) |
Check whether the result is TRUE or FALSE.
For the EFI_HII_VALUE value type is numeric, return TRUE if the value is not 0.
Result | Input the result data. |
TRUE | The result is TRUE. |
FALSE | The result is FALSE. |
Definition at line 3692 of file Expression.c.
BOOLEAN IsTypeInBuffer | ( | IN EFI_HII_VALUE * | Value | ) |
Check whether this value type can be transfer to EFI_IFR_TYPE_BUFFER type.
EFI_IFR_TYPE_REF, EFI_IFR_TYPE_DATE and EFI_IFR_TYPE_TIME are converted to EFI_IFR_TYPE_BUFFER when do the value compare.
Value | Expression value to compare on. |
TRUE | This value type can be transter to EFI_IFR_TYPE_BUFFER type. |
FALSE | This value type can't be transter to EFI_IFR_TYPE_BUFFER type. |
Definition at line 981 of file Expression.c.
BOOLEAN IsTypeInUINT64 | ( | IN EFI_HII_VALUE * | Value | ) |
Check whether this value type can be transfer to EFI_IFR_TYPE_UINT64
Value | Expression value to compare on. |
TRUE | This value type can be transter to EFI_IFR_TYPE_BUFFER type. |
FALSE | This value type can't be transter to EFI_IFR_TYPE_BUFFER type. |
Definition at line 1007 of file Expression.c.
EFI_STATUS PopConditionalExpression | ( | IN EXPRESS_LEVEL | Level | ) |
Pop the expression options from the Stack
Level | Which type this expression belong to. Form, statement or option? |
EFI_SUCCESS | The value was pushed onto the stack. |
EFI_OUT_OF_RESOURCES | There is not enough system memory to grow the stack. |
Definition at line 523 of file Expression.c.
EFI_STATUS PopConditionalStack | ( | IN FORM_EXPRESSION ** | Stack, |
IN OUT FORM_EXPRESSION *** | StackPtr, | ||
OUT FORM_EXPRESSION ** | Data | ||
) |
Pop an element from the stack.
Stack | On input: old stack |
StackPtr | On input: old stack pointer; On output: new stack pointer |
Data | Data to pop. |
EFI_SUCCESS | The value was popped onto the stack. |
EFI_ACCESS_DENIED | The pop operation underflowed the stack |
Definition at line 391 of file Expression.c.
EFI_STATUS PopCurrentExpression | ( | OUT VOID ** | Pointer | ) |
Pop current expression from the Stack
Pointer | Pointer to current expression to be pop. |
EFI_SUCCESS | The value was pushed onto the stack. |
EFI_OUT_OF_RESOURCES | There is not enough system memory to grow the stack. |
Definition at line 243 of file Expression.c.
EFI_STATUS PopExpression | ( | OUT EFI_HII_VALUE * | Value | ) |
Pop an Expression value from the stack.
Value | Expression value to pop. |
EFI_SUCCESS | The value was popped onto the stack. |
EFI_ACCESS_DENIED | The pop operation underflowed the stack |
Definition at line 714 of file Expression.c.
EFI_STATUS PopMapExpressionList | ( | OUT VOID ** | Pointer | ) |
Pop the list of map expression from the Stack
Pointer | Pointer to the list of map expression to be pop. |
EFI_SUCCESS | The value was pushed onto the stack. |
EFI_OUT_OF_RESOURCES | There is not enough system memory to grow the stack. |
Definition at line 594 of file Expression.c.
EFI_STATUS PopScope | ( | OUT UINT8 * | Operand | ) |
Pop an Operand from the Stack
Operand | Operand to pop. |
EFI_SUCCESS | The value was pushed onto the stack. |
EFI_OUT_OF_RESOURCES | There is not enough system memory to grow the stack. |
Definition at line 663 of file Expression.c.
EFI_STATUS PopStack | ( | IN EFI_HII_VALUE * | Stack, |
IN OUT EFI_HII_VALUE ** | StackPtr, | ||
OUT EFI_HII_VALUE * | Data | ||
) |
Pop an element from the stack.
Stack | On input: old stack |
StackPtr | On input: old stack pointer; On output: new stack pointer |
Data | Data to pop. |
EFI_SUCCESS | The value was popped onto the stack. |
EFI_ACCESS_DENIED | The pop operation underflowed the stack |
Definition at line 170 of file Expression.c.
EFI_STATUS PushConditionalExpression | ( | IN FORM_EXPRESSION * | Pointer, |
IN EXPRESS_LEVEL | Level | ||
) |
Push the expression options onto the Stack.
Pointer | Pointer to the current expression. |
Level | Which type this expression belong to. Form, statement or option? |
EFI_SUCCESS | The value was pushed onto the stack. |
EFI_OUT_OF_RESOURCES | There is not enough system memory to grow the stack. |
Definition at line 479 of file Expression.c.
EFI_STATUS PushConditionalStack | ( | IN OUT FORM_EXPRESSION *** | Stack, |
IN OUT FORM_EXPRESSION *** | StackPtr, | ||
IN OUT FORM_EXPRESSION *** | StackEnd, | ||
IN FORM_EXPRESSION ** | Data | ||
) |
Push an element onto the Stack.
Stack | On input: old stack; On output: new stack |
StackPtr | On input: old stack pointer; On output: new stack pointer |
StackEnd | On input: old stack end; On output: new stack end |
Data | Data to push. |
EFI_SUCCESS | Push stack success. |
Definition at line 348 of file Expression.c.
EFI_STATUS PushCurrentExpression | ( | IN VOID * | Pointer | ) |
Push current expression onto the Stack
Pointer | Pointer to current expression. |
EFI_SUCCESS | The value was pushed onto the stack. |
EFI_OUT_OF_RESOURCES | There is not enough system memory to grow the stack. |
Definition at line 216 of file Expression.c.
EFI_STATUS PushExpression | ( | IN EFI_HII_VALUE * | Value | ) |
Push an Expression value onto the Stack
Value | Expression value to push. |
EFI_SUCCESS | The value was pushed onto the stack. |
EFI_OUT_OF_RESOURCES | There is not enough system memory to grow the stack. |
Definition at line 692 of file Expression.c.
EFI_STATUS PushMapExpressionList | ( | IN VOID * | Pointer | ) |
Push the list of map expression onto the Stack
Pointer | Pointer to the list of map expression to be pushed. |
EFI_SUCCESS | The value was pushed onto the stack. |
EFI_OUT_OF_RESOURCES | There is not enough system memory to grow the stack. |
Definition at line 567 of file Expression.c.
EFI_STATUS PushScope | ( | IN UINT8 | Operand | ) |
Push an Operand onto the Stack
Operand | Operand to push. |
EFI_SUCCESS | The value was pushed onto the stack. |
EFI_OUT_OF_RESOURCES | There is not enough system memory to grow the stack. |
Definition at line 635 of file Expression.c.
EFI_STATUS PushStack | ( | IN OUT EFI_HII_VALUE ** | Stack, |
IN OUT EFI_HII_VALUE ** | StackPtr, | ||
IN OUT EFI_HII_VALUE ** | StackEnd, | ||
IN EFI_HII_VALUE * | Data | ||
) |
Push an element onto the Boolean Stack.
Stack | On input: old stack; On output: new stack |
StackPtr | On input: old stack pointer; On output: new stack pointer |
StackEnd | On input: old stack end; On output: new stack end |
Data | Data to push. |
EFI_SUCCESS | Push stack success. |
Definition at line 122 of file Expression.c.
VOID ResetCurrentExpressionStack | ( | VOID | ) |
Reset stack pointer to begin of the stack.
Definition at line 196 of file Expression.c.
VOID ResetMapExpressionListStack | ( | VOID | ) |
Reset stack pointer to begin of the stack.
Definition at line 266 of file Expression.c.
VOID ResetScopeStack | ( | VOID | ) |
Reset stack pointer to begin of the stack.
Definition at line 617 of file Expression.c.
VOID RestoreExpressionEvaluationStackOffset | ( | UINTN | StackOffset | ) |
Restore stack offset based on input stack offset
StackOffset | Offset to stack start. |
Definition at line 749 of file Expression.c.
FORM_EXPRESSION * RuleIdToExpression | ( | IN FORM_BROWSER_FORM * | Form, |
IN UINT8 | RuleId | ||
) |
Get Expression given its RuleId.
Form | The form which contains this Expression. |
RuleId | Id of this Expression. |
Pointer | The Expression. |
NULL | Specified Expression not found in the form. |
Definition at line 895 of file Expression.c.
UINTN SaveExpressionEvaluationStackOffset | ( | VOID | ) |
Get current stack offset from stack start.
Definition at line 731 of file Expression.c.
EFI_HII_VALUE* mCurrentExpressionEnd = NULL |
Definition at line 24 of file Expression.c.
EFI_HII_VALUE* mCurrentExpressionPointer = NULL |
Definition at line 25 of file Expression.c.
EFI_HII_VALUE* mCurrentExpressionStack = NULL |
Definition at line 23 of file Expression.c.
EFI_HII_VALUE* mExpressionEvaluationStack = NULL |
Definition at line 18 of file Expression.c.
EFI_HII_VALUE* mExpressionEvaluationStackEnd = NULL |
Definition at line 19 of file Expression.c.
UINTN mExpressionEvaluationStackOffset = 0 |
Definition at line 21 of file Expression.c.
EFI_HII_VALUE* mExpressionEvaluationStackPointer = NULL |
Definition at line 20 of file Expression.c.
FORM_EXPRESSION** mFormExpressionEnd = NULL |
Definition at line 32 of file Expression.c.
FORM_EXPRESSION** mFormExpressionPointer = NULL |
Definition at line 33 of file Expression.c.
FORM_EXPRESSION** mFormExpressionStack = NULL |
Definition at line 31 of file Expression.c.
EFI_HII_VALUE* mMapExpressionListEnd = NULL |
Definition at line 28 of file Expression.c.
EFI_HII_VALUE* mMapExpressionListPointer = NULL |
Definition at line 29 of file Expression.c.
EFI_HII_VALUE* mMapExpressionListStack = NULL |
Definition at line 27 of file Expression.c.
EFI_HII_VALUE* mOpCodeScopeStack = NULL |
Definition at line 14 of file Expression.c.
EFI_HII_VALUE* mOpCodeScopeStackEnd = NULL |
Definition at line 15 of file Expression.c.
EFI_HII_VALUE* mOpCodeScopeStackPointer = NULL |
Definition at line 16 of file Expression.c.
FORM_EXPRESSION** mOptionExpressionEnd = NULL |
Definition at line 40 of file Expression.c.
FORM_EXPRESSION** mOptionExpressionPointer = NULL |
Definition at line 41 of file Expression.c.
FORM_EXPRESSION** mOptionExpressionStack = NULL |
Definition at line 39 of file Expression.c.
FORM_EXPRESSION** mStatementExpressionEnd = NULL |
Definition at line 36 of file Expression.c.
FORM_EXPRESSION** mStatementExpressionPointer = NULL |
Definition at line 37 of file Expression.c.
FORM_EXPRESSION** mStatementExpressionStack = NULL |
Definition at line 35 of file Expression.c.
EFI_UNICODE_COLLATION_PROTOCOL* mUnicodeCollation = NULL |
Definition at line 46 of file Expression.c.
EFI_USER_MANAGER_PROTOCOL* mUserManager = NULL |
Definition at line 47 of file Expression.c.