EFI_PHYSICAL_ADDRESS VariableStoreBase;\r
UINT64 VariableStoreLength;\r
UINTN FtwMaxBlockSize;\r
+ UINT32 NvStorageVariableSize;\r
+ UINT64 NvStorageVariableSize64;\r
\r
//\r
// Ensure FTW protocol is installed.\r
return;\r
}\r
\r
+ Status = GetVariableFlashNvStorageInfo (&NvStorageVariableBase, &NvStorageVariableSize64);\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ Status = SafeUint64ToUint32 (NvStorageVariableSize64, &NvStorageVariableSize);\r
+ // This driver currently assumes the size will be UINT32 so assert the value is safe for now.\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ VariableStoreBase = NvStorageVariableBase + mNvFvHeaderCache->HeaderLength;\r
+\r
Status = FtwProtocol->GetMaxBlockSize (FtwProtocol, &FtwMaxBlockSize);\r
if (!EFI_ERROR (Status)) {\r
- ASSERT (PcdGet32 (PcdFlashNvStorageVariableSize) <= FtwMaxBlockSize);\r
+ ASSERT (NvStorageVariableSize <= FtwMaxBlockSize);\r
}\r
\r
- NvStorageVariableBase = NV_STORAGE_VARIABLE_BASE;\r
- VariableStoreBase = NvStorageVariableBase + mNvFvHeaderCache->HeaderLength;\r
-\r
//\r
// Let NonVolatileVariableBase point to flash variable store base directly after FTW ready.\r
//\r