TianoCore EDK2 master
Loading...
Searching...
No Matches
VarCheckHiiGen.c File Reference
#include "VarCheckHiiGen.h"
#include "VarCheckHii.h"

Go to the source code of this file.

Data Structures

struct  VAR_CHECK_HII_VARIABLE_NODE
 

Macros

#define VAR_CHECK_HII_VARIABLE_NODE_SIGNATURE   SIGNATURE_32 ('V', 'C', 'H', 'V')
 
#define VAR_CHECK_HII_VARIABLE_FROM_LINK(a)   CR (a, VAR_CHECK_HII_VARIABLE_NODE, Link, VAR_CHECK_HII_VARIABLE_NODE_SIGNATURE)
 

Functions

VOID * InternalVarCheckAllocatePool (IN EFI_MEMORY_TYPE MemoryType, IN UINTN AllocationSize)
 
VOID * InternalVarCheckAllocateZeroPool (IN UINTN AllocationSize)
 
VOID EFIAPI InternalVarCheckFreePool (IN VOID *Buffer)
 
VOID * InternalVarCheckReallocatePool (IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL)
 
VOID MergeHiiQuestion (IN OUT VAR_CHECK_HII_VARIABLE_NODE *HiiVariableNode, IN VAR_CHECK_HII_QUESTION_HEADER *HiiQuestion, IN BOOLEAN FromFv)
 
VOID GetOneOfOption (IN EFI_IFR_OP_HEADER *IfrOpCodeHeader, OUT UINTN *Count, OUT UINT8 *Width, OUT VOID *OptionBuffer OPTIONAL)
 
VAR_CHECK_HII_QUESTION_HEADERParseHiiQuestionOneOf (IN EFI_IFR_OP_HEADER *IfrOpCodeHeader, IN BOOLEAN StoredInBitField)
 
VAR_CHECK_HII_QUESTION_HEADERParseHiiQuestionCheckBox (IN EFI_IFR_OP_HEADER *IfrOpCodeHeader, IN BOOLEAN StoredInBitField)
 
VAR_CHECK_HII_QUESTION_HEADERParseHiiQuestionNumeric (IN EFI_IFR_OP_HEADER *IfrOpCodeHeader, IN BOOLEAN StoredInBitField)
 
VAR_CHECK_HII_QUESTION_HEADERParseHiiQuestionOrderedList (IN EFI_IFR_OP_HEADER *IfrOpCodeHeader)
 
VOID ParseHiiQuestion (IN VAR_CHECK_HII_VARIABLE_NODE *HiiVariableNode, IN EFI_IFR_OP_HEADER *IfrOpCodeHeader, IN BOOLEAN FromFv, IN BOOLEAN StoredInBitField)
 
VAR_CHECK_HII_VARIABLE_NODEFindHiiVariableNode (IN CHAR16 *Name, IN EFI_GUID *Guid)
 
VAR_CHECK_HII_VARIABLE_NODEFindHiiVariableNodeByVarStoreId (IN EFI_VARSTORE_ID VarStoreId)
 
VOID DestroyVarStoreId (VOID)
 
VOID CreateHiiVariableNode (IN EFI_IFR_VARSTORE_EFI *IfrEfiVarStore)
 
VOID ParseHiiVariable (IN VOID *HiiPackage)
 
VOID VarCheckParseHiiPackage (IN VOID *HiiPackage, IN BOOLEAN FromFv)
 
VOID VarCheckParseHiiDatabase (IN VOID *HiiDatabase, IN UINTN HiiDatabaseSize)
 
VOID DestroyHiiVariableNode (VOID)
 
VOID * BuildVarCheckHiiBin (IN OUT UINTN *Size)
 
VOID EFIAPI VarCheckHiiGen (VOID)
 

Variables

VAR_CHECK_HII_VARIABLE_HEADERmVarCheckHiiBin = NULL
 
UINTN mVarCheckHiiBinSize = 0
 
