Re: [edk2-devel] [edk2-platforms: PATCH v3 6/9] TigerlakeOpenBoardPkg: Use same variable name for FspNvsHob.

2021-10-11 Thread Heng Luo
Reviewed-by: Heng Luo 

> -Original Message-
> From: Chiu, Chasel 
> Sent: Friday, October 8, 2021 2:43 PM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel ; Chaganty, Rangasai V
> ; Desimone, Nathaniel L
> ; Luo, Heng 
> Subject: [edk2-platforms: PATCH v3 6/9] TigerlakeOpenBoardPkg: Use same
> variable name for FspNvsHob.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3678
> 
> 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 
> Cc: Nate DeSimone 
> Cc: Heng Luo 
> Signed-off-by: Chasel Chiu 
> ---
> 
> Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/
> PeiFspPolicyInitLib.c   | 21 ++---
> 
> Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/
> PeiFspPolicyInitLib.inf |  1 +
>  Platform/Intel/TigerlakeOpenBoardPkg/TigerlakeURvp/OpenBoardPkg.dsc
> |  3 +++
>  3 files changed, 22 insertions(+), 3 deletions(-)
> 
> diff --git
> a/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLi
> b/PeiFspPolicyInitLib.c
> b/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLi
> b/PeiFspPolicyInitLib.c
> index fc523e93d1..938b74e5d8 100644
> ---
> a/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLi
> b/PeiFspPolicyInitLib.c
> +++ b/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPoli
> +++ cyInitLib/PeiFspPolicyInitLib.c
> @@ -9,7 +9,9 @@
>  #include  #include 
> #include +#include  #include
> +#include   VOID EFIAPI@@
> -70,9 +72,11 @@ SiliconPolicyDonePreMem(
>  ) {   EFI_STATUS   Status;+  UINTN
> FspNvsBufferSize;+
> VOID *FspNvsBufferPtr; #if 
> FixedPcdGet8(PcdFspModeSelection) ==
> 0-  FSPM_ARCH_CONFIG_PPI  *FspmArchConfigPpi;-
> EFI_PEI_PPI_DESCRIPTOR*FspmArchConfigPpiDesc;+
> FSPM_ARCH_CONFIG_PPI *FspmArchConfigPpi;+  EFI_PEI_PPI_DESCRIPTOR
> *FspmArchConfigPpiDesc;FspmArchConfigPpi = (FSPM_ARCH_CONFIG_PPI *)
> AllocateZeroPool (sizeof (FSPM_ARCH_CONFIG_PPI));   if (FspmArchConfigPpi ==
> NULL) {@@ -80,7 +84,6 @@ SiliconPolicyDonePreMem(
>  return EFI_OUT_OF_RESOURCES;   }   FspmArchConfigPpi->Revision   
>  =
> 1;-  FspmArchConfigPpi->NvsBufferPtr= NULL;   FspmArchConfigPpi-
> >BootLoaderTolumSize = 0;FspmArchConfigPpiDesc =
> (EFI_PEI_PPI_DESCRIPTOR *) AllocateZeroPool (sizeof
> (EFI_PEI_PPI_DESCRIPTOR));@@ -98,6 +101,18 @@ SiliconPolicyDonePreMem(
>ASSERT_EFI_ERROR (Status); #endif +  //+  // Initialize S3 Data variable
> (S3DataPtr). It may be used for warm and fast boot paths.+  //+  
> FspNvsBufferPtr
> = NULL;+  FspNvsBufferSize  = 0;+  Status = PeiGetLargeVariable
> (L"FspNvsBuffer", , ,
> );+  if (Status == EFI_SUCCESS) {+DEBUG ((DEBUG_INFO,
> "Get L\"FspNvsBuffer\" gFspNvsBufferVariableGuid - %r\n", Status));+DEBUG
> ((DEBUG_INFO, "FspNvsBuffer Size - 0x%x\n", FspNvsBufferSize));+
> UPDATE_POLICY (((FSPM_UPD *) FspmUpd)->FspmArchUpd.NvsBufferPtr,
> FspmArchConfigPpi->NvsBufferPtr, FspNvsBufferPtr);+  }+   //   // Install 
> Policy
> Ready PPI   // While installed, RC assumes the Policy is ready and finalized. 
> So
> pleasediff --git
> a/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLi
> b/PeiFspPolicyInitLib.inf
> b/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLi
> b/PeiFspPolicyInitLib.inf
> index 708fbac08f..0236ae45ae 100644
> ---
> a/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLi
> b/PeiFspPolicyInitLib.inf
> +++ b/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPoli
> +++ cyInitLib/PeiFspPolicyInitLib.inf
> @@ -181,3 +181,4 @@
>gTianoLogoGuid  ## CONSUMES   gCnviConfigGuid
> ## CONSUMES   gHdAudioPreMemConfigGuid## CONSUMES+
> gFspNvsBufferVariableGuid   ## CONSUMESdiff --git
> a/Platform/Intel/TigerlakeOpenBoardPkg/TigerlakeURvp/OpenBoardPkg.dsc
> b/Platform/Intel/TigerlakeOpenBoardPkg/TigerlakeURvp/OpenBoardPkg.dsc
> index 1adf634034..451492f984 100644
> --- a/Platform/Intel/TigerlakeOpenBoardPkg/TigerlakeURvp/OpenBoardPkg.dsc
> +++ b/Platform/Intel/TigerlakeOpenBoardPkg/TigerlakeURvp/OpenBoardPkg.ds
> +++ c
> @@ -142,6 +142,9 @@
> 
> GpioCheckConflictLib|$(PLATFORM_SI_PACKAGE)/IpBlock/Gpio/Library/BaseGpi
> oCheckConflictLibNull/BaseGpioCheckConflictLibNull.inf !endif
> +[LibraryClasses.Common.SEC]+
> VariableReadLib|MinPlatformPkg/Library/BaseVariableReadLibNull/BaseVariabl
> eReadLibNull.inf+ [LibraryClasses.IA32.SEC]
> TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/Sec
> TestPointCheckLib.inf
> TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLibNull
> /TestPointCheckLibNull.inf--
> 2.28.0.windows.1




Re: [edk2-devel] [edk2-platforms: PATCH v3 6/9] TigerlakeOpenBoardPkg: Use same variable name for FspNvsHob.

2021-10-11 Thread Nate DeSimone
Reviewed-by: Nate DeSimone 

> -Original Message-
> From: Chiu, Chasel 
> Sent: Thursday, October 7, 2021 11:43 PM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel ; Chaganty, Rangasai V
> ; Desimone, Nathaniel L
> ; Luo, Heng 
> Subject: [edk2-platforms: PATCH v3 6/9] TigerlakeOpenBoardPkg: Use same
> variable name for FspNvsHob.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3678
> 
> 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 
> Cc: Nate DeSimone 
> Cc: Heng Luo 
> Signed-off-by: Chasel Chiu 
> ---
> 
> Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInit
> Lib/PeiFspPolicyInitLib.c   | 21 ++---
> 
> Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInit
> Lib/PeiFspPolicyInitLib.inf |  1 +
>  Platform/Intel/TigerlakeOpenBoardPkg/TigerlakeURvp/OpenBoardPkg.dsc
> |  3 +++
>  3 files changed, 22 insertions(+), 3 deletions(-)
> 
> diff --git
> a/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyI
> nitLib/PeiFspPolicyInitLib.c
> b/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyI
> nitLib/PeiFspPolicyInitLib.c
> index fc523e93d1..938b74e5d8 100644
> ---
> a/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyI
> nitLib/PeiFspPolicyInitLib.c
> +++
> b/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPoli
> +++ cyInitLib/PeiFspPolicyInitLib.c
> @@ -9,7 +9,9 @@
>  #include  #include
>  #include
> +#include  #include
> +#include   VOID
> EFIAPI@@ -70,9 +72,11 @@ SiliconPolicyDonePreMem(
>  ) {   EFI_STATUS   Status;+  UINTN
> FspNvsBufferSize;+
> VOID *FspNvsBufferPtr; #if
> FixedPcdGet8(PcdFspModeSelection) == 0-  FSPM_ARCH_CONFIG_PPI
> *FspmArchConfigPpi;-  EFI_PEI_PPI_DESCRIPTOR
> *FspmArchConfigPpiDesc;+  FSPM_ARCH_CONFIG_PPI
> *FspmArchConfigPpi;+  EFI_PEI_PPI_DESCRIPTOR
> *FspmArchConfigPpiDesc;FspmArchConfigPpi =
> (FSPM_ARCH_CONFIG_PPI *) AllocateZeroPool (sizeof
> (FSPM_ARCH_CONFIG_PPI));   if (FspmArchConfigPpi == NULL) {@@ -80,7
> +84,6 @@ SiliconPolicyDonePreMem(
>  return EFI_OUT_OF_RESOURCES;   }   FspmArchConfigPpi->Revision   
>  =
> 1;-  FspmArchConfigPpi->NvsBufferPtr= NULL;   FspmArchConfigPpi-
> >BootLoaderTolumSize = 0;FspmArchConfigPpiDesc =
> (EFI_PEI_PPI_DESCRIPTOR *) AllocateZeroPool (sizeof
> (EFI_PEI_PPI_DESCRIPTOR));@@ -98,6 +101,18 @@
> SiliconPolicyDonePreMem(
>ASSERT_EFI_ERROR (Status); #endif +  //+  // Initialize S3 Data variable
> (S3DataPtr). It may be used for warm and fast boot paths.+  //+
> FspNvsBufferPtr   = NULL;+  FspNvsBufferSize  = 0;+  Status =
> PeiGetLargeVariable (L"FspNvsBuffer", ,
> , );+  if (Status == EFI_SUCCESS) {+
> DEBUG ((DEBUG_INFO, "Get L\"FspNvsBuffer\" gFspNvsBufferVariableGuid
> - %r\n", Status));+DEBUG ((DEBUG_INFO, "FspNvsBuffer Size - 0x%x\n",
> FspNvsBufferSize));+UPDATE_POLICY (((FSPM_UPD *) FspmUpd)-
> >FspmArchUpd.NvsBufferPtr, FspmArchConfigPpi->NvsBufferPtr,
> FspNvsBufferPtr);+  }+   //   // Install Policy Ready PPI   // While 
> installed, RC
> assumes the Policy is ready and finalized. So pleasediff --git
> a/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyI
> nitLib/PeiFspPolicyInitLib.inf
> b/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyI
> nitLib/PeiFspPolicyInitLib.inf
> index 708fbac08f..0236ae45ae 100644
> ---
> a/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyI
> nitLib/PeiFspPolicyInitLib.inf
> +++
> b/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPoli
> +++ cyInitLib/PeiFspPolicyInitLib.inf
> @@ -181,3 +181,4 @@
>gTianoLogoGuid  ## CONSUMES   gCnviConfigGuid
> ## CONSUMES   gHdAudioPreMemConfigGuid## CONSUMES+
> gFspNvsBufferVariableGuid   ## CONSUMESdiff --git
> a/Platform/Intel/TigerlakeOpenBoardPkg/TigerlakeURvp/OpenBoardPkg.dsc
> b/Platform/Intel/TigerlakeOpenBoardPkg/TigerlakeURvp/OpenBoardPkg.dsc
> index 1adf634034..451492f984 100644
> ---
> a/Platform/Intel/TigerlakeOpenBoardPkg/TigerlakeURvp/OpenBoardPkg.dsc
> +++
> b/Platform/Intel/TigerlakeOpenBoardPkg/TigerlakeURvp/OpenBoardPkg.ds
> +++ c
> @@ -142,6 +142,9 @@
> 
> GpioCheckConflictLib|$(PLATFORM_SI_PACKAGE)/IpBlock/Gpio/Library/Bas
> eGpioCheckConflictLibNull/BaseGpioCheckConflictLibNull.inf !endif
> +[LibraryClasses.Common.SEC]+
> VariableReadLib|MinPlatformPkg/Library/BaseVariableReadLibNull/BaseVari
> ableReadLibNull.inf+ [LibraryClasses.IA32.SEC]
> TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib
> /SecTestPointCheckLib.inf
> TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib
> Null/TestPointCheckLibNull.inf--
> 2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-

[edk2-devel] [edk2-platforms: PATCH v3 6/9] TigerlakeOpenBoardPkg: Use same variable name for FspNvsHob.

2021-10-08 Thread Chiu, Chasel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3678

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 
Cc: Nate DeSimone 
Cc: Heng Luo 
Signed-off-by: Chasel Chiu 
---
 
Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.c
   | 21 ++---
 
Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf
 |  1 +
 Platform/Intel/TigerlakeOpenBoardPkg/TigerlakeURvp/OpenBoardPkg.dsc
 |  3 +++
 3 files changed, 22 insertions(+), 3 deletions(-)

diff --git 
a/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.c
 
b/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.c
index fc523e93d1..938b74e5d8 100644
--- 
a/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.c
+++ 
b/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.c
@@ -9,7 +9,9 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 
 VOID
 EFIAPI
@@ -70,9 +72,11 @@ SiliconPolicyDonePreMem(
 )
 {
   EFI_STATUS   Status;
+  UINTNFspNvsBufferSize;
+  VOID *FspNvsBufferPtr;
 #if FixedPcdGet8(PcdFspModeSelection) == 0
-  FSPM_ARCH_CONFIG_PPI  *FspmArchConfigPpi;
-  EFI_PEI_PPI_DESCRIPTOR*FspmArchConfigPpiDesc;
+  FSPM_ARCH_CONFIG_PPI *FspmArchConfigPpi;
+  EFI_PEI_PPI_DESCRIPTOR   *FspmArchConfigPpiDesc;
 
   FspmArchConfigPpi = (FSPM_ARCH_CONFIG_PPI *) AllocateZeroPool (sizeof 
(FSPM_ARCH_CONFIG_PPI));
   if (FspmArchConfigPpi == NULL) {
@@ -80,7 +84,6 @@ SiliconPolicyDonePreMem(
 return EFI_OUT_OF_RESOURCES;
   }
   FspmArchConfigPpi->Revision= 1;
-  FspmArchConfigPpi->NvsBufferPtr= NULL;
   FspmArchConfigPpi->BootLoaderTolumSize = 0;
 
   FspmArchConfigPpiDesc = (EFI_PEI_PPI_DESCRIPTOR *) AllocateZeroPool (sizeof 
(EFI_PEI_PPI_DESCRIPTOR));
@@ -98,6 +101,18 @@ SiliconPolicyDonePreMem(
   ASSERT_EFI_ERROR (Status);
 #endif
 
+  //
+  // Initialize S3 Data variable (S3DataPtr). It may be used for warm and fast 
boot paths.
+  //
+  FspNvsBufferPtr   = NULL;
+  FspNvsBufferSize  = 0;
+  Status = PeiGetLargeVariable (L"FspNvsBuffer", , 
, );
+  if (Status == EFI_SUCCESS) {
+DEBUG ((DEBUG_INFO, "Get L\"FspNvsBuffer\" gFspNvsBufferVariableGuid - 
%r\n", Status));
+DEBUG ((DEBUG_INFO, "FspNvsBuffer Size - 0x%x\n", FspNvsBufferSize));
+UPDATE_POLICY (((FSPM_UPD *) FspmUpd)->FspmArchUpd.NvsBufferPtr, 
FspmArchConfigPpi->NvsBufferPtr, FspNvsBufferPtr);
+  }
+
   //
   // Install Policy Ready PPI
   // While installed, RC assumes the Policy is ready and finalized. So please
diff --git 
a/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf
 
b/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf
index 708fbac08f..0236ae45ae 100644
--- 
a/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf
+++ 
b/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf
@@ -181,3 +181,4 @@
   gTianoLogoGuid  ## CONSUMES
   gCnviConfigGuid ## CONSUMES
   gHdAudioPreMemConfigGuid## CONSUMES
+  gFspNvsBufferVariableGuid   ## CONSUMES
diff --git 
a/Platform/Intel/TigerlakeOpenBoardPkg/TigerlakeURvp/OpenBoardPkg.dsc 
b/Platform/Intel/TigerlakeOpenBoardPkg/TigerlakeURvp/OpenBoardPkg.dsc
index 1adf634034..451492f984 100644
--- a/Platform/Intel/TigerlakeOpenBoardPkg/TigerlakeURvp/OpenBoardPkg.dsc
+++ b/Platform/Intel/TigerlakeOpenBoardPkg/TigerlakeURvp/OpenBoardPkg.dsc
@@ -142,6 +142,9 @@
   
GpioCheckConflictLib|$(PLATFORM_SI_PACKAGE)/IpBlock/Gpio/Library/BaseGpioCheckConflictLibNull/BaseGpioCheckConflictLibNull.inf
 !endif
 
+[LibraryClasses.Common.SEC]
+  
VariableReadLib|MinPlatformPkg/Library/BaseVariableReadLibNull/BaseVariableReadLibNull.inf
+
 [LibraryClasses.IA32.SEC]
   
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/SecTestPointCheckLib.inf
   
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLibNull/TestPointCheckLibNull.inf
-- 
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81663): https://edk2.groups.io/g/devel/message/81663
Mute This Topic: https://groups.io/mt/86164710/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-