public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Chiu, Chasel" <chasel.chiu@intel.com>
To: "Oram, Isaac W" <isaac.w.oram@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Desimone, Nathaniel L" <nathaniel.l.desimone@intel.com>
Subject: Re: [edk2-devel][edk2-platforms][PATCH V1 1/2] WhitleySiliconPkg/FspWrapperPlatformLib: Update for large variables
Date: Fri, 17 Sep 2021 00:14:50 +0000	[thread overview]
Message-ID: <BN9PR11MB548318395503742995DFB745E6DD9@BN9PR11MB5483.namprd11.prod.outlook.com> (raw)
In-Reply-To: <00401ec51bcef4ff40a74c1a1c623ccf808328a9.1631730773.git.isaac.w.oram@intel.com>


Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>

> -----Original Message-----
> From: Oram, Isaac W <isaac.w.oram@intel.com>
> Sent: Thursday, September 16, 2021 3:05 AM
> To: devel@edk2.groups.io
> Cc: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Chiu, Chasel
> <chasel.chiu@intel.com>
> Subject: [edk2-devel][edk2-platforms][PATCH V1 1/2]
> WhitleySiliconPkg/FspWrapperPlatformLib: Update for large variables
> 
> 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/FspWrapperPlat
> formLib.c   | 83 +++++++-------------
> 
> Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlat
> formLib.inf | 12 +--
>  2 files changed, 35 insertions(+), 60 deletions(-)
> 
> diff --git
> a/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPl
> atformLib.c
> b/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPl
> atformLib.c
> index 453e409523..a6196a78b0 100644
> ---
> a/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPl
> atformLib.c
> +++ b/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspW
> +++ rapperPlatformLib.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/FspWrapperPl
> atformLib.inf
> b/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPl
> atformLib.inf
> index 625337c453..3e80ea670c 100644
> ---
> a/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPl
> atformLib.inf
> +++ b/Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspW
> +++ rapperPlatformLib.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


  reply	other threads:[~2021-09-17  0:14 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 ` [edk2-devel][edk2-platforms][PATCH V1 1/2] WhitleySiliconPkg/FspWrapperPlatformLib: Update for large variables Oram, Isaac W
2021-09-17  0:14   ` Chiu, Chasel [this message]
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=BN9PR11MB548318395503742995DFB745E6DD9@BN9PR11MB5483.namprd11.prod.outlook.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