Skip to content

Commit

Permalink
UefiCpuPkg: Save MTRR by lockbox in CpuS3DataDxe
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Ray Ni <[email protected]>
Cc: Rahul Kumar <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Reviewed-by: Jiaxin Wu <[email protected]>
  • Loading branch information
td36 authored and mergify[bot] committed Jun 4, 2024
1 parent 32a9ee7 commit 3a516aa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 12 additions & 1 deletion UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.<BR>
Copyright (c) 2013 - 2024, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2015, Red Hat, Inc.
SPDX-License-Identifier: BSD-2-Clause-Patent
Expand All @@ -26,6 +26,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/DebugLib.h>
#include <Library/MtrrLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/LockBoxLib.h>

#include <Protocol/MpService.h>
#include <Guid/EventGroup.h>
Expand Down Expand Up @@ -130,6 +131,16 @@ CpuS3DataOnEndOfDxe (
DEBUG ((DEBUG_VERBOSE, "%a\n", __func__));
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.
//
Expand Down
4 changes: 3 additions & 1 deletion UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
Original file line number Diff line number Diff line change
Expand Up @@ -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.<BR>
# Copyright (c) 2013-2024, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2015, Red Hat, Inc.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
Expand Down Expand Up @@ -46,9 +46,11 @@
BaseLib
MtrrLib
MemoryAllocationLib
LockBoxLib

[Guids]
gEfiEndOfDxeEventGroupGuid ## CONSUMES ## Event
gEdkiiS3MtrrSettingGuid

[Protocols]
gEfiMpServiceProtocolGuid ## CONSUMES
Expand Down

0 comments on commit 3a516aa

Please sign in to comment.