TianoCore EDK2 master
Loading...
Searching...
No Matches
VarCheckLib.c File Reference

Go to the source code of this file.

Data Structures

struct  VAR_CHECK_VARIABLE_ENTRY
 

Macros

#define VAR_CHECK_TABLE_SIZE   0x8
 

Functions

BOOLEAN EFIAPI VarCheckInternalIsHexaDecimalDigitCharacter (IN CHAR16 Char)
 
VAR_CHECK_VARIABLE_PROPERTYVariablePropertyGetWithWildcardName (IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN BOOLEAN WildcardMatch)
 
VAR_CHECK_VARIABLE_PROPERTYVariablePropertyGetFunction (IN CHAR16 *Name, IN EFI_GUID *Guid, IN BOOLEAN WildcardMatch)
 
EFI_STATUS VarCheckAddTableEntry (IN OUT UINTN **Table, IN OUT UINTN *MaxNumber, IN OUT UINTN *CurrentNumber, IN UINTN Entry)
 
EFI_STATUS EFIAPI VarCheckLibRegisterEndOfDxeCallback (IN VAR_CHECK_END_OF_DXE_CALLBACK Callback)
 
VOID ***EFIAPI VarCheckLibInitializeAtEndOfDxe (IN OUT UINTN *AddressPointerCount OPTIONAL)
 
EFI_STATUS EFIAPI VarCheckLibRegisterAddressPointer (IN VOID **AddressPointer)
 
EFI_STATUS EFIAPI VarCheckLibRegisterSetVariableCheckHandler (IN VAR_CHECK_SET_VARIABLE_CHECK_HANDLER Handler)
 
EFI_STATUS EFIAPI VarCheckLibVariablePropertySet (IN CHAR16 *Name, IN EFI_GUID *Guid, IN VAR_CHECK_VARIABLE_PROPERTY *VariableProperty)
 
EFI_STATUS EFIAPI VarCheckLibVariablePropertyGet (IN CHAR16 *Name, IN EFI_GUID *Guid, OUT VAR_CHECK_VARIABLE_PROPERTY *VariableProperty)
 
EFI_STATUS EFIAPI VarCheckLibSetVariableCheck (IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN UINT32 Attributes, IN UINTN DataSize, IN VOID *Data, IN VAR_CHECK_REQUEST_SOURCE RequestSource)
 

Variables

BOOLEAN mVarCheckLibEndOfDxe = FALSE
 
UINTN mVarCheckLibEndOfDxeCallbackCount = 0
 
UINTN mVarCheckLibEndOfDxeCallbackMaxCount = 0
 
VAR_CHECK_END_OF_DXE_CALLBACK * mVarCheckLibEndOfDxeCallback = NULL
 
UINTN mVarCheckLibAddressPointerCount = 0
 
UINTN mVarCheckLibAddressPointerMaxCount = 0
 
VOID *** mVarCheckLibAddressPointer = NULL
 
UINTN mNumberOfVarCheckHandler = 0
 
UINTN mMaxNumberOfVarCheckHandler = 0
 
VAR_CHECK_SET_VARIABLE_CHECK_HANDLER * mVarCheckHandlerTable = NULL
 
UINTN mNumberOfVarCheckVariable = 0
 
UINTN mMaxNumberOfVarCheckVariable = 0
 
VARIABLE_ENTRY_PROPERTY ** mVarCheckVariableTable = NULL
 
VARIABLE_ENTRY_PROPERTY mVarCheckVariableWithWildcardName []
 

Detailed Description

Implementation functions and structures for var check services.

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

Definition in file VarCheckLib.c.

Macro Definition Documentation

◆ VAR_CHECK_TABLE_SIZE

#define VAR_CHECK_TABLE_SIZE   0x8

Definition at line 20 of file VarCheckLib.c.

Function Documentation

◆ VarCheckAddTableEntry()

EFI_STATUS VarCheckAddTableEntry ( IN OUT UINTN **  Table,
IN OUT UINTN MaxNumber,
IN OUT UINTN CurrentNumber,
IN UINTN  Entry 
)

Var check add table entry.

Parameters
[in,out]TablePointer to table buffer.
[in,out]MaxNumberPointer to maximum number of entry in the table.
[in,out]CurrentNumberPointer to current number of entry in the table.
[in]EntryEntry will be added to the table.
Return values
EFI_SUCCESSReallocate memory successfully.
EFI_OUT_OF_RESOURCESNo enough memory to allocate.

Definition at line 204 of file VarCheckLib.c.

◆ VarCheckInternalIsHexaDecimalDigitCharacter()

BOOLEAN EFIAPI VarCheckInternalIsHexaDecimalDigitCharacter ( IN CHAR16  Char)

Check if a Unicode character is an upper case hexadecimal character.

This function checks if a Unicode character is an upper case hexadecimal character. The valid upper case hexadecimal character is L'0' to L'9', or L'A' to L'F'.

Parameters
[in]CharThe character to check against.
Return values
TRUEIf the Char is an upper case hexadecmial character.
FALSEIf the Char is not an upper case hexadecmial character.

Definition at line 108 of file VarCheckLib.c.

◆ VarCheckLibInitializeAtEndOfDxe()

VOID ***EFIAPI VarCheckLibInitializeAtEndOfDxe ( IN OUT UINTN *AddressPointerCount  OPTIONAL)

Var check initialize at END_OF_DXE.

This function needs to be called at END_OF_DXE. Address pointers may be returned, and caller needs to ConvertPointer() for the pointers.

Parameters
[in,out]AddressPointerCountOutput pointer to address pointer count.
Returns
Address pointer buffer, NULL if input AddressPointerCount is NULL.

Definition at line 304 of file VarCheckLib.c.

◆ VarCheckLibRegisterAddressPointer()

EFI_STATUS EFIAPI VarCheckLibRegisterAddressPointer ( IN VOID **  AddressPointer)

Register address pointer. The AddressPointer may be returned by VarCheckLibInitializeAtEndOfDxe().

Parameters
[in]AddressPointerAddress pointer.
Return values
EFI_SUCCESSThe address pointer was registered successfully.
EFI_INVALID_PARAMETERAddressPointer is NULL.
EFI_ACCESS_DENIEDEFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has already been signaled.
EFI_OUT_OF_RESOURCESThere is not enough resource for the address pointer register request.

Definition at line 398 of file VarCheckLib.c.

◆ VarCheckLibRegisterEndOfDxeCallback()

EFI_STATUS EFIAPI VarCheckLibRegisterEndOfDxeCallback ( IN VAR_CHECK_END_OF_DXE_CALLBACK  Callback)

Register END_OF_DXE callback. The callback will be invoked by VarCheckLibInitializeAtEndOfDxe().

Parameters
[in]CallbackEND_OF_DXE callback.
Return values
EFI_SUCCESSThe callback was registered successfully.
EFI_INVALID_PARAMETERCallback is NULL.
EFI_ACCESS_DENIEDEFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has already been signaled.
EFI_OUT_OF_RESOURCESThere is not enough resource for the callback register request.

Definition at line 264 of file VarCheckLib.c.

◆ VarCheckLibRegisterSetVariableCheckHandler()

EFI_STATUS EFIAPI VarCheckLibRegisterSetVariableCheckHandler ( IN VAR_CHECK_SET_VARIABLE_CHECK_HANDLER  Handler)

Register SetVariable check handler.

Parameters
[in]HandlerPointer to check handler.
Return values
EFI_SUCCESSThe SetVariable check handler was registered successfully.
EFI_INVALID_PARAMETERHandler is NULL.
EFI_ACCESS_DENIEDEFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has already been signaled.
EFI_OUT_OF_RESOURCESThere is not enough resource for the SetVariable check handler register request.
EFI_UNSUPPORTEDThis interface is not implemented. For example, it is unsupported in VarCheck protocol if both VarCheck and SmmVarCheck protocols are present.

Definition at line 440 of file VarCheckLib.c.

◆ VarCheckLibSetVariableCheck()

EFI_STATUS EFIAPI VarCheckLibSetVariableCheck ( IN CHAR16 *  VariableName,
IN EFI_GUID VendorGuid,
IN UINT32  Attributes,
IN UINTN  DataSize,
IN VOID *  Data,
IN VAR_CHECK_REQUEST_SOURCE  RequestSource 
)

SetVariable check.

Parameters
[in]VariableNameName of Variable to set.
[in]VendorGuidVariable vendor GUID.
[in]AttributesAttribute value of the variable.
[in]DataSizeSize of Data to set.
[in]DataData pointer.
[in]RequestSourceRequest source.
Return values
EFI_SUCCESSThe SetVariable check result was success.
EFI_INVALID_PARAMETERAn invalid combination of attribute bits, name, GUID, DataSize and Data value was supplied.
EFI_WRITE_PROTECTEDThe variable in question is read-only.
OthersThe other return status from check handler.

Definition at line 607 of file VarCheckLib.c.

◆ VarCheckLibVariablePropertyGet()

EFI_STATUS EFIAPI VarCheckLibVariablePropertyGet ( IN CHAR16 *  Name,
IN EFI_GUID Guid,
OUT VAR_CHECK_VARIABLE_PROPERTY VariableProperty 
)

Variable property get.

Parameters
[in]NamePointer to the variable name.
[in]GuidPointer to the vendor GUID.
[out]VariablePropertyPointer to the output variable property.
Return values
EFI_SUCCESSThe property of variable specified by the Name and Guid was got successfully.
EFI_INVALID_PARAMETERName, Guid or VariableProperty is NULL, or Name is an empty string.
EFI_NOT_FOUNDThe property of variable specified by the Name and Guid was not found.

