public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-platforms: PATCH v5 0/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2.
@ 2021-10-14  9:16 Chiu, Chasel
  2021-10-14  9:16 ` [edk2-platforms: PATCH v5 1/9] " Chiu, Chasel
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: Chiu, Chasel @ 2021-10-14  9:16 UTC (permalink / raw)
  To: devel
  Cc: Chasel Chiu, Isaac Oram, Nate DeSimone, Heng Luo, Jeremy Soller,
	Benjamin Doron, Rangasai V Chaganty, Deepika Kethi Reddy,
	Kathappan Esakkithevar, Liming Gao, Eric Dong

V5:
Fix GCC build failure in LargeVariableWriteLib.c

V4:
  . Switched to LargeVariableRead(Write)Lib in SaveMemoryConfig driver
  . Fixed tailing white space issue in PeiLib.c/.h
  . Updated function descriptions for PeiGetVariable() and PeiGetLargeVariable()
  . Added VariableReadLib to CorePeiLib.dsc for all platforms
  . Fixed white space issue in GalagoPro3/.../PeiFspMiscUpdUpdateLib.c

V3:
Fix another GCC build failure.

V2:
Fix GCC build failures.

V1:
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>
Cc: Heng Luo <heng.luo@intel.com>
Cc: Jeremy Soller <jeremy@system76.com>
Cc: Benjamin Doron <benjamin.doron00@gmail.com>
Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
Cc: Deepika Kethi Reddy <deepika.kethi.reddy@intel.com>
Cc: Kathappan Esakkithevar <kathappan.esakkithevar@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>

Chasel Chiu (9):
  MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2.
  CometlakeOpenBoardPkg: Use same variable name for FspNvsHob.
  KabylakeOpenBoardPkg/AspireVn7Dash572G:Use same variable name for
    FspNvsHob
  KabylakeOpenBoardPkg/GalagoPro3: Use same variable name for FspNvsHob.
  KabylakeOpenBoardPkg/KabylakeRvp3: Use same variable name for
    FspNvsHob.
  TigerlakeOpenBoardPkg: Use same variable name for FspNvsHob.
  WhiskeylakeOpenBoardPkg: Use same variable name for FspNvsHob.
  WhitleyOpenBoardPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2.
  WhitleySiliconPkg: Use same variable name for FspNvsHob.

 Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c                          |  63 ++++++++++++++-------------------------------------------------
 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c         |  24 ++++++++++--------------
 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c             |  23 +++++++++--------------
 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c                |  25 +++++++++++--------------
 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c              |  25 ++++++++++---------------
 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c                  |  23 +++++++++--------------
 Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.c                                                           | 109 ++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------
 Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariableWriteLib.c                                                     |   2 +-
 Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.c                                                                                  |  89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------
 Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/PeiVariableReadLib.c                                                          |   4 ++--
 Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.c                                      |  21 ++++++++++++++++++---
 Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c                        |  63 ++++++++++++---------------------------------------------------
 Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c               |  63 ++++++++++++---------------------------------------------------
 Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSave.c                                                              |  29 +++++++++++++++++++++++------
 Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlatformLib.c                                                  |  35 +++++++++--------------------------
 Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf                  |   5 ++---
 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf |   7 ++++---
 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf           |   2 +-
 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf        |   5 ++---
 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf      |   5 ++---
 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf                |   2 +-
 Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.inf                                                         |   8 ++++++--
 Platform/Intel/MinPlatformPkg/Include/Dsc/CorePeiLib.dsc                                                                               |   1 +
 Platform/Intel/MinPlatformPkg/Include/Library/PeiLib.h                                                                                 |  40 +++++++++++++++++++++++++++++++++++-----
 Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.inf                                                                                |   4 +++-
 Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec                                                                                       |   1 +
 Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf                                    |   1 +
 Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf                |   5 ++---
 Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf       |   4 ++--
 Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/Include/Fdf/FlashMapInclude.fdf                                                        |  18 +++++++++---------
 Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSave.inf                                                            |   4 +++-
 Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc                                                                                     |   1 +
 Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlatformLib.inf                                                |   3 ++-
 33 files changed, 345 insertions(+), 369 deletions(-)

-- 
2.28.0.windows.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [edk2-platforms: PATCH v5 1/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2.
  2021-10-14  9:16 [edk2-platforms: PATCH v5 0/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2 Chiu, Chasel
@ 2021-10-14  9:16 ` Chiu, Chasel
  2021-10-14  9:16 ` [edk2-platforms: PATCH v5 2/9] CometlakeOpenBoardPkg: Use same variable name for FspNvsHob Chiu, Chasel
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Chiu, Chasel @ 2021-10-14  9:16 UTC (permalink / raw)
  To: devel; +Cc: Chasel Chiu, Nate DeSimone, Liming Gao, Eric Dong

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. (stored
across multiple variables)

Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
---
 Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.c       | 109 ++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------
 Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariableWriteLib.c |   2 +-
 Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.c                              |  89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------
 Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/PeiVariableReadLib.c      |   4 ++--
 Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.inf     |   8 ++++++--
 Platform/Intel/MinPlatformPkg/Include/Dsc/CorePeiLib.dsc                           |   1 +
 Platform/Intel/MinPlatformPkg/Include/Library/PeiLib.h                             |  40 +++++++++++++++++++++++++++++++++++-----
 Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.inf                            |   4 +++-
 Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec                                   |   1 +
 9 files changed, 176 insertions(+), 82 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.c b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.c
index 41ed2550bd..820585f676 100644
--- a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.c
+++ b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.c
@@ -2,7 +2,7 @@
   This is the driver that locates the MemoryConfigurationData HOB, if it
   exists, and saves the data to nvRAM.
 
-Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -16,7 +16,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <Guid/GlobalVariable.h>
 #include <Library/MemoryAllocationLib.h>
 #include <Library/BaseMemoryLib.h>
-#include <Protocol/VariableLock.h>
+#include <Library/LargeVariableReadLib.h>
+#include <Library/LargeVariableWriteLib.h>
+#include <Guid/FspNonVolatileStorageHob2.h>
 
 /**
   This is the standard EFI driver point that detects whether there is a
@@ -40,86 +42,71 @@ SaveMemoryConfigEntryPoint (
   VOID              *VariableData;
   UINTN             DataSize;
   UINTN             BufferSize;
-  EDKII_VARIABLE_LOCK_PROTOCOL        *VariableLock;
+  BOOLEAN           DataIsIdentical;
 
-  DataSize     = 0;
-  VariableData = NULL;
-  GuidHob      = NULL;
-  HobData      = NULL;
+  DataSize        = 0;
+  BufferSize      = 0;
+  VariableData    = NULL;
+  GuidHob         = NULL;
+  HobData         = NULL;
+  DataIsIdentical = FALSE;
 
   //
   // Search for the Memory Configuration GUID HOB.  If it is not present, then
   // there's nothing we can do. It may not exist on the update path.
+  // Firstly check version2 FspNvsHob.
   //
-  GuidHob = GetFirstGuidHob (&gFspNonVolatileStorageHobGuid);
+  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.NvsDataLength:%d\n", DataSize));
+    DEBUG ((DEBUG_INFO, "FspNvsHob.NvsDataPtr   : 0x%x\n", HobData));
     if (DataSize > 0) {
       //
-      // Use the HOB to save Memory Configuration Data
+      // Check if the presently saved data is identical to the data given by MRC/FSP
       //
-      BufferSize = DataSize;
-      VariableData = AllocatePool (BufferSize);
-      if (VariableData == NULL) {
-        return EFI_UNSUPPORTED;
-      }
-      Status = gRT->GetVariable (
-                      L"MemoryConfig",
-                      &gFspNonVolatileStorageHobGuid,
-                      NULL,
-                      &BufferSize,
-                      VariableData
-                      );
-
+      Status = GetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableGuid, &BufferSize, NULL);
       if (Status == EFI_BUFFER_TOO_SMALL) {
-        FreePool (VariableData);
-        VariableData = AllocatePool (BufferSize);
-        if (VariableData == NULL) {
-          return EFI_UNSUPPORTED;
+        if (BufferSize == DataSize) {
+          VariableData = AllocatePool (BufferSize);
+          if (VariableData != NULL) {
+            Status = GetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableGuid, &BufferSize, VariableData);
+            if (!EFI_ERROR (Status) && (BufferSize == DataSize) && (0 == CompareMem (HobData, VariableData, DataSize))) {
+              DataIsIdentical = TRUE;
+            }
+            FreePool (VariableData);
+          }
         }
-
-        Status = gRT->GetVariable (
-                        L"MemoryConfig",
-                        &gFspNonVolatileStorageHobGuid,
-                        NULL,
-                        &BufferSize,
-                        VariableData
-                        );
       }
+      Status = EFI_SUCCESS;
 
-      if ( (EFI_ERROR(Status)) || BufferSize != DataSize || 0 != CompareMem (HobData, VariableData, DataSize)) {
-        Status = gRT->SetVariable (
-                        L"MemoryConfig",
-                        &gFspNonVolatileStorageHobGuid,
-                        (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS),
-                        DataSize,
-                        HobData
-                        );
+      if (!DataIsIdentical) {
+        Status = SetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableGuid, TRUE, DataSize, HobData);
         ASSERT_EFI_ERROR (Status);
-
-        DEBUG((DEBUG_INFO, "Restored Size is 0x%x\n", DataSize));
-      }
-
-      //
-      // Mark MemoryConfig to read-only if the Variable Lock protocol exists
-      //
-      Status = gBS->LocateProtocol(&gEdkiiVariableLockProtocolGuid, NULL, (VOID **)&VariableLock);
-      if (!EFI_ERROR(Status)) {
-        Status = VariableLock->RequestToLock(VariableLock, L"MemoryConfig", &gFspNonVolatileStorageHobGuid);
-        ASSERT_EFI_ERROR(Status);
+        DEBUG ((DEBUG_INFO, "Saved size of FSP / MRC Training Data: 0x%x\n", DataSize));
+      } else {
+        DEBUG ((DEBUG_INFO, "FSP / MRC Training Data is identical to data from last boot, no need to save.\n"));
       }
-
-      FreePool (VariableData);
-    } else {
-      DEBUG((DEBUG_INFO, "Memory save size is %d\n", DataSize));
     }
   } else {
     DEBUG((DEBUG_ERROR, "Memory S3 Data HOB was not found\n"));
   }
 
   //
-  // This driver does not produce any protocol services, so always unload it.
+  // This driver cannot be unloaded because DxeRuntimeVariableWriteLib constructor will register ExitBootServices callback.
   //
-  return EFI_REQUEST_UNLOAD_IMAGE;
+  return EFI_SUCCESS;
 }
diff --git a/Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariableWriteLib.c b/Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariableWriteLib.c
index 703aca6fd8..e4b97ef1df 100644
--- a/Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariableWriteLib.c
+++ b/Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariableWriteLib.c
@@ -343,7 +343,7 @@ SetLargeVariable (
     // Check that it is possible to store the data using less than
     // MAX_VARIABLE_SPLIT variables
     //
-    if ((DataSize / (VariableSplitSize - MAX_VARIABLE_SPLIT_DIGITS)) > MAX_VARIABLE_SPLIT) {
+    if ((DataSize / ((UINTN) VariableSplitSize - MAX_VARIABLE_SPLIT_DIGITS)) > MAX_VARIABLE_SPLIT) {
       DEBUG ((
         DEBUG_ERROR,
         "SetLargeVariable: More than %d variables are needed to store the data, which exceeds the maximum supported\n",
diff --git a/Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.c b/Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.c
index 96dfd588dc..3f8cf761a7 100644
--- a/Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.c
+++ b/Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.c
@@ -1,6 +1,6 @@
 /** @file
 
-Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -9,13 +9,17 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <Library/DebugLib.h>
 #include <Library/PeiServicesLib.h>
 #include <Library/MemoryAllocationLib.h>
+#include <Library/LargeVariableReadLib.h>
 #include <Ppi/ReadOnlyVariable2.h>
 
 /**
-  Returns the status whether get the variable success. The function retrieves 
-  variable  through the ReadOnlyVariable2 PPI GetVariable().  The 
-  returned buffer is allocated using AllocatePool().  The caller is responsible
-  for freeing this buffer with FreePool().
+  Returns the status whether get the variable success. The function retrieves
+  variable  through the ReadOnlyVariable2 PPI GetVariable().
+
+  If the *Size is 0, the returned buffer is allocated using AllocatePool().
+  The buffer is not expected to be freed as PEI does not support a FreePool().
+
+  If the *Size is non-0, this function just uses caller allocated *Value.
 
   If Name  is NULL, then ASSERT().
   If Guid  is NULL, then ASSERT().
@@ -108,6 +112,71 @@ PeiGetVariable (
   return Status;
 }
 
+/**
+  This function returns a "large variable". A large variable is stored across multiple
+  UEFI Variables. This function retrieves the multiple UEFI Variables using
+  ReadOnlyVariable2 PPI GetVariable().
+  The function uses AllocatePages () to allocate the buffer.
+  The caller is responsible for freeing this buffer with FreePages().
+
+  If Name  is NULL, then ASSERT().
+  If Guid  is NULL, then ASSERT().
+  If Value is NULL, then ASSERT().
+
+  @param[in]  Name  The pointer to a Null-terminated Unicode string.
+  @param[in]  Guid  The pointer to an EFI_GUID structure
+  @param[out] Value The buffer point saved the variable info.
+  @param[out] Size  The buffer size of the variable.
+
+  @return EFI_OUT_OF_RESOURCES      Allocate buffer failed.
+  @return EFI_SUCCESS               Find the specified variable.
+  @return Others Errors             Return errors from call to gRT->GetVariable.
+
+**/
+EFI_STATUS
+EFIAPI
+PeiGetLargeVariable (
+  IN  CHAR16    *Name,
+  IN  EFI_GUID  *Guid,
+  OUT VOID      **Value,
+  OUT UINTN     *Size  OPTIONAL
+  )
+{
+  EFI_STATUS                        Status;
+  UINTN                             VariableSize;
+  VOID                              *VariableData;
+
+  ASSERT (Name != NULL);
+  ASSERT (Guid != NULL);
+  ASSERT (Value != NULL);
+
+  VariableSize = 0;
+  VariableData = NULL;
+  Status = GetLargeVariable (Name, Guid, &VariableSize, NULL);
+  if (Status == EFI_BUFFER_TOO_SMALL) {
+    VariableData = AllocatePages (EFI_SIZE_TO_PAGES (VariableSize));
+    if (VariableData == NULL) {
+      DEBUG ((DEBUG_ERROR, "Error: Cannot create VariableData, out of memory!\n"));
+      ASSERT (FALSE);
+      return EFI_OUT_OF_RESOURCES;
+    }
+    Status = GetLargeVariable (Name, Guid, &VariableSize, VariableData);
+    if (EFI_ERROR (Status)) {
+      DEBUG ((DEBUG_ERROR, "Error: Unable to read UEFI variable Status: %r\n", Status));
+      ASSERT_EFI_ERROR (Status);
+      return Status;
+    }
+    if (Value != NULL) {
+      *Value = VariableData;
+    }
+    if (Size != NULL) {
+      *Size = VariableSize;
+    }
+    return EFI_SUCCESS;
+  }
+  return Status;
+}
+
 EFI_PEI_FILE_HANDLE
 InternalGetFfsHandleFromAnyFv (
   IN CONST  EFI_GUID           *NameGuid
@@ -139,7 +208,7 @@ InternalGetFfsHandleFromAnyFv (
 
 /**
   Finds the file in any FV and gets file Address and Size
-  
+
   @param[in]  NameGuid             File GUID
   @param[out] Address              Pointer to the File Address
   @param[out] Size                 Pointer to File Size
@@ -162,7 +231,7 @@ PeiGetFfsFromAnyFv (
   if (FfsHandle == NULL) {
     return EFI_NOT_FOUND;
   }
-  
+
   //
   // Need get size
   //
@@ -185,7 +254,7 @@ PeiGetFfsFromAnyFv (
   @param[in]   SectionInstance   The Instance of Section to be found
   @param[out]  OutSectionBuffer  The section found, including SECTION_HEADER
   @param[out]  OutSectionSize    The size of section found, including SECTION_HEADER
-  
+
   @retval EFI_SUCCESS                Successfull in reading the section from FV
 **/
 EFI_STATUS
@@ -263,7 +332,7 @@ PeiGetSectionFromAnyFv  (
   EFI_COMMON_SECTION_HEADER  *Section;
   VOID                       *FileBuffer;
   UINTN                      FileBufferSize;
-  
+
   Status = PeiGetFfsFromAnyFv (NameGuid, &FileBuffer, &FileBufferSize);
   if (EFI_ERROR(Status)) {
     return Status;
@@ -282,6 +351,6 @@ PeiGetSectionFromAnyFv  (
     *Size = SECTION_SIZE(Section) - sizeof (EFI_COMMON_SECTION_HEADER);
     *Address = (UINT8 *)*Address + sizeof (EFI_COMMON_SECTION_HEADER);
   }
-  
+
   return EFI_SUCCESS;
 }
diff --git a/Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/PeiVariableReadLib.c b/Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/PeiVariableReadLib.c
index 5eeee12a3c..b7885dd6c2 100644
--- a/Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/PeiVariableReadLib.c
+++ b/Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/PeiVariableReadLib.c
@@ -67,7 +67,7 @@ VarLibGetVariable (
              &gEfiPeiReadOnlyVariable2PpiGuid,
              0,
              NULL,
-             &VariablePpi
+             (VOID **) &VariablePpi
              );
   ASSERT_EFI_ERROR (Status);
   if (EFI_ERROR (Status)) {
@@ -134,7 +134,7 @@ VarLibGetNextVariableName (
              &gEfiPeiReadOnlyVariable2PpiGuid,
              0,
              NULL,
-             &VariablePpi
+             (VOID **) &VariablePpi
              );
   ASSERT_EFI_ERROR (Status);
   if (EFI_ERROR (Status)) {
diff --git a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.inf b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.inf
index 0c8689a6f6..e2dbd2fb49 100644
--- a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.inf
+++ b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.inf
@@ -1,7 +1,7 @@
 ### @file
 # Component information file for SaveMemoryConfig module
 #
-# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -23,11 +23,14 @@
   DebugLib
   MemoryAllocationLib
   BaseMemoryLib
+  LargeVariableReadLib
+  LargeVariableWriteLib
 
 [Packages]
   MdePkg/MdePkg.dec
   MdeModulePkg/MdeModulePkg.dec
   IntelFsp2Pkg/IntelFsp2Pkg.dec
+  MinPlatformPkg/MinPlatformPkg.dec
 
 [Sources]
   SaveMemoryConfig.c
@@ -35,10 +38,11 @@
 [Protocols]
   gEfiVariableArchProtocolGuid                  ## CONSUMES
   gEfiVariableWriteArchProtocolGuid             ## CONSUMES
-  gEdkiiVariableLockProtocolGuid
 
 [Guids]
   gFspNonVolatileStorageHobGuid                 ## CONSUMES
+  gFspNonVolatileStorageHob2Guid                ## CONSUMES
+  gFspNvsBufferVariableGuid                     ## PRODUCES
 
 [Depex]
   gEfiVariableArchProtocolGuid        AND
diff --git a/Platform/Intel/MinPlatformPkg/Include/Dsc/CorePeiLib.dsc b/Platform/Intel/MinPlatformPkg/Include/Dsc/CorePeiLib.dsc
index d3c668d441..c12189bd9a 100644
--- a/Platform/Intel/MinPlatformPkg/Include/Dsc/CorePeiLib.dsc
+++ b/Platform/Intel/MinPlatformPkg/Include/Dsc/CorePeiLib.dsc
@@ -41,6 +41,7 @@
   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
 !endif
   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+  VariableReadLib|MinPlatformPkg/Library/BaseVariableReadLibNull/BaseVariableReadLibNull.inf
 
 [LibraryClasses.common.PEI_CORE]
   TimerLib|PcAtChipsetPkg/Library/AcpiTimerLib/PeiAcpiTimerLib.inf
diff --git a/Platform/Intel/MinPlatformPkg/Include/Library/PeiLib.h b/Platform/Intel/MinPlatformPkg/Include/Library/PeiLib.h
index d8b1a47c58..eed6502d84 100644
--- a/Platform/Intel/MinPlatformPkg/Include/Library/PeiLib.h
+++ b/Platform/Intel/MinPlatformPkg/Include/Library/PeiLib.h
@@ -1,6 +1,6 @@
 /** @file
 
-Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -11,11 +11,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <PiPei.h>
 
 /**
-  Returns the status whether get the variable success. The function retrieves 
+  Returns the status whether get the variable success. The function retrieves
   variable  through the ReadOnlyVariable2 PPI GetVariable().
 
   If the *Size is 0, the returned buffer is allocated using AllocatePool().
-  The caller is responsible for freeing this buffer with FreePool().
+  The buffer is not expected to be freed as PEI does not support a FreePool().
 
   If the *Size is non-0, this function just uses caller allocated *Value.
 
@@ -38,9 +38,39 @@ PeiGetVariable (
   OUT UINTN          *Size
   );
 
+/**
+  This function returns a "large variable". A large variable is stored across multiple
+  UEFI Variables. This function retrieves the multiple UEFI Variables using
+  ReadOnlyVariable2 PPI GetVariable().
+  The function uses AllocatePages () to allocate the buffer.
+  The caller is responsible for freeing this buffer with FreePages().
+
+  If Name  is NULL, then ASSERT().
+  If Guid  is NULL, then ASSERT().
+  If Value is NULL, then ASSERT().
+
+  @param[in]  Name  The pointer to a Null-terminated Unicode string.
+  @param[in]  Guid  The pointer to an EFI_GUID structure
+  @param[out] Value The buffer point saved the variable info.
+  @param[out] Size  The buffer size of the variable.
+
+  @return EFI_OUT_OF_RESOURCES      Allocate buffer failed.
+  @return EFI_SUCCESS               Find the specified variable.
+  @return Others Errors             Return errors from call to gRT->GetVariable.
+
+**/
+EFI_STATUS
+EFIAPI
+PeiGetLargeVariable (
+  IN  CHAR16    *Name,
+  IN  EFI_GUID  *Guid,
+  OUT VOID      **Value,
+  OUT UINTN     *Size  OPTIONAL
+  );
+
 /**
   Finds the file in any FV and gets file Address and Size
-  
+
   @param[in]  NameGuid             File GUID
   @param[out] Address              Pointer to the File Address
   @param[out] Size                 Pointer to File Size
@@ -57,7 +87,7 @@ PeiGetFfsFromAnyFv (
 
 /**
   Finds the section in any FV and gets section Address and Size
-  
+
   @param[in]  NameGuid             File GUID
   @param[in]  SectionType          The SectionType of Section to be found
   @param[in]  SectionInstance      The Instance of Section to be found
diff --git a/Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.inf b/Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.inf
index 7e740172a0..bd57cf7870 100644
--- a/Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.inf
+++ b/Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.inf
@@ -1,7 +1,7 @@
 ## @file
 # Component information file for Board Init Test Library
 #
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -20,9 +20,11 @@
   PeiServicesLib
   MemoryAllocationLib
   DebugLib
+  LargeVariableReadLib
 
 [Packages]
   MdePkg/MdePkg.dec
+  MinPlatformPkg/MinPlatformPkg.dec
 
 [Sources]
   PeiLib.c
diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
index bcb42f0ef9..d6e80a66ce 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
@@ -50,6 +50,7 @@
   gBdsEventBeforeConsoleAfterTrustedConsoleGuid  = {0x51e49ff5, 0x28a9, 0x4159, { 0xac, 0x8a, 0xb8, 0xc4, 0x88, 0xa7, 0xfd, 0xee}}
   gBdsEventBeforeConsoleBeforeEndOfDxeGuid       = {0xfcf26e41, 0xbda6, 0x4633, { 0xb5, 0x73, 0xd4, 0xb8, 0x0e, 0x6d, 0xd0, 0x78}}
   gBdsEventAfterConsoleReadyBeforeBootOptionGuid = {0x8eb3d5dc, 0xf4e7, 0x4b57, { 0xa9, 0xe7, 0x27, 0x39, 0x10, 0xf2, 0x18, 0x9f}}
+  gFspNvsBufferVariableGuid                      = {0x9c7715cd, 0x8d66, 0x4d2a, { 0x90, 0x0d, 0x01, 0x45, 0x9a, 0x57, 0x59, 0x6b}}
 
 [LibraryClasses]
 
-- 
2.28.0.windows.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [edk2-platforms: PATCH v5 2/9] CometlakeOpenBoardPkg: Use same variable name for FspNvsHob.
  2021-10-14  9:16 [edk2-platforms: PATCH v5 0/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2 Chiu, Chasel
  2021-10-14  9:16 ` [edk2-platforms: PATCH v5 1/9] " Chiu, Chasel
