Update to utilize the larger variables. Cc: Nate DeSimone <nathaniel.l.desim...@intel.com> Cc: Chasel Chiu <chasel.c...@intel.com> Signed-off-by: Isaac Oram <isaac.w.o...@intel.com> --- Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlatformLib.c | 83 +++++++------------- Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlatformLib.inf | 12 +-- 2 files changed, 35 insertions(+), 60 deletions(-)
diff --git a/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlatformLib.c b/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlatformLib.c index 453e409523..a6196a78b0 100644 --- a/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlatformLib.c +++ b/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlatformLib.c @@ -10,76 +10,52 @@ #include <PiPei.h> #include <Library/PeiServicesLib.h> #include <Library/DebugLib.h> -#include <FspmUpd.h> -#include <Ppi/UpiPolicyPpi.h> -#include <Guid/PlatformInfo.h> #include <Library/HobLib.h> -#include <Ppi/ReadOnlyVariable2.h> #include <Library/MemoryAllocationLib.h> +#include <Library/LargeVariableReadLib.h> + +#include <FspmUpd.h> +#include <Guid/PlatformInfo.h> +#include <Ppi/UpiPolicyPpi.h> VOID * -GetPlatformNvs( +GetFspNvsBuffer ( + VOID ) { EFI_STATUS Status; - EFI_PEI_READ_ONLY_VARIABLE2_PPI *PeiVariable; - VOID *DataBuffer; - UINT32 DataBufferSize; - UINTN VarAttrib; - CHAR16 EfiMemoryConfigVariable[] = L"MemoryConfig"; + UINTN FspNvsBufferSize; + VOID *FspNvsBufferPtr; - DEBUG ((EFI_D_INFO, "Start PlatformGetNvs\n")); - - Status = PeiServicesLocatePpi ( - &gEfiPeiReadOnlyVariable2PpiGuid, - 0, - NULL, - (VOID **) &PeiVariable - ); - if (EFI_ERROR (Status)) { - DEBUG ((EFI_D_ERROR, "PlatformGetNvs: PeiServicesLocatePpi not found\n")); + FspNvsBufferPtr = NULL; + FspNvsBufferSize = 0; + Status = GetLargeVariable (L"FspNvsBuffer", &gFspNonVolatileStorageHobGuid, &FspNvsBufferSize, NULL); + if (Status == EFI_BUFFER_TOO_SMALL) { + DEBUG ((DEBUG_INFO, "FspNvsBuffer Size = %d\n", FspNvsBufferSize)); + FspNvsBufferPtr = AllocateZeroPool (FspNvsBufferSize); + if (FspNvsBufferPtr == NULL) { + DEBUG ((DEBUG_ERROR, "Error: Cannot create FspNvsBuffer, out of memory!\n")); ASSERT (FALSE); return NULL; } - - VarAttrib = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS; - DataBufferSize = 0; - DataBuffer = NULL; - - Status = PeiVariable->GetVariable ( - PeiVariable, - EfiMemoryConfigVariable, - &gFspNonVolatileStorageHobGuid, - (UINT32*)&VarAttrib, - &DataBufferSize, - NULL - ); - if (Status == EFI_NOT_FOUND) { - DEBUG ((EFI_D_ERROR, "PlatformGetNvs: gEfiMemoryConfigDataGuid Variable not found\n")); + Status = GetLargeVariable (L"FspNvsBuffer", &gFspNonVolatileStorageHobGuid, &FspNvsBufferSize, FspNvsBufferPtr); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Error: Unable to read FspNvsBuffer UEFI variable Status: %r\n", Status)); + ASSERT_EFI_ERROR (Status); return NULL; } - if (Status != EFI_BUFFER_TOO_SMALL) { - DEBUG ((EFI_D_ERROR, "PlatformGetNvs: gEfiMemoryConfigDataGuid Get Error %r\n", Status)); - ASSERT (FALSE); + return FspNvsBufferPtr; + + } else if (Status == 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); } - DataBuffer = AllocateZeroPool(DataBufferSize); - Status = PeiVariable->GetVariable ( - PeiVariable, - EfiMemoryConfigVariable, - &gFspNonVolatileStorageHobGuid, - (UINT32*)&VarAttrib, - &DataBufferSize, - DataBuffer - ); - if (EFI_ERROR(Status)) { - DEBUG ((EFI_D_ERROR, "PlatformGetNvs: gEfiMemoryConfigDataGuid Variable Error %r\n", Status)); return NULL; } - DEBUG ((EFI_D_INFO, "PlatformGetNvs: GetNVS %x %x\n", DataBuffer, DataBufferSize)); - return DataBuffer; -} VOID EFIAPI @@ -164,11 +140,10 @@ UpdateFspmUpdData ( FspmUpd->FspmConfig.AllLanesSizeOfTable = Upi->AllLanesSizeOfTable; FspmUpd->FspmConfig.PerLaneSizeOfTable = Upi->PerLaneSizeOfTable; FspmUpd->FspmConfig.WaitTimeForPSBP = Upi->WaitTimeForPSBP; - FspmUpd->FspmConfig.IsKtiNvramDataReady = Upi->IsKtiNvramDataReady; FspmUpd->FspmConfig.WaSerializationEn = Upi->WaSerializationEn; FspmUpd->FspmConfig.KtiInEnableMktme = Upi->KtiInEnableMktme; FspmUpd->FspmConfig.BoardId = PlatformInfo->BoardId; - FspmUpd->FspmArchUpd.NvsBufferPtr = GetPlatformNvs(); + FspmUpd->FspmArchUpd.NvsBufferPtr = GetFspNvsBuffer (); } /** diff --git a/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlatformLib.inf b/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlatformLib.inf index 625337c453..3e80ea670c 100644 --- a/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlatformLib.inf +++ b/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlatformLib.inf @@ -35,7 +35,6 @@ [Sources] FspWrapperPlatformLib.c - ################################################################################ # # Package Dependency Section - list of Package files that are required for @@ -47,11 +46,11 @@ MdePkg/MdePkg.dec IntelFsp2Pkg/IntelFsp2Pkg.dec IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec - WhitleySiliconPkg/WhitleySiliconPkg.dec + MinPlatformPkg/MinPlatformPkg.dec WhitleySiliconPkg/SiliconPkg.dec WhitleySiliconPkg/CpRcPkg.dec - WhitleyOpenBoardPkg/PlatformPkg.dec - CedarIslandFspBinPkg/CedarIslandFspBinPkg.dec + WhitleyOpenBoardPkg/PlatformPkg.dec # For LargeVariableReadLib + WhitleyFspBinPkg/WhitleyFspBinPkg.dec [Ppis] gUpiSiPolicyPpiGuid @@ -63,9 +62,10 @@ [LibraryClasses] PeiServicesLib + LargeVariableReadLib [Pcd] gIntelFsp2PkgTokenSpaceGuid.PcdTemporaryRamBase ## CONSUMES - gIntelFsp2PkgTokenSpaceGuid.PcdTemporaryRamSize - gIntelFsp2PkgTokenSpaceGuid.PcdFspTemporaryRamSize + gIntelFsp2PkgTokenSpaceGuid.PcdTemporaryRamSize ## CONSUMES + gIntelFsp2PkgTokenSpaceGuid.PcdFspTemporaryRamSize ## CONSUMES gEfiCpRcPkgTokenSpaceGuid.PcdPeiTemporaryRamRcHeapSize ## CONSUMES -- 2.27.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#80735): https://edk2.groups.io/g/devel/message/80735 Mute This Topic: https://groups.io/mt/85635751/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-