summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChasel Chiu <chasel.chiu@intel.com>2023-02-09 06:32:09 +0300
committerChasel Chiu <chasel.chiu@intel.com>2023-02-09 21:16:48 +0300
commit3dd8add7a8bd638a4b42056cfa89c196b32c69bc (patch)
treef923af3915a892f1b766c47cfbe392112d0cbcfe
parente95c7988994c73918ffa282e2d2f5af11f8addc4 (diff)
downloadedk2-platforms-othernvs.tar.xz
IntelSiliconPkg/SpiFvbServiceSmm: Support Additional NVS region.othernvs
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. The PcdFlashNvStorageAdditionalSize is for compatible with legacy usages that should be deprecated. The new usage model should define separate regions without implicit connections to UEFI Variable or FTW regions. Example NVS flash map for such legacy usage: Note: PcdFlashNvStorageAdditionalSize is equal to platform PcdFlashFvNvStorageEventLogSize. --------------- |UEFI 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> Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
-rw-r--r--Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceCommon.c22
-rw-r--r--Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceSmm.inf7
-rw-r--r--Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec11
3 files changed, 37 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..e0d7f9e568 100644
--- a/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceCommon.c
+++ b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceCommon.c
@@ -568,6 +568,28 @@ 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.
+ //
+ // The below PcdFlashNvStorageAdditionalSize is for compatible with legacy usages that should be deprecated.
+ // The new usage model should define separate regions without implicit connections to UEFI Variable or FTW regions.
+ //
+ // Example NVS flash map for such legacy usage:
+ // Note: PcdFlashNvStorageAdditionalSize is equal to platform PcdFlashFvNvStorageEventLogSize.
+ // ---------------
+ // |UEFI 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..d73a51ca52 100644
--- a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
+++ b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
@@ -194,3 +194,14 @@
# Other value: reserved for future use.<BR>
# @Prompt Flash Variable Store type.
gIntelSiliconPkgTokenSpaceGuid.PcdFlashVariableStoreType|0x00|UINT8|0x0000000E
+
+ ## Declares Additional NVS Region Size.<BR><BR>
+ # Platform may implement a Regular variable region and an additional region, which will require this PCD
+ # to tell SpiFvbService to include both regions.
+ # Note: This PCD is for compatible with legacy usages that should be deprecated.
+ # The new usage model should define separate regions without implicit connections to UEFI Variable or FTW regions.<BR>
+ # Example legacy usage is to set this PCD equal to platform PcdFlashFvNvStorageEventLogSize.
+ # 0: No additional NVS region.<BR>
+ # non-zero: The size of an additional NVS region following the Regular variable region.<BR>
+ # @Prompt Additional NVS Region Size.
+ gIntelSiliconPkgTokenSpaceGuid.PcdFlashNvStorageAdditionalSize|0x00000000|UINT32|0x0000000F