public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Nate DeSimone" <nathaniel.l.desimone@intel.com>
To: "Chiu, Chasel" <chasel.chiu@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Oram, Isaac W" <isaac.w.oram@intel.com>
Subject: Re: [edk2-platforms: PATCH v3 8/9] WhitleyOpenBoardPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2.
Date: Mon, 11 Oct 2021 21:46:58 +0000	[thread overview]
Message-ID: <MWHPR1101MB2160E352201BD1BB6A118398CDB59@MWHPR1101MB2160.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20211008064317.1371-9-chasel.chiu@intel.com>

Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>

> -----Original Message-----
> From: Chiu, Chasel <chasel.chiu@intel.com>
> Sent: Thursday, October 7, 2021 11:43 PM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel <chasel.chiu@intel.com>; Oram, Isaac W
> <isaac.w.oram@intel.com>; Desimone, Nathaniel L
> <nathaniel.l.desimone@intel.com>
> Subject: [edk2-platforms: PATCH v3 8/9] WhitleyOpenBoardPkg: Support FSP
> 2.3 FSP_NON_VOLATILE_STORAGE_HOB2.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3678
> 
> Implementation should search FSP_NON_VOLATILE_STORAGE_HOB2 firstly
> and only search FSP_NON_VOLATILE_STORAGE_HOB when former one is
> not found.
> 
> Also added PeiGetLargeVariable () to support the scenarios where the
> variable data size is bigger than a single variable size limit.
> 
> Cc: Isaac Oram <isaac.w.oram@intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
> ---
> 
> Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3Nvra
> mSave.c   | 29 +++++++++++++++++++++++------
> 
> Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3Nvra
> mSave.inf |  4 +++-
>  Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc                          |  1 +
>  3 files changed, 27 insertions(+), 7 deletions(-)
> 
> diff --git
> a/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3Nvr
> amSave.c
> b/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3Nvr
> amSave.c
> index 709c7ad479..01e36cda27 100644
> ---
> a/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3Nvr
> amSave.c
> +++
> b/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3Nvr
> a
> +++ mSave.c
> @@ -7,6 +7,7 @@
>  **/  #include "S3NvramSave.h"+#include
> <Guid/FspNonVolatileStorageHob2.h> #include
> <Library/MemoryAllocationLib.h> #include <Library/LargeVariableReadLib.h>
> #include <Library/LargeVariableWriteLib.h>@@ -80,21 +81,37 @@
> SaveFspNonVolatileStorageHob (
>    Status            = EFI_SUCCESS;    DEBUG ((DEBUG_INFO, "Saving FSP / MRC
> Training Data\n"));-  GuidHob = GetFirstGuidHob
> (&gFspNonVolatileStorageHobGuid);+  //+  // Firstly check version2
> FspNvsHob.+  //+  GuidHob = GetFirstGuidHob
> (&gFspNonVolatileStorageHob2Guid);   if (GuidHob != NULL) {-    HobData  =
> GET_GUID_HOB_DATA (GuidHob);-    DataSize =
> GET_GUID_HOB_DATA_SIZE (GuidHob);+    HobData = (VOID *) (UINTN)
> ((FSP_NON_VOLATILE_STORAGE_HOB2 *) (UINTN) GuidHob)->NvsDataPtr;+
> DataSize = (UINTN) ((FSP_NON_VOLATILE_STORAGE_HOB2 *) (UINTN)
> GuidHob)->NvsDataLength;+  } else {+    //+    // Fall back to version1
> FspNvsHob+    //+    GuidHob = GetFirstGuidHob
> (&gFspNonVolatileStorageHobGuid);+    if (GuidHob != NULL) {+      HobData
> = GET_GUID_HOB_DATA (GuidHob);+      DataSize =
> GET_GUID_HOB_DATA_SIZE (GuidHob);+    }+  }+  if (HobData != NULL) {+
> DEBUG ((DEBUG_INFO, "FspNvsHob.Size:       %d\n",   DataSize));+    DEBUG
> ((DEBUG_INFO, "FspNvsHob.NvsDataPtr: 0x%x\n", HobData));     if (DataSize
> > 0) {        //       // Check if the presently saved data is identical to the data
> given by MRC/FSP       //-      Status = GetLargeVariable (L"FspNvsBuffer",
> &gFspNonVolatileStorageHobGuid, &FspNvsBufferSize, NULL);+      Status =
> GetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableGuid,
> &FspNvsBufferSize, NULL);       if (Status == EFI_BUFFER_TOO_SMALL) {         if
> (FspNvsBufferSize == DataSize) {           VariableData = AllocatePool
> (FspNvsBufferSize);           if (VariableData != NULL) {-            Status =
> GetLargeVariable (L"FspNvsBuffer", &gFspNonVolatileStorageHobGuid,
> &FspNvsBufferSize, VariableData);+            Status = GetLargeVariable
> (L"FspNvsBuffer", &gFspNvsBufferVariableGuid, &FspNvsBufferSize,
> VariableData);             if (!EFI_ERROR (Status) && (FspNvsBufferSize ==
> DataSize) && (0 == CompareMem (HobData, VariableData, DataSize))) {
> DataIsIdentical = TRUE;             }@@ -105,7 +122,7 @@
> SaveFspNonVolatileStorageHob (
>        Status = EFI_SUCCESS;        if (!DataIsIdentical) {-        Status =
> SetLargeVariable (L"FspNvsBuffer", &gFspNonVolatileStorageHobGuid,
> TRUE, DataSize, HobData);+        Status = SetLargeVariable (L"FspNvsBuffer",
> &gFspNvsBufferVariableGuid, TRUE, DataSize, HobData);
> ASSERT_EFI_ERROR (Status);         DEBUG ((DEBUG_INFO, "Saved size of FSP /
> MRC Training Data: 0x%x\n", DataSize));       } else {diff --git
> a/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3Nvr
> amSave.inf
> b/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3Nvr
> amSave.inf
> index e62baa24c4..a77125cf44 100644
> ---
> a/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3Nvr
> amSave.inf
> +++
> b/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3Nvr
> a
> +++ mSave.inf
> @@ -43,7 +43,9 @@
>    LargeVariableWriteLib  [Guids]-  gFspNonVolatileStorageHobGuid #
> CONSUMES+  gFspNonVolatileStorageHobGuid  # CONSUMES+
> gFspNonVolatileStorageHob2Guid # CONSUMES+
> gFspNvsBufferVariableGuid      # PRODUCES  [Pcd]
> gEfiCpRcPkgTokenSpaceGuid.PcdPeiSyshostMemorySizediff --git
> a/Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc
> b/Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc
> index dc3dd0e026..87165103bf 100644
> --- a/Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc
> +++ b/Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc
> @@ -637,6 +637,7 @@
>   [LibraryClasses.Common]
> DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.
> inf+  PeiLib|MinPlatformPkg/Library/PeiLib/PeiLib.inf  [Components.IA32]
> UefiCpuPkg/SecCore/SecCore.inf--
> 2.28.0.windows.1


  reply	other threads:[~2021-10-11 21:47 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-08  6:43 [edk2-platforms: PATCH v3 0/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2 Chiu, Chasel
2021-10-08  6:43 ` [edk2-platforms: PATCH v3 1/9] " Chiu, Chasel
2021-10-11 21:46   ` Nate DeSimone
2021-10-08  6:43 ` [edk2-platforms: PATCH v3 2/9] CometlakeOpenBoardPkg: Use same variable name for FspNvsHob Chiu, Chasel
2021-10-08 13:43   ` Kathappan Esakkithevar
2021-10-11 21:46   ` Nate DeSimone
2021-10-08  6:43 ` [edk2-platforms: PATCH v3 3/9] KabylakeOpenBoardPkg/AspireVn7Dash572G:Use " Chiu, Chasel
2021-10-11 21:46   ` Nate DeSimone
2021-10-08  6:43 ` [edk2-platforms: PATCH v3 4/9] KabylakeOpenBoardPkg/GalagoPro3: Use " Chiu, Chasel
2021-10-11 21:46   ` Nate DeSimone
2021-10-08  6:43 ` [edk2-platforms: PATCH v3 5/9] KabylakeOpenBoardPkg/KabylakeRvp3: " Chiu, Chasel
2021-10-11 21:46   ` Nate DeSimone
2021-10-08  6:43 ` [edk2-platforms: PATCH v3 6/9] TigerlakeOpenBoardPkg: " Chiu, Chasel
2021-10-11 21:46   ` Nate DeSimone
2021-10-12  1:33   ` Heng Luo
2021-10-08  6:43 ` [edk2-platforms: PATCH v3 7/9] WhiskeylakeOpenBoardPkg: " Chiu, Chasel
2021-10-11 21:46   ` Nate DeSimone
2021-10-08  6:43 ` [edk2-platforms: PATCH v3 8/9] WhitleyOpenBoardPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2 Chiu, Chasel
2021-10-11 21:46   ` Nate DeSimone [this message]
2021-10-08  6:43 ` [edk2-platforms: PATCH v3 9/9] WhitleySiliconPkg: Use same variable name for FspNvsHob Chiu, Chasel
2021-10-11 21:47   ` Nate DeSimone
2021-10-08 13:44 ` [edk2-platforms: PATCH v3 0/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2 Kathappan Esakkithevar
2021-10-11 21:46 ` Nate DeSimone
2021-10-12  1:43 ` Oram, Isaac W
2021-10-14  6:11 ` Chiu, Chasel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MWHPR1101MB2160E352201BD1BB6A118398CDB59@MWHPR1101MB2160.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox