[edk2-platforms: PATCH v5 6/9] TigerlakeOpenBoardPkg: 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: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Heng Luo <heng.luo@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
Reviewed-by: Heng Luo <heng.luo@intel.com>
---
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 <Library/FspWrapperApiLib.h>=0D
#include <Library/BaseMemoryLib.h>=0D
#include <Library/MemoryAllocationLib.h>=0D
+#include <Library/PeiLib.h>=0D
#include <Ppi/FspmArchConfigPpi.h>=0D
+#include <PolicyUpdateMacro.h>=0D
=0D
VOID=0D
EFIAPI=0D
@@ -70,9 +72,11 @@ SiliconPolicyDonePreMem(
)=0D
{=0D
EFI_STATUS Status;=0D
+ UINTN FspNvsBufferSize;=0D
+ VOID *FspNvsBufferPtr;=0D
#if FixedPcdGet8(PcdFspModeSelection) =3D=3D 0=0D
- FSPM_ARCH_CONFIG_PPI *FspmArchConfigPpi;=0D
- EFI_PEI_PPI_DESCRIPTOR *FspmArchConfigPpiDesc;=0D
+ FSPM_ARCH_CONFIG_PPI *FspmArchConfigPpi;=0D
+ EFI_PEI_PPI_DESCRIPTOR *FspmArchConfigPpiDesc;=0D
=0D
FspmArchConfigPpi =3D (FSPM_ARCH_CONFIG_PPI *) AllocateZeroPool (sizeof =
(FSPM_ARCH_CONFIG_PPI));=0D
if (FspmArchConfigPpi =3D=3D NULL) {=0D
@@ -80,7 +84,6 @@ SiliconPolicyDonePreMem(
return EFI_OUT_OF_RESOURCES;=0D
}=0D
FspmArchConfigPpi->Revision =3D 1;=0D
- FspmArchConfigPpi->NvsBufferPtr =3D NULL;=0D
FspmArchConfigPpi->BootLoaderTolumSize =3D 0;=0D
=0D
FspmArchConfigPpiDesc =3D (EFI_PEI_PPI_DESCRIPTOR *) AllocateZeroPool (s=
izeof (EFI_PEI_PPI_DESCRIPTOR));=0D
@@ -98,6 +101,18 @@ SiliconPolicyDonePreMem(
ASSERT_EFI_ERROR (Status);=0D
#endif=0D
=0D
+ //=0D
+ // Initialize S3 Data variable (S3DataPtr). It may be used for warm and =
fast boot paths.=0D
+ //=0D
+ FspNvsBufferPtr =3D NULL;=0D
+ FspNvsBufferSize =3D 0;=0D
+ Status =3D PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableG=
uid, &FspNvsBufferPtr, &FspNvsBufferSize);=0D
+ if (Status =3D=3D EFI_SUCCESS) {=0D
+ DEBUG ((DEBUG_INFO, "Get L\"FspNvsBuffer\" gFspNvsBufferVariableGuid -=
%r\n", Status));=0D
+ DEBUG ((DEBUG_INFO, "FspNvsBuffer Size - 0x%x\n", FspNvsBufferSize));=
=0D
+ UPDATE_POLICY (((FSPM_UPD *) FspmUpd)->FspmArchUpd.NvsBufferPtr, FspmA=
rchConfigPpi->NvsBufferPtr, FspNvsBufferPtr);=0D
+ }=0D
+=0D
//=0D
// Install Policy Ready PPI=0D
// While installed, RC assumes the Policy is ready and finalized. So ple=
ase=0D
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=0D
gCnviConfigGuid ## CONSUMES=0D
gHdAudioPreMemConfigGuid ## CONSUMES=0D
+ gFspNvsBufferVariableGuid ## CONSUMES=0D
--=20
2.28.0.windows.1

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