From 9dd4beb3289367e91bfff69bfa5a0b5bb8ee2dc1 Mon Sep 17 00:00:00 2001 From: Kun Qin Date: Mon, 8 Dec 2025 14:50:33 -0800 Subject: [PATCH] [CHERRY-PICK] StandaloneMmPkg: StandaloneMmIplPei: Guard S3 hob with PcdAcpiS3Enable The current module checks the value of gEfiAcpiVariableGuid hobs and could assert if there is no such hob available. However, these hobs are only available if a platform elects to support S3. Thus this change moves the hob copy logic behind a PCD check to prevent unnecessary asserts. Signed-off-by: Kun Qin (cherry picked from commit 1fe2504afb6ed8a991d5cfe2e3cf1d39afb47b95) --- .../Drivers/StandaloneMmIplPei/MmFoundationHob.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/StandaloneMmPkg/Drivers/StandaloneMmIplPei/MmFoundationHob.c b/StandaloneMmPkg/Drivers/StandaloneMmIplPei/MmFoundationHob.c index 96e041639fd..fc6d3476a4d 100644 --- a/StandaloneMmPkg/Drivers/StandaloneMmIplPei/MmFoundationHob.c +++ b/StandaloneMmPkg/Drivers/StandaloneMmIplPei/MmFoundationHob.c @@ -1026,9 +1026,12 @@ CreateMmFoundationHobList ( // // Build ACPI variable HOB // - HobLength = GetRemainingHobSize (*FoundationHobSize, UsedSize); - MmIplCopyGuidHob (FoundationHobList + UsedSize, &HobLength, &gEfiAcpiVariableGuid, FALSE); - UsedSize += HobLength; + if (PcdGetBool (PcdAcpiS3Enable)) { + // Only check on this variable when S3 needs it. + HobLength = GetRemainingHobSize (*FoundationHobSize, UsedSize); + MmIplCopyGuidHob (FoundationHobList + UsedSize, &HobLength, &gEfiAcpiVariableGuid, FALSE); + UsedSize += HobLength; + } if (FeaturePcdGet (PcdCpuSmmProfileEnable)) { //