From nobody Tue Feb 10 19:15:15 2026 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+82012+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+82012+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1634203069; cv=none; d=zohomail.com; s=zohoarc; b=N/clrDXPgjNe51fptNX9to20vsDkSt0pW44NJftdNcegOtkYw+B0nnhE5uTevfq9/ZUOfeNjxcV6/Gm8OlMXP+aY7g1VotKDuyCOx4El3Z6PMWT7wiCZ6pC67WVvp9nQ/4f+1jkmDTrGdRzWiRBwwW18pUPVkpZrRRIKoikRJGc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634203069; 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=zCRBCZFtdBqHf3jWem3pWq/lj0J2jZlgAMdGoUvHDBc=; b=OWsQDqakipDNET0ze8c/R7dWq7v2MtdvBhMQ2VK+z5aHn0MCoM0fNQrvEmiffLNP+SmkBc7GN3VSrCdYQR2GrdqFYRndM3DFM+G/DvGWum4c5hw8THYqM/yX9wJ4G4Q2hog/Qga4qqdkUsYkM3R1tMxsx2bQ9bzagEmQTEFyS2U= 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+82012+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 163420306908565.68529959218677; Thu, 14 Oct 2021 02:17:49 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id ZPOpYY1788612x5h8WPaLZT7; Thu, 14 Oct 2021 02:17:48 -0700 X-Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web09.6929.1634203067508091172 for ; Thu, 14 Oct 2021 02:17:47 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10136"; a="251071718" X-IronPort-AV: E=Sophos;i="5.85,372,1624345200"; d="scan'208";a="251071718" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2021 02:17:47 -0700 X-IronPort-AV: E=Sophos;i="5.85,372,1624345200"; d="scan'208";a="491871783" X-Received: from cchiu4-mobl.gar.corp.intel.com ([10.252.188.134]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2021 02:17:45 -0700 From: "Chiu, Chasel" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone , Liming Gao , Eric Dong Subject: [edk2-devel] [edk2-platforms: PATCH v5 1/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2. Date: Thu, 14 Oct 2021 17:16:14 +0800 Message-Id: <20211014091622.2168-2-chasel.chiu@intel.com> In-Reply-To: <20211014091622.2168-1-chasel.chiu@intel.com> References: <20211014091622.2168-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: gIPZcUHrcyq6pWSkBiasUnUlx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634203068; bh=bFiQr4hofTB9hA5ZuD6oBOggLifRgWq77B7oicv3tPI=; h=Cc:Date:From:Reply-To:Subject:To; b=Uod94QU/f0eNAWsdL7aSm8zBDtQlV8zwTr8JPKrggkOW4+3VDkQoSWDZZgLmhHTE/oE qPW4WfRd3HlTDY9K5kgLunlCkljAHhX5ZofR8I6jLSQ+MLlAEB/of7+dsbmw6+kLT0/rN g4v+SrBwQPRqnmhbjR5Ee64pCQZCSo8Nvxk= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634203070658100005 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/BaseLargeVariableLib/LargeVariableWr= iteLib.c | 2 +- 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 + 9 files changed, 176 insertions(+), 82 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/BaseLargeVariableLib/Lar= geVariableWriteLib.c b/Platform/Intel/MinPlatformPkg/Library/BaseLargeVaria= bleLib/LargeVariableWriteLib.c index 703aca6fd8..e4b97ef1df 100644 --- a/Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVaria= bleWriteLib.c +++ b/Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVaria= bleWriteLib.c @@ -343,7 +343,7 @@ SetLargeVariable ( // Check that it is possible to store the data using less than // MAX_VARIABLE_SPLIT variables // - if ((DataSize / (VariableSplitSize - MAX_VARIABLE_SPLIT_DIGITS)) > MAX= _VARIABLE_SPLIT) { + if ((DataSize / ((UINTN) VariableSplitSize - MAX_VARIABLE_SPLIT_DIGITS= )) > MAX_VARIABLE_SPLIT) { DEBUG (( DEBUG_ERROR, "SetLargeVariable: More than %d variables are needed to store the = data, which exceeds the maximum supported\n", diff --git a/Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.c b/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 (#82012): https://edk2.groups.io/g/devel/message/82012 Mute This Topic: https://groups.io/mt/86308172/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-