[edk2-platforms: PATCH v5 1/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2.


Chiu, Chasel
 

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 <nathaniel.l.desimone@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
---
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=0D
exists, and saves the data to nvRAM.=0D
=0D
-Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>=0D
+Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>=0D
SPDX-License-Identifier: BSD-2-Clause-Patent=0D
=0D
**/=0D
@@ -16,7 +16,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Guid/GlobalVariable.h>=0D
#include <Library/MemoryAllocationLib.h>=0D
#include <Library/BaseMemoryLib.h>=0D
-#include <Protocol/VariableLock.h>=0D
+#include <Library/LargeVariableReadLib.h>=0D
+#include <Library/LargeVariableWriteLib.h>=0D
+#include <Guid/FspNonVolatileStorageHob2.h>=0D
=0D
/**=0D
This is the standard EFI driver point that detects whether there is a=0D
@@ -40,86 +42,71 @@ SaveMemoryConfigEntryPoint (
VOID *VariableData;=0D
UINTN DataSize;=0D
UINTN BufferSize;=0D
- EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock;=0D
+ BOOLEAN DataIsIdentical;=0D
=0D
- DataSize =3D 0;=0D
- VariableData =3D NULL;=0D
- GuidHob =3D NULL;=0D
- HobData =3D NULL;=0D
+ DataSize =3D 0;=0D
+ BufferSize =3D 0;=0D
+ VariableData =3D NULL;=0D
+ GuidHob =3D NULL;=0D
+ HobData =3D NULL;=0D
+ DataIsIdentical =3D FALSE;=0D
=0D
//=0D
// Search for the Memory Configuration GUID HOB. If it is not present, =
then=0D
// there's nothing we can do. It may not exist on the update path.=0D
+ // Firstly check version2 FspNvsHob.=0D
//=0D
- GuidHob =3D GetFirstGuidHob (&gFspNonVolatileStorageHobGuid);=0D
+ GuidHob =3D GetFirstGuidHob (&gFspNonVolatileStorageHob2Guid);=0D
if (GuidHob !=3D NULL) {=0D
- HobData =3D GET_GUID_HOB_DATA (GuidHob);=0D
- DataSize =3D GET_GUID_HOB_DATA_SIZE(GuidHob);=0D
+ HobData =3D (VOID *) (UINTN) ((FSP_NON_VOLATILE_STORAGE_HOB2 *) (UINTN=
) GuidHob)->NvsDataPtr;=0D
+ DataSize =3D (UINTN) ((FSP_NON_VOLATILE_STORAGE_HOB2 *) (UINTN) GuidHo=
b)->NvsDataLength;=0D
+ } else {=0D
+ //=0D
+ // Fall back to version1 FspNvsHob=0D
+ //=0D
+ GuidHob =3D GetFirstGuidHob (&gFspNonVolatileStorageHobGuid);=0D
+ if (GuidHob !=3D NULL) {=0D
+ HobData =3D GET_GUID_HOB_DATA (GuidHob);=0D
+ DataSize =3D GET_GUID_HOB_DATA_SIZE (GuidHob);=0D
+ }=0D
+ }=0D
+=0D
+ if (HobData !=3D NULL) {=0D
+ DEBUG ((DEBUG_INFO, "FspNvsHob.NvsDataLength:%d\n", DataSize));=0D
+ DEBUG ((DEBUG_INFO, "FspNvsHob.NvsDataPtr : 0x%x\n", HobData));=0D
if (DataSize > 0) {=0D
//=0D
- // Use the HOB to save Memory Configuration Data=0D
+ // Check if the presently saved data is identical to the data given =
by MRC/FSP=0D
//=0D
- BufferSize =3D DataSize;=0D
- VariableData =3D AllocatePool (BufferSize);=0D
- if (VariableData =3D=3D NULL) {=0D
- return EFI_UNSUPPORTED;=0D
- }=0D
- Status =3D gRT->GetVariable (=0D
- L"MemoryConfig",=0D
- &gFspNonVolatileStorageHobGuid,=0D
- NULL,=0D
- &BufferSize,=0D
- VariableData=0D
- );=0D
-=0D
+ Status =3D GetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariable=
Guid, &BufferSize, NULL);=0D
if (Status =3D=3D EFI_BUFFER_TOO_SMALL) {=0D
- FreePool (VariableData);=0D
- VariableData =3D AllocatePool (BufferSize);=0D
- if (VariableData =3D=3D NULL) {=0D
- return EFI_UNSUPPORTED;=0D
+ if (BufferSize =3D=3D DataSize) {=0D
+ VariableData =3D AllocatePool (BufferSize);=0D
+ if (VariableData !=3D NULL) {=0D
+ Status =3D GetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVa=
riableGuid, &BufferSize, VariableData);=0D
+ if (!EFI_ERROR (Status) && (BufferSize =3D=3D DataSize) && (0 =
=3D=3D CompareMem (HobData, VariableData, DataSize))) {=0D
+ DataIsIdentical =3D TRUE;=0D
+ }=0D
+ FreePool (VariableData);=0D
+ }=0D
}=0D
-=0D
- Status =3D gRT->GetVariable (=0D
- L"MemoryConfig",=0D
- &gFspNonVolatileStorageHobGuid,=0D
- NULL,=0D
- &BufferSize,=0D
- VariableData=0D
- );=0D
}=0D
+ Status =3D EFI_SUCCESS;=0D
=0D
- if ( (EFI_ERROR(Status)) || BufferSize !=3D DataSize || 0 !=3D Compa=
reMem (HobData, VariableData, DataSize)) {=0D
- Status =3D gRT->SetVariable (=0D
- L"MemoryConfig",=0D
- &gFspNonVolatileStorageHobGuid,=0D
- (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERV=
ICE_ACCESS),=0D
- DataSize,=0D
- HobData=0D
- );=0D
+ if (!DataIsIdentical) {=0D
+ Status =3D SetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariab=
leGuid, TRUE, DataSize, HobData);=0D
ASSERT_EFI_ERROR (Status);=0D
-=0D
- DEBUG((DEBUG_INFO, "Restored Size is 0x%x\n", DataSize));=0D
- }=0D
-=0D
- //=0D
- // Mark MemoryConfig to read-only if the Variable Lock protocol exis=
ts=0D
- //=0D
- Status =3D gBS->LocateProtocol(&gEdkiiVariableLockProtocolGuid, NULL=
, (VOID **)&VariableLock);=0D
- if (!EFI_ERROR(Status)) {=0D
- Status =3D VariableLock->RequestToLock(VariableLock, L"MemoryConfi=
g", &gFspNonVolatileStorageHobGuid);=0D
- ASSERT_EFI_ERROR(Status);=0D
+ DEBUG ((DEBUG_INFO, "Saved size of FSP / MRC Training Data: 0x%x\n=
", DataSize));=0D
+ } else {=0D
+ DEBUG ((DEBUG_INFO, "FSP / MRC Training Data is identical to data =
from last boot, no need to save.\n"));=0D
}=0D
-=0D
- FreePool (VariableData);=0D
- } else {=0D
- DEBUG((DEBUG_INFO, "Memory save size is %d\n", DataSize));=0D
}=0D
} else {=0D
DEBUG((DEBUG_ERROR, "Memory S3 Data HOB was not found\n"));=0D
}=0D
=0D
//=0D
- // This driver does not produce any protocol services, so always unload =
it.=0D
+ // This driver cannot be unloaded because DxeRuntimeVariableWriteLib con=
structor will register ExitBootServices callback.=0D
//=0D
- return EFI_REQUEST_UNLOAD_IMAGE;=0D
+ return EFI_SUCCESS;=0D
}=0D
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=0D
// MAX_VARIABLE_SPLIT variables=0D
//=0D
- if ((DataSize / (VariableSplitSize - MAX_VARIABLE_SPLIT_DIGITS)) > MAX=
_VARIABLE_SPLIT) {=0D
+ if ((DataSize / ((UINTN) VariableSplitSize - MAX_VARIABLE_SPLIT_DIGITS=
)) > MAX_VARIABLE_SPLIT) {=0D
DEBUG ((=0D
DEBUG_ERROR,=0D
"SetLargeVariable: More than %d variables are needed to store the =
data, which exceeds the maximum supported\n",=0D
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=0D
=0D
-Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>=0D
+Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>=0D
SPDX-License-Identifier: BSD-2-Clause-Patent=0D
=0D
**/=0D
@@ -9,13 +9,17 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/DebugLib.h>=0D
#include <Library/PeiServicesLib.h>=0D
#include <Library/MemoryAllocationLib.h>=0D
+#include <Library/LargeVariableReadLib.h>=0D
#include <Ppi/ReadOnlyVariable2.h>=0D
=0D
/**=0D
- Returns the status whether get the variable success. The function retrie=
ves =0D
- variable through the ReadOnlyVariable2 PPI GetVariable(). The =0D
- returned buffer is allocated using AllocatePool(). The caller is respon=
sible=0D
- for freeing this buffer with FreePool().=0D
+ Returns the status whether get the variable success. The function retrie=
ves=0D
+ variable through the ReadOnlyVariable2 PPI GetVariable().=0D
+=0D
+ If the *Size is 0, the returned buffer is allocated using AllocatePool()=
.=0D
+ The buffer is not expected to be freed as PEI does not support a FreePoo=
l().=0D
+=0D
+ If the *Size is non-0, this function just uses caller allocated *Value.=
=0D
=0D
If Name is NULL, then ASSERT().=0D
If Guid is NULL, then ASSERT().=0D
@@ -108,6 +112,71 @@ PeiGetVariable (
return Status;=0D
}=0D
=0D
+/**=0D
+ This function returns a "large variable". A large variable is stored acr=
oss multiple=0D
+ UEFI Variables. This function retrieves the multiple UEFI Variables usin=
g=0D
+ ReadOnlyVariable2 PPI GetVariable().=0D
+ The function uses AllocatePages () to allocate the buffer.=0D
+ The caller is responsible for freeing this buffer with FreePages().=0D
+=0D
+ If Name is NULL, then ASSERT().=0D
+ If Guid is NULL, then ASSERT().=0D
+ If Value is NULL, then ASSERT().=0D
+=0D
+ @param[in] Name The pointer to a Null-terminated Unicode string.=0D
+ @param[in] Guid The pointer to an EFI_GUID structure=0D
+ @param[out] Value The buffer point saved the variable info.=0D
+ @param[out] Size The buffer size of the variable.=0D
+=0D
+ @return EFI_OUT_OF_RESOURCES Allocate buffer failed.=0D
+ @return EFI_SUCCESS Find the specified variable.=0D
+ @return Others Errors Return errors from call to gRT->GetVar=
iable.=0D
+=0D
+**/=0D
+EFI_STATUS=0D
+EFIAPI=0D
+PeiGetLargeVariable (=0D
+ IN CHAR16 *Name,=0D
+ IN EFI_GUID *Guid,=0D
+ OUT VOID **Value,=0D
+ OUT UINTN *Size OPTIONAL=0D
+ )=0D
+{=0D
+ EFI_STATUS Status;=0D
+ UINTN VariableSize;=0D
+ VOID *VariableData;=0D
+=0D
+ ASSERT (Name !=3D NULL);=0D
+ ASSERT (Guid !=3D NULL);=0D
+ ASSERT (Value !=3D NULL);=0D
+=0D
+ VariableSize =3D 0;=0D
+ VariableData =3D NULL;=0D
+ Status =3D GetLargeVariable (Name, Guid, &VariableSize, NULL);=0D
+ if (Status =3D=3D EFI_BUFFER_TOO_SMALL) {=0D
+ VariableData =3D AllocatePages (EFI_SIZE_TO_PAGES (VariableSize));=0D
+ if (VariableData =3D=3D NULL) {=0D
+ DEBUG ((DEBUG_ERROR, "Error: Cannot create VariableData, out of memo=
ry!\n"));=0D
+ ASSERT (FALSE);=0D
+ return EFI_OUT_OF_RESOURCES;=0D
+ }=0D
+ Status =3D GetLargeVariable (Name, Guid, &VariableSize, VariableData);=
=0D
+ if (EFI_ERROR (Status)) {=0D
+ DEBUG ((DEBUG_ERROR, "Error: Unable to read UEFI variable Status: %r=
\n", Status));=0D
+ ASSERT_EFI_ERROR (Status);=0D
+ return Status;=0D
+ }=0D
+ if (Value !=3D NULL) {=0D
+ *Value =3D VariableData;=0D
+ }=0D
+ if (Size !=3D NULL) {=0D
+ *Size =3D VariableSize;=0D
+ }=0D
+ return EFI_SUCCESS;=0D
+ }=0D
+ return Status;=0D
+}=0D
+=0D
EFI_PEI_FILE_HANDLE=0D
InternalGetFfsHandleFromAnyFv (=0D
IN CONST EFI_GUID *NameGuid=0D
@@ -139,7 +208,7 @@ InternalGetFfsHandleFromAnyFv (
=0D
/**=0D
Finds the file in any FV and gets file Address and Size=0D
- =0D
+=0D
@param[in] NameGuid File GUID=0D
@param[out] Address Pointer to the File Address=0D
@param[out] Size Pointer to File Size=0D
@@ -162,7 +231,7 @@ PeiGetFfsFromAnyFv (
if (FfsHandle =3D=3D NULL) {=0D
return EFI_NOT_FOUND;=0D
}=0D
- =0D
+=0D
//=0D
// Need get size=0D
//=0D
@@ -185,7 +254,7 @@ PeiGetFfsFromAnyFv (
@param[in] SectionInstance The Instance of Section to be found=0D
@param[out] OutSectionBuffer The section found, including SECTION_HEAD=
ER=0D
@param[out] OutSectionSize The size of section found, including SECT=
ION_HEADER=0D
- =0D
+=0D
@retval EFI_SUCCESS Successfull in reading the section fr=
om FV=0D
**/=0D
EFI_STATUS=0D
@@ -263,7 +332,7 @@ PeiGetSectionFromAnyFv (
EFI_COMMON_SECTION_HEADER *Section;=0D
VOID *FileBuffer;=0D
UINTN FileBufferSize;=0D
- =0D
+=0D
Status =3D PeiGetFfsFromAnyFv (NameGuid, &FileBuffer, &FileBufferSize);=
=0D
if (EFI_ERROR(Status)) {=0D
return Status;=0D
@@ -282,6 +351,6 @@ PeiGetSectionFromAnyFv (
*Size =3D SECTION_SIZE(Section) - sizeof (EFI_COMMON_SECTION_HEADER);=
=0D
*Address =3D (UINT8 *)*Address + sizeof (EFI_COMMON_SECTION_HEADER);=0D
}=0D
- =0D
+=0D
return EFI_SUCCESS;=0D
}=0D
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,=0D
0,=0D
NULL,=0D
- &VariablePpi=0D
+ (VOID **) &VariablePpi=0D
);=0D
ASSERT_EFI_ERROR (Status);=0D
if (EFI_ERROR (Status)) {=0D
@@ -134,7 +134,7 @@ VarLibGetNextVariableName (
&gEfiPeiReadOnlyVariable2PpiGuid,=0D
0,=0D
NULL,=0D
- &VariablePpi=0D
+ (VOID **) &VariablePpi=0D
);=0D
ASSERT_EFI_ERROR (Status);=0D
if (EFI_ERROR (Status)) {=0D
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=0D
# Component information file for SaveMemoryConfig module=0D
#=0D
-# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>=0D
+# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>=0D
#=0D
# SPDX-License-Identifier: BSD-2-Clause-Patent=0D
#=0D
@@ -23,11 +23,14 @@
DebugLib=0D
MemoryAllocationLib=0D
BaseMemoryLib=0D
+ LargeVariableReadLib=0D
+ LargeVariableWriteLib=0D
=0D
[Packages]=0D
MdePkg/MdePkg.dec=0D
MdeModulePkg/MdeModulePkg.dec=0D
IntelFsp2Pkg/IntelFsp2Pkg.dec=0D
+ MinPlatformPkg/MinPlatformPkg.dec=0D
=0D
[Sources]=0D
SaveMemoryConfig.c=0D
@@ -35,10 +38,11 @@
[Protocols]=0D
gEfiVariableArchProtocolGuid ## CONSUMES=0D
gEfiVariableWriteArchProtocolGuid ## CONSUMES=0D
- gEdkiiVariableLockProtocolGuid=0D
=0D
[Guids]=0D
gFspNonVolatileStorageHobGuid ## CONSUMES=0D
+ gFspNonVolatileStorageHob2Guid ## CONSUMES=0D
+ gFspNvsBufferVariableGuid ## PRODUCES=0D
=0D
[Depex]=0D
gEfiVariableArchProtocolGuid AND=0D
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.in=
f=0D
!endif=0D
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf=0D
+ VariableReadLib|MinPlatformPkg/Library/BaseVariableReadLibNull/BaseVaria=
bleReadLibNull.inf=0D
=0D
[LibraryClasses.common.PEI_CORE]=0D
TimerLib|PcAtChipsetPkg/Library/AcpiTimerLib/PeiAcpiTimerLib.inf=0D
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=0D
=0D
-Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>=0D
+Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>=0D
SPDX-License-Identifier: BSD-2-Clause-Patent=0D
=0D
**/=0D
@@ -11,11 +11,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <PiPei.h>=0D
=0D
/**=0D
- Returns the status whether get the variable success. The function retrie=
ves =0D
+ Returns the status whether get the variable success. The function retrie=
ves=0D
variable through the ReadOnlyVariable2 PPI GetVariable().=0D
=0D
If the *Size is 0, the returned buffer is allocated using AllocatePool()=
.=0D
- The caller is responsible for freeing this buffer with FreePool().=0D
+ The buffer is not expected to be freed as PEI does not support a FreePoo=
l().=0D
=0D
If the *Size is non-0, this function just uses caller allocated *Value.=
=0D
=0D
@@ -38,9 +38,39 @@ PeiGetVariable (
OUT UINTN *Size=0D
);=0D
=0D
+/**=0D
+ This function returns a "large variable". A large variable is stored acr=
oss multiple=0D
+ UEFI Variables. This function retrieves the multiple UEFI Variables usin=
g=0D
+ ReadOnlyVariable2 PPI GetVariable().=0D
+ The function uses AllocatePages () to allocate the buffer.=0D
+ The caller is responsible for freeing this buffer with FreePages().=0D
+=0D
+ If Name is NULL, then ASSERT().=0D
+ If Guid is NULL, then ASSERT().=0D
+ If Value is NULL, then ASSERT().=0D
+=0D
+ @param[in] Name The pointer to a Null-terminated Unicode string.=0D
+ @param[in] Guid The pointer to an EFI_GUID structure=0D
+ @param[out] Value The buffer point saved the variable info.=0D
+ @param[out] Size The buffer size of the variable.=0D
+=0D
+ @return EFI_OUT_OF_RESOURCES Allocate buffer failed.=0D
+ @return EFI_SUCCESS Find the specified variable.=0D
+ @return Others Errors Return errors from call to gRT->GetVar=
iable.=0D
+=0D
+**/=0D
+EFI_STATUS=0D
+EFIAPI=0D
+PeiGetLargeVariable (=0D
+ IN CHAR16 *Name,=0D
+ IN EFI_GUID *Guid,=0D
+ OUT VOID **Value,=0D
+ OUT UINTN *Size OPTIONAL=0D
+ );=0D
+=0D
/**=0D
Finds the file in any FV and gets file Address and Size=0D
- =0D
+=0D
@param[in] NameGuid File GUID=0D
@param[out] Address Pointer to the File Address=0D
@param[out] Size Pointer to File Size=0D
@@ -57,7 +87,7 @@ PeiGetFfsFromAnyFv (
=0D
/**=0D
Finds the section in any FV and gets section Address and Size=0D
- =0D
+=0D
@param[in] NameGuid File GUID=0D
@param[in] SectionType The SectionType of Section to be found=
=0D
@param[in] SectionInstance The Instance of Section to be found=0D
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=0D
# Component information file for Board Init Test Library=0D
#=0D
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>=0D
+# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>=0D
#=0D
# SPDX-License-Identifier: BSD-2-Clause-Patent=0D
#=0D
@@ -20,9 +20,11 @@
PeiServicesLib=0D
MemoryAllocationLib=0D
DebugLib=0D
+ LargeVariableReadLib=0D
=0D
[Packages]=0D
MdePkg/MdePkg.dec=0D
+ MinPlatformPkg/MinPlatformPkg.dec=0D
=0D
[Sources]=0D
PeiLib.c=0D
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}}=0D
gBdsEventBeforeConsoleBeforeEndOfDxeGuid =3D {0xfcf26e41, 0xbda6, =
0x4633, { 0xb5, 0x73, 0xd4, 0xb8, 0x0e, 0x6d, 0xd0, 0x78}}=0D
gBdsEventAfterConsoleReadyBeforeBootOptionGuid =3D {0x8eb3d5dc, 0xf4e7, =
0x4b57, { 0xa9, 0xe7, 0x27, 0x39, 0x10, 0xf2, 0x18, 0x9f}}=0D
+ gFspNvsBufferVariableGuid =3D {0x9c7715cd, 0x8d66, =
0x4d2a, { 0x90, 0x0d, 0x01, 0x45, 0x9a, 0x57, 0x59, 0x6b}}=0D
=0D
[LibraryClasses]=0D
=0D
--=20
2.28.0.windows.1

Join devel@edk2.groups.io to automatically receive all group messages.