OpenCore
1.0.4
OpenCore Bootloader
|
#include <PiDxe.h>
#include <Protocol/VariableWrite.h>
#include <Protocol/FaultTolerantWrite.h>
#include <Protocol/FirmwareVolumeBlock.h>
#include <Protocol/Variable.h>
#include <Protocol/VariableLock.h>
#include <Protocol/VarCheck.h>
#include <Library/PcdLib.h>
#include <Library/HobLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/DxeServicesTableLib.h>
#include <Library/UefiRuntimeLib.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
#include <Library/BaseLib.h>
#include <Library/SynchronizationLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/AuthVariableLib.h>
#include <Library/VarCheckLib.h>
#include <Guid/GlobalVariable.h>
#include <Guid/EventGroup.h>
#include <Guid/VariableFormat.h>
#include <Guid/SystemNvDataGuid.h>
#include <Guid/FaultTolerantWrite.h>
#include <Guid/VarErrorFlag.h>
#include "PrivilegePolymorphic.h"
Go to the source code of this file.
Data Structures | |
struct | VARIABLE_RUNTIME_CACHE |
struct | VARIABLE_RUNTIME_CACHE_CONTEXT |
struct | VARIABLE_POINTER_TRACK |
struct | VARIABLE_GLOBAL |
struct | VARIABLE_MODULE_GLOBAL |
Macros | |
#define | NV_STORAGE_VARIABLE_BASE |
#define | EFI_VARIABLE_ATTRIBUTES_MASK |
#define | ISO_639_2_ENTRY_SIZE 3 |
Enumerations | |
enum | VARIABLE_STORE_TYPE { VariableStoreTypeVolatile , VariableStoreTypeHob , VariableStoreTypeNv , VariableStoreTypeMax } |
Functions | |
VOID | FlushHobVariableToFlash (IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid) |
EFI_STATUS | FtwVariableSpace (IN EFI_PHYSICAL_ADDRESS VariableBase, IN VARIABLE_STORE_HEADER *VariableBuffer) |
EFI_STATUS | FindVariable (IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, OUT VARIABLE_POINTER_TRACK *PtrTrack, IN VARIABLE_GLOBAL *Global, IN BOOLEAN IgnoreRtCheck) |
BOOLEAN EFIAPI | CheckRemainingSpaceForConsistencyInternal (IN UINT32 Attributes, IN VA_LIST Marker) |
EFI_STATUS | UpdateVariable (IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN VOID *Data, IN UINTN DataSize, IN UINT32 Attributes OPTIONAL, IN UINT32 KeyIndex OPTIONAL, IN UINT64 MonotonicCount OPTIONAL, IN OUT VARIABLE_POINTER_TRACK *Variable, IN EFI_TIME *TimeStamp OPTIONAL) |
BOOLEAN | AtRuntime (VOID) |
EFI_LOCK * | InitializeLock (IN OUT EFI_LOCK *Lock, IN EFI_TPL Priority) |
VOID | AcquireLockOnlyAtBootTime (IN EFI_LOCK *Lock) |
VOID | ReleaseLockOnlyAtBootTime (IN EFI_LOCK *Lock) |
EFI_STATUS | GetFvbByHandle (IN EFI_HANDLE FvBlockHandle, OUT EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL **FvBlock) |
EFI_STATUS | GetFvbCountAndBuffer (OUT UINTN *NumberHandles, OUT EFI_HANDLE **Buffer) |
EFI_STATUS | VariableCommonInitialize (VOID) |
VOID | ReclaimForOS (VOID) |
UINTN | GetMaxVariableSize (VOID) |
EFI_STATUS | VariableWriteServiceInitialize (VOID) |
EFI_STATUS | GetFtwProtocol (OUT VOID **FtwProtocol) |
EFI_STATUS | GetFvbInfoByAddress (IN EFI_PHYSICAL_ADDRESS Address, OUT EFI_HANDLE *FvbHandle OPTIONAL, OUT EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL **FvbProtocol OPTIONAL) |
EFI_STATUS EFIAPI | VariableServiceGetVariable (IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, OUT UINT32 *Attributes OPTIONAL, IN OUT UINTN *DataSize, OUT VOID *Data OPTIONAL) |
EFI_STATUS EFIAPI | VariableServiceGetNextVariableName (IN OUT UINTN *VariableNameSize, IN OUT CHAR16 *VariableName, IN OUT EFI_GUID *VendorGuid) |
EFI_STATUS EFIAPI | VariableServiceSetVariable (IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN UINT32 Attributes, IN UINTN DataSize, IN VOID *Data) |
EFI_STATUS EFIAPI | VariableServiceQueryVariableInfoInternal (IN UINT32 Attributes, OUT UINT64 *MaximumVariableStorageSize, OUT UINT64 *RemainingVariableStorageSize, OUT UINT64 *MaximumVariableSize) |
EFI_STATUS EFIAPI | VariableServiceQueryVariableInfo (IN UINT32 Attributes, OUT UINT64 *MaximumVariableStorageSize, OUT UINT64 *RemainingVariableStorageSize, OUT UINT64 *MaximumVariableSize) |
EFI_STATUS EFIAPI | VariableLockRequestToLock (IN CONST EDKII_VARIABLE_LOCK_PROTOCOL *This, IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid) |
EFI_STATUS EFIAPI | VarCheckRegisterSetVariableCheckHandler (IN VAR_CHECK_SET_VARIABLE_CHECK_HANDLER Handler) |
EFI_STATUS EFIAPI | VarCheckVariablePropertySet (IN CHAR16 *Name, IN EFI_GUID *Guid, IN VAR_CHECK_VARIABLE_PROPERTY *VariableProperty) |
EFI_STATUS EFIAPI | VarCheckVariablePropertyGet (IN CHAR16 *Name, IN EFI_GUID *Guid, OUT VAR_CHECK_VARIABLE_PROPERTY *VariableProperty) |
VOID | InitializeVariableQuota (VOID) |
EFI_STATUS EFIAPI | VariableExLibFindVariable (IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, OUT AUTH_VARIABLE_INFO *AuthVariableInfo) |
EFI_STATUS EFIAPI | VariableExLibFindNextVariable (IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, OUT AUTH_VARIABLE_INFO *AuthVariableInfo) |
EFI_STATUS EFIAPI | VariableExLibUpdateVariable (IN AUTH_VARIABLE_INFO *AuthVariableInfo) |
EFI_STATUS EFIAPI | VariableExLibGetScratchBuffer (IN OUT UINTN *ScratchBufferSize, OUT VOID **ScratchBuffer) |
BOOLEAN EFIAPI | VariableExLibCheckRemainingSpaceForConsistency (IN UINT32 Attributes,...) |
BOOLEAN EFIAPI | VariableExLibAtRuntime (VOID) |
Variables | |
VARIABLE_MODULE_GLOBAL * | mVariableModuleGlobal |
EFI_FIRMWARE_VOLUME_HEADER * | mNvFvHeaderCache |
VARIABLE_STORE_HEADER * | mNvVariableCache |
VARIABLE_INFO_ENTRY * | gVariableInfo |
BOOLEAN | mEndOfDxe |
VAR_CHECK_REQUEST_SOURCE | mRequestSource |
AUTH_VAR_LIB_CONTEXT_OUT | mAuthContextOut |
The internal header file includes the common header files, defines internal structure and functions used by Variable modules.
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file Variable.h.
#define EFI_VARIABLE_ATTRIBUTES_MASK |
Definition at line 48 of file Variable.h.
#define ISO_639_2_ENTRY_SIZE 3 |
The size of a 3 character ISO639 language code.
Definition at line 58 of file Variable.h.
#define NV_STORAGE_VARIABLE_BASE |
Definition at line 43 of file Variable.h.
enum VARIABLE_STORE_TYPE |
Enumerator | |
---|---|
VariableStoreTypeVolatile | |
VariableStoreTypeHob | |
VariableStoreTypeNv | |
VariableStoreTypeMax |
Definition at line 60 of file Variable.h.
VOID AcquireLockOnlyAtBootTime | ( | IN EFI_LOCK * | Lock | ) |
Acquires lock only at boot time. Simply returns at runtime.
This is a temperary function that will be removed when EfiAcquireLock() in UefiLib can handle the call in UEFI Runtimer driver in RT phase. It calls EfiAcquireLock() at boot time, and simply returns at runtime.
Lock | A pointer to the lock to acquire. |
Definition at line 122 of file VariableDxe.c.
BOOLEAN AtRuntime | ( | VOID | ) |
Return TRUE if ExitBootServices () has been called.
TRUE | If ExitBootServices () has been called. |
Definition at line 77 of file VariableDxe.c.
BOOLEAN EFIAPI CheckRemainingSpaceForConsistencyInternal | ( | IN UINT32 | Attributes, |
IN VA_LIST | Marker ) |
This function is to check if the remaining variable space is enough to set all Variables from argument list successfully. The purpose of the check is to keep the consistency of the Variables to be in variable storage.
Note: Variables are assumed to be in same storage. The set sequence of Variables will be same with the sequence of VariableEntry from argument list, so follow the argument sequence to check the Variables.
[in] | Attributes | Variable attributes for Variable entries. |
[in] | Marker | VA_LIST style variable argument list. The variable argument list with type VARIABLE_ENTRY_CONSISTENCY *. A NULL terminates the list. The VariableSize of VARIABLE_ENTRY_CONSISTENCY is the variable data size as input. It will be changed to variable total size as output. |
TRUE | Have enough variable space to set the Variables successfully. |
FALSE | No enough variable space to set the Variables successfully. |
Definition at line 1242 of file Variable.c.
EFI_STATUS FindVariable | ( | IN CHAR16 * | VariableName, |
IN EFI_GUID * | VendorGuid, | ||
OUT VARIABLE_POINTER_TRACK * | PtrTrack, | ||
IN VARIABLE_GLOBAL * | Global, | ||
IN BOOLEAN | IgnoreRtCheck ) |
Finds variable in storage blocks of volatile and non-volatile storage areas.
This code finds variable in storage blocks of volatile and non-volatile storage areas. If VariableName is an empty string, then we just return the first qualified variable without comparing VariableName and VendorGuid. If IgnoreRtCheck is TRUE, then we ignore the EFI_VARIABLE_RUNTIME_ACCESS attribute check at runtime when searching existing variable, only VariableName and VendorGuid are compared. Otherwise, variables without EFI_VARIABLE_RUNTIME_ACCESS are not visible at runtime.
[in] | VariableName | Name of the variable to be found. |
[in] | VendorGuid | Vendor GUID to be found. |
[out] | PtrTrack | VARIABLE_POINTER_TRACK structure for output, including the range searched and the target position. |
[in] | Global | Pointer to VARIABLE_GLOBAL structure, including base of volatile variable storage area, base of NV variable storage area, and a lock. |
[in] | IgnoreRtCheck | Ignore EFI_VARIABLE_RUNTIME_ACCESS attribute check at runtime when searching variable. |
EFI_INVALID_PARAMETER | If VariableName is not an empty string, while VendorGuid is NULL. |
EFI_SUCCESS | Variable successfully found. |
EFI_NOT_FOUND | Variable not found |
Definition at line 853 of file Variable.c.
VOID FlushHobVariableToFlash | ( | IN CHAR16 * | VariableName, |
IN EFI_GUID * | VendorGuid ) |
Flush the HOB variable to flash.
[in] | VariableName | Name of variable has been updated or deleted. |
[in] | VendorGuid | Guid of variable has been updated or deleted. |
Definition at line 3294 of file Variable.c.
EFI_STATUS FtwVariableSpace | ( | IN EFI_PHYSICAL_ADDRESS | VariableBase, |
IN VARIABLE_STORE_HEADER * | VariableBuffer ) |
Writes a buffer to variable storage space, in the working block.
This function writes a buffer to variable storage space into a firmware volume block device. The destination is specified by the parameter VariableBase. Fault Tolerant Write protocol is used for writing.
VariableBase | Base address of the variable to write. |
VariableBuffer | Point to the variable data buffer. |
EFI_SUCCESS | The function completed successfully. |
EFI_NOT_FOUND | Fail to locate Fault Tolerant Write protocol. |
EFI_ABORTED | The function could not complete successfully. |
Writes a buffer to variable storage space, in the working block.
This function writes a buffer to variable storage space into a firmware volume block device. The destination is specified by parameter VariableBase. Fault Tolerant Write protocol is used for writing.
VariableBase | Base address of variable to write |
VariableBuffer | Point to the variable data buffer. |
EFI_SUCCESS | The function completed successfully. |
EFI_NOT_FOUND | Fail to locate Fault Tolerant Write protocol. |
EFI_ABORTED | The function could not complete successfully. |
EFI_STATUS GetFtwProtocol | ( | OUT VOID ** | FtwProtocol | ) |
Retrieve the SMM Fault Tolerent Write protocol interface.
[out] | FtwProtocol | The interface of SMM Ftw protocol |
EFI_SUCCESS | The SMM SAR protocol instance was found and returned in SarProtocol. |
EFI_NOT_FOUND | The SMM SAR protocol instance was not found. |
EFI_INVALID_PARAMETER | SarProtocol is NULL. |
Retrieve the Fault Tolerent Write protocol interface.
[out] | FtwProtocol | The interface of Ftw protocol |
EFI_SUCCESS | The FTW protocol instance was found and returned in FtwProtocol. |
EFI_NOT_FOUND | The FTW protocol instance was not found. |
EFI_INVALID_PARAMETER | SarProtocol is NULL. |
Definition at line 164 of file VariableDxe.c.
EFI_STATUS GetFvbByHandle | ( | IN EFI_HANDLE | FvBlockHandle, |
OUT EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL ** | FvBlock ) |
Retrieve the FVB protocol interface by HANDLE.
[in] | FvBlockHandle | The handle of FVB protocol that provides services for reading, writing, and erasing the target block. |
[out] | FvBlock | The interface of FVB protocol |
EFI_SUCCESS | The interface information for the specified protocol was returned. |
EFI_UNSUPPORTED | The device does not support the FVB protocol. |
EFI_INVALID_PARAMETER | FvBlockHandle is not a valid EFI_HANDLE or FvBlock is NULL. |
Definition at line 194 of file VariableDxe.c.
EFI_STATUS GetFvbCountAndBuffer | ( | OUT UINTN * | NumberHandles, |
OUT EFI_HANDLE ** | Buffer ) |
Function returns an array of handles that support the FVB protocol in a buffer allocated from pool.
[out] | NumberHandles | The number of handles returned in Buffer. |
[out] | Buffer | A pointer to the buffer to return the requested array of handles that support FVB protocol. |
EFI_SUCCESS | The array of handles was returned in Buffer, and the number of handles in Buffer was returned in NumberHandles. |
EFI_NOT_FOUND | No FVB handle was found. |
EFI_OUT_OF_RESOURCES | There is not enough pool memory to store the matching results. |
EFI_INVALID_PARAMETER | NumberHandles is NULL or Buffer is NULL. |
Definition at line 225 of file VariableDxe.c.
EFI_STATUS GetFvbInfoByAddress | ( | IN EFI_PHYSICAL_ADDRESS | Address, |
OUT EFI_HANDLE *FvbHandle | OPTIONAL, | ||
OUT EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL **FvbProtocol | OPTIONAL ) |
Get the proper fvb handle and/or fvb protocol by the given Flash address.
[in] | Address | The Flash address. |
[out] | FvbHandle | In output, if it is not NULL, it points to the proper FVB handle. |
[out] | FvbProtocol | In output, if it is not NULL, it points to the proper FVB protocol. |
Definition at line 3822 of file Variable.c.
UINTN GetMaxVariableSize | ( | VOID | ) |
Get maximum variable size, covering both non-volatile and volatile variables.
Definition at line 3268 of file Variable.c.
EFI_LOCK * InitializeLock | ( | IN OUT EFI_LOCK * | Lock, |
IN EFI_TPL | Priority ) |
Initializes a basic mutual exclusion lock.
This function initializes a basic mutual exclusion lock to the released state and returns the lock. Each lock provides mutual exclusion access at its task priority level. Since there is no preemption or multiprocessor support in EFI, acquiring the lock only consists of raising to the locks TPL. If Lock is NULL, then ASSERT(). If Priority is not a valid TPL value, then ASSERT().
Lock | A pointer to the lock data structure to initialize. |
Priority | EFI TPL is associated with the lock. |
Definition at line 101 of file VariableDxe.c.
VOID InitializeVariableQuota | ( | VOID | ) |
Initialize variable quota.
Definition at line 490 of file Variable.c.
VOID ReclaimForOS | ( | VOID | ) |
This function reclaims variable storage if free size is below the threshold.
This function reclaims variable storage if free size is below the threshold.
Caution: This function may be invoked at SMM mode. Care must be taken to make sure not security issue.
Definition at line 3213 of file Variable.c.
VOID ReleaseLockOnlyAtBootTime | ( | IN EFI_LOCK * | Lock | ) |
Releases lock only at boot time. Simply returns at runtime.
This is a temperary function which will be removed when EfiReleaseLock() in UefiLib can handle the call in UEFI Runtimer driver in RT phase. It calls EfiReleaseLock() at boot time and simply returns at runtime.
Lock | A pointer to the lock to release. |
Definition at line 144 of file VariableDxe.c.
EFI_STATUS UpdateVariable | ( | IN CHAR16 * | VariableName, |
IN EFI_GUID * | VendorGuid, | ||
IN VOID * | Data, | ||
IN UINTN | DataSize, | ||
IN UINT32 Attributes | OPTIONAL, | ||
IN UINT32 KeyIndex | OPTIONAL, | ||
IN UINT64 MonotonicCount | OPTIONAL, | ||
IN OUT VARIABLE_POINTER_TRACK * | CacheVariable, | ||
IN EFI_TIME *TimeStamp | OPTIONAL ) |
Update the variable region with Variable information. If EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is set, index of associated public key is needed.
[in] | VariableName | Name of variable. |
[in] | VendorGuid | Guid of variable. |
[in] | Data | Variable data. |
[in] | DataSize | Size of data. 0 means delete. |
[in] | Attributes | Attributes of the variable. |
[in] | KeyIndex | Index of associated public key. |
[in] | MonotonicCount | Value of associated monotonic count. |
[in,out] | Variable | The variable information that is used to keep track of variable usage. |
[in] | TimeStamp | Value of associated TimeStamp. |
EFI_SUCCESS | The update operation is success. |
EFI_OUT_OF_RESOURCES | Variable region is full, cannot write other data into this region. |
Update the variable region with Variable information. If EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is set, index of associated public key is needed.
[in] | VariableName | Name of variable. |
[in] | VendorGuid | Guid of variable. |
[in] | Data | Variable data. |
[in] | DataSize | Size of data. 0 means delete. |
[in] | Attributes | Attributes of the variable. |
[in] | KeyIndex | Index of associated public key. |
[in] | MonotonicCount | Value of associated monotonic count. |
[in,out] | CacheVariable | The variable information which is used to keep track of variable usage. |
[in] | TimeStamp | Value of associated TimeStamp. |
EFI_SUCCESS | The update operation is success. |
EFI_OUT_OF_RESOURCES | Variable region is full, can not write other data into this region. |
Definition at line 1680 of file Variable.c.
EFI_STATUS EFIAPI VarCheckRegisterSetVariableCheckHandler | ( | IN VAR_CHECK_SET_VARIABLE_CHECK_HANDLER | Handler | ) |
Register SetVariable check handler.
[in] | Handler | Pointer to check handler. |
EFI_SUCCESS | The SetVariable check handler was registered successfully. |
EFI_INVALID_PARAMETER | Handler is NULL. |
EFI_ACCESS_DENIED | EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has already been signaled. |
EFI_OUT_OF_RESOURCES | There is not enough resource for the SetVariable check handler register request. |
EFI_UNSUPPORTED | This interface is not implemented. For example, it is unsupported in VarCheck protocol if both VarCheck and SmmVarCheck protocols are present. |
Definition at line 29 of file VarCheck.c.
EFI_STATUS EFIAPI VarCheckVariablePropertyGet | ( | IN CHAR16 * | Name, |
IN EFI_GUID * | Guid, | ||
OUT VAR_CHECK_VARIABLE_PROPERTY * | VariableProperty ) |
Variable property get.
[in] | Name | Pointer to the variable name. |
[in] | Guid | Pointer to the vendor GUID. |
[out] | VariableProperty | Pointer to the output variable property. |
EFI_SUCCESS | The property of variable specified by the Name and Guid was got successfully. |
EFI_INVALID_PARAMETER | Name, Guid or VariableProperty is NULL, or Name is an empty string. |
EFI_NOT_FOUND | The property of variable specified by the Name and Guid was not found. |
Definition at line 88 of file VarCheck.c.
EFI_STATUS EFIAPI VarCheckVariablePropertySet | ( | IN CHAR16 * | Name, |
IN EFI_GUID * | Guid, | ||
IN VAR_CHECK_VARIABLE_PROPERTY * | VariableProperty ) |
Variable property set.
[in] | Name | Pointer to the variable name. |
[in] | Guid | Pointer to the vendor GUID. |
[in] | VariableProperty | Pointer to the input variable property. |
EFI_SUCCESS | The property of variable specified by the Name and Guid was set successfully. |
EFI_INVALID_PARAMETER | Name, Guid or VariableProperty is NULL, or Name is an empty string, or the fields of VariableProperty are not valid. |
EFI_ACCESS_DENIED | EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has already been signaled. |
EFI_OUT_OF_RESOURCES | There is not enough resource for the variable property set request. |
Definition at line 59 of file VarCheck.c.
EFI_STATUS VariableCommonInitialize | ( | VOID | ) |
Initializes variable store area for non-volatile and volatile variable.
EFI_SUCCESS | Function successfully executed. |
EFI_OUT_OF_RESOURCES | Fail to allocate enough memory resource. |
Definition at line 3714 of file Variable.c.
BOOLEAN EFIAPI VariableExLibAtRuntime | ( | VOID | ) |
Return TRUE if at OS runtime.
TRUE | If at OS runtime. |
FALSE | If at boot time. |
Definition at line 253 of file VariableExLib.c.
BOOLEAN EFIAPI VariableExLibCheckRemainingSpaceForConsistency | ( | IN UINT32 | Attributes, |
... ) |
This function is to check if the remaining variable space is enough to set all Variables from argument list successfully. The purpose of the check is to keep the consistency of the Variables to be in variable storage.
Note: Variables are assumed to be in same storage. The set sequence of Variables will be same with the sequence of VariableEntry from argument list, so follow the argument sequence to check the Variables.
[in] | Attributes | Variable attributes for Variable entries. |
... | The variable argument list with type VARIABLE_ENTRY_CONSISTENCY *. A NULL terminates the list. The VariableSize of VARIABLE_ENTRY_CONSISTENCY is the variable data size as input. It will be changed to variable total size as output. |
TRUE | Have enough variable space to set the Variables successfully. |
FALSE | No enough variable space to set the Variables successfully. |
Definition at line 227 of file VariableExLib.c.
EFI_STATUS EFIAPI VariableExLibFindNextVariable | ( | IN CHAR16 * | VariableName, |
IN EFI_GUID * | VendorGuid, | ||
OUT AUTH_VARIABLE_INFO * | AuthVariableInfo ) |
Finds next variable in storage blocks of volatile and non-volatile storage areas.
This code finds next variable in storage blocks of volatile and non-volatile storage areas. If VariableName is an empty string, then we just return the first qualified variable without comparing VariableName and VendorGuid.
[in] | VariableName | Name of the variable to be found. |
[in] | VendorGuid | Variable vendor GUID to be found. |
[out] | AuthVariableInfo | Pointer to AUTH_VARIABLE_INFO structure for output of the next variable. |
EFI_INVALID_PARAMETER | If VariableName is not an empty string, while VendorGuid is NULL. |
EFI_SUCCESS | Variable successfully found. |
EFI_NOT_FOUND | Variable not found |
Definition at line 92 of file VariableExLib.c.
EFI_STATUS EFIAPI VariableExLibFindVariable | ( | IN CHAR16 * | VariableName, |
IN EFI_GUID * | VendorGuid, | ||
OUT AUTH_VARIABLE_INFO * | AuthVariableInfo ) |
Finds variable in storage blocks of volatile and non-volatile storage areas.
This code finds variable in storage blocks of volatile and non-volatile storage areas. If VariableName is an empty string, then we just return the first qualified variable without comparing VariableName and VendorGuid.
[in] | VariableName | Name of the variable to be found. |
[in] | VendorGuid | Variable vendor GUID to be found. |
[out] | AuthVariableInfo | Pointer to AUTH_VARIABLE_INFO structure for output of the variable found. |
EFI_INVALID_PARAMETER | If VariableName is not an empty string, while VendorGuid is NULL. |
EFI_SUCCESS | Variable successfully found. |
EFI_NOT_FOUND | Variable not found |
Definition at line 32 of file VariableExLib.c.
EFI_STATUS EFIAPI VariableExLibGetScratchBuffer | ( | IN OUT UINTN * | ScratchBufferSize, |
OUT VOID ** | ScratchBuffer ) |
Get scratch buffer.
[in,out] | ScratchBufferSize | Scratch buffer size. If input size is greater than the maximum supported buffer size, this value contains the maximum supported buffer size as output. |
[out] | ScratchBuffer | Pointer to scratch buffer address. |
EFI_SUCCESS | Get scratch buffer successfully. |
EFI_UNSUPPORTED | If input size is greater than the maximum supported buffer size. |
Definition at line 189 of file VariableExLib.c.
EFI_STATUS EFIAPI VariableExLibUpdateVariable | ( | IN AUTH_VARIABLE_INFO * | AuthVariableInfo | ) |
Update the variable region with Variable information.
[in] | AuthVariableInfo | Pointer AUTH_VARIABLE_INFO structure for input of the variable. |
EFI_SUCCESS | The update operation is success. |
EFI_INVALID_PARAMETER | Invalid parameter. |
EFI_WRITE_PROTECTED | Variable is write-protected. |
EFI_OUT_OF_RESOURCES | There is not enough resource. |
Definition at line 155 of file VariableExLib.c.
EFI_STATUS EFIAPI VariableLockRequestToLock | ( | IN CONST EDKII_VARIABLE_LOCK_PROTOCOL * | This, |
IN CHAR16 * | VariableName, | ||
IN EFI_GUID * | VendorGuid ) |
Mark a variable that will become read-only after leaving the DXE phase of execution.
[in] | This | The VARIABLE_LOCK_PROTOCOL instance. |
[in] | VariableName | A pointer to the variable name that will be made read-only subsequently. |
[in] | VendorGuid | A pointer to the vendor GUID that will be made read-only subsequently. |
EFI_SUCCESS | The variable specified by the VariableName and the VendorGuid was marked as pending to be read-only. |
EFI_INVALID_PARAMETER | VariableName or VendorGuid is NULL. Or VariableName is an empty string. |
EFI_ACCESS_DENIED | EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has already been signaled. |
EFI_OUT_OF_RESOURCES | There is not enough resource to hold the lock request. |
DEPRECATED. THIS IS ONLY HERE AS A CONVENIENCE WHILE PORTING. Mark a variable that will become read-only after leaving the DXE phase of execution. Write request coming from SMM environment through EFI_SMM_VARIABLE_PROTOCOL is allowed.
[in] | This | The VARIABLE_LOCK_PROTOCOL instance. |
[in] | VariableName | A pointer to the variable name that will be made read-only subsequently. |
[in] | VendorGuid | A pointer to the vendor GUID that will be made read-only subsequently. |
EFI_SUCCESS | The variable specified by the VariableName and the VendorGuid was marked as pending to be read-only. |
EFI_INVALID_PARAMETER | VariableName or VendorGuid is NULL. Or VariableName is an empty string. |
EFI_ACCESS_DENIED | EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has already been signaled. |
EFI_OUT_OF_RESOURCES | There is not enough resource to hold the lock request. |
Definition at line 42 of file VariableLockRequestToLock.c.
EFI_STATUS EFIAPI VariableServiceGetNextVariableName | ( | IN OUT UINTN * | VariableNameSize, |
IN OUT CHAR16 * | VariableName, | ||
IN OUT EFI_GUID * | VendorGuid ) |
This code Finds the Next available variable.
Caution: This function may receive untrusted input. This function may be invoked in SMM mode. This function will do basic validation, before parse the data.
VariableNameSize | The size of the VariableName buffer. The size must be large enough to fit input string supplied in VariableName buffer. |
VariableName | Pointer to variable name. |
VendorGuid | Variable Vendor Guid. |
EFI_SUCCESS | The function completed successfully. |
EFI_NOT_FOUND | The next variable was not found. |
EFI_BUFFER_TOO_SMALL | The VariableNameSize is too small for the result. VariableNameSize has been updated with the size needed to complete the request. |
EFI_INVALID_PARAMETER | VariableNameSize is NULL. |
EFI_INVALID_PARAMETER | VariableName is NULL. |
EFI_INVALID_PARAMETER | VendorGuid is NULL. |
EFI_INVALID_PARAMETER | The input values of VariableName and VendorGuid are not a name and GUID of an existing variable. |
EFI_INVALID_PARAMETER | Null-terminator is not found in the first VariableNameSize bytes of the input VariableName buffer. |
Definition at line 2525 of file Variable.c.
EFI_STATUS EFIAPI VariableServiceGetVariable | ( | IN CHAR16 * | VariableName, |
IN EFI_GUID * | VendorGuid, | ||
OUT UINT32 *Attributes | OPTIONAL, | ||
IN OUT UINTN * | DataSize, | ||
OUT VOID *Data | OPTIONAL ) |
This code finds variable in storage blocks (Volatile or Non-Volatile).
Caution: This function may receive untrusted input. This function may be invoked in SMM mode, and datasize and data are external input. This function will do basic validation, before parse the data.
VariableName | Name of Variable to be found. |
VendorGuid | Variable vendor GUID. |
Attributes | Attribute value of the variable found. |
DataSize | Size of Data found. If size is less than the data, this value contains the required size. |
Data | The buffer to return the contents of the variable. May be NULL with a zero DataSize in order to determine the size buffer needed. |
This code finds variable in storage blocks (Volatile or Non-Volatile).
Caution: This function may receive untrusted input. This function may be invoked in SMM mode, and datasize is external input. This function will do basic validation, before parse the data.
VariableName | Name of Variable to be found. |
VendorGuid | Variable vendor GUID. |
Attributes | Attribute value of the variable found. |
DataSize | Size of Data found. If size is less than the data, this value contains the required size. |
Data | The buffer to return the contents of the variable. May be NULL with a zero DataSize in order to determine the size buffer needed. |
Definition at line 2435 of file Variable.c.
EFI_STATUS EFIAPI VariableServiceQueryVariableInfo | ( | IN UINT32 | Attributes, |
OUT UINT64 * | MaximumVariableStorageSize, | ||
OUT UINT64 * | RemainingVariableStorageSize, | ||
OUT UINT64 * | MaximumVariableSize ) |
This code returns information about the EFI variables.
Caution: This function may receive untrusted input. This function may be invoked in SMM mode. This function will do basic validation, before parse the data.
Attributes | Attributes bitmask to specify the type of variables on which to return information. |
MaximumVariableStorageSize | Pointer to the maximum size of the storage space available for the EFI variables associated with the attributes specified. |
RemainingVariableStorageSize | Pointer to the remaining size of the storage space available for EFI variables associated with the attributes specified. |
MaximumVariableSize | Pointer to the maximum size of an individual EFI variables associated with the attributes specified. |
Definition at line 3131 of file Variable.c.
EFI_STATUS EFIAPI VariableServiceQueryVariableInfoInternal | ( | IN UINT32 | Attributes, |
OUT UINT64 * | MaximumVariableStorageSize, | ||
OUT UINT64 * | RemainingVariableStorageSize, | ||
OUT UINT64 * | MaximumVariableSize ) |
This code returns information about the EFI variables.
Caution: This function may receive untrusted input. This function may be invoked in SMM mode. This function will do basic validation, before parse the data.
Attributes | Attributes bitmask to specify the type of variables on which to return information. |
MaximumVariableStorageSize | Pointer to the maximum size of the storage space available for the EFI variables associated with the attributes specified. |
RemainingVariableStorageSize | Pointer to the remaining size of the storage space available for EFI variables associated with the attributes specified. |
MaximumVariableSize | Pointer to the maximum size of an individual EFI variables associated with the attributes specified. |
Definition at line 2951 of file Variable.c.
EFI_STATUS EFIAPI VariableServiceSetVariable | ( | IN CHAR16 * | VariableName, |
IN EFI_GUID * | VendorGuid, | ||
IN UINT32 | Attributes, | ||
IN UINTN | DataSize, | ||
IN VOID * | Data ) |
This code sets variable in storage blocks (Volatile or Non-Volatile).
Caution: This function may receive untrusted input. This function may be invoked in SMM mode, and datasize and data are external input. This function will do basic validation, before parse the data. This function will parse the authentication carefully to avoid security issues, like buffer overflow, integer overflow. This function will check attribute carefully to avoid authentication bypass.
VariableName | Name of Variable to be found. |
VendorGuid | Variable vendor GUID. |
Attributes | Attribute value of the variable found |
DataSize | Size of Data found. If size is less than the data, this value contains the required size. |
Data | Data pointer. |
Definition at line 2627 of file Variable.c.
EFI_STATUS VariableWriteServiceInitialize | ( | VOID | ) |
Initializes variable write service.
EFI_SUCCESS | Function successfully executed. |
Others | Fail to initialize the variable service. |
Definition at line 3426 of file Variable.c.
|
extern |
The memory entry used for variable statistics data.
Definition at line 51 of file Variable.c.
|
extern |
Definition at line 101 of file Variable.c.
|
extern |
The flag to indicate whether the platform has left the DXE phase of execution.
Definition at line 56 of file Variable.c.
|
extern |
Memory cache of Fv Header.
Definition at line 46 of file Variable.c.
|
extern |
Define a memory cache that improves the search performance for a variable. For EmuNvMode == TRUE, it will be equal to NonVolatileVariableBase.
Definition at line 41 of file Variable.c.
|
extern |
It indicates the var check request source. In the implementation, DXE is regarded as untrusted, and SMM is trusted.
Definition at line 62 of file Variable.c.
|
extern |
Definition at line 35 of file Variable.c.