From nobody Thu Apr 25 04:48:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+81951+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81951+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1634191773; cv=none; d=zohomail.com; s=zohoarc; b=GY7px6VoKV70juxaPgt8xqTAU4yR0YSa7XFj3ZOyhFVFe9kfL6Rh5xXbkWi+TfeftGPxxNsU8jvAxAAgPCITtpBJv7SVtHa94I5YuUC9fUo/jnpbK1B98XPdScnFokkrnVncbfmwczBWmktbEsqEhZ5s7mj4xfWkBV/REshoN8U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634191773; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=7qjnWuhNOcJQmgxkbMiBJ633EopSrYbsaE8pLgn8XA4=; b=J7CaYy4NlzwIB+DoroX6Vrl8S5e1w47lirloeT+tqA4k67sgXh9mePxoJqIohu8pY+YH2tjxlRaC0MIOwb3zgAPw4RvfGkiYgkPDCe/v9oVPlLEmeB3ucSdJk0YZGYeoymJVxikYJSzT7ezSZ5XguiRAcNMo+KXAiDjYCSB1ERk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81951+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1634191773387221.5250501968627; Wed, 13 Oct 2021 23:09:33 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id GPqyYY1788612xwKz40EcCiq; Wed, 13 Oct 2021 23:09:33 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web12.5656.1634191771996632083 for ; Wed, 13 Oct 2021 23:09:32 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10136"; a="227890230" X-IronPort-AV: E=Sophos;i="5.85,371,1624345200"; d="scan'208";a="227890230" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2021 23:09:20 -0700 X-IronPort-AV: E=Sophos;i="5.85,371,1624345200"; d="scan'208";a="524927774" X-Received: from cchiu4-mobl.gar.corp.intel.com ([10.252.188.134]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2021 23:09:18 -0700 From: "Chiu, Chasel" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone , Liming Gao , Eric Dong Subject: [edk2-devel] [edk2-platforms: PATCH v4 1/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2. Date: Thu, 14 Oct 2021 14:09:01 +0800 Message-Id: <20211014060909.2040-2-chasel.chiu@intel.com> In-Reply-To: <20211014060909.2040-1-chasel.chiu@intel.com> References: <20211014060909.2040-1-chasel.chiu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,chasel.chiu@intel.com X-Gm-Message-State: AqFP6CYRjKbrDVaSNEufuQyGx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634191773; bh=BJOpBYsm8G31XQdD9jFWncSrU926cD0u3YIreOvAVdM=; h=Cc:Date:From:Reply-To:Subject:To; b=HGeLaTExbqZ79eKoz5h8q4ErSxxg8duIwclahrsFOzoMSBQLbhLYJasT0aEUxYSx+lw M4wttyy3eJPnoZuPdv344iFBAyhHgBNZA+dq5MZlsWq2nNQYXE6potMXS/ql0TrdD50pk GriRXmlezsVSrfl6/sbmAQ2mA1+gDgSJoOI= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634191774946100003 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3678 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 Cc: Liming Gao Cc: Eric Dong Signed-off-by: Chasel Chiu --- Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig= .c | 109 ++++++++++++++++++++++++++++++++++++++++++++++++----------------= --------------------------------------------- Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.c = | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++---------- Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/PeiVariableReadLi= b.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 + 8 files changed, 175 insertions(+), 81 deletions(-) diff --git a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/Save= MemoryConfig.c b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/= SaveMemoryConfig.c index 41ed2550bd..820585f676 100644 --- a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryC= onfig.c +++ b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryC= onfig.c @@ -2,7 +2,7 @@ This is the driver that locates the MemoryConfigurationData HOB, if it exists, and saves the data to nvRAM. =20 -Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -16,7 +16,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include -#include +#include +#include +#include =20 /** 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; =20 - DataSize =3D 0; - VariableData =3D NULL; - GuidHob =3D NULL; - HobData =3D NULL; + DataSize =3D 0; + BufferSize =3D 0; + VariableData =3D NULL; + GuidHob =3D NULL; + HobData =3D NULL; + DataIsIdentical =3D FALSE; =20 // // 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 =3D GetFirstGuidHob (&gFspNonVolatileStorageHobGuid); + GuidHob =3D GetFirstGuidHob (&gFspNonVolatileStorageHob2Guid); if (GuidHob !=3D NULL) { - HobData =3D GET_GUID_HOB_DATA (GuidHob); - DataSize =3D GET_GUID_HOB_DATA_SIZE(GuidHob); + HobData =3D (VOID *) (UINTN) ((FSP_NON_VOLATILE_STORAGE_HOB2 *) (UINTN= ) GuidHob)->NvsDataPtr; + DataSize =3D (UINTN) ((FSP_NON_VOLATILE_STORAGE_HOB2 *) (UINTN) GuidHo= b)->NvsDataLength; + } else { + // + // Fall back to version1 FspNvsHob + // + GuidHob =3D GetFirstGuidHob (&gFspNonVolatileStorageHobGuid); + if (GuidHob !=3D NULL) { + HobData =3D GET_GUID_HOB_DATA (GuidHob); + DataSize =3D GET_GUID_HOB_DATA_SIZE (GuidHob); + } + } + + if (HobData !=3D 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 =3D DataSize; - VariableData =3D AllocatePool (BufferSize); - if (VariableData =3D=3D NULL) { - return EFI_UNSUPPORTED; - } - Status =3D gRT->GetVariable ( - L"MemoryConfig", - &gFspNonVolatileStorageHobGuid, - NULL, - &BufferSize, - VariableData - ); - + Status =3D GetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariable= Guid, &BufferSize, NULL); if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { - FreePool (VariableData); - VariableData =3D AllocatePool (BufferSize); - if (VariableData =3D=3D NULL) { - return EFI_UNSUPPORTED; + if (BufferSize =3D=3D DataSize) { + VariableData =3D AllocatePool (BufferSize); + if (VariableData !=3D NULL) { + Status =3D GetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVa= riableGuid, &BufferSize, VariableData); + if (!EFI_ERROR (Status) && (BufferSize =3D=3D DataSize) && (0 = =3D=3D CompareMem (HobData, VariableData, DataSize))) { + DataIsIdentical =3D TRUE; + } + FreePool (VariableData); + } } - - Status =3D gRT->GetVariable ( - L"MemoryConfig", - &gFspNonVolatileStorageHobGuid, - NULL, - &BufferSize, - VariableData - ); } + Status =3D EFI_SUCCESS; =20 - if ( (EFI_ERROR(Status)) || BufferSize !=3D DataSize || 0 !=3D Compa= reMem (HobData, VariableData, DataSize)) { - Status =3D gRT->SetVariable ( - L"MemoryConfig", - &gFspNonVolatileStorageHobGuid, - (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERV= ICE_ACCESS), - DataSize, - HobData - ); + if (!DataIsIdentical) { + Status =3D SetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariab= leGuid, 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 exis= ts - // - Status =3D gBS->LocateProtocol(&gEdkiiVariableLockProtocolGuid, NULL= , (VOID **)&VariableLock); - if (!EFI_ERROR(Status)) { - Status =3D VariableLock->RequestToLock(VariableLock, L"MemoryConfi= g", &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")); } =20 // - // This driver does not produce any protocol services, so always unload = it. + // This driver cannot be unloaded because DxeRuntimeVariableWriteLib con= structor will register ExitBootServices callback. // - return EFI_REQUEST_UNLOAD_IMAGE; + return EFI_SUCCESS; } diff --git a/Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.c b/Platfo= rm/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 =20 -Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -9,13 +9,17 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include =20 /** - Returns the status whether get the variable success. The function retrie= ves=20 - variable through the ReadOnlyVariable2 PPI GetVariable(). The=20 - returned buffer is allocated using AllocatePool(). The caller is respon= sible - for freeing this buffer with FreePool(). + Returns the status whether get the variable success. The function retrie= ves + 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 FreePoo= l(). + + If the *Size is non-0, this function just uses caller allocated *Value. =20 If Name is NULL, then ASSERT(). If Guid is NULL, then ASSERT(). @@ -108,6 +112,71 @@ PeiGetVariable ( return Status; } =20 +/** + This function returns a "large variable". A large variable is stored acr= oss 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->GetVar= iable. + +**/ +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 !=3D NULL); + ASSERT (Guid !=3D NULL); + ASSERT (Value !=3D NULL); + + VariableSize =3D 0; + VariableData =3D NULL; + Status =3D GetLargeVariable (Name, Guid, &VariableSize, NULL); + if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { + VariableData =3D AllocatePages (EFI_SIZE_TO_PAGES (VariableSize)); + if (VariableData =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "Error: Cannot create VariableData, out of memo= ry!\n")); + ASSERT (FALSE); + return EFI_OUT_OF_RESOURCES; + } + Status =3D 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 !=3D NULL) { + *Value =3D VariableData; + } + if (Size !=3D NULL) { + *Size =3D VariableSize; + } + return EFI_SUCCESS; + } + return Status; +} + EFI_PEI_FILE_HANDLE InternalGetFfsHandleFromAnyFv ( IN CONST EFI_GUID *NameGuid @@ -139,7 +208,7 @@ InternalGetFfsHandleFromAnyFv ( =20 /** Finds the file in any FV and gets file Address and Size - =20 + @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 =3D=3D NULL) { return EFI_NOT_FOUND; } - =20 + // // 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_HEAD= ER @param[out] OutSectionSize The size of section found, including SECT= ION_HEADER - =20 + @retval EFI_SUCCESS Successfull in reading the section fr= om FV **/ EFI_STATUS @@ -263,7 +332,7 @@ PeiGetSectionFromAnyFv ( EFI_COMMON_SECTION_HEADER *Section; VOID *FileBuffer; UINTN FileBufferSize; - =20 + Status =3D PeiGetFfsFromAnyFv (NameGuid, &FileBuffer, &FileBufferSize); if (EFI_ERROR(Status)) { return Status; @@ -282,6 +351,6 @@ PeiGetSectionFromAnyFv ( *Size =3D SECTION_SIZE(Section) - sizeof (EFI_COMMON_SECTION_HEADER); *Address =3D (UINT8 *)*Address + sizeof (EFI_COMMON_SECTION_HEADER); } - =20 + return EFI_SUCCESS; } diff --git a/Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/PeiVa= riableReadLib.c b/Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/= PeiVariableReadLib.c index 5eeee12a3c..b7885dd6c2 100644 --- a/Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/PeiVariableR= eadLib.c +++ b/Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/PeiVariableR= eadLib.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/Save= MemoryConfig.inf b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfi= g/SaveMemoryConfig.inf index 0c8689a6f6..e2dbd2fb49 100644 --- a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryC= onfig.inf +++ b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryC= onfig.inf @@ -1,7 +1,7 @@ ### @file # Component information file for SaveMemoryConfig module # -# Copyright (c) 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -23,11 +23,14 @@ DebugLib MemoryAllocationLib BaseMemoryLib + LargeVariableReadLib + LargeVariableWriteLib =20 [Packages] MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec IntelFsp2Pkg/IntelFsp2Pkg.dec + MinPlatformPkg/MinPlatformPkg.dec =20 [Sources] SaveMemoryConfig.c @@ -35,10 +38,11 @@ [Protocols] gEfiVariableArchProtocolGuid ## CONSUMES gEfiVariableWriteArchProtocolGuid ## CONSUMES - gEdkiiVariableLockProtocolGuid =20 [Guids] gFspNonVolatileStorageHobGuid ## CONSUMES + gFspNonVolatileStorageHob2Guid ## CONSUMES + gFspNvsBufferVariableGuid ## PRODUCES =20 [Depex] gEfiVariableArchProtocolGuid AND diff --git a/Platform/Intel/MinPlatformPkg/Include/Dsc/CorePeiLib.dsc b/Pla= tform/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/BaseVaria= bleReadLibNull.inf =20 [LibraryClasses.common.PEI_CORE] TimerLib|PcAtChipsetPkg/Library/AcpiTimerLib/PeiAcpiTimerLib.inf diff --git a/Platform/Intel/MinPlatformPkg/Include/Library/PeiLib.h b/Platf= orm/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 =20 -Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -11,11 +11,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include =20 /** - Returns the status whether get the variable success. The function retrie= ves=20 + Returns the status whether get the variable success. The function retrie= ves variable through the ReadOnlyVariable2 PPI GetVariable(). =20 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 FreePoo= l(). =20 If the *Size is non-0, this function just uses caller allocated *Value. =20 @@ -38,9 +38,39 @@ PeiGetVariable ( OUT UINTN *Size ); =20 +/** + This function returns a "large variable". A large variable is stored acr= oss 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->GetVar= iable. + +**/ +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 - =20 + @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 ( =20 /** Finds the section in any FV and gets section Address and Size - =20 + @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/Plat= form/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.
+# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -20,9 +20,11 @@ PeiServicesLib MemoryAllocationLib DebugLib + LargeVariableReadLib =20 [Packages] MdePkg/MdePkg.dec + MinPlatformPkg/MinPlatformPkg.dec =20 [Sources] PeiLib.c diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec b/Platform/In= tel/MinPlatformPkg/MinPlatformPkg.dec index bcb42f0ef9..d6e80a66ce 100644 --- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec +++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec @@ -50,6 +50,7 @@ gBdsEventBeforeConsoleAfterTrustedConsoleGuid =3D {0x51e49ff5, 0x28a9, = 0x4159, { 0xac, 0x8a, 0xb8, 0xc4, 0x88, 0xa7, 0xfd, 0xee}} gBdsEventBeforeConsoleBeforeEndOfDxeGuid =3D {0xfcf26e41, 0xbda6, = 0x4633, { 0xb5, 0x73, 0xd4, 0xb8, 0x0e, 0x6d, 0xd0, 0x78}} gBdsEventAfterConsoleReadyBeforeBootOptionGuid =3D {0x8eb3d5dc, 0xf4e7, = 0x4b57, { 0xa9, 0xe7, 0x27, 0x39, 0x10, 0xf2, 0x18, 0x9f}} + gFspNvsBufferVariableGuid =3D {0x9c7715cd, 0x8d66, = 0x4d2a, { 0x90, 0x0d, 0x01, 0x45, 0x9a, 0x57, 0x59, 0x6b}} =20 [LibraryClasses] =20 --=20 2.28.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#81951): https://edk2.groups.io/g/devel/message/81951 Mute This Topic: https://groups.io/mt/86306584/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Apr 25 04:48:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+81953+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81953+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1634191774; cv=none; d=zohomail.com; s=zohoarc; b=bfeX8xw0Lz7z4zVygdGXKThpzUJWe5EANeXWGUoamN28vBABQTEB/iVUcEXZtkTXFEpuZwxigq0RK3/mFYBeorosKStOkti8BNzgPyYk8hNLBukgSHy+VESD7BZgvB6WTq/hq+WKci35dJzcP625j1QXTYpYKjzDZVHyhfSpI2o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634191774; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=oumD5b2cpvTO8BCgHtliix50Xy+OHNeaGPMN/NlhjAY=; b=gVnRWI3XhgmHgF5vkAXGIGWfEMpypA1oJmhxBVPUxs7nzhBH0HS2/wH7O02Bs4c2yDGDHeZ6HowSfarrTOL1McpNfMY929thEAIcIsNZtw1Npk5mHmxrmooxUeNXAZ6EBEq6EjTCriIqUaRepkHBQk1Zh82p4ecYvSa3vmqSFtg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81953+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1634191774274182.0060353328363; Wed, 13 Oct 2021 23:09:34 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id O6kfYY1788612xGRCpEbsigy; Wed, 13 Oct 2021 23:09:33 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web12.5657.1634191772586802165 for ; Wed, 13 Oct 2021 23:09:33 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10136"; a="227890234" X-IronPort-AV: E=Sophos;i="5.85,371,1624345200"; d="scan'208";a="227890234" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2021 23:09:22 -0700 X-IronPort-AV: E=Sophos;i="5.85,371,1624345200"; d="scan'208";a="524927786" X-Received: from cchiu4-mobl.gar.corp.intel.com ([10.252.188.134]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2021 23:09:20 -0700 From: "Chiu, Chasel" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone , Rangasai V Chaganty , Deepika Kethi Reddy , Kathappan Esakkithevar Subject: [edk2-devel] [edk2-platforms: PATCH v4 2/9] CometlakeOpenBoardPkg: Use same variable name for FspNvsHob. Date: Thu, 14 Oct 2021 14:09:02 +0800 Message-Id: <20211014060909.2040-3-chasel.chiu@intel.com> In-Reply-To: <20211014060909.2040-1-chasel.chiu@intel.com> References: <20211014060909.2040-1-chasel.chiu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,chasel.chiu@intel.com X-Gm-Message-State: 0ptcyKYmJ7mjEXIKHDYC033ax1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634191773; bh=7o3O//nJhtmUy/F091HEYfz+3g4LTFRW4oxLzKqUyPg=; h=Cc:Date:From:Reply-To:Subject:To; b=EdsczCSrZ0VNS/FLSyDitlny52dCe7newEqwARNtOoFOywQZfS0N296vwAdnbb0nZ50 k3yPF42TmRas5k1/cIHRDzHouorC1uqalJaucSkuCvMY2Y14NWCvzJ3uAYMe7UcMZ3uyQ LmASFn6cP1sWUe/Yj2G6XzLRPCR9zgVRhx4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634191774985100006 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Nate DeSimone Reviewed-by: Kathappan Esakkithevar --- Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUp= dateLibFsp/PeiFspMiscUpdUpdateLib.c | 63 ++++++++++++++------------= ------------------------------------- Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUp= dateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf | 5 ++--- 2 files changed, 16 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. =20 =20 - Copyright (c) 2020, Intel Corporation. All rights reserved.
+ Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ =20 @@ -17,7 +17,6 @@ #include #include =20 -#include #include #include #include @@ -44,55 +43,21 @@ PeiFspMiscUpdUpdatePreMem ( ) { EFI_STATUS Status; - EFI_PEI_READ_ONLY_VARIABLE2_PPI *VariableServices; - UINTN VariableSize; - VOID *MemorySavedData; - - Status =3D 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 =3D NULL; + FspNvsBufferSize =3D 0; + Status =3D PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableG= uid, &FspNvsBufferPtr, &FspNvsBufferSize); + if (Status =3D=3D EFI_SUCCESS) { + DEBUG ((DEBUG_INFO, "Get L\"FspNvsBuffer\" gFspNvsBufferVariableGuid -= %r\n", Status)); + DEBUG ((DEBUG_INFO, "FspNvsBuffer Size - 0x%x\n", FspNvsBufferSize)); + FspmUpd->FspmArchUpd.NvsBufferPtr =3D FspNvsBufferPtr; } =20 - VariableSize =3D 0; - MemorySavedData =3D NULL; - Status =3D VariableServices->GetVariable ( - VariableServices, - L"MemoryConfig", - &gFspNonVolatileStorageHobGuid, - NULL, - &VariableSize, - MemorySavedData - ); - if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { - MemorySavedData =3D AllocatePool (VariableSize); - if (MemorySavedData =3D=3D NULL) { - ASSERT (MemorySavedData !=3D NULL); - return EFI_OUT_OF_RESOURCES; - } - - DEBUG ((DEBUG_INFO, "VariableSize is 0x%x\n", VariableSize)); - Status =3D VariableServices->GetVariable ( - VariableServices, - L"MemoryConfig", - &gFspNonVolatileStorageHobGuid, - NULL, - &VariableSize, - MemorySavedData - ); - if (Status =3D=3D EFI_SUCCESS) { - FspmUpd->FspmArchUpd.NvsBufferPtr =3D MemorySavedData; - } else { - DEBUG ((DEBUG_ERROR, "Fail to retrieve Variable:\"MemoryConfig\" gMe= moryConfigVariableGuid, Status =3D %r\n", Status)); - ASSERT_EFI_ERROR (Status); - } - } - FspmUpd->FspmArchUpd.NvsBufferPtr =3D MemorySavedData; =20 return EFI_SUCCESS; } 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. # # -# Copyright (c) 2020, Intel Corporation. All rights reserved.
+# Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -82,7 +82,6 @@ PchInfoLib PchHsioLib PchPcieRpLib - MemoryAllocationLib DebugPrintErrorLevelLib SiPolicyLib PchGbeLib @@ -132,7 +131,7 @@ gCometlakeOpenBoardPkgTokenSpaceGuid.PcdMrcSpdAddressTable3 =20 [Guids] - gFspNonVolatileStorageHobGuid ## CONSUMES + gFspNvsBufferVariableGuid ## CONSUMES gTianoLogoGuid ## CONSUMES gEfiMemoryOverwriteControlDataGuid =20 --=20 2.28.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#81953): https://edk2.groups.io/g/devel/message/81953 Mute This Topic: https://groups.io/mt/86306586/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Apr 25 04:48:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+81952+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81952+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1634191773; cv=none; d=zohomail.com; s=zohoarc; b=MUoW2F1adGW8gX5gzSdJZmcwUzRJmt6KqPeGS1bOcOi8sVHSP0/Ku2hOlp3ZY0fa+26G4kyk1AI13jlZLv2O6NJgQZ6wwSQfeNk8s5qnx0mSxPsCt/MnZPT0+SJBomhD/yCAV6uGipdDiFGGR5KEIXhyZ693IeUPqrrbmV8REPI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634191773; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=633p9kca/u1DvVtuxCUVfc0Sr0/CJvc5UndLHIMWdxw=; b=bnvYILSsteBtrAAotdWbIZJjtYCT6UVdPes3Ddo6OlnGlLGrcdzzDRuVINEamMpBqrgOS0mejQfOl9wgLKL9Q4JeAeIo5hiR4MulYxjoP1j3oSny6FF1uhv8mo0CRbEAGmx42rJPMHYKhBGjXKWS2xdQOmui4uQJCANp+MiBrG8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81952+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1634191773866326.5018453527787; Wed, 13 Oct 2021 23:09:33 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id OIs3YY1788612xbSRubVozvd; Wed, 13 Oct 2021 23:09:33 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web12.5656.1634191771996632083 for ; Wed, 13 Oct 2021 23:09:33 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10136"; a="227890238" X-IronPort-AV: E=Sophos;i="5.85,371,1624345200"; d="scan'208";a="227890238" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2021 23:09:24 -0700 X-IronPort-AV: E=Sophos;i="5.85,371,1624345200"; d="scan'208";a="524927814" X-Received: from cchiu4-mobl.gar.corp.intel.com ([10.252.188.134]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2021 23:09:22 -0700 From: "Chiu, Chasel" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone , Benjamin Doron Subject: [edk2-devel] [edk2-platforms: PATCH v4 3/9] KabylakeOpenBoardPkg/AspireVn7Dash572G:Use same variable name for FspNvsHob Date: Thu, 14 Oct 2021 14:09:03 +0800 Message-Id: <20211014060909.2040-4-chasel.chiu@intel.com> In-Reply-To: <20211014060909.2040-1-chasel.chiu@intel.com> References: <20211014060909.2040-1-chasel.chiu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,chasel.chiu@intel.com X-Gm-Message-State: mFtv3JjMNY7CfcI0q0SuCNaux1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634191773; bh=55AOGB0SALKVgYSU15jwaqkN5F1kMDHORlJ+dB693dk=; h=Cc:Date:From:Reply-To:Subject:To; b=Z/om3mEwk5TDwxQHykPzBx24R3BZXQgtYR/qPR74DS+RqBWpyO7SRdtqO3BegQ9R/gL ofHiQXwtOLH16oJnf29cwtBQ4/h7rtXV1hZc6qR4AT47bac0lAmCb6DmlWa4c2nn+JWb6 qk5Jjz6TIcxaZ/1m9mslTC6pD3dyEszBnvQ= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634191774977100005 Content-Type: text/plain; charset="utf-8" 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: Benjamin Doron Signed-off-by: Chasel Chiu Reviewed-by: Nate DeSimone --- Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/P= eiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c | 24 +++++++++= +-------------- Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSi= liconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c | 23 +++++++++= -------------- Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/P= eiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf | 7 ++++--- Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSi= liconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf | 2 +- 4 files changed, 24 insertions(+), 32 deletions(-) diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapp= er/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c b/Platform= /Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSilicon= PolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c index d8413d284e..a9b7e446c8 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Libr= ary/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Libr= ary/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c @@ -1,7 +1,7 @@ /** @file Implementation of Fsp Misc UPD Initialization. =20 -Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -11,7 +11,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include - #include #include #include @@ -34,24 +33,21 @@ PeiFspMiscUpdUpdatePreMem ( { EFI_STATUS Status; UINTN VariableSize; - VOID *MemorySavedData; + VOID *FspNvsBufferPtr; UINT8 MorControl; VOID *MorControlPtr; =20 // // Initialize S3 Data variable (S3DataPtr). It may be used for warm and = fast boot paths. // - VariableSize =3D 0; - MemorySavedData =3D NULL; - Status =3D 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 =3D MemorySavedData; + FspNvsBufferPtr =3D NULL; + VariableSize =3D 0; + Status =3D PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableG= uid, &FspNvsBufferPtr, &VariableSize); + if (Status =3D=3D EFI_SUCCESS) { + DEBUG ((DEBUG_INFO, "Get L\"FspNvsBuffer\" gFspNvsBufferVariableGuid -= %r\n", Status)); + DEBUG ((DEBUG_INFO, "FspNvsBuffer Size - 0x%x\n", VariableSize)); + FspmUpd->FspmArchUpd.NvsBufferPtr =3D FspNvsBufferPtr; + } =20 if (FspmUpd->FspmArchUpd.NvsBufferPtr !=3D NULL) { // diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/L= ibrary/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c b/Platform/Int= el/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSiliconPolicyUp= dateLib/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]; =20 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 a= dded in FSP 2.1, hence // the platform specific S3DataPtr must be used instead. // - VariableSize =3D 0; - MemorySavedData =3D NULL; - Status =3D PeiGetVariable ( - L"MemoryConfig", - &gFspNonVolatileStorageHobGuid, - &MemorySavedData, - &VariableSize - ); - DEBUG ((DEBUG_INFO, "Get L\"MemoryConfig\" gFspNonVolatileStorageHob= Guid - %r\n", Status)); - DEBUG ((DEBUG_INFO, "MemoryConfig Size - 0x%x\n", VariableSize)); - if (!EFI_ERROR (Status)) { - MiscPeiPreMemConfig->S3DataPtr =3D MemorySavedData; + FspNvsBufferPtr =3D NULL; + FspNvsBufferSize =3D 0; + Status =3D PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVaria= bleGuid, &FspNvsBufferPtr, &FspNvsBufferSize); + if (Status =3D=3D EFI_SUCCESS) { + DEBUG ((DEBUG_INFO, "Get L\"FspNvsBuffer\" gFspNvsBufferVariableGu= id - %r\n", Status)); + DEBUG ((DEBUG_INFO, "FspNvsBuffer Size - 0x%x\n", FspNvsBufferSize= )); + MiscPeiPreMemConfig->S3DataPtr =3D FspNvsBufferPtr; } =20 // diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapp= er/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf b/= Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/Pe= iSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf index e4a657c5f1..eac9344b0a 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Libr= ary/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Libr= ary/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf @@ -1,7 +1,7 @@ ## @file # Provide FSP wrapper platform related function. # -# Copyright (c) 2017 - 2020 Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2021 Intel Corporation. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -74,7 +74,6 @@ PchInfoLib PchHsioLib PchPcieRpLib - MemoryAllocationLib SiPolicyLib PeiLib =20 @@ -134,9 +133,11 @@ gKabylakeOpenBoardPkgTokenSpaceGuid.PcdAudioConnector =20 gKabylakeOpenBoardPkgTokenSpaceGuid.PcdGraphicsVbtGuid + gIntelFsp2WrapperTokenSpaceGuid.PcdFspmUpdDataAddress + gKabylakeOpenBoardPkgTokenSpaceGuid.PcdRootPort4ClkInfo =20 [Guids] - gFspNonVolatileStorageHobGuid ## CONSUMES + gFspNvsBufferVariableGuid ## CONSUMES gTianoLogoGuid ## CONSUMES gEfiMemoryOverwriteControlDataGuid =20 diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/L= ibrary/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf b/Platform/I= ntel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSiliconPolicy= UpdateLib/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 --=20 2.28.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#81952): https://edk2.groups.io/g/devel/message/81952 Mute This Topic: https://groups.io/mt/86306585/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Apr 25 04:48:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+81954+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81954+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1634191774; cv=none; d=zohomail.com; s=zohoarc; b=Or/pZrly6RDrkjV1r0cuJ5U/EhonczGylIeEH24gaUgWfO8H1aqlRCN99AryWdGPWHG0Kr4+DpMGy0IW3yLiAwJ/RTogqqKsYMQ0AZ4N0OvDUZ+5QfH4fij2GYaCf8dFE0QSnMtWViVl2Imut45J+tJAU83otUnfFLSmPy/Y/EQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634191774; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=JZkEI34TA36Ab8PcY60EN+F9xpddVirgaeSkAGQRimw=; b=lJE7yfb/O1756wpKcSiHcavdxtdDNRjwkn2KKJIgjl7Gfc1ewHA+VNJ/oUPA9y1jeo4d+43nHC6SfgZIYGFGueJjaMfrohbtV9o4Y0WMJ8e7gVa88UY21imBcRRI+MA59IzrkUqHUqeHum/UhwiyX96prugg7QGcWLrKTCeZsgk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81954+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1634191774960857.3434814129126; Wed, 13 Oct 2021 23:09:34 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id DdUuYY1788612xuExTN873LX; Wed, 13 Oct 2021 23:09:34 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web12.5656.1634191771996632083 for ; Wed, 13 Oct 2021 23:09:33 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10136"; a="227890244" X-IronPort-AV: E=Sophos;i="5.85,371,1624345200"; d="scan'208";a="227890244" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2021 23:09:27 -0700 X-IronPort-AV: E=Sophos;i="5.85,371,1624345200"; d="scan'208";a="524927843" X-Received: from cchiu4-mobl.gar.corp.intel.com ([10.252.188.134]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2021 23:09:25 -0700 From: "Chiu, Chasel" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone , Jeremy Soller Subject: [edk2-devel] [edk2-platforms: PATCH v4 4/9] KabylakeOpenBoardPkg/GalagoPro3: Use same variable name for FspNvsHob. Date: Thu, 14 Oct 2021 14:09:04 +0800 Message-Id: <20211014060909.2040-5-chasel.chiu@intel.com> In-Reply-To: <20211014060909.2040-1-chasel.chiu@intel.com> References: <20211014060909.2040-1-chasel.chiu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,chasel.chiu@intel.com X-Gm-Message-State: viLNlXpji3pqqwPyEb9jaWJdx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634191774; bh=devXSOQx8yWO7S44x8Hg1IMdnxNd9ybVdtoyA9K/sbU=; h=Cc:Date:From:Reply-To:Subject:To; b=CRtc7LZZrQ19LWv0vX123Wd8EqzoIhvoSgVPowCloC5mOPrx8Xq6FXJoP7MikAeKePE tFhRoeSRFU6ZiLVccTVVFfyAmcatcsDSgmzJXXspMzJzmgETFAhpAR9zqsjTLRz2aUN/T hu/v2g9+PqPKmRvVEEMYjPuBKGPiz5RxjfU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634191776996100019 Content-Type: text/plain; charset="utf-8" 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: Jeremy Soller Signed-off-by: Chasel Chiu Reviewed-by: Nate DeSimone --- Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSilic= onPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c | 25 +++++++++++-----= --------- Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSilic= onPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf | 5 ++--- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Libr= ary/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c b/Platform/Intel/= KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyUpdateLi= bFsp/PeiFspMiscUpdUpdateLib.c index 9d6c0176f6..dbc84631ac 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/Pei= SiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/Pei= SiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c @@ -1,7 +1,7 @@ /** @file Implementation of Fsp Misc UPD Initialization. =20 -Copyright (c) 2019, Intel Corporation. All rights reserved.
+Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -16,7 +16,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include =20 -#include #include #include #include @@ -38,24 +37,22 @@ PeiFspMiscUpdUpdatePreMem ( { EFI_STATUS Status; UINTN VariableSize; - VOID *MemorySavedData; + VOID *FspNvsBufferPtr; UINT8 MorControl; VOID *MorControlPtr; =20 // // Initialize S3 Data variable (S3DataPtr). It may be used for warm and = fast boot paths. // - VariableSize =3D 0; - MemorySavedData =3D NULL; - Status =3D 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 =3D MemorySavedData; + FspNvsBufferPtr =3D NULL; + VariableSize =3D 0; + + Status =3D PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableG= uid, &FspNvsBufferPtr, &VariableSize); + if (Status =3D=3D EFI_SUCCESS) { + DEBUG ((DEBUG_INFO, "Get L\"FspNvsBuffer\" gFspNvsBufferVariableGuid -= %r\n", Status)); + DEBUG ((DEBUG_INFO, "FspNvsBuffer Size - 0x%x\n", VariableSize)); + FspmUpd->FspmArchUpd.NvsBufferPtr =3D FspNvsBufferPtr; + } =20 if (FspmUpd->FspmArchUpd.NvsBufferPtr !=3D NULL) { // diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Libr= ary/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf b/Platfor= m/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicy= UpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf index 463455c90b..ceefe7639e 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/Pei= SiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/Pei= SiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf @@ -1,7 +1,7 @@ ## @file # FSP wrapper silicon policy update library. # -# Copyright (c) 2019 - 2020 Intel Corporation. All rights reserved.
+# Copyright (c) 2019 - 2021 Intel Corporation. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -81,7 +81,6 @@ PchInfoLib PchHsioLib PchPcieRpLib - MemoryAllocationLib CpuMailboxLib DebugPrintErrorLevelLib SiPolicyLib @@ -138,7 +137,7 @@ gKabylakeOpenBoardPkgTokenSpaceGuid.PcdGraphicsVbtGuid =20 [Guids] - gFspNonVolatileStorageHobGuid ## CONSUMES + gFspNvsBufferVariableGuid ## CONSUMES gTianoLogoGuid ## CONSUMES gEfiMemoryOverwriteControlDataGuid =20 --=20 2.28.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#81954): https://edk2.groups.io/g/devel/message/81954 Mute This Topic: https://groups.io/mt/86306587/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Apr 25 04:48:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+81955+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81955+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1634191775; cv=none; d=zohomail.com; s=zohoarc; b=ki/7IdOUHxU3xm3fJyPV5AlD4KvPabjYIXkivSPc0ohr+F+lZwZR+ruWJGi5AHsDvWBWjz6fJeIWBp7w9evpXLih8Zq2HWg2ceXBsILfPA7WlbPQUJG7Wy0ZlTTYSCVt6hwg4yBzGTvY1jaa1/iHtCik+fVxOaay3lwtMyaHazc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634191775; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=UqmYJoWhwTXw8S0TFCWU9S1iWPG+m78OIKyFUICMRrY=; b=KEr+8xONQYGXq4bj9NLWW/ODX9l37+MyyXAUaSkTcwuD8ijpbMI/IucPzGYMVJIkFXD8M+uZaB3Iw/2jWzZ52VQbZuDfCP33Qo8MVdjzAu6bgf94PcxL1LrqJgT0dPRSB5m2F6brTZ8uKqjlIdcM9ia9OfScx2H3cBUyVLgMeMQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81955+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1634191775120821.9486968372496; Wed, 13 Oct 2021 23:09:35 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id NlprYY1788612xkRyEMbINwE; Wed, 13 Oct 2021 23:09:34 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web12.5657.1634191772586802165 for ; Wed, 13 Oct 2021 23:09:33 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10136"; a="227890247" X-IronPort-AV: E=Sophos;i="5.85,371,1624345200"; d="scan'208";a="227890247" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2021 23:09:29 -0700 X-IronPort-AV: E=Sophos;i="5.85,371,1624345200"; d="scan'208";a="524927869" X-Received: from cchiu4-mobl.gar.corp.intel.com ([10.252.188.134]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2021 23:09:27 -0700 From: "Chiu, Chasel" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone Subject: [edk2-devel] [edk2-platforms: PATCH v4 5/9] KabylakeOpenBoardPkg/KabylakeRvp3: Use same variable name for FspNvsHob. Date: Thu, 14 Oct 2021 14:09:05 +0800 Message-Id: <20211014060909.2040-6-chasel.chiu@intel.com> In-Reply-To: <20211014060909.2040-1-chasel.chiu@intel.com> References: <20211014060909.2040-1-chasel.chiu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,chasel.chiu@intel.com X-Gm-Message-State: HRJGYAK3pT6c2SV5xVinEOV0x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634191774; bh=MThfU2Wa8SX3HjRswKOks1maVpniktE6ASKmbB8jkt8=; h=Cc:Date:From:Reply-To:Subject:To; b=KKVRbUfFQIsdT2JmdhGDjng7XzBr1OQ58gRY3C5EBsVJEnyBlXmaxtRYCu6WI+53pCD uXvyXCm2uRIPXkGLtUXvCPmLImMsYnGlLgSeVFBIe9s+BIwKXJ1qccXMCKcqn4lB5KVk8 Hzi0Qef0HsuQK3Qsg0/1kDTqk06UJsUHnpI= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634191777013100020 Content-Type: text/plain; charset="utf-8" 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 Signed-off-by: Chasel Chiu Reviewed-by: Nate DeSimone --- Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/PeiSil= iconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c | 25 ++++++++++----= ----------- Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSilicon= PolicyUpdateLib/PeiSiliconPolicyUpdateLib.c | 23 +++++++++-----= --------- Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/PeiSil= iconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf | 5 ++--- Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSilicon= PolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf | 2 +- 4 files changed, 22 insertions(+), 33 deletions(-) diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Li= brary/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c b/Platform/Inte= l/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/PeiSiliconPolicyUpda= teLibFsp/PeiFspMiscUpdUpdateLib.c index d8aff1960f..699f4297fa 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/P= eiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/P= eiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c @@ -1,7 +1,7 @@ /** @file Implementation of Fsp Misc UPD Initialization. =20 -Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -16,7 +16,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include =20 -#include #include #include #include @@ -38,25 +37,21 @@ PeiFspMiscUpdUpdatePreMem ( { EFI_STATUS Status; UINTN VariableSize; - VOID *MemorySavedData; + VOID *FspNvsBufferPtr; UINT8 MorControl; VOID *MorControlPtr; =20 // // Initialize S3 Data variable (S3DataPtr). It may be used for warm and = fast boot paths. // - VariableSize =3D 0; - MemorySavedData =3D NULL; - Status =3D 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 =3D MemorySavedData; - + FspNvsBufferPtr =3D NULL; + VariableSize =3D 0; + Status =3D PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableG= uid, &FspNvsBufferPtr, &VariableSize); + if (Status =3D=3D EFI_SUCCESS) { + DEBUG ((DEBUG_INFO, "Get L\"FspNvsBuffer\" gFspNvsBufferVariableGuid -= %r\n", Status)); + DEBUG ((DEBUG_INFO, "FspNvsBuffer Size - 0x%x\n", VariableSize)); + FspmUpd->FspmArchUpd.NvsBufferPtr =3D FspNvsBufferPtr; + } if (FspmUpd->FspmArchUpd.NvsBufferPtr !=3D NULL) { // // Set the DISB bit in PCH (DRAM Initialization Scratchpad Bit - GEN_P= MCON_A[23]), diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Librar= y/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c b/Platform/Intel/Ka= bylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSiliconPolicyUpdateLib/Pe= iSiliconPolicyUpdateLib.c index 2dce9be63c..22aadc0221 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSi= liconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSi= liconPolicyUpdateLib/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]; =20 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 a= dded in FSP 2.1, hence // the platform specific S3DataPtr must be used instead. // - VariableSize =3D 0; - MemorySavedData =3D NULL; - Status =3D PeiGetVariable ( - L"MemoryConfig", - &gFspNonVolatileStorageHobGuid, - &MemorySavedData, - &VariableSize - ); - DEBUG ((DEBUG_INFO, "Get L\"MemoryConfig\" gFspNonVolatileStorageHob= Guid - %r\n", Status)); - DEBUG ((DEBUG_INFO, "MemoryConfig Size - 0x%x\n", VariableSize)); - if (!EFI_ERROR (Status)) { - MiscPeiPreMemConfig->S3DataPtr =3D MemorySavedData; + FspNvsBufferPtr =3D NULL; + FspNvsBufferSize =3D 0; + Status =3D PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVaria= bleGuid, &FspNvsBufferPtr, &FspNvsBufferSize); + if (Status =3D=3D EFI_SUCCESS) { + DEBUG ((DEBUG_INFO, "Get L\"FspNvsBuffer\" gFspNvsBufferVariableGu= id - %r\n", Status)); + DEBUG ((DEBUG_INFO, "FspNvsBuffer Size - 0x%x\n", FspNvsBufferSize= )); + MiscPeiPreMemConfig->S3DataPtr =3D FspNvsBufferPtr; } =20 // diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Li= brary/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf b/Platf= orm/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/PeiSiliconPo= licyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf index f8bec0c852..dacec18cd9 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/P= eiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/P= eiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf @@ -1,7 +1,7 @@ ## @file # Provide FSP wrapper platform related function. # -# Copyright (c) 2017 - 2020 Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2021 Intel Corporation. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -80,7 +80,6 @@ PchInfoLib PchHsioLib PchPcieRpLib - MemoryAllocationLib CpuMailboxLib DebugPrintErrorLevelLib SiPolicyLib @@ -141,7 +140,7 @@ gKabylakeOpenBoardPkgTokenSpaceGuid.PcdGraphicsVbtGuid =20 [Guids] - gFspNonVolatileStorageHobGuid ## CONSUMES + gFspNvsBufferVariableGuid ## CONSUMES gTianoLogoGuid ## CONSUMES gEfiMemoryOverwriteControlDataGuid =20 diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Librar= y/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf b/Platform/Intel/= KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSiliconPolicyUpdateLib/= PeiSiliconPolicyUpdateLib.inf index 5c2da68bf9..4b30ba02ea 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSi= liconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSi= liconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf @@ -50,7 +50,7 @@ gHsioPciePreMemConfigGuid ## CONSUMES gHsioSataPreMemConfigGuid ## CONSUMES gSaMiscPeiPreMemConfigGuid ## CONSUMES - gFspNonVolatileStorageHobGuid ## CONSUMES + gFspNvsBufferVariableGuid ## CONSUMES =20 [Pcd] gSiPkgTokenSpaceGuid.PcdPeiMinMemorySize --=20 2.28.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#81955): https://edk2.groups.io/g/devel/message/81955 Mute This Topic: https://groups.io/mt/86306588/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Apr 25 04:48:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+81956+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81956+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1634191775; cv=none; d=zohomail.com; s=zohoarc; b=HnjzsIST6kfz7GAjj51jm3NwonBc/gB38/nU+j6dEOUAUYVtx5eTiuBBhoVSvQ1Q68KAcsDe3PUZ7zoGUPxNoAB+92e63WiHdX7+l6FIlFrqdHUkYGBydriytiICo3PJQFxWSVSG9tee+keX0rpGXtPFhtQZDNy+GuTrM6xSRrk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634191775; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=fHLqiJLXjL+0EsgAS4UNE24wfi91HF4lkoOIpCerjns=; b=Kevc8mng0AkR0elFJpU8YboIP9qqIo2p3lO7kJpWhT4+KDvE+J3GNF0QOggKWDJ9ebAH8mnSSpUfm8H9WVu5ELfORZsv4Rw3Am2ETaGCG2EReqVvydsUQA9er7Rmz6G/rVAEOBElFwciQnS3gC7f+LY9XH3ahojZk8McrFeLDdU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81956+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1634191775687357.98185692918196; Wed, 13 Oct 2021 23:09:35 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id J4EOYY1788612x96FzGW98Ew; Wed, 13 Oct 2021 23:09:35 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web08.5698.1634191773862495538 for ; Wed, 13 Oct 2021 23:09:33 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10136"; a="227890250" X-IronPort-AV: E=Sophos;i="5.85,371,1624345200"; d="scan'208";a="227890250" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2021 23:09:31 -0700 X-IronPort-AV: E=Sophos;i="5.85,371,1624345200"; d="scan'208";a="524927898" X-Received: from cchiu4-mobl.gar.corp.intel.com ([10.252.188.134]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2021 23:09:29 -0700 From: "Chiu, Chasel" To: devel@edk2.groups.io Cc: Chasel Chiu , Sai Chaganty , Nate DeSimone , Heng Luo Subject: [edk2-devel] [edk2-platforms: PATCH v4 6/9] TigerlakeOpenBoardPkg: Use same variable name for FspNvsHob. Date: Thu, 14 Oct 2021 14:09:06 +0800 Message-Id: <20211014060909.2040-7-chasel.chiu@intel.com> In-Reply-To: <20211014060909.2040-1-chasel.chiu@intel.com> References: <20211014060909.2040-1-chasel.chiu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,chasel.chiu@intel.com X-Gm-Message-State: TjzFpNyKYnHznG9VkmOkMgXtx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634191775; bh=FROKZenOrEcIXe7qR6vw0EdSmnTTadRYNsM5Vh/pRS4=; h=Cc:Date:From:Reply-To:Subject:To; b=Cdt4Q4i9xx/g8DWUyjKnDDJpvipztxarp1d3rLgXH8+YV1+KAmZHy9fwg2afpbDY3eK E/8P2QhzDeQ1d2shqvWZ8K8dr6F3lWCV7de4D309L0w04J/aQRZygKQxcUkvvjZJauN09 cO80XqsKEQWpmtIp7niHXoEivTEc2fWiLjc= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634191777116100023 Content-Type: text/plain; charset="utf-8" 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: Sai Chaganty Cc: Nate DeSimone Cc: Heng Luo Signed-off-by: Chasel Chiu Reviewed-by: Nate DeSimone Reviewed-by: Heng Luo --- Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLi= b/PeiFspPolicyInitLib.c | 21 ++++++++++++++++++--- Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLi= b/PeiFspPolicyInitLib.inf | 1 + 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFsp= PolicyInitLib/PeiFspPolicyInitLib.c b/Platform/Intel/TigerlakeOpenBoardPkg/= FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.c index fc523e93d1..938b74e5d8 100644 --- a/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyI= nitLib/PeiFspPolicyInitLib.c +++ b/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyI= nitLib/PeiFspPolicyInitLib.c @@ -9,7 +9,9 @@ #include #include #include +#include #include +#include =20 VOID EFIAPI @@ -70,9 +72,11 @@ SiliconPolicyDonePreMem( ) { EFI_STATUS Status; + UINTN FspNvsBufferSize; + VOID *FspNvsBufferPtr; #if FixedPcdGet8(PcdFspModeSelection) =3D=3D 0 - FSPM_ARCH_CONFIG_PPI *FspmArchConfigPpi; - EFI_PEI_PPI_DESCRIPTOR *FspmArchConfigPpiDesc; + FSPM_ARCH_CONFIG_PPI *FspmArchConfigPpi; + EFI_PEI_PPI_DESCRIPTOR *FspmArchConfigPpiDesc; =20 FspmArchConfigPpi =3D (FSPM_ARCH_CONFIG_PPI *) AllocateZeroPool (sizeof = (FSPM_ARCH_CONFIG_PPI)); if (FspmArchConfigPpi =3D=3D NULL) { @@ -80,7 +84,6 @@ SiliconPolicyDonePreMem( return EFI_OUT_OF_RESOURCES; } FspmArchConfigPpi->Revision =3D 1; - FspmArchConfigPpi->NvsBufferPtr =3D NULL; FspmArchConfigPpi->BootLoaderTolumSize =3D 0; =20 FspmArchConfigPpiDesc =3D (EFI_PEI_PPI_DESCRIPTOR *) AllocateZeroPool (s= izeof (EFI_PEI_PPI_DESCRIPTOR)); @@ -98,6 +101,18 @@ SiliconPolicyDonePreMem( ASSERT_EFI_ERROR (Status); #endif =20 + // + // Initialize S3 Data variable (S3DataPtr). It may be used for warm and = fast boot paths. + // + FspNvsBufferPtr =3D NULL; + FspNvsBufferSize =3D 0; + Status =3D PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableG= uid, &FspNvsBufferPtr, &FspNvsBufferSize); + if (Status =3D=3D 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, FspmA= rchConfigPpi->NvsBufferPtr, FspNvsBufferPtr); + } + // // Install Policy Ready PPI // While installed, RC assumes the Policy is ready and finalized. So ple= ase diff --git a/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFsp= PolicyInitLib/PeiFspPolicyInitLib.inf b/Platform/Intel/TigerlakeOpenBoardPk= g/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf index 708fbac08f..0236ae45ae 100644 --- a/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyI= nitLib/PeiFspPolicyInitLib.inf +++ b/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyI= nitLib/PeiFspPolicyInitLib.inf @@ -181,3 +181,4 @@ gTianoLogoGuid ## CONSUMES gCnviConfigGuid ## CONSUMES gHdAudioPreMemConfigGuid ## CONSUMES + gFspNvsBufferVariableGuid ## CONSUMES --=20 2.28.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#81956): https://edk2.groups.io/g/devel/message/81956 Mute This Topic: https://groups.io/mt/86306589/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Apr 25 04:48:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+81957+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81957+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1634191776; cv=none; d=zohomail.com; s=zohoarc; b=XqhV16+D9llHscHYLNVbr60nvOgcNqfAlXXq+9LJqWGPl19iqEyTBKPiLrvNAGQeZon0LI8xi1heoyM+3n0OSa+JHNLIcHB+tE+JWC7QLzLzWd1ysRYSlm6ijIbl1jO9xB/UkctDqOqjR+lgohlJ5OC+fjR/gLR0WxIPM0FDyx8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634191776; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=t3+1Tzk6wtHbs9au1wEzSy3xRcOIU4O6VqnJLsknHCw=; b=argvY/2H4BrPFWyTZtvE/ZspvkzpFWXXisV4iEuRtxfon/X5pKzmT39gvz2Sr0i/EGkRPb3c9Ul1+0LAqglWCUjML3d5SudjNrlAixDp4MdGbROsq24/bZoTH8AC0FbbpH9rZ94HG+EQzVNy5DL5m20/OOfKSHSpANvJiXtm3z0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81957+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 16341917761291008.3220623086436; Wed, 13 Oct 2021 23:09:36 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id R7UJYY1788612xHZ360vou3F; Wed, 13 Oct 2021 23:09:35 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web12.5656.1634191771996632083 for ; Wed, 13 Oct 2021 23:09:34 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10136"; a="227890260" X-IronPort-AV: E=Sophos;i="5.85,371,1624345200"; d="scan'208";a="227890260" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2021 23:09:32 -0700 X-IronPort-AV: E=Sophos;i="5.85,371,1624345200"; d="scan'208";a="524927932" X-Received: from cchiu4-mobl.gar.corp.intel.com ([10.252.188.134]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2021 23:09:31 -0700 From: "Chiu, Chasel" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone Subject: [edk2-devel] [edk2-platforms: PATCH v4 7/9] WhiskeylakeOpenBoardPkg: Use same variable name for FspNvsHob. Date: Thu, 14 Oct 2021 14:09:07 +0800 Message-Id: <20211014060909.2040-8-chasel.chiu@intel.com> In-Reply-To: <20211014060909.2040-1-chasel.chiu@intel.com> References: <20211014060909.2040-1-chasel.chiu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,chasel.chiu@intel.com X-Gm-Message-State: LjnmzG7q6XHWtD6MQUSdtCvFx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634191775; bh=cgD25zS6gGRaRBPTpJJG5wPqUATGaOhdtVLoC+H0k+c=; h=Cc:Date:From:Reply-To:Subject:To; b=aI7nlav6VWpXH6kL/BWfqYFNwUCW31xHxDL3B9esgYWQys179WAFuqiuu3Z8h1DupgO c28cEItXsfAQhXrnzVztNw5k9HIIaneRIXNzWqCl6oNnfmJezcXm79uLlP67FeGFw0kXm mPwaSPyUYPqUh+ACwyw1n1yRpp28i+TgvH0= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634191777147100028 Content-Type: text/plain; charset="utf-8" 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 Signed-off-by: Chasel Chiu Reviewed-by: Nate DeSimone --- Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicy= UpdateLibFsp/PeiFspMiscUpdUpdateLib.c | 63 ++++++++++++---= ------------------------------------------------ Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSili= conPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c | 63 ++++++++++++---= ------------------------------------------------ Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicy= UpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf | 5 ++--- Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSili= conPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf | 4 ++-- Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/Include/Fdf/FlashMapInclud= e.fdf | 18 +++++++++------= --- 5 files changed, 37 insertions(+), 116 deletions(-) diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiS= iliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c b/Platform/Intel/Whiskeyl= akeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscU= pdUpdateLib.c index a341a58930..ab35bc3f8f 100644 --- a/Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconP= olicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c +++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconP= olicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c @@ -2,7 +2,7 @@ Implementation of Fsp Misc UPD Initialization. =20 =20 - Copyright (c) 2019, Intel Corporation. All rights reserved.
+ Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ =20 @@ -17,11 +17,9 @@ #include #include =20 -#include #include #include #include -#include #include #include =20 @@ -44,55 +42,18 @@ PeiFspMiscUpdUpdatePreMem ( ) { EFI_STATUS Status; - EFI_PEI_READ_ONLY_VARIABLE2_PPI *VariableServices; - UINTN VariableSize; - VOID *MemorySavedData; - - Status =3D PeiServicesLocatePpi ( - &gEfiPeiReadOnlyVariable2PpiGuid, - 0, - NULL, - (VOID **) &VariableServices - ); - if (EFI_ERROR (Status)) { - ASSERT_EFI_ERROR (Status); - return Status; - } - - VariableSize =3D 0; - MemorySavedData =3D NULL; - Status =3D VariableServices->GetVariable ( - VariableServices, - L"MemoryConfig", - &gFspNonVolatileStorageHobGuid, - NULL, - &VariableSize, - MemorySavedData - ); - if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { - MemorySavedData =3D AllocatePool (VariableSize); - if (MemorySavedData =3D=3D NULL) { - ASSERT (MemorySavedData !=3D NULL); - return EFI_OUT_OF_RESOURCES; - } - - DEBUG ((DEBUG_INFO, "VariableSize is 0x%x\n", VariableSize)); - Status =3D VariableServices->GetVariable ( - VariableServices, - L"MemoryConfig", - &gFspNonVolatileStorageHobGuid, - NULL, - &VariableSize, - MemorySavedData - ); - if (Status =3D=3D EFI_SUCCESS) { - FspmUpd->FspmArchUpd.NvsBufferPtr =3D MemorySavedData; - } else { - DEBUG ((DEBUG_ERROR, "Fail to retrieve Variable:\"MemoryConfig\" gMe= moryConfigVariableGuid, Status =3D %r\n", Status)); - ASSERT_EFI_ERROR (Status); - } + UINTN FspNvsBufferSize; + VOID *FspNvsBufferPtr; + + FspNvsBufferPtr =3D NULL; + FspNvsBufferSize =3D 0; + Status =3D PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableG= uid, &FspNvsBufferPtr, &FspNvsBufferSize); + if (Status =3D=3D EFI_SUCCESS) { + FspmUpd->FspmArchUpd.NvsBufferPtr =3D 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 =3D NULL; } - FspmUpd->FspmArchUpd.NvsBufferPtr =3D MemorySavedData; =20 return EFI_SUCCESS; } diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Lib= rary/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c b/Platform/Intel= /WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPolicyUpdate= LibFsp/PeiFspMiscUpdUpdateLib.c index 145deb5de3..381ef232ea 100644 --- a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/Pe= iSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c +++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/Pe= iSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c @@ -2,7 +2,7 @@ Implementation of Fsp Misc UPD Initialization. =20 =20 - Copyright (c) 2020, Intel Corporation. All rights reserved.
+ Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ =20 @@ -18,11 +18,9 @@ #include #include =20 -#include #include #include #include -#include #include #include #include @@ -46,54 +44,17 @@ PeiFspMiscUpdUpdatePreMem ( ) { EFI_STATUS Status; - EFI_PEI_READ_ONLY_VARIABLE2_PPI *VariableServices; - UINTN VariableSize; - VOID *MemorySavedData; - - Status =3D PeiServicesLocatePpi ( - &gEfiPeiReadOnlyVariable2PpiGuid, - 0, - NULL, - (VOID **) &VariableServices - ); - if (EFI_ERROR (Status)) { - ASSERT_EFI_ERROR (Status); - return Status; - } - - VariableSize =3D 0; - MemorySavedData =3D NULL; - Status =3D VariableServices->GetVariable ( - VariableServices, - L"MemoryConfig", - &gFspNonVolatileStorageHobGuid, - NULL, - &VariableSize, - MemorySavedData - ); - if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { - MemorySavedData =3D AllocatePool (VariableSize); - if (MemorySavedData =3D=3D NULL) { - ASSERT (MemorySavedData !=3D NULL); - return EFI_OUT_OF_RESOURCES; - } - - DEBUG ((DEBUG_INFO, "VariableSize is 0x%x\n", VariableSize)); - Status =3D VariableServices->GetVariable ( - VariableServices, - L"MemoryConfig", - &gFspNonVolatileStorageHobGuid, - NULL, - &VariableSize, - MemorySavedData - ); - if (Status =3D=3D EFI_SUCCESS) { - FspmUpd->FspmArchUpd.NvsBufferPtr =3D MemorySavedData; - } else { - FspmUpd->FspmArchUpd.NvsBufferPtr =3D NULL; - DEBUG ((DEBUG_ERROR, "Fail to retrieve Variable:\"MemoryConfig\" gMe= moryConfigVariableGuid, Status =3D %r\n", Status)); - ASSERT_EFI_ERROR (Status); - } + UINTN FspNvsBufferSize; + VOID *FspNvsBufferPtr; + + FspNvsBufferPtr =3D NULL; + FspNvsBufferSize =3D 0; + Status =3D PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableG= uid, &FspNvsBufferPtr, &FspNvsBufferSize); + if (Status =3D=3D EFI_SUCCESS) { + FspmUpd->FspmArchUpd.NvsBufferPtr =3D 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 =3D NULL; } =20 FspmUpd->FspmConfig.TsegSize =3D FixedPcdGet32 (PcdTsegSize= ); diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiS= iliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf b/Platform/Intel/= WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/Pei= SiliconPolicyUpdateLibFsp.inf index 2c90d0cb94..362dc2c995 100644 --- a/Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconP= olicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf +++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconP= olicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf @@ -2,7 +2,7 @@ # Provide FSP wrapper platform related function. # # -# Copyright (c) 2019 - 2020 Intel Corporation. All rights reserved.
+# Copyright (c) 2019 - 2021 Intel Corporation. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -82,7 +82,6 @@ PchInfoLib PchHsioLib PchPcieRpLib - MemoryAllocationLib DebugPrintErrorLevelLib SiPolicyLib PchGbeLib @@ -132,7 +131,7 @@ gWhiskeylakeOpenBoardPkgTokenSpaceGuid.PcdMrcSpdAddressTable3 =20 [Guids] - gFspNonVolatileStorageHobGuid ## CONSUMES + gFspNvsBufferVariableGuid ## CONSUMES gTianoLogoGuid ## CONSUMES gEfiMemoryOverwriteControlDataGuid =20 diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Lib= rary/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf b/Platfo= rm/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPoli= cyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf index 529c2f1253..1a664b1327 100644 --- a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/Pe= iSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf +++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/Pe= iSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf @@ -2,7 +2,7 @@ # FSP silicon policy updates for the Up Xtreme board. # # -# Copyright (c) 2020, Intel Corporation. All rights reserved.
+# Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -136,7 +136,7 @@ gWhiskeylakeOpenBoardPkgTokenSpaceGuid.PcdBoardBomId =20 [Guids] - gFspNonVolatileStorageHobGuid ## CONSUMES + gFspNvsBufferVariableGuid ## CONSUMES gTianoLogoGuid ## CONSUMES gEfiMemoryOverwriteControlDataGuid =20 diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/Include/Fdf/Fl= ashMapInclude.fdf b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/Include= /Fdf/FlashMapInclude.fdf index f7aa730ae7..698efce248 100644 --- a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/Include/Fdf/FlashMapI= nclude.fdf +++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/Include/Fdf/FlashMapI= nclude.fdf @@ -2,7 +2,7 @@ # Flash map for the UpXtreme Board. # # -# Copyright (c) 2020, Intel Corporation. All rights reserved.
+# Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -35,16 +35,16 @@ SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootSize = =3D 0x00090000 SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootOffset =3D 0x= 00190000 # Flash addr (0xFFAE0000) SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootSize =3D 0x= 00190000 # SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryOffset =3D 0x= 00320000 # Flash addr (0xFFC70000) -SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemorySize =3D 0x= 00170000 # -SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSOffset =3D 0x= 00490000 # Flash addr (0xFFDE0000) +SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemorySize =3D 0x= 00160000 # +SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSOffset =3D 0x= 00480000 # Flash addr (0xFFDD0000) SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSSize =3D 0x= 00070000 # -SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvOffset =3D 0x= 00500000 # Flash addr (0xFFE50000) +SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvOffset =3D 0x= 004F0000 # Flash addr (0xFFE40000) SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize =3D 0x= 00050000 # -SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMOffset =3D 0x= 00550000 # Flash addr (0xFFEA0000) +SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMOffset =3D 0x= 00540000 # Flash addr (0xFFE90000) SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMSize =3D 0x= 000EA000 # -SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTOffset =3D 0x= 0063A000 # Flash addr (0xFFF8A000) +SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTOffset =3D 0x= 0062A000 # Flash addr (0xFFF7A000) SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTSize =3D 0x= 00006000 # -SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryOffset =3D 0x= 00640000 # Flash addr (0xFFF90000) +SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryOffset =3D 0x= 00630000 # Flash addr (0xFFF80000) SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize =3D 0x= 00010000 # -SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryOffset =3D 0x= 00650000 # Flash addr (0xFFFA0000) -SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize =3D 0x= 00060000 # +SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryOffset =3D 0x= 00640000 # Flash addr (0xFFF90000) +SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize =3D 0x= 00070000 # --=20 2.28.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#81957): https://edk2.groups.io/g/devel/message/81957 Mute This Topic: https://groups.io/mt/86306590/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Apr 25 04:48:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+81959+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81959+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1634191779; cv=none; d=zohomail.com; s=zohoarc; b=L4lkm/TNNtxfVrRlid9QSXcMDQl5sqUVb67JnkpPzJ0eg27o1Lb5j72vgF0NUZavaUvY8fXGbFn14R1k3DKvdu18rtcAEqRcGM3j90KMebDJDfYGHzphIGqKgm1coqxSrQWeIb4rbpNMkpPj3Aba5YZQlungNvx3AjRbDUi4pbk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634191779; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=tx1oyJY+IpKKtgdJ21zSLI2CQOR9csNYqXIUulYgUhg=; b=juXoTOfxR4kNOuWXSk2szbS6kAbEJoWVOa+/CNv9xKftGWGBt9tAoixIiDatwIoGrkjbSl5u1gK9kPfepragISpMI0O8GcXXtEu2y86WALelV81opa085n3rEzztwAgPjUlQeDCh2Wb7C9VK63gAqD2ad99+8HKIMSA5D+22hEw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81959+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1634191779097861.7948452041342; Wed, 13 Oct 2021 23:09:39 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id XX0YYY1788612xUhLY3ef7je; Wed, 13 Oct 2021 23:09:38 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web11.5835.1634191777856738572 for ; Wed, 13 Oct 2021 23:09:37 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10136"; a="227890270" X-IronPort-AV: E=Sophos;i="5.85,371,1624345200"; d="scan'208";a="227890270" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2021 23:09:34 -0700 X-IronPort-AV: E=Sophos;i="5.85,371,1624345200"; d="scan'208";a="524927959" X-Received: from cchiu4-mobl.gar.corp.intel.com ([10.252.188.134]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2021 23:09:32 -0700 From: "Chiu, Chasel" To: devel@edk2.groups.io Cc: Chasel Chiu , Isaac Oram , Nate DeSimone Subject: [edk2-devel] [edk2-platforms: PATCH v4 8/9] WhitleyOpenBoardPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2. Date: Thu, 14 Oct 2021 14:09:08 +0800 Message-Id: <20211014060909.2040-9-chasel.chiu@intel.com> In-Reply-To: <20211014060909.2040-1-chasel.chiu@intel.com> References: <20211014060909.2040-1-chasel.chiu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,chasel.chiu@intel.com X-Gm-Message-State: d28qA99q7EgVP84omFgJwpX5x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634191778; bh=b6/NKMlYKQgYIt4mNh36CzScyC5S4uZ/yj53UYJFqWY=; h=Cc:Date:From:Reply-To:Subject:To; b=dooWHU9rIkUkwCWskM4dgwB41/g5ve5cdv6raTdy/xDnKXsrlVTb6KrVuTdK+jwU6Qe OIZkUTy2wpD5+0bmG/lIIvs/bnRsOpKX+tZiMR6e3JMDm32WVCyLaU+FIf9qt1n0DjBaM 5YHtV+kYD0qisyNHuCKM8DPFwBJTNvJ2/IU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634191781284100039 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3678 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 Cc: Nate DeSimone Signed-off-by: Chasel Chiu Reviewed-by: Nate DeSimone --- Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSave.c = | 29 +++++++++++++++++++++++------ Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSave.in= f | 4 +++- Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc = | 1 + 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3= NvramSave.c b/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S= 3NvramSave.c index 709c7ad479..01e36cda27 100644 --- a/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSa= ve.c +++ b/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSa= ve.c @@ -7,6 +7,7 @@ **/ =20 #include "S3NvramSave.h" +#include #include #include #include @@ -80,21 +81,37 @@ SaveFspNonVolatileStorageHob ( Status =3D EFI_SUCCESS; =20 DEBUG ((DEBUG_INFO, "Saving FSP / MRC Training Data\n")); - GuidHob =3D GetFirstGuidHob (&gFspNonVolatileStorageHobGuid); + // + // Firstly check version2 FspNvsHob. + // + GuidHob =3D GetFirstGuidHob (&gFspNonVolatileStorageHob2Guid); if (GuidHob !=3D NULL) { - HobData =3D GET_GUID_HOB_DATA (GuidHob); - DataSize =3D GET_GUID_HOB_DATA_SIZE (GuidHob); + HobData =3D (VOID *) (UINTN) ((FSP_NON_VOLATILE_STORAGE_HOB2 *) (UINTN= ) GuidHob)->NvsDataPtr; + DataSize =3D (UINTN) ((FSP_NON_VOLATILE_STORAGE_HOB2 *) (UINTN) GuidHo= b)->NvsDataLength; + } else { + // + // Fall back to version1 FspNvsHob + // + GuidHob =3D GetFirstGuidHob (&gFspNonVolatileStorageHobGuid); + if (GuidHob !=3D NULL) { + HobData =3D GET_GUID_HOB_DATA (GuidHob); + DataSize =3D GET_GUID_HOB_DATA_SIZE (GuidHob); + } + } + if (HobData !=3D NULL) { + DEBUG ((DEBUG_INFO, "FspNvsHob.Size: %d\n", DataSize)); + DEBUG ((DEBUG_INFO, "FspNvsHob.NvsDataPtr: 0x%x\n", HobData)); if (DataSize > 0) { =20 // // Check if the presently saved data is identical to the data given = by MRC/FSP // - Status =3D GetLargeVariable (L"FspNvsBuffer", &gFspNonVolatileStorag= eHobGuid, &FspNvsBufferSize, NULL); + Status =3D GetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariable= Guid, &FspNvsBufferSize, NULL); if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { if (FspNvsBufferSize =3D=3D DataSize) { VariableData =3D AllocatePool (FspNvsBufferSize); if (VariableData !=3D NULL) { - Status =3D GetLargeVariable (L"FspNvsBuffer", &gFspNonVolatile= StorageHobGuid, &FspNvsBufferSize, VariableData); + Status =3D GetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVa= riableGuid, &FspNvsBufferSize, VariableData); if (!EFI_ERROR (Status) && (FspNvsBufferSize =3D=3D DataSize) = && (0 =3D=3D CompareMem (HobData, VariableData, DataSize))) { DataIsIdentical =3D TRUE; } @@ -105,7 +122,7 @@ SaveFspNonVolatileStorageHob ( Status =3D EFI_SUCCESS; =20 if (!DataIsIdentical) { - Status =3D SetLargeVariable (L"FspNvsBuffer", &gFspNonVolatileStor= ageHobGuid, TRUE, DataSize, HobData); + Status =3D SetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariab= leGuid, 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/S3= NvramSave.inf b/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave= /S3NvramSave.inf index e62baa24c4..a77125cf44 100644 --- a/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSa= ve.inf +++ b/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSa= ve.inf @@ -43,7 +43,9 @@ LargeVariableWriteLib =20 [Guids] - gFspNonVolatileStorageHobGuid # CONSUMES + gFspNonVolatileStorageHobGuid # CONSUMES + gFspNonVolatileStorageHob2Guid # CONSUMES + gFspNvsBufferVariableGuid # PRODUCES =20 [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 @@ =20 [LibraryClasses.Common] DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf + PeiLib|MinPlatformPkg/Library/PeiLib/PeiLib.inf =20 [Components.IA32] UefiCpuPkg/SecCore/SecCore.inf --=20 2.28.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#81959): https://edk2.groups.io/g/devel/message/81959 Mute This Topic: https://groups.io/mt/86306592/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Apr 25 04:48:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+81958+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81958+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1634191778; cv=none; d=zohomail.com; s=zohoarc; b=TqUqQUX0M3BiGlMBCa8Iedqf9tjY4ARuooyai38cbvzfBnJgEBQ/mLPxxU4uhJH/Q2VBqdSxjAztvPxv1OQnYWpCG75HFiEShpFdGRelVFgyUPUzOfckfwDzoazUZAS0SQCuJdGp+rt4H5EQpt0cHO+YVlbQ0HkErt1N6zPmzto= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634191778; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=0pStWYwCC/ugNeAT+ngQF6FKFGlYHMgkUdVXeHYuTDQ=; b=iHSGbqZKsMHpFSCh2Kw11HxvFtoaVyAe+bzpSS9UQuxndOuUOEd26VGL+facKRBgk82mOM/9qlNu9KxH78Baw9/LmHdUWSjLpi1lbfA1qOuGdzlF+D2PDlFDgMo2Nr7saYiWpI9KAGqPJmok39y7iYsSaDjEDYVmGJ4adEtFUKY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81958+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1634191778598890.9854304166171; Wed, 13 Oct 2021 23:09:38 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id g3Q5YY1788612xSCzEGXl4Ft; Wed, 13 Oct 2021 23:09:38 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web12.5656.1634191771996632083 for ; Wed, 13 Oct 2021 23:09:37 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10136"; a="227890277" X-IronPort-AV: E=Sophos;i="5.85,371,1624345200"; d="scan'208";a="227890277" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2021 23:09:36 -0700 X-IronPort-AV: E=Sophos;i="5.85,371,1624345200"; d="scan'208";a="524927968" X-Received: from cchiu4-mobl.gar.corp.intel.com ([10.252.188.134]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2021 23:09:34 -0700 From: "Chiu, Chasel" To: devel@edk2.groups.io Cc: Chasel Chiu , Isaac Oram , Nate DeSimone Subject: [edk2-devel] [edk2-platforms: PATCH v4 9/9] WhitleySiliconPkg: Use same variable name for FspNvsHob. Date: Thu, 14 Oct 2021 14:09:09 +0800 Message-Id: <20211014060909.2040-10-chasel.chiu@intel.com> In-Reply-To: <20211014060909.2040-1-chasel.chiu@intel.com> References: <20211014060909.2040-1-chasel.chiu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,chasel.chiu@intel.com X-Gm-Message-State: 3UqkWXMgcrwufPBSHO0uTijAx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634191778; bh=r9ydYdR86cUyoSmNb+bQffRsi6TX9SmU54H71+Hk82o=; h=Cc:Date:From:Reply-To:Subject:To; b=R2R8ouBFliXfUkLoSbmydzQLhCGf/80e+FhnIfKBA7sai5r+j6YFBMxCjEn1BpWF0Q4 IGqTiIJsoH2+qOqpOV+WZmZK87QiAkm8xgUWsVI1xVWQhHSS1l1T5SGfG8S8hNR8jPUUL IYWQ2K13Wpmx5lR9gYW6CS45BVl2zq81hBA= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634191779246100033 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Nate DeSimone --- 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 #include #include - +#include #include #include #include @@ -24,39 +24,22 @@ GetFspNvsBuffer ( ) { EFI_STATUS Status; - UINTN FspNvsBufferSize; - VOID *FspNvsBufferPtr; + UINTN FspNvsBufferSize; + VOID *FspNvsBufferPtr; =20 FspNvsBufferPtr =3D NULL; FspNvsBufferSize =3D 0; - Status =3D GetLargeVariable (L"FspNvsBuffer", &gFspNonVolatileStorageHob= Guid, &FspNvsBufferSize, NULL); - if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { - DEBUG ((DEBUG_INFO, "FspNvsBuffer Size =3D %d\n", FspNvsBufferSize)); - FspNvsBufferPtr =3D AllocateZeroPool (FspNvsBufferSize); - if (FspNvsBufferPtr =3D=3D NULL) { - DEBUG ((DEBUG_ERROR, "Error: Cannot create FspNvsBuffer, out of memo= ry!\n")); - ASSERT (FALSE); - return NULL; - } - Status =3D GetLargeVariable (L"FspNvsBuffer", &gFspNonVolatileStorageH= obGuid, &FspNvsBufferSize, FspNvsBufferPtr); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "Error: Unable to read FspNvsBuffer UEFI variab= le Status: %r\n", Status)); - ASSERT_EFI_ERROR (Status); - return NULL; - } - + Status =3D PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableG= uid, &FspNvsBufferPtr, &FspNvsBufferSize); + if (Status =3D=3D EFI_SUCCESS) { return FspNvsBufferPtr; - - } else if (Status =3D=3D 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; } =20 + +} + VOID EFIAPI UpdateFspmUpdData ( 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 @@ =20 [Guids] gEfiPlatformInfoGuid - gFspNonVolatileStorageHobGuid + gFspNvsBufferVariableGuid # CONSUMES =20 [LibraryClasses] PeiServicesLib LargeVariableReadLib + PeiLib =20 [Pcd] gIntelFsp2PkgTokenSpaceGuid.PcdTemporaryRamBase ## CONSUMES --=20 2.28.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#81958): https://edk2.groups.io/g/devel/message/81958 Mute This Topic: https://groups.io/mt/86306591/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-