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

Go to the source code of this file.

Functions

EFI_STATUS FlushPendingRuntimeVariableCacheUpdates (VOID)
 
EFI_STATUS SynchronizeRuntimeVariableCache (IN VARIABLE_RUNTIME_CACHE *VariableRuntimeCache, IN UINTN Offset, IN UINTN Length)
 

Variables

VARIABLE_MODULE_GLOBALmVariableModuleGlobal
 
VARIABLE_STORE_HEADERmNvVariableCache
 

Detailed Description

Functions related to managing the UEFI variable runtime cache. This file should only include functions used by the SMM UEFI variable driver.

Caution: This module requires additional review when modified. This driver will have external input - variable data. They may be input in SMM mode. This external input must be validated carefully to avoid security issue like buffer overflow, integer overflow.

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

Definition in file VariableRuntimeCache.c.

Function Documentation

◆ FlushPendingRuntimeVariableCacheUpdates()

EFI_STATUS FlushPendingRuntimeVariableCacheUpdates ( VOID  )

Copies any pending updates to runtime variable caches.

Return values
EFI_UNSUPPORTEDThe volatile store to be updated is not initialized properly.
EFI_SUCCESSThe volatile store was updated successfully.

Definition at line 29 of file VariableRuntimeCache.c.

◆ SynchronizeRuntimeVariableCache()

EFI_STATUS SynchronizeRuntimeVariableCache ( IN VARIABLE_RUNTIME_CACHE VariableRuntimeCache,
IN UINTN  Offset,
IN UINTN  Length 
)

Synchronizes the runtime variable caches with all pending updates outside runtime.

Ensures all conditions are met to maintain coherency for runtime cache updates. This function will attempt to write the given update (and any other pending updates) if the ReadLock is available. Otherwise, the update is added as a pending update for the given variable store and it will be flushed to the runtime cache at the next opportunity the ReadLock is available.

Parameters
[in]VariableRuntimeCacheVariable runtime cache structure for the runtime cache being synchronized.
[in]OffsetOffset in bytes to apply the update.
[in]LengthLength of data in bytes of the update.
Return values
EFI_SUCCESSThe update was added as a pending update successfully. If the variable runtime cache ReadLock was available, the runtime cache was updated successfully.
EFI_UNSUPPORTEDThe volatile store to be updated is not initialized properly.

Definition at line 114 of file VariableRuntimeCache.c.

Variable Documentation

◆ mNvVariableCache

VARIABLE_STORE_HEADER* mNvVariableCache
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 39 of file Variable.c.

◆ mVariableModuleGlobal

VARIABLE_MODULE_GLOBAL* mVariableModuleGlobal
extern

Definition at line 33 of file Variable.c.