@ 2021-10-14  9:16 ` Chiu, Chasel
  2021-10-14  9:16 ` [edk2-platforms: PATCH v5 3/9] KabylakeOpenBoardPkg/AspireVn7Dash572G:Use " Chiu, Chasel
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Chiu, Chasel @ 2021-10-14  9:16 UTC (permalink / raw)
  To: devel
  Cc: Chasel Chiu, Nate DeSimone, Rangasai V Chaganty,
	Deepika Kethi Reddy, Kathappan Esakkithevar

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3678

To simplify the implementation the variable Name/GUID has been
changed to "FspNvsBuffer" and gFspNvsBufferVariableGuid
regardless it stores the data from FSP_NON_VOLATILE_STORAGE_HOB2
or FSP_NON_VOLATILE_STORAGE_HOB.

Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
Cc: Deepika Kethi Reddy <deepika.kethi.reddy@intel.com>
Cc: Kathappan Esakkithevar <kathappan.esakkithevar@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
Reviewed-by: Kathappan Esakkithevar <kathappan.esakkithevar@intel.com>
---
 Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c         | 63 ++++++++++++++-------------------------------------------------
 Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf |  5 ++---
 2 files changed, 16 insertions(+), 52 deletions(-)

diff --git a/Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c b/Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c
index 7dbdfa7c16..9e8606ada9 100644
--- a/Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c
+++ b/Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c
@@ -2,7 +2,7 @@
   Implementation of Fsp Misc UPD Initialization.
 
 
