MdeModulePkg Variable: Not get NV PCD in VariableWriteServiceInitialize
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1323 Merge EmuVariable and Real variable driver. Add macro NV_STORAGE_VARIABLE_BASE. Not get NV PCD in VariableWriteServiceInitialize, but in FtwNotificationEvent/SmmFtwNotificationEvent, then VariableWriteServiceInitialize could be not aware the NV storage is real or emulated. 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> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Tested-by: Julien Grall <julien.grall@arm.com> Acked-by: Julien Grall <julien.grall@arm.com>
This commit is contained in:
@@ -382,13 +382,17 @@ FtwNotificationEvent (
|
||||
ASSERT (PcdGet32 (PcdFlashNvStorageVariableSize) <= FtwMaxBlockSize);
|
||||
}
|
||||
|
||||
NvStorageVariableBase = NV_STORAGE_VARIABLE_BASE;
|
||||
VariableStoreBase = NvStorageVariableBase + mNvFvHeaderCache->HeaderLength;
|
||||
|
||||
//
|
||||
// Let NonVolatileVariableBase point to flash variable store base directly after FTW ready.
|
||||
//
|
||||
mVariableModuleGlobal->VariableGlobal.NonVolatileVariableBase = VariableStoreBase;
|
||||
|
||||
//
|
||||
// Find the proper FVB protocol for variable.
|
||||
//
|
||||
NvStorageVariableBase = (EFI_PHYSICAL_ADDRESS) PcdGet64 (PcdFlashNvStorageVariableBase64);
|
||||
if (NvStorageVariableBase == 0) {
|
||||
NvStorageVariableBase = (EFI_PHYSICAL_ADDRESS) PcdGet32 (PcdFlashNvStorageVariableBase);
|
||||
}
|
||||
Status = GetFvbInfoByAddress (NvStorageVariableBase, NULL, &FvbProtocol);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return ;
|
||||
@@ -398,7 +402,6 @@ FtwNotificationEvent (
|
||||
//
|
||||
// Mark the variable storage region of the FLASH as RUNTIME.
|
||||
//
|
||||
VariableStoreBase = NvStorageVariableBase + mNvFvHeaderCache->HeaderLength;
|
||||
VariableStoreLength = mNvVariableCache->Size;
|
||||
BaseAddress = VariableStoreBase & (~EFI_PAGE_MASK);
|
||||
Length = VariableStoreLength + (VariableStoreBase - BaseAddress);
|
||||
|
Reference in New Issue
Block a user