LIST_ENTRY mVarCheckHiiList = INITIALIZE_LIST_HEAD_VARIABLE (mVarCheckHiiList)
 
CHAR16 * mVarName = NULL
 
UINTN mMaxVarNameSize = 0
 

Detailed Description

Var Check Hii bin generation.

Copyright (c) 2015 - 2024, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file VarCheckHiiGen.c.

Macro Definition Documentation

◆ VAR_CHECK_HII_VARIABLE_FROM_LINK

#define VAR_CHECK_HII_VARIABLE_FROM_LINK (   a)    CR (a, VAR_CHECK_HII_VARIABLE_NODE, Link, VAR_CHECK_HII_VARIABLE_NODE_SIGNATURE)

Definition at line 27 of file VarCheckHiiGen.c.

◆ VAR_CHECK_HII_VARIABLE_NODE_SIGNATURE

#define VAR_CHECK_HII_VARIABLE_NODE_SIGNATURE   SIGNATURE_32 ('V', 'C', 'H', 'V')

Definition at line 16 of file VarCheckHiiGen.c.

Function Documentation

◆ BuildVarCheckHiiBin()

VOID * BuildVarCheckHiiBin ( IN OUT UINTN Size)

Build VarCheckHiiBin.

Parameters
[out]SizePointer to VarCheckHii size.
Returns
Pointer to VarCheckHiiBin.

Definition at line 1516 of file VarCheckHiiGen.c.

◆ CreateHiiVariableNode()

VOID CreateHiiVariableNode ( IN EFI_IFR_VARSTORE_EFI IfrEfiVarStore)

Create Hii Variable node.

Parameters
[in]IfrEfiVarStorePointer to EFI VARSTORE.

Definition at line 1247 of file VarCheckHiiGen.c.

◆ DestroyHiiVariableNode()

VOID DestroyHiiVariableNode ( VOID  )

Destroy Hii Variable node.

Definition at line 1478 of file VarCheckHiiGen.c.

◆ DestroyVarStoreId()

VOID DestroyVarStoreId ( VOID  )

Destroy var store id in the Hii Variable node after parsing one Hii Package.

Definition at line 1220 of file VarCheckHiiGen.c.

◆ FindHiiVariableNode()

VAR_CHECK_HII_VARIABLE_NODE * FindHiiVariableNode ( IN CHAR16 *  Name,
IN EFI_GUID Guid 
)

Find Hii variable node by name and GUID.

Parameters
[in]NamePointer to variable name.
[in]GuidPointer to vendor GUID.
Returns
Pointer to Hii Variable node.

Definition at line 1151 of file VarCheckHiiGen.c.

◆ FindHiiVariableNodeByVarStoreId()

VAR_CHECK_HII_VARIABLE_NODE * FindHiiVariableNodeByVarStoreId ( IN EFI_VARSTORE_ID  VarStoreId)

Find Hii variable node by var store id.

Parameters
[in]VarStoreIdVar store id.
Returns
Pointer to Hii Variable node.

Definition at line 1184 of file VarCheckHiiGen.c.

◆ GetOneOfOption()

VOID GetOneOfOption ( IN EFI_IFR_OP_HEADER IfrOpCodeHeader,
OUT UINTN Count,
OUT UINT8 *  Width,
OUT VOID *OptionBuffer  OPTIONAL 
)

Get OneOf option data.

Parameters
[in]IfrOpCodeHeaderPointer to Ifr OpCode header.
[out]CountPointer to option count.
[out]WidthPointer to option width.
[out]OptionBufferPointer to option buffer.

Definition at line 796 of file VarCheckHiiGen.c.

◆ InternalVarCheckAllocatePool()

VOID * InternalVarCheckAllocatePool ( IN EFI_MEMORY_TYPE  MemoryType,
IN UINTN  AllocationSize 
)

Allocates a buffer of a certain pool type.

Allocates the number bytes specified by AllocationSize of a certain pool type and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.

