From: "Oram, Isaac W" <isaac.w.oram@intel.com>
To: devel@edk2.groups.io
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>,
Chasel Chiu <chasel.chiu@intel.com>
Subject: [edk2-devel][edk2-platforms][PATCH V1 1/2] WhitleySiliconPkg/FspWrapperPlatformLib: Update for large variables
Date: Wed, 15 Sep 2021 12:04:40 -0700 [thread overview]
Message-ID: <00401ec51bcef4ff40a74c1a1c623ccf808328a9.1631730773.git.isaac.w.oram@intel.com> (raw)
In-Reply-To: <cover.1631730773.git.isaac.w.oram@intel.com>
Update to utilize the larger variables.
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Signed-off-by: Isaac Oram <isaac.w.oram@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
next prev parent reply other threads:[~2021-09-15 19:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-15 19:04 [edk2-devel][edk2-platforms][PATCH V1 0/2] Whitley SEC support Oram, Isaac W
2021-09-15 19:04 ` Oram, Isaac W [this message]
2021-09-17 0:14 ` [edk2-devel][edk2-platforms][PATCH V1 1/2] WhitleySiliconPkg/FspWrapperPlatformLib: Update for large variables Chiu, Chasel
2021-09-15 19:04 ` [edk2-devel][edk2-platforms][PATCH V1 2/2] WhitleyOpenBoardPkg/SecCore: Add SecCore source code support Oram, Isaac W
2021-09-17 0:15 ` Chiu, Chasel
2021-09-16 21:24 ` [edk2-devel][edk2-platforms][PATCH V1 0/2] Whitley SEC support Nate DeSimone
2021-09-16 22:17 ` Oram, Isaac W
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=00401ec51bcef4ff40a74c1a1c623ccf808328a9.1631730773.git.isaac.w.oram@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox