From: Laszlo Ersek Date: Fri, 5 May 2017 01:31:32 +0000 (+0200) Subject: OvmfPkg: sync PcdVariableStoreSize with PcdFlashNvStorageVariableSize X-Git-Tag: edk2-stable201903~4029 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=62f43f7c1947c799dd69fb4b2d94376b8e689b51;hp=c15c1c086325efd9b50ca754e44a52501d5fc5ca OvmfPkg: sync PcdVariableStoreSize with PcdFlashNvStorageVariableSize "MdeModulePkg/MdeModulePkg.dec" declares PcdVariableStoreSize like this: > The size of volatile buffer. This buffer is used to store VOLATILE > attribute variables. There is no inherent reason why the size of the volatile variable store should match the same of the non-volatile variable store. Indeed flash variables in the 4MB build work fine without this equality. However, OvmfPkg/EmuVariableFvbRuntimeDxe uses PcdVariableStoreSize to initialize the non-volatile VARIABLE_STORE_HEADER too. (Presumably based on the fact that ultimately that storage will not be permanent.) When using EmuVariableFvbRuntimeDxe in the 4MB build, the mismatch between the two mentioned PCDs (which is apparent through EmuVariableFvbRuntimeDxe's VARIABLE_STORE_HEADER) triggers an assertion in the variable driver: > ASSERT MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c(3772): > mNvVariableCache->Size == VariableStoreLength Bringing PcdVariableStoreSize in sync with PcdFlashNvStorageVariableSize fixes this. It also happens to ensure a volatile store size in the 4MB build that equals the non-volatile store size, which likely doesn't hurt for symmetry. Cc: Jordan Justen Fixes: b24fca05751f8222acf264853709012e0ab7bf49 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Reviewed-by: Jordan Justen --- diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index 8f8d347210..64427716c5 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -414,12 +414,13 @@ !if ($(FD_SIZE_IN_KB) == 1024) || ($(FD_SIZE_IN_KB) == 2048) gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000 gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800 + gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xe000 !endif !if $(FD_SIZE_IN_KB) == 4096 gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x8400 gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x8400 + gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0x40000 !endif - gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xe000 gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress|0x0 diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index fd554f8f37..887964cd27 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -419,12 +419,13 @@ !if ($(FD_SIZE_IN_KB) == 1024) || ($(FD_SIZE_IN_KB) == 2048) gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000 gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800 + gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xe000 !endif !if $(FD_SIZE_IN_KB) == 4096 gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x8400 gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x8400 + gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0x40000 !endif - gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xe000 gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress|0x0 diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index 3bcd488fc7..dc5fea3577 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -419,12 +419,13 @@ !if ($(FD_SIZE_IN_KB) == 1024) || ($(FD_SIZE_IN_KB) == 2048) gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000 gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800 + gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xe000 !endif !if $(FD_SIZE_IN_KB) == 4096 gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x8400 gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x8400 + gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0x40000 !endif - gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xe000 gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress|0x0