[edk2-devel] [edk2-platforms: PATCH v5 2/9] CometlakeOpenBoardPkg: Use same variable name for FspNvsHob.

Chiu, Chasel chasel.chiu at intel.com
Thu Oct 14 09:16:15 UTC 2021


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 at intel.com>
Cc: Rangasai V Chaganty <rangasai.v.chaganty at intel.com>
Cc: Deepika Kethi Reddy <deepika.kethi.reddy at intel.com>
Cc: Kathappan Esakkithevar <kathappan.esakkithevar at intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu at intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone at intel.com>
Reviewed-by: Kathappan Esakkithevar <kathappan.esakkithevar at 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82013): https://edk2.groups.io/g/devel/message/82013
Mute This Topic: https://groups.io/mt/86308174/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list