diff options
author | Hongbin1 Zhang <hongbin1.zhang@intel.com> | 2024-12-17 18:28:32 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-12-20 04:22:06 +0000 |
commit | 8279e49aaec387869e28d4e3e7cc209f727afd26 (patch) | |
tree | e5e25b85c866cb8513376950438c72d19258e467 | |
parent | e8ce6c518973beab6b52ba6f783cfc7f53c1ce66 (diff) | |
download | edk2-8279e49aaec387869e28d4e3e7cc209f727afd26.tar.gz |
StandaloneMmPkg/MmIpl : Check if MM FV HOB was built
Skip MM FV HOB build if MM platform HOB list already has
the HOB.
Signed-off-by: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
-rw-r--r-- | StandaloneMmPkg/Drivers/StandaloneMmIplPei/MmFoundationHob.c | 56 |
1 files changed, 52 insertions, 4 deletions
diff --git a/StandaloneMmPkg/Drivers/StandaloneMmIplPei/MmFoundationHob.c b/StandaloneMmPkg/Drivers/StandaloneMmIplPei/MmFoundationHob.c index b2611f2b49..27103a4564 100644 --- a/StandaloneMmPkg/Drivers/StandaloneMmIplPei/MmFoundationHob.c +++ b/StandaloneMmPkg/Drivers/StandaloneMmIplPei/MmFoundationHob.c @@ -804,6 +804,49 @@ GetRemainingHobSize ( }
/**
+ Check if FV HOB was created.
+
+ Check if FV HOB was created on HOB list,
+ if yes, skip building MM Core FV HOB,
+ if No, continue to build MM Core FV HOB
+
+ @param[in] HobList HOB list.
+ @param[in] HobSize HOB size.
+
+ @retval TRUE Skip building MM Core FV HOB.
+ FALSE Continue to build MM Core FV HOB.
+**/
+BOOLEAN
+IsFvHobExist (
+ IN UINT8 *HobList,
+ IN UINTN HobSize
+ )
+{
+ EFI_PEI_HOB_POINTERS Hob;
+ UINTN HobLength;
+
+ if ((HobList == NULL) || (HobSize == 0)) {
+ return FALSE;
+ }
+
+ Hob.Raw = (UINT8 *)HobList;
+ HobLength = GET_HOB_LENGTH (Hob);
+ //
+ // Parse the HOB list until end of list or matching type is found.
+ //
+ while (HobLength <= HobSize) {
+ if (Hob.Header->HobType == EFI_HOB_TYPE_FV) {
+ return TRUE;
+ }
+
+ Hob.Raw = GET_NEXT_HOB (Hob);
+ HobLength += GET_HOB_LENGTH (Hob);
+ }
+
+ return FALSE;
+}
+
+/**
Create the MM foundation specific HOB list which StandaloneMm Core needed.
This function build the MM foundation specific HOB list needed by StandaloneMm Core
@@ -892,11 +935,16 @@ CreateMmFoundationHobList ( UsedSize += HobLength;
//
- // BFV address for StandaloneMm Core
+ // Skip to report FV that contains MmCore when Platform reports FV
//
- HobLength = GetRemainingHobSize (*FoundationHobSize, UsedSize);
- MmIplBuildFvHob (FoundationHobList + UsedSize, &HobLength, MmFvBase, MmFvSize);
- UsedSize += HobLength;
+ if (!IsFvHobExist (PlatformHobList, PlatformHobSize)) {
+ //
+ // BFV address for StandaloneMm Core
+ //
+ HobLength = GetRemainingHobSize (*FoundationHobSize, UsedSize);
+ MmIplBuildFvHob (FoundationHobList + UsedSize, &HobLength, MmFvBase, MmFvSize);
+ UsedSize += HobLength;
+ }
//
// Build MM ACPI S3 Enable HOB
|