[edk2-platforms: PATCH v5 9/9] WhitleySiliconPkg: Use same variable name for FspNvsHob.


Chiu, Chasel
 

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 <isaac.w.oram@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
---
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 <Library/HobLib.h>=0D
#include <Library/MemoryAllocationLib.h>=0D
#include <Library/LargeVariableReadLib.h>=0D
-=0D
+#include <Library/PeiLib.h>=0D
#include <FspmUpd.h>=0D
#include <Guid/PlatformInfo.h>=0D
#include <Ppi/UpiPolicyPpi.h>=0D
@@ -24,39 +24,22 @@ GetFspNvsBuffer (
)=0D
{=0D
EFI_STATUS Status;=0D
- UINTN FspNvsBufferSize;=0D
- VOID *FspNvsBufferPtr;=0D
+ UINTN FspNvsBufferSize;=0D
+ VOID *FspNvsBufferPtr;=0D
=0D
FspNvsBufferPtr =3D NULL;=0D
FspNvsBufferSize =3D 0;=0D
- Status =3D GetLargeVariable (L"FspNvsBuffer", &gFspNonVolatileStorageHob=
Guid, &FspNvsBufferSize, NULL);=0D
- if (Status =3D=3D EFI_BUFFER_TOO_SMALL) {=0D
- DEBUG ((DEBUG_INFO, "FspNvsBuffer Size =3D %d\n", FspNvsBufferSize));=
=0D
- FspNvsBufferPtr =3D AllocateZeroPool (FspNvsBufferSize);=0D
- if (FspNvsBufferPtr =3D=3D NULL) {=0D
- DEBUG ((DEBUG_ERROR, "Error: Cannot create FspNvsBuffer, out of memo=
ry!\n"));=0D
- ASSERT (FALSE);=0D
- return NULL;=0D
- }=0D
- Status =3D GetLargeVariable (L"FspNvsBuffer", &gFspNonVolatileStorageH=
obGuid, &FspNvsBufferSize, FspNvsBufferPtr);=0D
- if (EFI_ERROR (Status)) {=0D
- DEBUG ((DEBUG_ERROR, "Error: Unable to read FspNvsBuffer UEFI variab=
le Status: %r\n", Status));=0D
- ASSERT_EFI_ERROR (Status);=0D
- return NULL;=0D
- }=0D
-=0D
+ Status =3D PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableG=
uid, &FspNvsBufferPtr, &FspNvsBufferSize);=0D
+ if (Status =3D=3D EFI_SUCCESS) {=0D
return FspNvsBufferPtr;=0D
-=0D
- } else if (Status =3D=3D EFI_NOT_FOUND) {=0D
- DEBUG ((DEBUG_INFO, "Cannot create FSP NVS Buffer, UEFI variable does =
not exist (this is likely a first boot)\n"));=0D
} else {=0D
- DEBUG ((DEBUG_ERROR, "Error: Unable to read FspNvsBuffer UEFI variable=
Status: %r\n", Status));=0D
- ASSERT_EFI_ERROR (Status);=0D
- }=0D
-=0D
+ DEBUG ((DEBUG_INFO, "Cannot create FSP NVS Buffer, UEFI variable does =
not exist (this is likely a first boot)\n"));=0D
return NULL;=0D
}=0D
=0D
+=0D
+}=0D
+=0D
VOID=0D
EFIAPI=0D
UpdateFspmUpdData (=0D
diff --git a/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/=
FspWrapperPlatformLib.inf b/Silicon/Intel/WhitleySiliconPkg/Library/FspWrap=
perPlatformLib/FspWrapperPlatformLib.inf
index 3e80ea670c..6ee15ea55f 100644
--- a/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrap=
perPlatformLib.inf
+++ b/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrap=
perPlatformLib.inf
@@ -58,11 +58,12 @@
=0D
[Guids]=0D
gEfiPlatformInfoGuid=0D
- gFspNonVolatileStorageHobGuid=0D
+ gFspNvsBufferVariableGuid # CONSUMES=0D
=0D
[LibraryClasses]=0D
PeiServicesLib=0D
LargeVariableReadLib=0D
+ PeiLib=0D
=0D
[Pcd]=0D
gIntelFsp2PkgTokenSpaceGuid.PcdTemporaryRamBase ## CONSUMES=0D
--=20
2.28.0.windows.1

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