Parameters
MemoryTypeThe type of memory to allocate.
AllocationSizeThe number of bytes to allocate.
Returns
A pointer to the allocated buffer or NULL if allocation fails.

Definition at line 391 of file VarCheckHiiGen.c.

◆ InternalVarCheckAllocateZeroPool()

VOID * InternalVarCheckAllocateZeroPool ( IN UINTN  AllocationSize)

Allocates and zeros a buffer of type EfiBootServicesData.

Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.

Parameters
AllocationSizeThe number of bytes to allocate and zero.
Returns
A pointer to the allocated buffer or NULL if allocation fails.

Definition at line 421 of file VarCheckHiiGen.c.

◆ InternalVarCheckFreePool()

VOID EFIAPI InternalVarCheckFreePool ( IN VOID *  Buffer)

Frees a buffer that was previously allocated with one of the pool allocation functions in the Memory Allocation Library.

Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the pool allocation services of the Memory Allocation Library. If it is not possible to free pool resources, then this function will perform no actions.

If Buffer was not allocated with a pool allocation function in the Memory Allocation Library, then ASSERT().

Parameters
BufferThe pointer to the buffer to free.

Definition at line 451 of file VarCheckHiiGen.c.

◆ InternalVarCheckReallocatePool()

VOID * InternalVarCheckReallocatePool ( IN UINTN  OldSize,
IN UINTN  NewSize,
IN VOID *OldBuffer  OPTIONAL 
)

Reallocates a buffer of type EfiBootServicesData.

Allocates and zeros the number bytes specified by NewSize from memory of type EfiBootServicesData. If OldBuffer is not NULL, then the smaller of OldSize and NewSize bytes are copied from OldBuffer to the newly allocated buffer, and OldBuffer is freed. A pointer to the newly allocated buffer is returned. If NewSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.

If the allocation of the new buffer is successful and the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().

Parameters
OldSizeThe size, in bytes, of OldBuffer.
NewSizeThe size, in bytes, of the buffer to reallocate.
OldBufferThe buffer to copy to the allocated buffer. This is an optional parameter that may be NULL.
Returns
A pointer to the allocated buffer or NULL if allocation fails.

Definition at line 483 of file VarCheckHiiGen.c.

◆ MergeHiiQuestion()

VOID MergeHiiQuestion ( IN OUT VAR_CHECK_HII_VARIABLE_NODE HiiVariableNode,
IN VAR_CHECK_HII_QUESTION_HEADER HiiQuestion,
IN BOOLEAN  FromFv 
)

Merge Hii Question.

Parameters
[in,out]HiiVariableNodePointer to Hii Variable node.
[in]HiiQuestionPointer to Hii Question.
[in]FromFvHii Question from FV.

Definition at line 509 of file VarCheckHiiGen.c.

◆ ParseHiiQuestion()

VOID ParseHiiQuestion ( IN VAR_CHECK_HII_VARIABLE_NODE HiiVariableNode,
IN EFI_IFR_OP_HEADER IfrOpCodeHeader,
IN BOOLEAN  FromFv,
IN BOOLEAN  StoredInBitField 
)

Parse and create Hii Question node.

Parameters
[in]HiiVariableNodePointer to Hii Variable node.
[in]IfrOpCodeHeaderPointer to Ifr OpCode header.
[in]FromFvHii Question from FV.
[in]StoredInBitFieldWhether the Question is stored in bit field Storage.

Definition at line 1092 of file VarCheckHiiGen.c.

◆ ParseHiiQuestionCheckBox()

VAR_CHECK_HII_QUESTION_HEADER * ParseHiiQuestionCheckBox ( IN EFI_IFR_OP_HEADER IfrOpCodeHeader,
IN BOOLEAN  StoredInBitField 
)

Parse Hii Question CheckBox.

Parameters
[in]IfrOpCodeHeaderPointer to Ifr OpCode header.
[in]StoredInBitFieldWhether the CheckBox is stored in bit field Storage.