Definition at line 558 of file VarCheckLib.c.

◆ VarCheckLibVariablePropertySet()

EFI_STATUS EFIAPI VarCheckLibVariablePropertySet ( IN CHAR16 *  Name,
IN EFI_GUID Guid,
IN VAR_CHECK_VARIABLE_PROPERTY VariableProperty 
)

Variable property set.

Parameters
[in]NamePointer to the variable name.
[in]GuidPointer to the vendor GUID.
[in]VariablePropertyPointer to the input variable property.
Return values
EFI_SUCCESSThe property of variable specified by the Name and Guid was set successfully.
EFI_INVALID_PARAMETERName, Guid or VariableProperty is NULL, or Name is an empty string, or the fields of VariableProperty are not valid.
EFI_ACCESS_DENIEDEFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has already been signaled.
EFI_OUT_OF_RESOURCESThere is not enough resource for the variable property set request.

Definition at line 483 of file VarCheckLib.c.

◆ VariablePropertyGetFunction()

VAR_CHECK_VARIABLE_PROPERTY * VariablePropertyGetFunction ( IN CHAR16 *  Name,
IN EFI_GUID Guid,
IN BOOLEAN  WildcardMatch 
)

Variable property get function.

Parameters
[in]NamePointer to the variable name.
[in]GuidPointer to the vendor GUID.
[in]WildcardMatchTry wildcard match or not.
Returns
Pointer to the property of variable specified by the Name and Guid.

Definition at line 170 of file VarCheckLib.c.

◆ VariablePropertyGetWithWildcardName()

VAR_CHECK_VARIABLE_PROPERTY * VariablePropertyGetWithWildcardName ( IN CHAR16 *  VariableName,
IN EFI_GUID VendorGuid,
IN BOOLEAN  WildcardMatch 
)

Variable property get with wildcard name.

Parameters
[in]VariableNamePointer to variable name.
[in]VendorGuidPointer to variable vendor GUID.
[in]WildcardMatchTry wildcard match or not.
Returns
Pointer to variable property.

Definition at line 126 of file VarCheckLib.c.

Variable Documentation

◆ mMaxNumberOfVarCheckHandler

UINTN mMaxNumberOfVarCheckHandler = 0

Definition at line 31 of file VarCheckLib.c.

◆ mMaxNumberOfVarCheckVariable

UINTN mMaxNumberOfVarCheckVariable = 0

Definition at line 41 of file VarCheckLib.c.

◆ mNumberOfVarCheckHandler

UINTN mNumberOfVarCheckHandler = 0

Definition at line 30 of file VarCheckLib.c.

◆ mNumberOfVarCheckVariable

UINTN mNumberOfVarCheckVariable = 0

Definition at line 40 of file VarCheckLib.c.

◆ mVarCheckHandlerTable

VAR_CHECK_SET_VARIABLE_CHECK_HANDLER* mVarCheckHandlerTable = NULL

Definition at line 32 of file VarCheckLib.c.

◆ mVarCheckLibAddressPointer

VOID*** mVarCheckLibAddressPointer = NULL

Definition at line 28 of file VarCheckLib.c.

◆ mVarCheckLibAddressPointerCount

UINTN mVarCheckLibAddressPointerCount = 0

Definition at line 26 of file VarCheckLib.c.

◆ mVarCheckLibAddressPointerMaxCount

UINTN mVarCheckLibAddressPointerMaxCount = 0

Definition at line 27 of file VarCheckLib.c.

◆ mVarCheckLibEndOfDxe

BOOLEAN mVarCheckLibEndOfDxe = FALSE

Definition at line 18 of file VarCheckLib.c.

◆ mVarCheckLibEndOfDxeCallback

VAR_CHECK_END_OF_DXE_CALLBACK* mVarCheckLibEndOfDxeCallback = NULL

Definition at line 24 of file VarCheckLib.c.

◆ mVarCheckLibEndOfDxeCallbackCount

UINTN mVarCheckLibEndOfDxeCallbackCount = 0

Definition at line 22 of file VarCheckLib.c.

◆ mVarCheckLibEndOfDxeCallbackMaxCount

UINTN mVarCheckLibEndOfDxeCallbackMaxCount = 0

Definition at line 23 of file VarCheckLib.c.

◆ mVarCheckVariableTable

VARIABLE_ENTRY_PROPERTY** mVarCheckVariableTable = NULL

Definition at line 42 of file VarCheckLib.c.

◆ mVarCheckVariableWithWildcardName

VARIABLE_ENTRY_PROPERTY mVarCheckVariableWithWildcardName[]

Definition at line 47 of file VarCheckLib.c.