-  Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
@@ -17,7 +17,6 @@
 #include <FspmUpd.h>
 #include <FspsUpd.h>
 
-#include <Library/MemoryAllocationLib.h>
 #include <Library/DebugLib.h>
 #include <Library/DebugPrintErrorLevelLib.h>
 #include <Library/PciLib.h>
@@ -44,55 +43,21 @@ PeiFspMiscUpdUpdatePreMem (
   )
 {
   EFI_STATUS                        Status;
-  EFI_PEI_READ_ONLY_VARIABLE2_PPI   *VariableServices;
-  UINTN                             VariableSize;
-  VOID                              *MemorySavedData;
-
-  Status = PeiServicesLocatePpi (
-             &gEfiPeiReadOnlyVariable2PpiGuid,
-             0,
-             NULL,
-             (VOID **) &VariableServices
-             );
-  if (EFI_ERROR (Status)) {
-    ASSERT_EFI_ERROR (Status);
-    return Status;
+  UINTN                             FspNvsBufferSize;
+  VOID                              *FspNvsBufferPtr;
+
+  //
+  // Initialize S3 Data variable (S3DataPtr). It may be used for warm and fast boot paths.
+  //
+  FspNvsBufferPtr   = NULL;
+  FspNvsBufferSize  = 0;
+  Status = PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableGuid, &FspNvsBufferPtr, &FspNvsBufferSize);
+  if (Status == EFI_SUCCESS) {
+    DEBUG ((DEBUG_INFO, "Get L\"FspNvsBuffer\" gFspNvsBufferVariableGuid - %r\n", Status));
+    DEBUG ((DEBUG_INFO, "FspNvsBuffer Size - 0x%x\n", FspNvsBufferSize));
+    FspmUpd->FspmArchUpd.NvsBufferPtr = FspNvsBufferPtr;
   }
 
-  VariableSize = 0;
-  MemorySavedData = NULL;
-  Status = VariableServices->GetVariable (
-                               VariableServices,
-                               L"MemoryConfig",
-                               &gFspNonVolatileStorageHobGuid,
-                               NULL,
-                               &VariableSize,
-                               MemorySavedData
-                               );
-  if (Status == EFI_BUFFER_TOO_SMALL) {
-    MemorySavedData = AllocatePool (VariableSize);
-    if (MemorySavedData == NULL) {
-      ASSERT (MemorySavedData != NULL);
-      return EFI_OUT_OF_RESOURCES;
-    }
-
-    DEBUG ((DEBUG_INFO, "VariableSize is 0x%x\n", VariableSize));
-    Status = VariableServices->GetVariable (
-                                 VariableServices,
-                                 L"MemoryConfig",
-                                 &gFspNonVolatileStorageHobGuid,
-                                 NULL,
-                                 &VariableSize,
-                                 MemorySavedData
-                                 );
-    if (Status == EFI_SUCCESS) {
-      FspmUpd->FspmArchUpd.NvsBufferPtr = MemorySavedData;
-    } else {
-      DEBUG ((DEBUG_ERROR, "Fail to retrieve Variable:\"MemoryConfig\" gMemoryConfigVariableGuid, Status = %r\n", Status));
-      ASSERT_EFI_ERROR (Status);
-    }
-  }
-  FspmUpd->FspmArchUpd.NvsBufferPtr = MemorySavedData;
 
   return EFI_SUCCESS;
 }
diff --git a/Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf b/Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf
index c842b7eef6..94776603c4 100644
--- a/Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf
+++ b/Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf
@@ -2,7 +2,7 @@
 #  Provide FSP wrapper platform related function.
 #
 #
-#  Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -82,7 +82,6 @@
   PchInfoLib
   PchHsioLib
   PchPcieRpLib
-  MemoryAllocationLib
   DebugPrintErrorLevelLib
   SiPolicyLib
   PchGbeLib
@@ -132,7 +131,7 @@
   gCometlakeOpenBoardPkgTokenSpaceGuid.PcdMrcSpdAddressTable3
 
 [Guids]
-  gFspNonVolatileStorageHobGuid                 ## CONSUMES
+  gFspNvsBufferVariableGuid                     ## CONSUMES
   gTianoLogoGuid                                ## CONSUMES
   gEfiMemoryOverwriteControlDataGuid
 
