X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FVariable%2FRuntimeDxe%2FVariableDxe.c;fp=MdeModulePkg%2FUniversal%2FVariable%2FRuntimeDxe%2FVariableDxe.c;h=d5c409c914d151442b03edcb0f6141a5552b4f08;hp=03fec3048dc46c60ff1d03a96bdf33223d24a88f;hb=4dbebc2d102e83dbafab568a2f7471791001b42c;hpb=60b519456cf01beb269bf864a37fa2acdc53f003 diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c index 03fec3048d..d5c409c914 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c @@ -423,6 +423,8 @@ FtwNotificationEvent ( EFI_PHYSICAL_ADDRESS VariableStoreBase; UINT64 VariableStoreLength; UINTN FtwMaxBlockSize; + UINT32 NvStorageVariableSize; + UINT64 NvStorageVariableSize64; // // Ensure FTW protocol is installed. @@ -432,14 +434,20 @@ FtwNotificationEvent ( return; } + 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); + + 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. //