mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-27 15:44:04 +02:00
UefiCpuPkg: LoadMtrrData for all cpu in S3Resume
In this commit, S3Resume.c wakeup all Aps to run LoadMtrrData for all cpu before transfer to CpuS3.c in smm cpu driver. The MtrrSetting table can be restored by gEdkiiS3MtrrSettingGuid which is saved by lockbox in PEI phase. This can avoid waking up APs in CpuS3.c. Signed-off-by: Dun Tan <dun.tan@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
This commit is contained in:
parent
3a516aa240
commit
ad245ffeff
@ -4,7 +4,7 @@
|
|||||||
This module will execute the boot script saved during last boot and after that,
|
This module will execute the boot script saved during last boot and after that,
|
||||||
control is passed to OS waking up handler.
|
control is passed to OS waking up handler.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2023, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2024, Intel Corporation. All rights reserved.<BR>
|
||||||
Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
|
Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
|
||||||
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
@ -39,6 +39,7 @@
|
|||||||
#include <Library/DebugAgentLib.h>
|
#include <Library/DebugAgentLib.h>
|
||||||
#include <Library/LocalApicLib.h>
|
#include <Library/LocalApicLib.h>
|
||||||
#include <Library/ReportStatusCodeLib.h>
|
#include <Library/ReportStatusCodeLib.h>
|
||||||
|
#include <Library/MtrrLib.h>
|
||||||
|
|
||||||
#include <Library/HobLib.h>
|
#include <Library/HobLib.h>
|
||||||
#include <Library/LockBoxLib.h>
|
#include <Library/LockBoxLib.h>
|
||||||
@ -938,6 +939,20 @@ S3ResumeExecuteBootScript (
|
|||||||
CpuDeadLoop ();
|
CpuDeadLoop ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sync up the MTRR values for all processors.
|
||||||
|
|
||||||
|
@param[in] MtrrTable Address of MTRR setting.
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
LoadMtrrData (
|
||||||
|
IN VOID *MtrrTable
|
||||||
|
)
|
||||||
|
{
|
||||||
|
MtrrSetAllMtrrs (MtrrTable);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Restores the platform to its preboot configuration for an S3 resume and
|
Restores the platform to its preboot configuration for an S3 resume and
|
||||||
jumps to the OS waking vector.
|
jumps to the OS waking vector.
|
||||||
@ -990,6 +1005,7 @@ S3RestoreConfig2 (
|
|||||||
BOOLEAN InterruptStatus;
|
BOOLEAN InterruptStatus;
|
||||||
IA32_CR0 Cr0;
|
IA32_CR0 Cr0;
|
||||||
EDKII_PEI_MP_SERVICES2_PPI *MpService2Ppi;
|
EDKII_PEI_MP_SERVICES2_PPI *MpService2Ppi;
|
||||||
|
MTRR_SETTINGS MtrrTable;
|
||||||
|
|
||||||
TempAcpiS3Context = 0;
|
TempAcpiS3Context = 0;
|
||||||
TempEfiBootScriptExecutorVariable = 0;
|
TempEfiBootScriptExecutorVariable = 0;
|
||||||
@ -1082,6 +1098,39 @@ S3RestoreConfig2 (
|
|||||||
Status = SmmAccess->Open ((EFI_PEI_SERVICES **)GetPeiServicesTablePointer (), SmmAccess, Index);
|
Status = SmmAccess->Open ((EFI_PEI_SERVICES **)GetPeiServicesTablePointer (), SmmAccess, Index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get MP Services2 Ppi to pass it to Smm S3.
|
||||||
|
//
|
||||||
|
Status = PeiServicesLocatePpi (
|
||||||
|
&gEdkiiPeiMpServices2PpiGuid,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
(VOID **)&MpService2Ppi
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Restore MTRR setting
|
||||||
|
//
|
||||||
|
VarSize = sizeof (MTRR_SETTINGS);
|
||||||
|
Status = RestoreLockBox (
|
||||||
|
&gEdkiiS3MtrrSettingGuid,
|
||||||
|
&MtrrTable,
|
||||||
|
&VarSize
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Sync up the MTRR values for all processors.
|
||||||
|
//
|
||||||
|
Status = MpService2Ppi->StartupAllCPUs (
|
||||||
|
MpService2Ppi,
|
||||||
|
(EFI_AP_PROCEDURE)LoadMtrrData,
|
||||||
|
0,
|
||||||
|
(VOID *)&MtrrTable
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
SmramDescriptor = (EFI_SMRAM_DESCRIPTOR *)GET_GUID_HOB_DATA (GuidHob);
|
SmramDescriptor = (EFI_SMRAM_DESCRIPTOR *)GET_GUID_HOB_DATA (GuidHob);
|
||||||
SmmS3ResumeState = (SMM_S3_RESUME_STATE *)(UINTN)SmramDescriptor->CpuStart;
|
SmmS3ResumeState = (SMM_S3_RESUME_STATE *)(UINTN)SmramDescriptor->CpuStart;
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
# This module will excute the boot script saved during last boot and after that,
|
# This module will excute the boot script saved during last boot and after that,
|
||||||
# control is passed to OS waking up handler.
|
# control is passed to OS waking up handler.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2010 - 2023, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2010 - 2024, Intel Corporation. All rights reserved.<BR>
|
||||||
# Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
|
# Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
@ -67,6 +67,7 @@
|
|||||||
LocalApicLib
|
LocalApicLib
|
||||||
ReportStatusCodeLib
|
ReportStatusCodeLib
|
||||||
LockBoxLib
|
LockBoxLib
|
||||||
|
MtrrLib
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
gEfiBootScriptExecutorVariableGuid ## SOMETIMES_CONSUMES ## UNDEFINED # LockBox
|
gEfiBootScriptExecutorVariableGuid ## SOMETIMES_CONSUMES ## UNDEFINED # LockBox
|
||||||
@ -79,6 +80,7 @@
|
|||||||
## SOMETIMES_PRODUCES ## UNDEFINED # Install PPI
|
## SOMETIMES_PRODUCES ## UNDEFINED # Install PPI
|
||||||
## SOMETIMES_CONSUMES ## UNDEFINED # Used to do smm communication
|
## SOMETIMES_CONSUMES ## UNDEFINED # Used to do smm communication
|
||||||
gEdkiiS3SmmInitDoneGuid
|
gEdkiiS3SmmInitDoneGuid
|
||||||
|
gEdkiiS3MtrrSettingGuid
|
||||||
|
|
||||||
[Ppis]
|
[Ppis]
|
||||||
gEfiPeiS3Resume2PpiGuid ## PRODUCES
|
gEfiPeiS3Resume2PpiGuid ## PRODUCES
|
||||||
|
Loading…
x
Reference in New Issue
Block a user