From 52a4bc65f64209c53acad03a46de851362eae4ca Mon Sep 17 00:00:00 2001 From: Dun Tan Date: Tue, 23 Apr 2024 11:10:00 +0800 Subject: OvmfPkg: Save MTRR by lockbox in CpuS3DataDxe Save MTRR by lockbox in CpuS3DataDxe. In S3 boot, The MTRR setting will be restored in S3Resume.c in following patches. Then S3Resume.c will wakeup all APs to load the MTRR setting. This can avoid waking up APs in CpuS3.c. Signed-off-by: Dun Tan Reviewed-by: Ard Biesheuvel Cc: Jiewen Yao Cc: Gerd Hoffmann Reviewed-by: Ray Ni Reviewed-by: Jiaxin Wu --- OvmfPkg/CpuS3DataDxe/CpuS3Data.c | 13 ++++++++++++- OvmfPkg/CpuS3DataDxe/CpuS3DataDxe.inf | 4 +++- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'OvmfPkg') diff --git a/OvmfPkg/CpuS3DataDxe/CpuS3Data.c b/OvmfPkg/CpuS3DataDxe/CpuS3Data.c index 289048b..eacdfa1 100644 --- a/OvmfPkg/CpuS3DataDxe/CpuS3Data.c +++ b/OvmfPkg/CpuS3DataDxe/CpuS3Data.c @@ -9,7 +9,7 @@ number of CPUs reported by the MP Services Protocol, so this module does not support hot plug CPUs. This module can be copied into a CPU specific package and customized if these additional features are required. -Copyright (c) 2013 - 2021, Intel Corporation. All rights reserved.
+Copyright (c) 2013 - 2024, Intel Corporation. All rights reserved.
Copyright (c) 2015 - 2020, Red Hat, Inc. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -26,6 +26,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include #include @@ -131,6 +132,16 @@ CpuS3DataOnEndOfDxe ( MtrrGetAllMtrrs (&AcpiCpuDataEx->MtrrTable); // + // Save MTRR in lockbox + // + Status = SaveLockBox ( + &gEdkiiS3MtrrSettingGuid, + &AcpiCpuDataEx->MtrrTable, + sizeof (MTRR_SETTINGS) + ); + ASSERT_EFI_ERROR (Status); + + // // Close event, so it will not be invoked again. // gBS->CloseEvent (Event); diff --git a/OvmfPkg/CpuS3DataDxe/CpuS3DataDxe.inf b/OvmfPkg/CpuS3DataDxe/CpuS3DataDxe.inf index 228d5ae..5369613 100644 --- a/OvmfPkg/CpuS3DataDxe/CpuS3DataDxe.inf +++ b/OvmfPkg/CpuS3DataDxe/CpuS3DataDxe.inf @@ -9,7 +9,7 @@ # support hot plug CPUs. This module can be copied into a CPU specific package # and customized if these additional features are required. # -# Copyright (c) 2013-2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2013-2024, Intel Corporation. All rights reserved.
# Copyright (c) 2015-2020, Red Hat, Inc. # # SPDX-License-Identifier: BSD-2-Clause-Patent @@ -46,9 +46,11 @@ MtrrLib UefiBootServicesTableLib UefiDriverEntryPoint + LockBoxLib [Guids] gEfiEndOfDxeEventGroupGuid ## CONSUMES ## Event + gEdkiiS3MtrrSettingGuid [Protocols] gEfiMpServiceProtocolGuid ## CONSUMES -- cgit v1.1