return Pointer to Hii Question.

Definition at line 966 of file VarCheckHiiGen.c.

◆ ParseHiiQuestionNumeric()

VAR_CHECK_HII_QUESTION_HEADER * ParseHiiQuestionNumeric ( IN EFI_IFR_OP_HEADER IfrOpCodeHeader,
IN BOOLEAN  StoredInBitField 
)

Parse Hii Question Numeric.

Parameters
[in]IfrOpCodeHeaderPointer to Ifr OpCode header.
[in]StoredInBitFieldWhether the Numeric is stored in bit field Storage.

return Pointer to Hii Question.

Definition at line 1001 of file VarCheckHiiGen.c.

◆ ParseHiiQuestionOneOf()

VAR_CHECK_HII_QUESTION_HEADER * ParseHiiQuestionOneOf ( IN EFI_IFR_OP_HEADER IfrOpCodeHeader,
IN BOOLEAN  StoredInBitField 
)

Parse Hii Question Oneof.

Parameters
[in]IfrOpCodeHeaderPointer to Ifr OpCode header.
[in]StoredInBitFieldWhether the OneOf is stored in bit field Storage.

return Pointer to Hii Question.

Definition at line 907 of file VarCheckHiiGen.c.

◆ ParseHiiQuestionOrderedList()

VAR_CHECK_HII_QUESTION_HEADER * ParseHiiQuestionOrderedList ( IN EFI_IFR_OP_HEADER IfrOpCodeHeader)

Parse Hii Question OrderedList.

Parameters
[in]IfrOpCodeHeaderPointer to Ifr OpCode header.

return Pointer to Hii Question.

Definition at line 1052 of file VarCheckHiiGen.c.

◆ ParseHiiVariable()

VOID ParseHiiVariable ( IN VOID *  HiiPackage)

Parse and create Hii Variable node list.

Parameters
[in]HiiPackagePointer to Hii Package.

Definition at line 1312 of file VarCheckHiiGen.c.

◆ VarCheckHiiGen()

VOID EFIAPI VarCheckHiiGen ( VOID  )

Generate VarCheckHiiBin from Hii Database and FV.

Definition at line 1617 of file VarCheckHiiGen.c.

◆ VarCheckParseHiiDatabase()

VOID VarCheckParseHiiDatabase ( IN VOID *  HiiDatabase,
IN UINTN  HiiDatabaseSize 
)

Var Check Parse Hii Database.

Parameters
[in]HiiDatabasePointer to Hii Database.
[in]HiiDatabaseSizeHii Database size.

Definition at line 1447 of file VarCheckHiiGen.c.

◆ VarCheckParseHiiPackage()

VOID VarCheckParseHiiPackage ( IN VOID *  HiiPackage,
IN BOOLEAN  FromFv 
)

Var Check Parse Hii Package.

Parameters
[in]HiiPackagePointer to Hii Package.
[in]FromFvHii Package from FV.

Definition at line 1366 of file VarCheckHiiGen.c.

Variable Documentation

◆ mMaxVarNameSize

UINTN mMaxVarNameSize = 0

Definition at line 30 of file VarCheckHiiGen.c.

◆ mVarCheckHiiBin

VAR_CHECK_HII_VARIABLE_HEADER* mVarCheckHiiBin = NULL

Definition at line 12 of file VarCheckHiiGen.c.

◆ mVarCheckHiiBinSize

UINTN mVarCheckHiiBinSize = 0

Definition at line 13 of file VarCheckHiiGen.c.

◆ mVarCheckHiiList

LIST_ENTRY mVarCheckHiiList = INITIALIZE_LIST_HEAD_VARIABLE (mVarCheckHiiList)

Definition at line 14 of file VarCheckHiiGen.c.

◆ mVarName

CHAR16* mVarName = NULL

Definition at line 29 of file VarCheckHiiGen.c.