[edk2-devel] [edk2-platforms: PATCH v3] IntelSiliconPkg/SpiFvbServiceSmm: Support Additional NVS region.

Chiu, Chasel posted 1 patch 1 year, 2 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceCommon.c | 17 +++++++++++++++++
Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceSmm.inf  |  7 ++++---
Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec                               |  8 ++++++++
3 files changed, 29 insertions(+), 3 deletions(-)
[edk2-devel] [edk2-platforms: PATCH v3] IntelSiliconPkg/SpiFvbServiceSmm: Support Additional NVS region.
Posted by Chiu, Chasel 1 year, 2 months ago
Platform may implement an additional NVS region following
Regular variable region and in this case SpiFvbService should include
both region size when calculating the total NVS region size.

One usage model is EventLog NVS region and there could be others.
Example NVS flash map for such usage model:
  --------------
  |UEI Variable|
  --------------
  |EventLog    | <= this is Additional NVS region
  --------------
  |FTW Working |
  --------------
  |FTW Spare   |
  --------------

Cc: Ashraf Ali S <ashraf.ali.s@intel.com>
Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
---
 Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceCommon.c | 17 +++++++++++++++++
 Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceSmm.inf  |  7 ++++---
 Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec                               |  8 ++++++++
 3 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceCommon.c b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceCommon.c
index 942abf95a6..cf5a40bf27 100644
--- a/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceCommon.c
+++ b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceCommon.c
@@ -568,6 +568,23 @@ GetVariableFvInfo (
     return;
   }
 
