MdeModulePkg/Variable: Consume Variable Flash Info
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3479 Updates VariableRuntimeDxe, VariableSmm, and VariableStandaloneMm to acquire variable flash information from the Variable Flash Information library. Note: This introduces a dependency on VariableFlashInfoLib in these modules. Therefore, a platform building the variable modules must specify an instance of VariableFlashInfoLib in their platform build. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
This commit is contained in:
committed by
mergify[bot]
parent
60b519456c
commit
4dbebc2d10
@@ -1084,6 +1084,8 @@ SmmFtwNotificationEvent (
|
||||
EFI_SMM_FAULT_TOLERANT_WRITE_PROTOCOL *FtwProtocol;
|
||||
EFI_PHYSICAL_ADDRESS NvStorageVariableBase;
|
||||
UINTN FtwMaxBlockSize;
|
||||
UINT32 NvStorageVariableSize;
|
||||
UINT64 NvStorageVariableSize64;
|
||||
|
||||
if (mVariableModuleGlobal->FvbInstance != NULL) {
|
||||
return EFI_SUCCESS;
|
||||
@@ -1097,14 +1099,21 @@ SmmFtwNotificationEvent (
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = GetVariableFlashNvStorageInfo (&NvStorageVariableBase, &NvStorageVariableSize64);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = SafeUint64ToUint32 (NvStorageVariableSize64, &NvStorageVariableSize);
|
||||
// This driver currently assumes the size will be UINT32 so assert the value is safe for now.
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
ASSERT (NvStorageVariableBase != 0);
|
||||
VariableStoreBase = NvStorageVariableBase + mNvFvHeaderCache->HeaderLength;
|
||||
|
||||
Status = FtwProtocol->GetMaxBlockSize (FtwProtocol, &FtwMaxBlockSize);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
ASSERT (PcdGet32 (PcdFlashNvStorageVariableSize) <= FtwMaxBlockSize);
|
||||
ASSERT (NvStorageVariableSize <= FtwMaxBlockSize);
|
||||
}
|
||||
|
||||
NvStorageVariableBase = NV_STORAGE_VARIABLE_BASE;
|
||||
VariableStoreBase = NvStorageVariableBase + mNvFvHeaderCache->HeaderLength;
|
||||
|
||||
//
|
||||
// Let NonVolatileVariableBase point to flash variable store base directly after FTW ready.
|
||||
//
|
||||
|
Reference in New Issue
Block a user