From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web12.5706.1633675414240225705 for ; Thu, 07 Oct 2021 23:43:34 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: chasel.chiu@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10130"; a="289945145" X-IronPort-AV: E=Sophos;i="5.85,356,1624345200"; d="scan'208";a="289945145" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2021 23:43:33 -0700 X-IronPort-AV: E=Sophos;i="5.85,356,1624345200"; d="scan'208";a="440544910" Received: from cchiu4-mobl.gar.corp.intel.com ([10.252.188.53]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2021 23:43:32 -0700 From: "Chiu, Chasel" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone , Rangasai V Chaganty , Deepika Kethi Reddy , Kathappan Esakkithevar Subject: [edk2-platforms: PATCH v3 2/9] CometlakeOpenBoardPkg: Use same variable name for FspNvsHob. Date: Fri, 8 Oct 2021 14:43:10 +0800 Message-Id: <20211008064317.1371-3-chasel.chiu@intel.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20211008064317.1371-1-chasel.chiu@intel.com> References: <20211008064317.1371-1-chasel.chiu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3678 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 Cc: Rangasai V Chaganty Cc: Deepika Kethi Reddy Cc: Kathappan Esakkithevar Signed-off-by: Chasel Chiu --- Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUp= dateLibFsp/PeiFspMiscUpdUpdateLib.c | 63 ++++++++++++++------------= ------------------------------------- Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc = | 3 +++ Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUp= dateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf | 5 ++--- 3 files changed, 19 insertions(+), 52 deletions(-) diff --git a/Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSil= iconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c b/Platform/Intel/CometlakeO= penBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUp= dateLib.c index 7dbdfa7c16..9e8606ada9 100644 --- a/Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPol= icyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c +++ b/Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPol= icyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c @@ -2,7 +2,7 @@ Implementation of Fsp Misc UPD Initialization.=0D =0D =0D - Copyright (c) 2020, Intel Corporation. All rights reserved.
=0D + Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.
=0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D **/=0D =0D @@ -17,7 +17,6 @@ #include =0D #include =0D =0D -#include =0D #include =0D #include =0D #include =0D @@ -44,55 +43,21 @@ PeiFspMiscUpdUpdatePreMem ( )=0D {=0D EFI_STATUS Status;=0D - EFI_PEI_READ_ONLY_VARIABLE2_PPI *VariableServices;=0D - UINTN VariableSize;=0D - VOID *MemorySavedData;=0D -=0D - Status =3D PeiServicesLocatePpi (=0D - &gEfiPeiReadOnlyVariable2PpiGuid,=0D - 0,=0D - NULL,=0D - (VOID **) &VariableServices=0D - );=0D - if (EFI_ERROR (Status)) {=0D - ASSERT_EFI_ERROR (Status);=0D - return Status;=0D + UINTN FspNvsBufferSize;=0D + VOID *FspNvsBufferPtr;=0D +=0D + //=0D + // Initialize S3 Data variable (S3DataPtr). It may be used for warm and = fast boot paths.=0D + //=0D + FspNvsBufferPtr =3D NULL;=0D + FspNvsBufferSize =3D 0;=0D + Status =3D PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableG= uid, &FspNvsBufferPtr, &FspNvsBufferSize);=0D + if (Status =3D=3D EFI_SUCCESS) {=0D + DEBUG ((DEBUG_INFO, "Get L\"FspNvsBuffer\" gFspNvsBufferVariableGuid -= %r\n", Status));=0D + DEBUG ((DEBUG_INFO, "FspNvsBuffer Size - 0x%x\n", FspNvsBufferSize));= =0D + FspmUpd->FspmArchUpd.NvsBufferPtr =3D FspNvsBufferPtr;=0D }=0D =0D - VariableSize =3D 0;=0D - MemorySavedData =3D NULL;=0D - Status =3D VariableServices->GetVariable (=0D - VariableServices,=0D - L"MemoryConfig",=0D - &gFspNonVolatileStorageHobGuid,=0D - NULL,=0D - &VariableSize,=0D - MemorySavedData=0D - );=0D - if (Status =3D=3D EFI_BUFFER_TOO_SMALL) {=0D - MemorySavedData =3D AllocatePool (VariableSize);=0D - if (MemorySavedData =3D=3D NULL) {=0D - ASSERT (MemorySavedData !=3D NULL);=0D - return EFI_OUT_OF_RESOURCES;=0D - }=0D -=0D - DEBUG ((DEBUG_INFO, "VariableSize is 0x%x\n", VariableSize));=0D - Status =3D VariableServices->GetVariable (=0D - VariableServices,=0D - L"MemoryConfig",=0D - &gFspNonVolatileStorageHobGuid,=0D - NULL,=0D - &VariableSize,=0D - MemorySavedData=0D - );=0D - if (Status =3D=3D EFI_SUCCESS) {=0D - FspmUpd->FspmArchUpd.NvsBufferPtr =3D MemorySavedData;=0D - } else {=0D - DEBUG ((DEBUG_ERROR, "Fail to retrieve Variable:\"MemoryConfig\" gMe= moryConfigVariableGuid, Status =3D %r\n", Status));=0D - ASSERT_EFI_ERROR (Status);=0D - }=0D - }=0D - FspmUpd->FspmArchUpd.NvsBufferPtr =3D MemorySavedData;=0D =0D return EFI_SUCCESS;=0D }=0D diff --git a/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPk= g.dsc b/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc index 44a1bd54d6..d63ff263c1 100644 --- a/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc +++ b/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc @@ -142,6 +142,9 @@ #######################################=0D PlatformHookLib|$(PROJECT)/Library/BasePlatformHookLib/BasePlatformHookL= ib.inf=0D =0D +[LibraryClasses.Common.SEC]=0D + VariableReadLib|MinPlatformPkg/Library/BaseVariableReadLibNull/BaseVaria= bleReadLibNull.inf=0D +=0D [LibraryClasses.IA32.SEC]=0D #######################################=0D # Platform Package=0D diff --git a/Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSil= iconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf b/Platform/Intel/Co= metlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSili= conPolicyUpdateLibFsp.inf index c842b7eef6..94776603c4 100644 --- a/Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPol= icyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf +++ b/Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPol= icyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf @@ -2,7 +2,7 @@ # Provide FSP wrapper platform related function.=0D #=0D #=0D -# Copyright (c) 2020, Intel Corporation. All rights reserved.
=0D +# Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.
= =0D #=0D # SPDX-License-Identifier: BSD-2-Clause-Patent=0D #=0D @@ -82,7 +82,6 @@ PchInfoLib=0D PchHsioLib=0D PchPcieRpLib=0D - MemoryAllocationLib=0D DebugPrintErrorLevelLib=0D SiPolicyLib=0D PchGbeLib=0D @@ -132,7 +131,7 @@ gCometlakeOpenBoardPkgTokenSpaceGuid.PcdMrcSpdAddressTable3=0D =0D [Guids]=0D - gFspNonVolatileStorageHobGuid ## CONSUMES=0D + gFspNvsBufferVariableGuid ## CONSUMES=0D gTianoLogoGuid ## CONSUMES=0D gEfiMemoryOverwriteControlDataGuid=0D =0D --=20 2.28.0.windows.1