-- 
2.28.0.windows.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [edk2-platforms: PATCH v5 3/9] KabylakeOpenBoardPkg/AspireVn7Dash572G:Use same variable name for FspNvsHob
  2021-10-14  9:16 [edk2-platforms: PATCH v5 0/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2 Chiu, Chasel
  2021-10-14  9:16 ` [edk2-platforms: PATCH v5 1/9] " Chiu, Chasel
  2021-10-14  9:16 ` [edk2-platforms: PATCH v5 2/9] CometlakeOpenBoardPkg: Use same variable name for FspNvsHob Chiu, Chasel
@ 2021-10-14  9:16 ` Chiu, Chasel
  2021-10-14  9:16 ` [edk2-platforms: PATCH v5 4/9] KabylakeOpenBoardPkg/GalagoPro3: Use " Chiu, Chasel
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Chiu, Chasel @ 2021-10-14  9:16 UTC (permalink / raw)
  To: devel; +Cc: Chasel Chiu, Nate DeSimone, Benjamin Doron

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3678

To simplify the implementation the variable Name/GUID has been
changed to "FspNvsBuffer" and gFspNvsBufferVariableGuid
regardless it stores the data from FSP_NON_VOLATILE_STORAGE_HOB2
or FSP_NON_VOLATILE_STORAGE_HOB.

Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Benjamin Doron <benjamin.doron00@gmail.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
---
 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c         | 24 ++++++++++--------------
 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c             | 23 +++++++++--------------
 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf |  7 ++++---
 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf           |  2 +-
 4 files changed, 24 insertions(+), 32 deletions(-)

diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c
index d8413d284e..a9b7e446c8 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c
+++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c
@@ -1,7 +1,7 @@
 /** @file
   Implementation of Fsp Misc UPD Initialization.
 
-Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -11,7 +11,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <Library/DebugLib.h>
 #include <Library/PciLib.h>
 #include <Library/PeiLib.h>
-
 #include <FspEas.h>
 #include <FspmUpd.h>
 #include <FspsUpd.h>
@@ -34,24 +33,21 @@ PeiFspMiscUpdUpdatePreMem (
 {
   EFI_STATUS                        Status;
   UINTN                             VariableSize;
-  VOID                              *MemorySavedData;
+  VOID                              *FspNvsBufferPtr;
   UINT8                             MorControl;
   VOID                              *MorControlPtr;
 
   //
   // Initialize S3 Data variable (S3DataPtr). It may be used for warm and fast boot paths.
   //
-  VariableSize = 0;
-  MemorySavedData = NULL;
-  Status = PeiGetVariable (
-             L"MemoryConfig",
-             &gFspNonVolatileStorageHobGuid,
-             &MemorySavedData,
-             &VariableSize
-             );
-  DEBUG ((DEBUG_INFO, "Get L\"MemoryConfig\" gFspNonVolatileStorageHobGuid - %r\n", Status));
-  DEBUG ((DEBUG_INFO, "MemoryConfig Size - 0x%x\n", VariableSize));
-  FspmUpd->FspmArchUpd.NvsBufferPtr = MemorySavedData;
+  FspNvsBufferPtr   = NULL;
+  VariableSize  = 0;
+  Status = PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableGuid, &FspNvsBufferPtr, &VariableSize);
+  if (Status == EFI_SUCCESS) {
+    DEBUG ((DEBUG_INFO, "Get L\"FspNvsBuffer\" gFspNvsBufferVariableGuid - %r\n", Status));
+    DEBUG ((DEBUG_INFO, "FspNvsBuffer Size - 0x%x\n", VariableSize));
+    FspmUpd->FspmArchUpd.NvsBufferPtr = FspNvsBufferPtr;
+  }
 
   if (FspmUpd->FspmArchUpd.NvsBufferPtr != NULL) {
     //
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c
index c9dfb17e0a..3764f7c3ac 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c
+++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c
@@ -431,8 +431,8 @@ SiliconPolicyUpdatePreMem (
   SA_MISC_PEI_PREMEM_CONFIG     *MiscPeiPreMemConfig;
   MEMORY_CONFIG_NO_CRC          *MemConfigNoCrc;
   VOID                          *Buffer;
-  UINTN                         VariableSize;
-  VOID                          *MemorySavedData;
+  UINTN                         FspNvsBufferSize;
+  VOID                          *FspNvsBufferPtr;
   UINT8                         SpdAddressTable[4];
 
   DEBUG((DEBUG_INFO, "\nUpdating Policy in Pre-Mem\n"));
@@ -463,18 +463,13 @@ SiliconPolicyUpdatePreMem (
       // Note: AmberLake FSP does not implement the FSPM_ARCH_CONFIG_PPI added in FSP 2.1, hence
       // the platform specific S3DataPtr must be used instead.
       //
-      VariableSize = 0;
-      MemorySavedData = NULL;
-      Status = PeiGetVariable (
-                L"MemoryConfig",
-                &gFspNonVolatileStorageHobGuid,
-                &MemorySavedData,
-                &VariableSize
-                );
-      DEBUG ((DEBUG_INFO, "Get L\"MemoryConfig\" gFspNonVolatileStorageHobGuid - %r\n", Status));
-      DEBUG ((DEBUG_INFO, "MemoryConfig Size - 0x%x\n", VariableSize));
-      if (!EFI_ERROR (Status)) {
-        MiscPeiPreMemConfig->S3DataPtr = MemorySavedData;
+      FspNvsBufferPtr   = NULL;
+      FspNvsBufferSize  = 0;
+      Status = PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableGuid, &FspNvsBufferPtr, &FspNvsBufferSize);
+      if (Status == EFI_SUCCESS) {
+        DEBUG ((DEBUG_INFO, "Get L\"FspNvsBuffer\" gFspNvsBufferVariableGuid - %r\n", Status));
+        DEBUG ((DEBUG_INFO, "FspNvsBuffer Size - 0x%x\n", FspNvsBufferSize));
+        MiscPeiPreMemConfig->S3DataPtr = FspNvsBufferPtr;
       }
 
       //
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf
index e4a657c5f1..eac9344b0a 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf
+++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf
@@ -1,7 +1,7 @@
 ## @file
 #  Provide FSP wrapper platform related function.
 #
-# Copyright (c) 2017 - 2020 Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2017 - 2021 Intel Corporation. All rights reserved.<BR>
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -74,7 +74,6 @@
   PchInfoLib
   PchHsioLib
   PchPcieRpLib
-  MemoryAllocationLib
   SiPolicyLib
   PeiLib
 
@@ -134,9 +133,11 @@
   gKabylakeOpenBoardPkgTokenSpaceGuid.PcdAudioConnector
 
   gKabylakeOpenBoardPkgTokenSpaceGuid.PcdGraphicsVbtGuid
+  gIntelFsp2WrapperTokenSpaceGuid.PcdFspmUpdDataAddress
+  gKabylakeOpenBoardPkgTokenSpaceGuid.PcdRootPort4ClkInfo
 
 [Guids]
-  gFspNonVolatileStorageHobGuid                 ## CONSUMES
+  gFspNvsBufferVariableGuid                     ## CONSUMES
   gTianoLogoGuid                                ## CONSUMES
   gEfiMemoryOverwriteControlDataGuid
 
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf
index 0a8cf91b07..4dcc000186 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf
+++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf
@@ -52,7 +52,7 @@
   gHsioPciePreMemConfigGuid                     ## CONSUMES
   gHsioSataPreMemConfigGuid                     ## CONSUMES
   gSaMiscPeiPreMemConfigGuid                    ## CONSUMES
-  gFspNonVolatileStorageHobGuid                 ## CONSUMES
+  gFspNvsBufferVariableGuid                     ## CONSUMES
   gIoApicConfigGuid                             ## CONSUMES
   gHpetPreMemConfigGuid                         ## CONSUMES
   gLockDownConfigGuid
-- 
2.28.0.windows.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [edk2-platforms: PATCH v5 4/9] KabylakeOpenBoardPkg/GalagoPro3: Use same variable name for FspNvsHob.
  2021-10-14  9:16 [edk2-platforms: PATCH v5 0/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2 Chiu, Chasel
                   ` (2 preceding siblings ...)
  2021-10-14  9:16 ` [edk2-platforms: PATCH v5 3/9] KabylakeOpenBoardPkg/AspireVn7Dash572G:Use " Chiu, Chasel
@ 2021-10-14  9:16 ` Chiu, Chasel
  2021-10-14  9:16 ` [edk2-platforms: PATCH v5 5/9] KabylakeOpenBoardPkg/KabylakeRvp3: " Chiu, Chasel
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Chiu, Chasel @ 2021-10-14  9:16 UTC (permalink / raw)
  To: devel; +Cc: Chasel Chiu, Nate DeSimone, Jeremy Soller

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3678

To simplify the implementation the variable Name/GUID has been
changed to "FspNvsBuffer" and gFspNvsBufferVariableGuid
regardless it stores the data from FSP_NON_VOLATILE_STORAGE_HOB2
or FSP_NON_VOLATILE_STORAGE_HOB.

Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Jeremy Soller <jeremy@system76.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
---
 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c         | 25 +++++++++++--------------
 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf |  5 ++---
 2 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c
index 9d6c0176f6..dbc84631ac 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c
@@ -1,7 +1,7 @@
 /** @file
   Implementation of Fsp Misc UPD Initialization.
 
-Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.<BR>
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -16,7 +16,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <FspmUpd.h>
 #include <FspsUpd.h>
 
-#include <Library/MemoryAllocationLib.h>
 #include <Library/DebugLib.h>
 #include <Library/DebugPrintErrorLevelLib.h>
 #include <Library/PciLib.h>
@@ -38,24 +37,22 @@ PeiFspMiscUpdUpdatePreMem (
 {
   EFI_STATUS                        Status;
   UINTN                             VariableSize;
-  VOID                              *MemorySavedData;
+  VOID                              *FspNvsBufferPtr;
   UINT8                             MorControl;
   VOID                              *MorControlPtr;
 
   //
   // Initialize S3 Data variable (S3DataPtr). It may be used for warm and fast boot paths.
   //
-  VariableSize = 0;
-  MemorySavedData = NULL;
-  Status = PeiGetVariable (
-             L"MemoryConfig",
-             &gFspNonVolatileStorageHobGuid,
-             &MemorySavedData,
-             &VariableSize
-             );
-  DEBUG ((DEBUG_INFO, "Get L\"MemoryConfig\" gFspNonVolatileStorageHobGuid - %r\n", Status));
-  DEBUG ((DEBUG_INFO, "MemoryConfig Size - 0x%x\n", VariableSize));
-  FspmUpd->FspmArchUpd.NvsBufferPtr = MemorySavedData;
+  FspNvsBufferPtr = NULL;
+  VariableSize    = 0;
+
+  Status = PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableGuid, &FspNvsBufferPtr, &VariableSize);
+  if (Status == EFI_SUCCESS) {
+    DEBUG ((DEBUG_INFO, "Get L\"FspNvsBuffer\" gFspNvsBufferVariableGuid - %r\n", Status));
+    DEBUG ((DEBUG_INFO, "FspNvsBuffer Size - 0x%x\n", VariableSize));
+    FspmUpd->FspmArchUpd.NvsBufferPtr = FspNvsBufferPtr;
+  }
 
   if (FspmUpd->FspmArchUpd.NvsBufferPtr != NULL) {
     //
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf
index 463455c90b..ceefe7639e 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf
@@ -1,7 +1,7 @@
 ## @file
 #  FSP wrapper silicon policy update library.
 #
-# Copyright (c) 2019 - 2020 Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2019 - 2021 Intel Corporation. All rights reserved.<BR>
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -81,7 +81,6 @@
   PchInfoLib
   PchHsioLib
   PchPcieRpLib
-  MemoryAllocationLib
   CpuMailboxLib
   DebugPrintErrorLevelLib
   SiPolicyLib
@@ -138,7 +137,7 @@
   gKabylakeOpenBoardPkgTokenSpaceGuid.PcdGraphicsVbtGuid
 
 [Guids]
-  gFspNonVolatileStorageHobGuid                 ## CONSUMES
+  gFspNvsBufferVariableGuid                     ## CONSUMES
   gTianoLogoGuid                                ## CONSUMES
   gEfiMemoryOverwriteControlDataGuid
 
-- 
2.28.0.windows.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [edk2-platforms: PATCH v5 5/9] KabylakeOpenBoardPkg/KabylakeRvp3: Use same variable name for FspNvsHob.
  2021-10-14  9:16 [edk2-platforms: PATCH v5 0/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2 Chiu, Chasel
                   ` (3 preceding siblings ...)
  2021-10-14  9:16 ` [edk2-platforms: PATCH v5 4/9] KabylakeOpenBoardPkg/GalagoPro3: Use " Chiu, Chasel
@ 2021-10-14  9:16 ` Chiu, Chasel
  2021-10-14  9:16 ` [edk2-platforms: PATCH v5 6/9] TigerlakeOpenBoardPkg: " Chiu, Chasel
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Chiu, Chasel @ 2021-10-14  9:16 UTC (permalink / raw)
  To: devel; +Cc: Chasel Chiu, Nate DeSimone

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3678

To simplify the implementation the variable Name/GUID has been
changed to "FspNvsBuffer" and gFspNvsBufferVariableGuid
regardless it stores the data from FSP_NON_VOLATILE_STORAGE_HOB2
or FSP_NON_VOLATILE_STORAGE_HOB.

Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
---
 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c         | 25 ++++++++++---------------
 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c             | 23 +++++++++--------------
 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf |  5 ++---
 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf           |  2 +-
 4 files changed, 22 insertions(+), 33 deletions(-)

diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c
index d8aff1960f..699f4297fa 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c
@@ -1,7 +1,7 @@
 /** @file
   Implementation of Fsp Misc UPD Initialization.
 
-Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -16,7 +16,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <FspmUpd.h>
 #include <FspsUpd.h>
 
-#include <Library/MemoryAllocationLib.h>
 #include <Library/DebugLib.h>
 #include <Library/DebugPrintErrorLevelLib.h>
 #include <Library/PciLib.h>
@@ -38,25 +37,21 @@ PeiFspMiscUpdUpdatePreMem (
 {
   EFI_STATUS                        Status;
   UINTN                             VariableSize;
-  VOID                              *MemorySavedData;
+  VOID                              *FspNvsBufferPtr;
   UINT8                             MorControl;
   VOID                              *MorControlPtr;
 
   //
   // Initialize S3 Data variable (S3DataPtr). It may be used for warm and fast boot paths.
   //
-  VariableSize = 0;
-  MemorySavedData = NULL;
-  Status = PeiGetVariable (
-             L"MemoryConfig",
-             &gFspNonVolatileStorageHobGuid,
-             &MemorySavedData,
-             &VariableSize
-             );
-  DEBUG ((DEBUG_INFO, "Get L\"MemoryConfig\" gFspNonVolatileStorageHobGuid - %r\n", Status));
-  DEBUG ((DEBUG_INFO, "MemoryConfig Size - 0x%x\n", VariableSize));
-  FspmUpd->FspmArchUpd.NvsBufferPtr = MemorySavedData;
-
+  FspNvsBufferPtr   = NULL;
+  VariableSize  = 0;
+  Status = PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableGuid, &FspNvsBufferPtr, &VariableSize);
+  if (Status == EFI_SUCCESS) {
+    DEBUG ((DEBUG_INFO, "Get L\"FspNvsBuffer\" gFspNvsBufferVariableGuid - %r\n", Status));
+    DEBUG ((DEBUG_INFO, "FspNvsBuffer Size - 0x%x\n", VariableSize));
+    FspmUpd->FspmArchUpd.NvsBufferPtr = FspNvsBufferPtr;
+  }
   if (FspmUpd->FspmArchUpd.NvsBufferPtr != NULL) {
     //
     // Set the DISB bit in PCH (DRAM Initialization Scratchpad Bit - GEN_PMCON_A[23]),
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c
index 2dce9be63c..22aadc0221 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c
@@ -398,8 +398,8 @@ SiliconPolicyUpdatePreMem (
   SA_MISC_PEI_PREMEM_CONFIG     *MiscPeiPreMemConfig;
   MEMORY_CONFIG_NO_CRC          *MemConfigNoCrc;
   VOID                          *Buffer;
-  UINTN                         VariableSize;
-  VOID                          *MemorySavedData;
+  UINTN                         FspNvsBufferSize;
+  VOID                          *FspNvsBufferPtr;
   UINT8                         SpdAddressTable[4];
 
   DEBUG((DEBUG_INFO, "\nUpdating Policy in Pre-Mem\n"));
@@ -430,18 +430,13 @@ SiliconPolicyUpdatePreMem (
       // Note: AmberLake FSP does not implement the FSPM_ARCH_CONFIG_PPI added in FSP 2.1, hence
       // the platform specific S3DataPtr must be used instead.
       //
-      VariableSize = 0;
-      MemorySavedData = NULL;
-      Status = PeiGetVariable (
-                L"MemoryConfig",
-                &gFspNonVolatileStorageHobGuid,
-                &MemorySavedData,
-                &VariableSize
-                );
-      DEBUG ((DEBUG_INFO, "Get L\"MemoryConfig\" gFspNonVolatileStorageHobGuid - %r\n", Status));
-      DEBUG ((DEBUG_INFO, "MemoryConfig Size - 0x%x\n", VariableSize));
-      if (!EFI_ERROR (Status)) {
-        MiscPeiPreMemConfig->S3DataPtr = MemorySavedData;
+      FspNvsBufferPtr   = NULL;
+      FspNvsBufferSize  = 0;
+      Status = PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableGuid, &FspNvsBufferPtr, &FspNvsBufferSize);
+      if (Status == EFI_SUCCESS) {
+        DEBUG ((DEBUG_INFO, "Get L\"FspNvsBuffer\" gFspNvsBufferVariableGuid - %r\n", Status));
+        DEBUG ((DEBUG_INFO, "FspNvsBuffer Size - 0x%x\n", FspNvsBufferSize));
+        MiscPeiPreMemConfig->S3DataPtr = FspNvsBufferPtr;
       }
 
       //
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf
index f8bec0c852..dacec18cd9 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf
@@ -1,7 +1,7 @@
 ## @file
 #  Provide FSP wrapper platform related function.
 #
-# Copyright (c) 2017 - 2020 Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2017 - 2021 Intel Corporation. All rights reserved.<BR>
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -80,7 +80,6 @@
   PchInfoLib
   PchHsioLib
   PchPcieRpLib
-  MemoryAllocationLib
   CpuMailboxLib
   DebugPrintErrorLevelLib
   SiPolicyLib
@@ -141,7 +140,7 @@
   gKabylakeOpenBoardPkgTokenSpaceGuid.PcdGraphicsVbtGuid
 
 [Guids]
-  gFspNonVolatileStorageHobGuid                 ## CONSUMES
+  gFspNvsBufferVariableGuid                     ## CONSUMES
   gTianoLogoGuid                                ## CONSUMES
   gEfiMemoryOverwriteControlDataGuid
 
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf
index 5c2da68bf9..4b30ba02ea 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf
@@ -50,7 +50,7 @@
   gHsioPciePreMemConfigGuid                     ## CONSUMES
   gHsioSataPreMemConfigGuid                     ## CONSUMES
   gSaMiscPeiPreMemConfigGuid                    ## CONSUMES
-  gFspNonVolatileStorageHobGuid                 ## CONSUMES
+  gFspNvsBufferVariableGuid                     ## CONSUMES
 
 [Pcd]
   gSiPkgTokenSpaceGuid.PcdPeiMinMemorySize
-- 
2.28.0.windows.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [edk2-platforms: PATCH v5 6/9] TigerlakeOpenBoardPkg: Use same variable name for FspNvsHob.
  2021-10-14  9:16 [edk2-platforms: PATCH v5 0/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2 Chiu, Chasel
                   ` (4 preceding siblings ...)
  2021-10-14  9:16 ` [edk2-platforms: PATCH v5 5/9] KabylakeOpenBoardPkg/KabylakeRvp3: " Chiu, Chasel
@ 2021-10-14  9:16 ` Chiu, Chasel
  2021-10-14  9:16 ` [edk2-platforms: PATCH v5 7/9] WhiskeylakeOpenBoardPkg: " Chiu, Chasel
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Chiu, Chasel @ 2021-10-14  9:16 UTC (permalink / raw)
  To: devel; +Cc: Chasel Chiu, Sai Chaganty, Nate DeSimone, Heng Luo

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3678

To simplify the implementation the variable Name/GUID has been
changed to "FspNvsBuffer" and gFspNvsBufferVariableGuid
regardless it stores the data from FSP_NON_VOLATILE_STORAGE_HOB2
or FSP_NON_VOLATILE_STORAGE_HOB.

Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Heng Luo <heng.luo@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
Reviewed-by: Heng Luo <heng.luo@intel.com>
---
 Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.c   | 21 ++++++++++++++++++---
 Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf |  1 +
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.c b/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.c
index fc523e93d1..938b74e5d8 100644
--- a/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.c
+++ b/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.c
@@ -9,7 +9,9 @@
 #include <Library/FspWrapperApiLib.h>
 #include <Library/BaseMemoryLib.h>
 #include <Library/MemoryAllocationLib.h>
+#include <Library/PeiLib.h>
 #include <Ppi/FspmArchConfigPpi.h>
+#include <PolicyUpdateMacro.h>
 
 VOID
 EFIAPI
@@ -70,9 +72,11 @@ SiliconPolicyDonePreMem(
 )
 {
   EFI_STATUS                   Status;
+  UINTN                        FspNvsBufferSize;
+  VOID                         *FspNvsBufferPtr;
 #if FixedPcdGet8(PcdFspModeSelection) == 0
-  FSPM_ARCH_CONFIG_PPI                  *FspmArchConfigPpi;
-  EFI_PEI_PPI_DESCRIPTOR                *FspmArchConfigPpiDesc;
+  FSPM_ARCH_CONFIG_PPI         *FspmArchConfigPpi;
+  EFI_PEI_PPI_DESCRIPTOR       *FspmArchConfigPpiDesc;
 
   FspmArchConfigPpi = (FSPM_ARCH_CONFIG_PPI *) AllocateZeroPool (sizeof (FSPM_ARCH_CONFIG_PPI));
   if (FspmArchConfigPpi == NULL) {
@@ -80,7 +84,6 @@ SiliconPolicyDonePreMem(
     return EFI_OUT_OF_RESOURCES;
   }
   FspmArchConfigPpi->Revision            = 1;
-  FspmArchConfigPpi->NvsBufferPtr        = NULL;
   FspmArchConfigPpi->BootLoaderTolumSize = 0;
 
   FspmArchConfigPpiDesc = (EFI_PEI_PPI_DESCRIPTOR *) AllocateZeroPool (sizeof (EFI_PEI_PPI_DESCRIPTOR));
@@ -98,6 +101,18 @@ SiliconPolicyDonePreMem(
   ASSERT_EFI_ERROR (Status);
 #endif
 
+  //
+  // Initialize S3 Data variable (S3DataPtr). It may be used for warm and fast boot paths.
+  //
+  FspNvsBufferPtr   = NULL;
+  FspNvsBufferSize  = 0;
+  Status = PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableGuid, &FspNvsBufferPtr, &FspNvsBufferSize);
+  if (Status == EFI_SUCCESS) {
+    DEBUG ((DEBUG_INFO, "Get L\"FspNvsBuffer\" gFspNvsBufferVariableGuid - %r\n", Status));
+    DEBUG ((DEBUG_INFO, "FspNvsBuffer Size - 0x%x\n", FspNvsBufferSize));
+    UPDATE_POLICY (((FSPM_UPD *) FspmUpd)->FspmArchUpd.NvsBufferPtr, FspmArchConfigPpi->NvsBufferPtr, FspNvsBufferPtr);
+  }
+
   //
   // Install Policy Ready PPI
   // While installed, RC assumes the Policy is ready and finalized. So please
diff --git a/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf b/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf
index 708fbac08f..0236ae45ae 100644
--- a/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf
+++ b/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf
@@ -181,3 +181,4 @@
   gTianoLogoGuid                          ## CONSUMES
   gCnviConfigGuid                         ## CONSUMES
   gHdAudioPreMemConfigGuid                ## CONSUMES
+  gFspNvsBufferVariableGuid               ## CONSUMES
-- 
2.28.0.windows.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [edk2-platforms: PATCH v5 7/9] WhiskeylakeOpenBoardPkg: Use same variable name for FspNvsHob.
  2021-10-14  9:16 [edk2-platforms: PATCH v5 0/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2 Chiu, Chasel
                   ` (5 preceding siblings ...)
  2021-10-14  9:16 ` [edk2-platforms: PATCH v5 6/9] TigerlakeOpenBoardPkg: " Chiu, Chasel
@ 2021-10-14  9:16 ` Chiu, Chasel
  2021-10-14  9:16 ` [edk2-platforms: PATCH v5 8/9] WhitleyOpenBoardPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2 Chiu, Chasel
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Chiu, Chasel @ 2021-10-14  9:16 UTC (permalink / raw)
  To: devel; +Cc: Chasel Chiu, Nate DeSimone

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3678

To simplify the implementation the variable Name/GUID has been
changed to "FspNvsBuffer" and gFspNvsBufferVariableGuid
regardless it stores the data from FSP_NON_VOLATILE_STORAGE_HOB2
or FSP_NON_VOLATILE_STORAGE_HOB.

Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
---
 Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c                  | 63 ++++++++++++---------------------------------------------------
 Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c         | 63 ++++++++++++---------------------------------------------------
 Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf          |  5 ++---
 Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf |  4 ++--
 Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/Include/Fdf/FlashMapInclude.fdf                                                  | 18 +++++++++---------
 5 files changed, 37 insertions(+), 116 deletions(-)

diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c b/Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c
index a341a58930..ab35bc3f8f 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c
@@ -2,7 +2,7 @@
   Implementation of Fsp Misc UPD Initialization.
 
 
-  Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
@@ -17,11 +17,9 @@
 #include <FspmUpd.h>
 #include <FspsUpd.h>
 
-#include <Library/MemoryAllocationLib.h>
 #include <Library/DebugLib.h>
 #include <Library/DebugPrintErrorLevelLib.h>
 #include <Library/PciLib.h>
-#include <Ppi/ReadOnlyVariable2.h>
 #include <Guid/MemoryOverwriteControl.h>
 #include <PchAccess.h>
 
@@ -44,55 +42,18 @@ PeiFspMiscUpdUpdatePreMem (
   )
 {
   EFI_STATUS                        Status;
-  EFI_PEI_READ_ONLY_VARIABLE2_PPI   *VariableServices;
-  UINTN                             VariableSize;
-  VOID                              *MemorySavedData;
-
-  Status = PeiServicesLocatePpi (
-             &gEfiPeiReadOnlyVariable2PpiGuid,
-             0,
-             NULL,
-             (VOID **) &VariableServices
-             );
-  if (EFI_ERROR (Status)) {
-    ASSERT_EFI_ERROR (Status);
-    return Status;
-  }
-
-  VariableSize = 0;
-  MemorySavedData = NULL;
-  Status = VariableServices->GetVariable (
-                               VariableServices,
-                               L"MemoryConfig",
-                               &gFspNonVolatileStorageHobGuid,
-                               NULL,
-                               &VariableSize,
-                               MemorySavedData
-                               );
-  if (Status == EFI_BUFFER_TOO_SMALL) {
-    MemorySavedData = AllocatePool (VariableSize);
-    if (MemorySavedData == NULL) {
-      ASSERT (MemorySavedData != NULL);
-      return EFI_OUT_OF_RESOURCES;
-    }
-
-    DEBUG ((DEBUG_INFO, "VariableSize is 0x%x\n", VariableSize));
-    Status = VariableServices->GetVariable (
-                                 VariableServices,
-                                 L"MemoryConfig",
-                                 &gFspNonVolatileStorageHobGuid,
-                                 NULL,
-                                 &VariableSize,
-                                 MemorySavedData
-                                 );
-    if (Status == EFI_SUCCESS) {
-      FspmUpd->FspmArchUpd.NvsBufferPtr = MemorySavedData;
-    } else {
-      DEBUG ((DEBUG_ERROR, "Fail to retrieve Variable:\"MemoryConfig\" gMemoryConfigVariableGuid, Status = %r\n", Status));
-      ASSERT_EFI_ERROR (Status);
-    }
+  UINTN                             FspNvsBufferSize;
+  VOID                              *FspNvsBufferPtr;
+
+  FspNvsBufferPtr   = NULL;
+  FspNvsBufferSize  = 0;
+  Status = PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableGuid, &FspNvsBufferPtr, &FspNvsBufferSize);
+  if (Status == EFI_SUCCESS) {
+    FspmUpd->FspmArchUpd.NvsBufferPtr = FspNvsBufferPtr;
+  } else {
+    DEBUG ((DEBUG_INFO, "Cannot create FSP NVS Buffer, UEFI variable does not exist (this is likely a first boot)\n"));
+    FspmUpd->FspmArchUpd.NvsBufferPtr = NULL;
   }
-  FspmUpd->FspmArchUpd.NvsBufferPtr = MemorySavedData;
 
   return EFI_SUCCESS;
 }
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c
index 145deb5de3..381ef232ea 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c
@@ -2,7 +2,7 @@
   Implementation of Fsp Misc UPD Initialization.
 
 
-  Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
@@ -18,11 +18,9 @@
 #include <FspmUpd.h>
 #include <FspsUpd.h>
 
-#include <Library/MemoryAllocationLib.h>
 #include <Library/DebugLib.h>
 #include <Library/DebugPrintErrorLevelLib.h>
 #include <Library/PciLib.h>
-#include <Ppi/ReadOnlyVariable2.h>
 #include <Guid/MemoryOverwriteControl.h>
 #include <PchAccess.h>
 #include <Platform.h>
@@ -46,54 +44,17 @@ PeiFspMiscUpdUpdatePreMem (
   )
 {
   EFI_STATUS                        Status;
-  EFI_PEI_READ_ONLY_VARIABLE2_PPI   *VariableServices;
-  UINTN                             VariableSize;
-  VOID                              *MemorySavedData;
-
-  Status = PeiServicesLocatePpi (
-             &gEfiPeiReadOnlyVariable2PpiGuid,
-             0,
-             NULL,
-             (VOID **) &VariableServices
-             );
-  if (EFI_ERROR (Status)) {
-    ASSERT_EFI_ERROR (Status);
-    return Status;
-  }
-
-  VariableSize = 0;
-  MemorySavedData = NULL;
-  Status = VariableServices->GetVariable (
-                               VariableServices,
-                               L"MemoryConfig",
-                               &gFspNonVolatileStorageHobGuid,
-                               NULL,
-                               &VariableSize,
-                               MemorySavedData
-                               );
-  if (Status == EFI_BUFFER_TOO_SMALL) {
-    MemorySavedData = AllocatePool (VariableSize);
-    if (MemorySavedData == NULL) {
-      ASSERT (MemorySavedData != NULL);
-      return EFI_OUT_OF_RESOURCES;
-    }
-
-    DEBUG ((DEBUG_INFO, "VariableSize is 0x%x\n", VariableSize));
-    Status = VariableServices->GetVariable (
-                                 VariableServices,
-                                 L"MemoryConfig",
-                                 &gFspNonVolatileStorageHobGuid,
-                                 NULL,
-                                 &VariableSize,
-                                 MemorySavedData
-                                 );
-    if (Status == EFI_SUCCESS) {
-      FspmUpd->FspmArchUpd.NvsBufferPtr = MemorySavedData;
-    } else {
-      FspmUpd->FspmArchUpd.NvsBufferPtr = NULL;
-      DEBUG ((DEBUG_ERROR, "Fail to retrieve Variable:\"MemoryConfig\" gMemoryConfigVariableGuid, Status = %r\n", Status));
-      ASSERT_EFI_ERROR (Status);
-    }
+  UINTN                             FspNvsBufferSize;
+  VOID                              *FspNvsBufferPtr;
+
+  FspNvsBufferPtr   = NULL;
+  FspNvsBufferSize  = 0;
+  Status = PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableGuid, &FspNvsBufferPtr, &FspNvsBufferSize);
+  if (Status == EFI_SUCCESS) {
+    FspmUpd->FspmArchUpd.NvsBufferPtr = FspNvsBufferPtr;
+  } else {
+    DEBUG ((DEBUG_INFO, "Cannot create FSP NVS Buffer, UEFI variable does not exist (this is likely a first boot)\n"));
+    FspmUpd->FspmArchUpd.NvsBufferPtr = NULL;
   }
 
   FspmUpd->FspmConfig.TsegSize              = FixedPcdGet32 (PcdTsegSize);
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf b/Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf
index 2c90d0cb94..362dc2c995 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf
@@ -2,7 +2,7 @@
 #  Provide FSP wrapper platform related function.
 #
 #
-#  Copyright (c) 2019 - 2020 Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2019 - 2021 Intel Corporation. All rights reserved.<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -82,7 +82,6 @@
   PchInfoLib
   PchHsioLib
   PchPcieRpLib
-  MemoryAllocationLib
   DebugPrintErrorLevelLib
   SiPolicyLib
   PchGbeLib
@@ -132,7 +131,7 @@
   gWhiskeylakeOpenBoardPkgTokenSpaceGuid.PcdMrcSpdAddressTable3
 
 [Guids]
-  gFspNonVolatileStorageHobGuid                 ## CONSUMES
+  gFspNvsBufferVariableGuid                     ## CONSUMES
   gTianoLogoGuid                                ## CONSUMES
   gEfiMemoryOverwriteControlDataGuid
 
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf
index 529c2f1253..1a664b1327 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf
@@ -2,7 +2,7 @@
 #  FSP silicon policy updates for the Up Xtreme board.
 #
 #
-#  Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -136,7 +136,7 @@
   gWhiskeylakeOpenBoardPkgTokenSpaceGuid.PcdBoardBomId
 
 [Guids]
-  gFspNonVolatileStorageHobGuid                 ## CONSUMES
+  gFspNvsBufferVariableGuid                     ## CONSUMES
   gTianoLogoGuid                                ## CONSUMES
   gEfiMemoryOverwriteControlDataGuid
 
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/Include/Fdf/FlashMapInclude.fdf b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/Include/Fdf/FlashMapInclude.fdf
index f7aa730ae7..698efce248 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/Include/Fdf/FlashMapInclude.fdf
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/Include/Fdf/FlashMapInclude.fdf
@@ -2,7 +2,7 @@
 #  Flash map for the UpXtreme Board.
 #
 #
-#  Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -35,16 +35,16 @@ SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootSize              = 0x00090000
 SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootOffset          = 0x00190000  # Flash addr (0xFFAE0000)
 SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootSize            = 0x00190000  #
 SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryOffset        = 0x00320000  # Flash addr (0xFFC70000)
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemorySize          = 0x00170000  #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSOffset              = 0x00490000  # Flash addr (0xFFDE0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemorySize          = 0x00160000  #
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSOffset              = 0x00480000  # Flash addr (0xFFDD0000)
 SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSSize                = 0x00070000  #
-SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvOffset                  = 0x00500000  # Flash addr (0xFFE50000)
+SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvOffset                  = 0x004F0000  # Flash addr (0xFFE40000)
 SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize                    = 0x00050000  #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMOffset              = 0x00550000  # Flash addr (0xFFEA0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMOffset              = 0x00540000  # Flash addr (0xFFE90000)
 SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMSize                = 0x000EA000  #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTOffset              = 0x0063A000  # Flash addr (0xFFF8A000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTOffset              = 0x0062A000  # Flash addr (0xFFF7A000)
 SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTSize                = 0x00006000  #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryOffset = 0x00640000  # Flash addr (0xFFF90000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryOffset = 0x00630000  # Flash addr (0xFFF80000)
 SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize   = 0x00010000  #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryOffset         = 0x00650000  # Flash addr (0xFFFA0000)
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize           = 0x00060000  #
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryOffset         = 0x00640000  # Flash addr (0xFFF90000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize           = 0x00070000  #
-- 
2.28.0.windows.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [edk2-platforms: PATCH v5 8/9] WhitleyOpenBoardPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2.
  2021-10-14  9:16 [edk2-platforms: PATCH v5 0/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2 Chiu, Chasel
                   ` (6 preceding siblings ...)
  2021-10-14  9:16 ` [edk2-platforms: PATCH v5 7/9] WhiskeylakeOpenBoardPkg: " Chiu, Chasel
@ 2021-10-14  9:16 ` Chiu, Chasel
  2021-10-14  9:16 ` [edk2-platforms: PATCH v5 9/9] WhitleySiliconPkg: Use same variable name for FspNvsHob Chiu, Chasel
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Chiu, Chasel @ 2021-10-14  9:16 UTC (permalink / raw)
  To: devel; +Cc: Chasel Chiu, Isaac Oram, Nate DeSimone

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>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
---
 Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSave.c   | 29 +++++++++++++++++++++++------
 Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSave.inf |  4 +++-
 Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc                          |  1 +
 3 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSave.c b/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSave.c
index 709c7ad479..01e36cda27 100644
--- a/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSave.c
+++ b/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSave.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/S3NvramSave.inf b/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSave.inf
index e62baa24c4..a77125cf44 100644
--- a/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSave.inf
+++ b/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSave.inf
@@ -43,7 +43,9 @@
   LargeVariableWriteLib
 
 [Guids]
-  gFspNonVolatileStorageHobGuid # CONSUMES
+  gFspNonVolatileStorageHobGuid  # CONSUMES
+  gFspNonVolatileStorageHob2Guid # CONSUMES
+  gFspNvsBufferVariableGuid      # PRODUCES
 
 [Pcd]
   gEfiCpRcPkgTokenSpaceGuid.PcdPeiSyshostMemorySize
diff --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


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [edk2-platforms: PATCH v5 9/9] WhitleySiliconPkg: Use same variable name for FspNvsHob.
  2021-10-14  9:16 [edk2-platforms: PATCH v5 0/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2 Chiu, Chasel
                   ` (7 preceding siblings ...)
  2021-10-14  9:16 ` [edk2-platforms: PATCH v5 8/9] WhitleyOpenBoardPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2 Chiu, Chasel
@ 2021-10-14  9:16 ` Chiu, Chasel
  2021-10-14 14:21 ` [edk2-platforms: PATCH v5 0/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2 Oram, Isaac W
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Chiu, Chasel @ 2021-10-14  9:16 UTC (permalink / raw)
  To: devel; +Cc: Chasel Chiu, Isaac Oram, Nate DeSimone

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3678

To simplify the implementation the variable Name/GUID has been
changed to "FspNvsBuffer" and gFspNvsBufferVariableGuid
regardless it stores the data from FSP_NON_VOLATILE_STORAGE_HOB2
or FSP_NON_VOLATILE_STORAGE_HOB.

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>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
---
 Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlatformLib.c   | 35 +++++++++--------------------------
 Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlatformLib.inf |  3 ++-
 2 files changed, 11 insertions(+), 27 deletions(-)

diff --git a/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlatformLib.c b/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlatformLib.c
index a6196a78b0..95a1f2a33c 100644
--- a/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlatformLib.c
+++ b/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlatformLib.c
@@ -13,7 +13,7 @@
 #include <Library/HobLib.h>
 #include <Library/MemoryAllocationLib.h>
 #include <Library/LargeVariableReadLib.h>
-
+#include <Library/PeiLib.h>
 #include <FspmUpd.h>
 #include <Guid/PlatformInfo.h>
 #include <Ppi/UpiPolicyPpi.h>
@@ -24,39 +24,22 @@ GetFspNvsBuffer (
 )
 {
   EFI_STATUS          Status;
-  UINTN                     FspNvsBufferSize;
-  VOID                      *FspNvsBufferPtr;
+  UINTN               FspNvsBufferSize;
+  VOID                *FspNvsBufferPtr;
 
   FspNvsBufferPtr   = NULL;
   FspNvsBufferSize  = 0;
-  Status = GetLargeVariable (L"FspNvsBuffer", &gFspNonVolatileStorageHobGuid, &FspNvsBufferSize, NULL);
-  if (Status == EFI_BUFFER_TOO_SMALL) {
-    DEBUG ((DEBUG_INFO, "FspNvsBuffer Size = %d\n", FspNvsBufferSize));
-    FspNvsBufferPtr = AllocateZeroPool (FspNvsBufferSize);
-    if (FspNvsBufferPtr == NULL) {
-      DEBUG ((DEBUG_ERROR, "Error: Cannot create FspNvsBuffer, out of memory!\n"));
-    ASSERT (FALSE);
-    return NULL;
-  }
-    Status = GetLargeVariable (L"FspNvsBuffer", &gFspNonVolatileStorageHobGuid, &FspNvsBufferSize, FspNvsBufferPtr);
-    if (EFI_ERROR (Status)) {
-      DEBUG ((DEBUG_ERROR, "Error: Unable to read FspNvsBuffer UEFI variable Status: %r\n", Status));
-      ASSERT_EFI_ERROR (Status);
-    return NULL;
-  }
-
+  Status = PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableGuid, &FspNvsBufferPtr, &FspNvsBufferSize);
+  if (Status == EFI_SUCCESS) {
     return FspNvsBufferPtr;
-
-  } else if (Status == EFI_NOT_FOUND) {
-    DEBUG ((DEBUG_INFO, "Cannot create FSP NVS Buffer, UEFI variable does not exist (this is likely a first boot)\n"));
   } else {
-    DEBUG ((DEBUG_ERROR, "Error: Unable to read FspNvsBuffer UEFI variable Status: %r\n", Status));
-    ASSERT_EFI_ERROR (Status);
-  }
-
+    DEBUG ((DEBUG_INFO, "Cannot create FSP NVS Buffer, UEFI variable does not exist (this is likely a first boot)\n"));
     return NULL;
   }
 
+
+}
+
 VOID
 EFIAPI
 UpdateFspmUpdData (
diff --git a/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlatformLib.inf b/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlatformLib.inf
index 3e80ea670c..6ee15ea55f 100644
--- a/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlatformLib.inf
+++ b/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlatformLib.inf
@@ -58,11 +58,12 @@
 
 [Guids]
   gEfiPlatformInfoGuid
-  gFspNonVolatileStorageHobGuid
+  gFspNvsBufferVariableGuid      # CONSUMES
 
 [LibraryClasses]
   PeiServicesLib
   LargeVariableReadLib
+  PeiLib
 
 [Pcd]
   gIntelFsp2PkgTokenSpaceGuid.PcdTemporaryRamBase         ## CONSUMES
-- 
2.28.0.windows.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [edk2-platforms: PATCH v5 0/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2.
  2021-10-14  9:16 [edk2-platforms: PATCH v5 0/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2 Chiu, Chasel
                   ` (8 preceding siblings ...)
  2021-10-14  9:16 ` [edk2-platforms: PATCH v5 9/9] WhitleySiliconPkg: Use same variable name for FspNvsHob Chiu, Chasel
@ 2021-10-14 14:21 ` Oram, Isaac W
  2021-10-15  0:45 ` Nate DeSimone
  2021-10-15  2:51 ` Chiu, Chasel
  11 siblings, 0 replies; 13+ messages in thread
From: Oram, Isaac W @ 2021-10-14 14:21 UTC (permalink / raw)
  To: Chiu, Chasel, devel@edk2.groups.io
  Cc: Desimone, Nathaniel L, Luo, Heng, Jeremy Soller, Benjamin Doron,
	Chaganty, Rangasai V, Kethi Reddy, Deepika,
	Esakkithevar, Kathappan, Liming Gao, Dong, Eric

Series Reviewed-by: Isaac Oram <isaac.w.oram@intel.com>

-----Original Message-----
From: Chiu, Chasel <chasel.chiu@intel.com> 
Sent: Thursday, October 14, 2021 2:16 AM
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>; Luo, Heng <heng.luo@intel.com>; Jeremy Soller <jeremy@system76.com>; Benjamin Doron <benjamin.doron00@gmail.com>; Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Kethi Reddy, Deepika <deepika.kethi.reddy@intel.com>; Esakkithevar, Kathappan <kathappan.esakkithevar@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Dong, Eric <eric.dong@intel.com>
Subject: [edk2-platforms: PATCH v5 0/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2.

V5:
Fix GCC build failure in LargeVariableWriteLib.c

V4:
  . Switched to LargeVariableRead(Write)Lib in SaveMemoryConfig driver
  . Fixed tailing white space issue in PeiLib.c/.h
  . Updated function descriptions for PeiGetVariable() and PeiGetLargeVariable()
  . Added VariableReadLib to CorePeiLib.dsc for all platforms
  . Fixed white space issue in GalagoPro3/.../PeiFspMiscUpdUpdateLib.c

V3:
Fix another GCC build failure.

V2:
Fix GCC build failures.

V1:
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>
Cc: Heng Luo <heng.luo@intel.com>
Cc: Jeremy Soller <jeremy@system76.com>
Cc: Benjamin Doron <benjamin.doron00@gmail.com>
Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
Cc: Deepika Kethi Reddy <deepika.kethi.reddy@intel.com>
Cc: Kathappan Esakkithevar <kathappan.esakkithevar@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>

Chasel Chiu (9):
  MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2.
  CometlakeOpenBoardPkg: Use same variable name for FspNvsHob.
  KabylakeOpenBoardPkg/AspireVn7Dash572G:Use same variable name for
    FspNvsHob
  KabylakeOpenBoardPkg/GalagoPro3: Use same variable name for FspNvsHob.
  KabylakeOpenBoardPkg/KabylakeRvp3: Use same variable name for
    FspNvsHob.
  TigerlakeOpenBoardPkg: Use same variable name for FspNvsHob.
  WhiskeylakeOpenBoardPkg: Use same variable name for FspNvsHob.
  WhitleyOpenBoardPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2.
  WhitleySiliconPkg: Use same variable name for FspNvsHob.

 Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c                          |  63 ++++++++++++++-------------------------------------------------
 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c         |  24 ++++++++++--------------
 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c             |  23 +++++++++--------------
 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c                |  25 +++++++++++--------------
 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c              |  25 ++++++++++---------------
 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c                  |  23 +++++++++--------------
 Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.c                                                           | 109 ++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------
 Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariableWriteLib.c                                                     |   2 +-
 Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.c                                                                                  |  89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------
 Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/PeiVariableReadLib.c                                                          |   4 ++--
 Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.c                                      |  21 ++++++++++++++++++---
 Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c                        |  63 ++++++++++++---------------------------------------------------
 Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c               |  63 ++++++++++++---------------------------------------------------
 Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSave.c                                                              |  29 +++++++++++++++++++++++------
 Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlatformLib.c                                                  |  35 +++++++++--------------------------
 Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf                  |   5 ++---
 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf |   7 ++++---
 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf           |   2 +-
 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf        |   5 ++---
 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf      |   5 ++---
 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf                |   2 +-
 Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.inf                                                         |   8 ++++++--
 Platform/Intel/MinPlatformPkg/Include/Dsc/CorePeiLib.dsc                                                                               |   1 +
 Platform/Intel/MinPlatformPkg/Include/Library/PeiLib.h                                                                                 |  40 +++++++++++++++++++++++++++++++++++-----
 Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.inf                                                                                |   4 +++-
 Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec                                                                                       |   1 +
 Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf                                    |   1 +
 Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf                |   5 ++---
 Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf       |   4 ++--
 Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/Include/Fdf/FlashMapInclude.fdf                                                        |  18 +++++++++---------
 Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSave.inf                                                            |   4 +++-
 Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc                                                                                     |   1 +
 Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlatformLib.inf                                                |   3 ++-
 33 files changed, 345 insertions(+), 369 deletions(-)

--
2.28.0.windows.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [edk2-platforms: PATCH v5 0/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2.
  2021-10-14  9:16 [edk2-platforms: PATCH v5 0/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2 Chiu, Chasel
                   ` (9 preceding siblings ...)
  2021-10-14 14:21 ` [edk2-platforms: PATCH v5 0/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2 Oram, Isaac W
@ 2021-10-15  0:45 ` Nate DeSimone
  2021-10-15  2:51 ` Chiu, Chasel
  11 siblings, 0 replies; 13+ messages in thread
From: Nate DeSimone @ 2021-10-15  0:45 UTC (permalink / raw)
  To: Chiu, Chasel, devel@edk2.groups.io
  Cc: Oram, Isaac W, Luo, Heng, Jeremy Soller, Benjamin Doron,
	Chaganty, Rangasai V, Kethi Reddy, Deepika,
	Esakkithevar, Kathappan, Liming Gao, Dong, Eric

For the series...

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

> -----Original Message-----
> From: Chiu, Chasel <chasel.chiu@intel.com>
> Sent: Thursday, October 14, 2021 2:16 AM
> 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>; Luo, Heng <heng.luo@intel.com>;
> Jeremy Soller <jeremy@system76.com>; Benjamin Doron
> <benjamin.doron00@gmail.com>; Chaganty, Rangasai V
> <rangasai.v.chaganty@intel.com>; Kethi Reddy, Deepika
> <deepika.kethi.reddy@intel.com>; Esakkithevar, Kathappan
> <kathappan.esakkithevar@intel.com>; Liming Gao
> <gaoliming@byosoft.com.cn>; Dong, Eric <eric.dong@intel.com>
> Subject: [edk2-platforms: PATCH v5 0/9] MinPlatformPkg: Support FSP 2.3
> FSP_NON_VOLATILE_STORAGE_HOB2.
> 
> V5:
> Fix GCC build failure in LargeVariableWriteLib.c
> 
> V4:
>   . Switched to LargeVariableRead(Write)Lib in SaveMemoryConfig driver
>   . Fixed tailing white space issue in PeiLib.c/.h
>   . Updated function descriptions for PeiGetVariable() and
> PeiGetLargeVariable()
>   . Added VariableReadLib to CorePeiLib.dsc for all platforms
>   . Fixed white space issue in GalagoPro3/.../PeiFspMiscUpdUpdateLib.c
> 
> V3:
> Fix another GCC build failure.
> 
> V2:
> Fix GCC build failures.
> 
> V1:
> 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>
> Cc: Heng Luo <heng.luo@intel.com>
> Cc: Jeremy Soller <jeremy@system76.com>
> Cc: Benjamin Doron <benjamin.doron00@gmail.com>
> Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
> Cc: Deepika Kethi Reddy <deepika.kethi.reddy@intel.com>
> Cc: Kathappan Esakkithevar <kathappan.esakkithevar@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Eric Dong <eric.dong@intel.com>
> Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
> 
> Chasel Chiu (9):
>   MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2.
>   CometlakeOpenBoardPkg: Use same variable name for FspNvsHob.
>   KabylakeOpenBoardPkg/AspireVn7Dash572G:Use same variable name for
>     FspNvsHob
>   KabylakeOpenBoardPkg/GalagoPro3: Use same variable name for
> FspNvsHob.
>   KabylakeOpenBoardPkg/KabylakeRvp3: Use same variable name for
>     FspNvsHob.
>   TigerlakeOpenBoardPkg: Use same variable name for FspNvsHob.
>   WhiskeylakeOpenBoardPkg: Use same variable name for FspNvsHob.
>   WhitleyOpenBoardPkg: Support FSP 2.3
> FSP_NON_VOLATILE_STORAGE_HOB2.
>   WhitleySiliconPkg: Use same variable name for FspNvsHob.
> 
> 
> Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolic
> yUpdateLibFsp/PeiFspMiscUpdUpdateLib.c                          |  63
> ++++++++++++++-------------------------------------------------
> 
> Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Li
> brary/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c         |  24
> ++++++++++--------------
> 
> Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/
> PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c             |  23
> +++++++++--------------
> 
> Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/Pei
> SiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c                |  25
> +++++++++++--------------
> 
> Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/
> PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c              |  25
> ++++++++++---------------
> 
> Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSilic
> onPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c                  |  23 +++++++++-----
> ---------
> 
> Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMem
> oryConfig.c                                                           | 109
> ++++++++++++++++++++++++++++++++++++++++++++++++-----------------
> --------------------------------------------
> 
> Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariable
> WriteLib.c                                                     |   2 +-
>  Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.c
> |  89
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++++++++++++++++----------
> 
> Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/PeiVariableRead
> Lib.c                                                          |   4 ++--
> 
> Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInit
> Lib/PeiFspPolicyInitLib.c                                      |  21 ++++++++++++++++++---
> 
> Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPo
> licyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c                        |  63
> ++++++++++++---------------------------------------------------
> 
> Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/
> PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c               |  63
> ++++++++++++---------------------------------------------------
> 
> Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3Nvra
> mSave.c                                                              |  29 +++++++++++++++++++++++---
> ---
> 
> Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapper
> PlatformLib.c                                                  |  35 +++++++++--------------------------
> 
> Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolic
> yUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf                  |   5 ++---
> 
> Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Li
> brary/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf |   7
> ++++---
> 
> Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/
> PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf           |   2 +-
> 
> Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/Pei
> SiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf        |   5 ++---
> 
> Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/
> PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf      |   5 ++---
> 
> Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSilic
> onPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf                |   2 +-
> 
> Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMem
> oryConfig.inf                                                         |   8 ++++++--
>  Platform/Intel/MinPlatformPkg/Include/Dsc/CorePeiLib.dsc
> |   1 +
>  Platform/Intel/MinPlatformPkg/Include/Library/PeiLib.h
> |  40 +++++++++++++++++++++++++++++++++++-----
>  Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.inf
> |   4 +++-
>  Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
> |   1 +
> 
> Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInit
> Lib/PeiFspPolicyInitLib.inf                                    |   1 +
> 
> Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPo
> licyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf                |   5 ++---
> 
> Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/
> PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf       |   4 ++--
> 
> Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/Include/Fdf/FlashMa
> pInclude.fdf                                                        |  18 +++++++++---------
> 
> Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3Nvra
> mSave.inf                                                            |   4 +++-
>  Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc
> |   1 +
> 
> Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapper
> PlatformLib.inf                                                |   3 ++-
>  33 files changed, 345 insertions(+), 369 deletions(-)
> 
> --
> 2.28.0.windows.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [edk2-platforms: PATCH v5 0/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2.
  2021-10-14  9:16 [edk2-platforms: PATCH v5 0/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2 Chiu, Chasel
                   ` (10 preceding siblings ...)
  2021-10-15  0:45 ` Nate DeSimone
@ 2021-10-15  2:51 ` Chiu, Chasel
  11 siblings, 0 replies; 13+ messages in thread
From: Chiu, Chasel @ 2021-10-15  2:51 UTC (permalink / raw)
  To: devel@edk2.groups.io
  Cc: Oram, Isaac W, Desimone, Nathaniel L, Luo, Heng, Jeremy Soller,
	Benjamin Doron, Chaganty, Rangasai V, Kethi Reddy, Deepika,
	Esakkithevar, Kathappan, Liming Gao, Dong, Eric


Patch series pushed:
https://github.com/tianocore/edk2-platforms/commit/6b4a1eb461a87811627ee3bfdd847b1117aa155b
https://github.com/tianocore/edk2-platforms/commit/59dc66e86afad34293a124b5facecd193ada26c8
https://github.com/tianocore/edk2-platforms/commit/df697c2230f8a0ff6a82bf12164e285c54e27a43
https://github.com/tianocore/edk2-platforms/commit/71af84858edad6a69291e4d6a825b4dbdcb4528b
https://github.com/tianocore/edk2-platforms/commit/547fe50eff072fe05f4043924c24696ce2a58f40
https://github.com/tianocore/edk2-platforms/commit/6f543cdde0031571b6a1d64a9e899b5c19a5a52f
https://github.com/tianocore/edk2-platforms/commit/33d556c6c6387e92e24daff0e9b8f5c8029b997d
https://github.com/tianocore/edk2-platforms/commit/e8a64852af49b91473d3e3cdecabf83f2184d8c2
https://github.com/tianocore/edk2-platforms/commit/c24188b81fa9d286dbb4070cca774066f39d4bb7

Thanks,
Chasel

> -----Original Message-----
> From: Chiu, Chasel <chasel.chiu@intel.com>
> Sent: Thursday, October 14, 2021 5:16 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>; Luo, Heng <heng.luo@intel.com>; Jeremy
> Soller <jeremy@system76.com>; Benjamin Doron
> <benjamin.doron00@gmail.com>; Chaganty, Rangasai V
> <rangasai.v.chaganty@intel.com>; Kethi Reddy, Deepika
> <deepika.kethi.reddy@intel.com>; Esakkithevar, Kathappan
> <kathappan.esakkithevar@intel.com>; Liming Gao
> <gaoliming@byosoft.com.cn>; Dong, Eric <eric.dong@intel.com>
> Subject: [edk2-platforms: PATCH v5 0/9] MinPlatformPkg: Support FSP 2.3
> FSP_NON_VOLATILE_STORAGE_HOB2.
> 
> V5:
> Fix GCC build failure in LargeVariableWriteLib.c
> 
> V4:
>   . Switched to LargeVariableRead(Write)Lib in SaveMemoryConfig driver
>   . Fixed tailing white space issue in PeiLib.c/.h
>   . Updated function descriptions for PeiGetVariable() and PeiGetLargeVariable()
>   . Added VariableReadLib to CorePeiLib.dsc for all platforms
>   . Fixed white space issue in GalagoPro3/.../PeiFspMiscUpdUpdateLib.c
> 
> V3:
> Fix another GCC build failure.
> 
> V2:
> Fix GCC build failures.
> 
> V1:
> 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>
> Cc: Heng Luo <heng.luo@intel.com>
> Cc: Jeremy Soller <jeremy@system76.com>
> Cc: Benjamin Doron <benjamin.doron00@gmail.com>
> Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
> Cc: Deepika Kethi Reddy <deepika.kethi.reddy@intel.com>
> Cc: Kathappan Esakkithevar <kathappan.esakkithevar@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Eric Dong <eric.dong@intel.com>
> Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
> 
> Chasel Chiu (9):
>   MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2.
>   CometlakeOpenBoardPkg: Use same variable name for FspNvsHob.
>   KabylakeOpenBoardPkg/AspireVn7Dash572G:Use same variable name for
>     FspNvsHob
>   KabylakeOpenBoardPkg/GalagoPro3: Use same variable name for FspNvsHob.
>   KabylakeOpenBoardPkg/KabylakeRvp3: Use same variable name for
>     FspNvsHob.
>   TigerlakeOpenBoardPkg: Use same variable name for FspNvsHob.
>   WhiskeylakeOpenBoardPkg: Use same variable name for FspNvsHob.
>   WhitleyOpenBoardPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2.
>   WhitleySiliconPkg: Use same variable name for FspNvsHob.
> 
> 
> Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyU
> pdateLibFsp/PeiFspMiscUpdUpdateLib.c                          |  63 ++++++++++++++----
> ---------------------------------------------
> 
> Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Librar
> y/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c         |  24
> ++++++++++--------------
> 
> Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSi
> liconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c             |  23 +++++++++---------
> -----
> 
> Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSilic
> onPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c                |  25 +++++++++++---
> -----------
> 
> Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/PeiSi
> liconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c              |  25 ++++++++++---
> ------------
> 
> Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSiliconP
> olicyUpdateLib/PeiSiliconPolicyUpdateLib.c                  |  23 +++++++++-------------
> -
> 
> Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryC
> onfig.c                                                           | 109
> ++++++++++++++++++++++++++++++++++++++++++++++++--------------------------
> -----------------------------------
> 
> Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariableWri
> teLib.c                                                     |   2 +-
>  Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.c
> |  89
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> ++++++++++++++----------
> 
> Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/PeiVariableReadLib.
> c                                                          |   4 ++--
> 
> Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/
> PeiFspPolicyInitLib.c                                      |  21 ++++++++++++++++++---
> 
> Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicy
> UpdateLibFsp/PeiFspMiscUpdUpdateLib.c                        |  63 ++++++++++++-------
> --------------------------------------------
> 
> Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSi
> liconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c               |  63
> ++++++++++++---------------------------------------------------
> 
> Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSav
> e.c                                                              |  29 +++++++++++++++++++++++------
> 
> Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlat
> formLib.c                                                  |  35 +++++++++--------------------------
> 
> Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyU
> pdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf                  |   5 ++---
> 
> Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Librar
> y/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf |   7 ++++---
> 
> Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSi
> liconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf           |   2 +-
> 
> Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSilic
> onPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf        |   5 ++---
> 
> Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/PeiSi
> liconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf      |   5 ++---
> 
> Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSiliconP
> olicyUpdateLib/PeiSiliconPolicyUpdateLib.inf                |   2 +-
> 
> Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryC
> onfig.inf                                                         |   8 ++++++--
>  Platform/Intel/MinPlatformPkg/Include/Dsc/CorePeiLib.dsc
> |   1 +
>  Platform/Intel/MinPlatformPkg/Include/Library/PeiLib.h
> |  40 +++++++++++++++++++++++++++++++++++-----
>  Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.inf
> |   4 +++-
>  Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
> |   1 +
> 
> Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/
> PeiFspPolicyInitLib.inf                                    |   1 +
> 
> Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicy
> UpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf                |   5 ++---
> 
> Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSi
> liconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf       |   4 ++--
> 
> Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/Include/Fdf/FlashMapIncl
> ude.fdf                                                        |  18 +++++++++---------
> 
> Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSav
> e.inf                                                            |   4 +++-
>  Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc
> |   1 +
> 
> Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlat
> formLib.inf                                                |   3 ++-
>  33 files changed, 345 insertions(+), 369 deletions(-)
> 
> --
> 2.28.0.windows.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-10-15  2:51 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-14  9:16 [edk2-platforms: PATCH v5 0/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2 Chiu, Chasel
2021-10-14  9:16 ` [edk2-platforms: PATCH v5 1/9] " Chiu, Chasel
2021-10-14  9:16 ` [edk2-platforms: PATCH v5 2/9] CometlakeOpenBoardPkg: Use same variable name for FspNvsHob Chiu, Chasel
2021-10-14  9:16 ` [edk2-platforms: PATCH v5 3/9] KabylakeOpenBoardPkg/AspireVn7Dash572G:Use " Chiu, Chasel
2021-10-14  9:16 ` [edk2-platforms: PATCH v5 4/9] KabylakeOpenBoardPkg/GalagoPro3: Use " Chiu, Chasel
2021-10-14  9:16 ` [edk2-platforms: PATCH v5 5/9] KabylakeOpenBoardPkg/KabylakeRvp3: " Chiu, Chasel
2021-10-14  9:16 ` [edk2-platforms: PATCH v5 6/9] TigerlakeOpenBoardPkg: " Chiu, Chasel
2021-10-14  9:16 ` [edk2-platforms: PATCH v5 7/9] WhiskeylakeOpenBoardPkg: " Chiu, Chasel
2021-10-14  9:16 ` [edk2-platforms: PATCH v5 8/9] WhitleyOpenBoardPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2 Chiu, Chasel
2021-10-14  9:16 ` [edk2-platforms: PATCH v5 9/9] WhitleySiliconPkg: Use same variable name for FspNvsHob Chiu, Chasel
2021-10-14 14:21 ` [edk2-platforms: PATCH v5 0/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2 Oram, Isaac W
2021-10-15  0:45 ` Nate DeSimone
2021-10-15  2:51 ` Chiu, Chasel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox