mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-27 15:44:04 +02:00
MdeModulePkg Variable: Remove CacheOffset in UpdateVariable()
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1323 Merge EmuVariable and Real variable driver. CacheOffset could be removed in UpdateVariable() after // // update the memory copy of Flash region. // CopyMem ( (UINT8 *)mNvVariableCache + CacheOffset, (UINT8 *)NextVariable, VarSize ); is moved to be before mVariableModuleGlobal->NonVolatileLastVariableOffset value is updated, like right before mVariableModuleGlobal->NonVolatileLastVariableOffset += HEADER_ALIGN (VarSize); Except for the movement above, the patch also capitalizes the first character of "update the memory copy of Flash region". This patch prepares for adding emulated variable NV mode support in VariableRuntimeDxe. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Julien Grall <julien.grall@arm.com> Acked-by: Julien Grall <julien.grall@arm.com>
This commit is contained in:
parent
b59fd889ac
commit
ebe34c96f4
@ -2139,7 +2139,6 @@ UpdateVariable (
|
|||||||
VARIABLE_POINTER_TRACK *Variable;
|
VARIABLE_POINTER_TRACK *Variable;
|
||||||
VARIABLE_POINTER_TRACK NvVariable;
|
VARIABLE_POINTER_TRACK NvVariable;
|
||||||
VARIABLE_STORE_HEADER *VariableStoreHeader;
|
VARIABLE_STORE_HEADER *VariableStoreHeader;
|
||||||
UINTN CacheOffset;
|
|
||||||
UINT8 *BufferForMerge;
|
UINT8 *BufferForMerge;
|
||||||
UINTN MergedBufSize;
|
UINTN MergedBufSize;
|
||||||
BOOLEAN DataReady;
|
BOOLEAN DataReady;
|
||||||
@ -2577,7 +2576,6 @@ UpdateVariable (
|
|||||||
//
|
//
|
||||||
// Step 1:
|
// Step 1:
|
||||||
//
|
//
|
||||||
CacheOffset = mVariableModuleGlobal->NonVolatileLastVariableOffset;
|
|
||||||
Status = UpdateVariableStore (
|
Status = UpdateVariableStore (
|
||||||
&mVariableModuleGlobal->VariableGlobal,
|
&mVariableModuleGlobal->VariableGlobal,
|
||||||
FALSE,
|
FALSE,
|
||||||
@ -2643,6 +2641,11 @@ UpdateVariable (
|
|||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Update the memory copy of Flash region.
|
||||||
|
//
|
||||||
|
CopyMem ((UINT8 *)mNvVariableCache + mVariableModuleGlobal->NonVolatileLastVariableOffset, (UINT8 *)NextVariable, VarSize);
|
||||||
|
|
||||||
mVariableModuleGlobal->NonVolatileLastVariableOffset += HEADER_ALIGN (VarSize);
|
mVariableModuleGlobal->NonVolatileLastVariableOffset += HEADER_ALIGN (VarSize);
|
||||||
|
|
||||||
if ((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) != 0) {
|
if ((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) != 0) {
|
||||||
@ -2653,10 +2656,6 @@ UpdateVariable (
|
|||||||
mVariableModuleGlobal->CommonUserVariableTotalSize += HEADER_ALIGN (VarSize);
|
mVariableModuleGlobal->CommonUserVariableTotalSize += HEADER_ALIGN (VarSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// update the memory copy of Flash region.
|
|
||||||
//
|
|
||||||
CopyMem ((UINT8 *)mNvVariableCache + CacheOffset, (UINT8 *)NextVariable, VarSize);
|
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// Create a volatile variable.
|
// Create a volatile variable.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user