From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4001:c06::244; helo=mail-io0-x244.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-io0-x244.google.com (mail-io0-x244.google.com [IPv6:2607:f8b0:4001:c06::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id EB4F4224A9EBB for ; Fri, 30 Mar 2018 03:57:41 -0700 (PDT) Received: by mail-io0-x244.google.com with SMTP id v13so10729727iob.6 for ; Fri, 30 Mar 2018 03:57:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ByWj4zjnc5DnLz2q+vkg56C/do7SbvzC2OvAotbIsE0=; b=KAkVlT9pOm9tINcmbS7xXGwauJF0NU056nrjeas00nKnlKW/pRO0wLcmtDmecRJnkO bJToF06al+7wGV6+WwaNNuw+urgqgjLLFBw9HAmnbCS/cd0jyRaqGw2gQ5naJuNLgw8C fURl7xtXXu3nxJz87mBM02Y9WaIK3Z5lwCm3A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ByWj4zjnc5DnLz2q+vkg56C/do7SbvzC2OvAotbIsE0=; b=rjQZObu38mHNxAS/QZN3/B48lm7noUtj+vc4LJ0b/36Pd7mW7m7BaVQ2DdcBUzVDKx g3UNom4tTEYRdFi3DHB5ugLT7J/nO6nppBBdAI2QuBDG45X1quTf8cFmN3INo/Q6pUF8 55ZyQEExAboQgII71wVgr4ovHCvvueihF8vl2vn1hVF5jB5jrbfvvHhmHzfCNQH6moMi ZPPiM5q+zMz80r+SL6BqHK0uK1GtATDtNOaXrHhtIlQGG+0udX/7Jd4caQ2zI0n4bOJq rLMwiq0ncbYnYwKgahy1E8o/3YPqz2/BImXNVjTPiBUV1yy9AOXMpO+UO4yEtn86U9NE 20nQ== X-Gm-Message-State: AElRT7E0Fz22cbvsU+TziJOO9g/+KQWP22Ebl8o92GvSaa/Vh+1waegr DcH0xMC1yGQZfgn/TjpjZ6ZXGyDDwnI1S06lOUFBSQ== X-Google-Smtp-Source: AG47ELtIEw2RWcj3ObQHFeYpomcTVVJLZWxSRtQdYElV3J/P4P0yaDInd/FogL5355C+YvldfYtXrM29lUkeKwZYX5E= X-Received: by 10.107.164.17 with SMTP id n17mr55332145ioe.173.1522407460863; Fri, 30 Mar 2018 03:57:40 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.187.67 with HTTP; Fri, 30 Mar 2018 03:57:40 -0700 (PDT) In-Reply-To: <20180328202651.1478-3-lersek@redhat.com> References: <20180328202651.1478-1-lersek@redhat.com> <20180328202651.1478-3-lersek@redhat.com> From: Ard Biesheuvel Date: Fri, 30 Mar 2018 11:57:40 +0100 Message-ID: To: Laszlo Ersek Cc: edk2-devel-01 , Anthony Perard , Gary Ching-Pang Lin , Jordan Justen , Julien Grall Subject: Re: [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: Fri, 30 Mar 2018 10:57:42 -0000 Content-Type: text/plain; charset="UTF-8" On 28 March 2018 at 21:26, Laszlo Ersek wrote: > 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 Reviewed-by: Ard Biesheuvel > --- > 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 > >