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.web10.5603.1633675420050669559 for ; Thu, 07 Oct 2021 23:43:43 -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="289945240" X-IronPort-AV: E=Sophos;i="5.85,356,1624345200"; d="scan'208";a="289945240" 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:42 -0700 X-IronPort-AV: E=Sophos;i="5.85,356,1624345200"; d="scan'208";a="440544956" 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:41 -0700 From: "Chiu, Chasel" To: devel@edk2.groups.io Cc: Chasel Chiu , Isaac Oram , Nate DeSimone Subject: [edk2-platforms: PATCH v3 9/9] WhitleySiliconPkg: Use same variable name for FspNvsHob. Date: Fri, 8 Oct 2021 14:43:17 +0800 Message-Id: <20211008064317.1371-10-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: Isaac Oram Cc: Nate DeSimone Signed-off-by: Chasel Chiu --- Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPl= atformLib.c | 35 +++++++++-------------------------- Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPl= atformLib.inf | 3 ++- 2 files changed, 11 insertions(+), 27 deletions(-) diff --git a/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/= FspWrapperPlatformLib.c b/Silicon/Intel/WhitleySiliconPkg/Library/FspWrappe= rPlatformLib/FspWrapperPlatformLib.c index a6196a78b0..95a1f2a33c 100644 --- a/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrap= perPlatformLib.c +++ b/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrap= perPlatformLib.c @@ -13,7 +13,7 @@ #include =0D #include =0D #include =0D -=0D +#include =0D #include =0D #include =0D #include =0D @@ -24,39 +24,22 @@ GetFspNvsBuffer ( )=0D {=0D EFI_STATUS Status;=0D - UINTN FspNvsBufferSize;=0D - VOID *FspNvsBufferPtr;=0D + UINTN FspNvsBufferSize;=0D + VOID *FspNvsBufferPtr;=0D =0D FspNvsBufferPtr =3D NULL;=0D FspNvsBufferSize =3D 0;=0D - Status =3D GetLargeVariable (L"FspNvsBuffer", &gFspNonVolatileStorageHob= Guid, &FspNvsBufferSize, NULL);=0D - if (Status =3D=3D EFI_BUFFER_TOO_SMALL) {=0D - DEBUG ((DEBUG_INFO, "FspNvsBuffer Size =3D %d\n", FspNvsBufferSize));= =0D - FspNvsBufferPtr =3D AllocateZeroPool (FspNvsBufferSize);=0D - if (FspNvsBufferPtr =3D=3D NULL) {=0D - DEBUG ((DEBUG_ERROR, "Error: Cannot create FspNvsBuffer, out of memo= ry!\n"));=0D - ASSERT (FALSE);=0D - return NULL;=0D - }=0D - Status =3D GetLargeVariable (L"FspNvsBuffer", &gFspNonVolatileStorageH= obGuid, &FspNvsBufferSize, FspNvsBufferPtr);=0D - if (EFI_ERROR (Status)) {=0D - DEBUG ((DEBUG_ERROR, "Error: Unable to read FspNvsBuffer UEFI variab= le Status: %r\n", Status));=0D - ASSERT_EFI_ERROR (Status);=0D - return NULL;=0D - }=0D -=0D + Status =3D PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableG= uid, &FspNvsBufferPtr, &FspNvsBufferSize);=0D + if (Status =3D=3D EFI_SUCCESS) {=0D return FspNvsBufferPtr;=0D -=0D - } else if (Status =3D=3D EFI_NOT_FOUND) {=0D - DEBUG ((DEBUG_INFO, "Cannot create FSP NVS Buffer, UEFI variable does = not exist (this is likely a first boot)\n"));=0D } else {=0D - DEBUG ((DEBUG_ERROR, "Error: Unable to read FspNvsBuffer UEFI variable= Status: %r\n", Status));=0D - ASSERT_EFI_ERROR (Status);=0D - }=0D -=0D + DEBUG ((DEBUG_INFO, "Cannot create FSP NVS Buffer, UEFI variable does = not exist (this is likely a first boot)\n"));=0D return NULL;=0D }=0D =0D +=0D +}=0D +=0D VOID=0D EFIAPI=0D UpdateFspmUpdData (=0D diff --git a/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/= FspWrapperPlatformLib.inf b/Silicon/Intel/WhitleySiliconPkg/Library/FspWrap= perPlatformLib/FspWrapperPlatformLib.inf index 3e80ea670c..6ee15ea55f 100644 --- a/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrap= perPlatformLib.inf +++ b/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrap= perPlatformLib.inf @@ -58,11 +58,12 @@ =0D [Guids]=0D gEfiPlatformInfoGuid=0D - gFspNonVolatileStorageHobGuid=0D + gFspNvsBufferVariableGuid # CONSUMES=0D =0D [LibraryClasses]=0D PeiServicesLib=0D LargeVariableReadLib=0D + PeiLib=0D =0D [Pcd]=0D gIntelFsp2PkgTokenSpaceGuid.PcdTemporaryRamBase ## CONSUMES=0D --=20 2.28.0.windows.1