+  //
+  // GetVariableFlashNvStorageInfo () only reports regular variable region information,
+  // if platform implemented an additional NVS region following the regular variable region,
+  // the both region size should be included as overall NVS region size.
+  // Example NVS flash map for such usage model:
+  //  --------------
+  //  |UEI Variable|
+  //  --------------
+  //  |EventLog    | <= this is Additional NVS region
+  //  --------------
+  //  |FTW Working |
+  //  --------------
+  //  |FTW Spare   |
+  //  --------------
+  //
+  NvStoreLength += PcdGet32 (PcdFlashNvStorageAdditionalSize);
+
   Status = GetVariableFlashFtwSpareInfo (&NvBaseAddress, &Length64);
   if (!EFI_ERROR (Status)) {
     // Stay within the current UINT32 size assumptions in the variable stack.
diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceSmm.inf b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceSmm.inf
index 73049eceb2..f4009d8d8c 100644
--- a/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceSmm.inf
+++ b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceSmm.inf
@@ -43,9 +43,10 @@
   IntelSiliconPkg/IntelSiliconPkg.dec
 
 [Pcd]
-  gIntelSiliconPkgTokenSpaceGuid.PcdFlashMicrocodeFvBase         ## CONSUMES
-  gIntelSiliconPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize         ## CONSUMES
-  gIntelSiliconPkgTokenSpaceGuid.PcdFlashVariableStoreType       ## SOMETIMES_CONSUMES
+  gIntelSiliconPkgTokenSpaceGuid.PcdFlashMicrocodeFvBase            ## CONSUMES
+  gIntelSiliconPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize            ## CONSUMES
+  gIntelSiliconPkgTokenSpaceGuid.PcdFlashVariableStoreType          ## SOMETIMES_CONSUMES
+  gIntelSiliconPkgTokenSpaceGuid.PcdFlashNvStorageAdditionalSize    ## CONSUMES
 
 [Sources]
   FvbInfo.c
diff --git a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
index 63dae756ad..b10529b69d 100644
--- a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
+++ b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
@@ -194,3 +194,11 @@
   #  Other value: reserved for future use.<BR>
   # @Prompt Flash Variable Store type.
   gIntelSiliconPkgTokenSpaceGuid.PcdFlashVariableStoreType|0x00|UINT8|0x0000000E
+
+  ## Declares Additional NVS Variable Region Size.<BR><BR>
+  #  Platform may implement a Regular variable region and an additional variable region, which will require this PCD
+  #  to tell SpiFvbService to include both regions.<BR>
+  #  0: No additional variable region.<BR>
+  #  non-zero: The size of an additional variable region following the Regular variable region.<BR>
+  # @Prompt Additional NVS Variable Region Size.
+  gIntelSiliconPkgTokenSpaceGuid.PcdFlashNvStorageAdditionalSize|0x00000000|UINT32|0x0000000F
-- 
2.35.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#99920): https://edk2.groups.io/g/devel/message/99920
Mute This Topic: https://groups.io/mt/96858004/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [edk2-platforms: PATCH v3] IntelSiliconPkg/SpiFvbServiceSmm: Support Additional NVS region.
Posted by Michael Kubacki 1 year, 2 months ago
Please fix the typo in the commit message and code comment before pushing.

"|UEI Variable|" -> "|UEFI Variable|"

Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>

On 2/9/2023 12:20 PM, Chiu, Chasel wrote:
> Platform may implement an additional NVS region following
> Regular variable region and in this case SpiFvbService should include
> both region size when calculating the total NVS region size.
> 
> One usage model is EventLog NVS region and there could be others.
> Example NVS flash map for such usage model:
>    --------------
>    |UEI Variable|
>    --------------
>    |EventLog    | <= this is Additional NVS region
>    --------------
>    |FTW Working |
>    --------------
>    |FTW Spare   |
>    --------------
> 
> Cc: Ashraf Ali S <ashraf.ali.s@intel.com>
> Cc: Isaac Oram <isaac.w.oram@intel.com>
> Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Michael Kubacki <michael.kubacki@microsoft.com>
> Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
> ---
>   Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceCommon.c | 17 +++++++++++++++++
>   Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceSmm.inf  |  7 ++++---
>   Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec                               |  8 ++++++++
>   3 files changed, 29 insertions(+), 3 deletions(-)
> 
> diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceCommon.c b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceCommon.c
> index 942abf95a6..cf5a40bf27 100644
> --- a/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceCommon.c
> +++ b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceCommon.c
> @@ -568,6 +568,23 @@ GetVariableFvInfo (
>       return;
> 
>     }
> 
>   
> 
> +  //
> 
> +  // GetVariableFlashNvStorageInfo () only reports regular variable region information,
> 
> +  // if platform implemented an additional NVS region following the regular variable region,
> 
> +  // the both region size should be included as overall NVS region size.
> 
> +  // Example NVS flash map for such usage model:
> 
> +  //  --------------
> 
> +  //  |UEI Variable|
> 
> +  //  --------------
> 
> +  //  |EventLog    | <= this is Additional NVS region
> 
> +  //  --------------
> 
> +  //  |FTW Working |
> 
> +  //  --------------
> 
> +  //  |FTW Spare   |
> 
> +  //  --------------
> 
> +  //
> 
> +  NvStoreLength += PcdGet32 (PcdFlashNvStorageAdditionalSize);
> 
> +
> 
>     Status = GetVariableFlashFtwSpareInfo (&NvBaseAddress, &Length64);
> 
>     if (!EFI_ERROR (Status)) {
> 
>       // Stay within the current UINT32 size assumptions in the variable stack.
> 
> diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceSmm.inf b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceSmm.inf
> index 73049eceb2..f4009d8d8c 100644
> --- a/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceSmm.inf
> +++ b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceSmm.inf
> @@ -43,9 +43,10 @@
>     IntelSiliconPkg/IntelSiliconPkg.dec
> 
>   
> 
>   [Pcd]
> 
> -  gIntelSiliconPkgTokenSpaceGuid.PcdFlashMicrocodeFvBase         ## CONSUMES
> 
> -  gIntelSiliconPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize         ## CONSUMES
> 
> -  gIntelSiliconPkgTokenSpaceGuid.PcdFlashVariableStoreType       ## SOMETIMES_CONSUMES
> 
> +  gIntelSiliconPkgTokenSpaceGuid.PcdFlashMicrocodeFvBase            ## CONSUMES
> 
> +  gIntelSiliconPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize            ## CONSUMES
> 
> +  gIntelSiliconPkgTokenSpaceGuid.PcdFlashVariableStoreType          ## SOMETIMES_CONSUMES
> 
> +  gIntelSiliconPkgTokenSpaceGuid.PcdFlashNvStorageAdditionalSize    ## CONSUMES
> 
>   
> 
>   [Sources]
> 
>     FvbInfo.c
> 
> diff --git a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
> index 63dae756ad..b10529b69d 100644
> --- a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
> +++ b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
> @@ -194,3 +194,11 @@
>     #  Other value: reserved for future use.<BR>
> 
>     # @Prompt Flash Variable Store type.
> 
>     gIntelSiliconPkgTokenSpaceGuid.PcdFlashVariableStoreType|0x00|UINT8|0x0000000E
> 
> +
> 
> +  ## Declares Additional NVS Variable Region Size.<BR><BR>
> 
> +  #  Platform may implement a Regular variable region and an additional variable region, which will require this PCD
> 
> +  #  to tell SpiFvbService to include both regions.<BR>
> 
> +  #  0: No additional variable region.<BR>
> 
> +  #  non-zero: The size of an additional variable region following the Regular variable region.<BR>
> 
> +  # @Prompt Additional NVS Variable Region Size.
> 
> +  gIntelSiliconPkgTokenSpaceGuid.PcdFlashNvStorageAdditionalSize|0x00000000|UINT32|0x0000000F
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#99921): https://edk2.groups.io/g/devel/message/99921
Mute This Topic: https://groups.io/mt/96858004/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-