From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2C3CD22106DCE for ; Wed, 28 Mar 2018 13:20:20 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7CE0C406802A; Wed, 28 Mar 2018 20:26:58 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-75.rdu2.redhat.com [10.10.120.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4CBAC10B2B26; Wed, 28 Mar 2018 20:26:57 +0000 (UTC) From: Laszlo Ersek To: edk2-devel-01 Cc: Anthony Perard , Ard Biesheuvel , Gary Ching-Pang Lin , Jordan Justen , Julien Grall Date: Wed, 28 Mar 2018 22:26:49 +0200 Message-Id: <20180328202651.1478-3-lersek@redhat.com> In-Reply-To: <20180328202651.1478-1-lersek@redhat.com> References: <20180328202651.1478-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 28 Mar 2018 20:26:58 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 28 Mar 2018 20:26:58 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lersek@redhat.com' RCPT:'' Subject: [PATCH 2/4] OvmfPkg/EmuVariableFvbRuntimeDxe: stop using PcdVariableStoreSize X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Mar 2018 20:20:20 -0000 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 Cc: Ard Biesheuvel Cc: Gary Ching-Pang Lin Cc: Jordan Justen Cc: Julien Grall Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek --- OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf | 3 +-- OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf b/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf index 9f37938408a4..2aacf06c923d 100644 --- a/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf +++ b/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf @@ -58,12 +58,11 @@ [Protocols] gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_PRODUCED [FixedPcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize [Pcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase diff --git a/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c b/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c index 2d106bb50bed..9480d879c935 100644 --- a/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c +++ b/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c @@ -665,7 +665,7 @@ InitializeFvAndVariableStoreHeaders ( // UINT32 Size; ( - FixedPcdGet32 (PcdVariableStoreSize) - + FixedPcdGet32 (PcdFlashNvStorageVariableSize) - OFFSET_OF (FVB_FV_HDR_AND_VARS_TEMPLATE, VarHdr) ), @@ -733,7 +733,7 @@ FvbInitialize ( ASSERT (FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) % EMU_FVB_BLOCK_SIZE == 0); if ( - (PcdGet32 (PcdVariableStoreSize) + + (PcdGet32 (PcdFlashNvStorageVariableSize) + PcdGet32 (PcdFlashNvStorageFtwWorkingSize) ) > EMU_FVB_NUM_SPARE_BLOCKS * EMU_FVB_BLOCK_SIZE @@ -788,7 +788,7 @@ FvbInitialize ( // // Initialize the Fault Tolerant Write data area // - SubPtr = (VOID*) ((UINT8*) Ptr + PcdGet32 (PcdVariableStoreSize)); + SubPtr = (VOID*) ((UINT8*) Ptr + PcdGet32 (PcdFlashNvStorageVariableSize)); PcdStatus = PcdSet32S (PcdFlashNvStorageFtwWorkingBase, (UINT32)(UINTN) SubPtr); ASSERT_RETURN_ERROR (PcdStatus); -- 2.14.1.3.gb7cf6e02401b