From 1f22b96b11cec64c11ef2681566c7fd50ee9c0cf Mon Sep 17 00:00:00 2001 From: Jiaxin Wu Date: Wed, 26 Jun 2024 12:43:51 +0800 Subject: [PATCH] UefiCpuPkg/PiSmmCpuDxeSmm: Impl GetAcpiS3EnableFlag for MM MM CPU can not use the dynamic PCD (PcdAcpiS3Enable), so, it consumes the gMmAcpiS3EnableHobGuid to get ACPI S3 enable flag. Signed-off-by: Jiaxin Wu Cc: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Star Zeng Cc: Dun Tan Cc: Hongbin1 Zhang Cc: Wei6 Xu Cc: Yuanhao Xie --- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuCommon.h | 1 + .../PiSmmCpuDxeSmm/PiSmmCpuStandaloneMm.c | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuCommon.h b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuCommon.h index 7f11429e50..1769af2fa6 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuCommon.h +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuCommon.h @@ -29,6 +29,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include #include diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuStandaloneMm.c b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuStandaloneMm.c index 3471d40cb2..35657a3b57 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuStandaloneMm.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuStandaloneMm.c @@ -8,3 +8,31 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ #include "PiSmmCpuCommon.h" + +/** + Get ACPI S3 enable flag. + +**/ +VOID +GetAcpiS3EnableFlag ( + VOID + ) +{ + EFI_HOB_GUID_TYPE *GuidHob; + MM_ACPI_S3_ENABLE *MmAcpiS3EnableHob; + + MmAcpiS3EnableHob = NULL; + + // + // Get MM_ACPI_S3_ENABLE for Standalone MM init. + // + GuidHob = GetFirstGuidHob (&gMmAcpiS3EnableHobGuid); + ASSERT (GuidHob != NULL); + if (GuidHob != NULL) { + MmAcpiS3EnableHob = GET_GUID_HOB_DATA (GuidHob); + } + + if (MmAcpiS3EnableHob != NULL) { + mAcpiS3Enable = MmAcpiS3EnableHob->AcpiS3Enable; + } +}