OvmfPkg/EmuVariableFvbRuntimeDxe: stop using PcdVariableStoreSize
authorLaszlo Ersek <lersek@redhat.com>
Tue, 27 Mar 2018 22:45:23 +0000 (00:45 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Fri, 30 Mar 2018 19:18:35 +0000 (21:18 +0200)
In commit 62f43f7c1947c, we set PcdVariableStoreSize to the same value as
PcdFlashNvStorageVariableSize (which in turn comes from VARS_LIVE_SIZE in
"OvmfPkg.fdf.inc").

This equality between both PCDs is a false requirement from
EmuVariableFvbRuntimeDxe. FVB drivers should use
PcdFlashNvStorageVariableSize for supporting non-volatile variables (even
if they happen to be kept in RAM only), along the other PcdFlashNvStorage*
PCDs. Whereas PcdVariableStoreSize is for variables that are volatile at
the gRT->SetVariable() / gRT->GetVariable() API level.

(PlatformPei too bases the preallocation for EmuVariableFvbRuntimeDxe on
PcdFlashNvStorageFtwSpareSize.)

Replace PcdVariableStoreSize in EmuVariableFvbRuntimeDxe with the
same-value PcdFlashNvStorageVariableSize. This means no change in
behavior, and it allows us to increase PcdVariableStoreSize in a later
patch without disturbing EmuVariableFvbRuntimeDxe (or PlatformPei).

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gary Ching-Pang Lin <glin@suse.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien.grall@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Gary Lin <glin@suse.com>
Tested-by: Gary Lin <glin@suse.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c
OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf

index 2d106bb50bed68d2739204c86a0567e37426db60..9480d879c9353cb518daabeb174242b68108b8ce 100644 (file)
@@ -665,7 +665,7 @@ InitializeFvAndVariableStoreHeaders (
 \r
       // UINT32  Size;\r
       (\r
 \r
       // UINT32  Size;\r
       (\r
-        FixedPcdGet32 (PcdVariableStoreSize) -\r
+        FixedPcdGet32 (PcdFlashNvStorageVariableSize) -\r
         OFFSET_OF (FVB_FV_HDR_AND_VARS_TEMPLATE, VarHdr)\r
       ),\r
 \r
         OFFSET_OF (FVB_FV_HDR_AND_VARS_TEMPLATE, VarHdr)\r
       ),\r
 \r
@@ -733,7 +733,7 @@ FvbInitialize (
   ASSERT (FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) %\r
           EMU_FVB_BLOCK_SIZE == 0);\r
   if (\r
   ASSERT (FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) %\r
           EMU_FVB_BLOCK_SIZE == 0);\r
   if (\r
-       (PcdGet32 (PcdVariableStoreSize) +\r
+       (PcdGet32 (PcdFlashNvStorageVariableSize) +\r
         PcdGet32 (PcdFlashNvStorageFtwWorkingSize)\r
        ) >\r
        EMU_FVB_NUM_SPARE_BLOCKS * EMU_FVB_BLOCK_SIZE\r
         PcdGet32 (PcdFlashNvStorageFtwWorkingSize)\r
        ) >\r
        EMU_FVB_NUM_SPARE_BLOCKS * EMU_FVB_BLOCK_SIZE\r
@@ -788,7 +788,7 @@ FvbInitialize (
   //\r
   // Initialize the Fault Tolerant Write data area\r
   //\r
   //\r
   // Initialize the Fault Tolerant Write data area\r
   //\r
-  SubPtr = (VOID*) ((UINT8*) Ptr + PcdGet32 (PcdVariableStoreSize));\r
+  SubPtr = (VOID*) ((UINT8*) Ptr + PcdGet32 (PcdFlashNvStorageVariableSize));\r
   PcdStatus = PcdSet32S (PcdFlashNvStorageFtwWorkingBase,\r
                 (UINT32)(UINTN) SubPtr);\r
   ASSERT_RETURN_ERROR (PcdStatus);\r
   PcdStatus = PcdSet32S (PcdFlashNvStorageFtwWorkingBase,\r
                 (UINT32)(UINTN) SubPtr);\r
   ASSERT_RETURN_ERROR (PcdStatus);\r
index 9f37938408a40535e58956b945d45583ad58da33..2aacf06c923da0ca993bd9daa0eafc32588bdc1c 100644 (file)
   gEfiDevicePathProtocolGuid                    # PROTOCOL ALWAYS_PRODUCED\r
 \r
 [FixedPcd]\r
   gEfiDevicePathProtocolGuid                    # PROTOCOL ALWAYS_PRODUCED\r
 \r
 [FixedPcd]\r
-  gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize\r
 \r
 [Pcd]\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize\r
 \r
 [Pcd]\r
-  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase\r