diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuCommon.h b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuCommon.h index c75f0ea9d6..cc1fceb837 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuCommon.h +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuCommon.h @@ -20,6 +20,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include #include diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf index 2705ca69ea..d8eda7825f 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf @@ -110,6 +110,7 @@ gEfiMmMpProtocolGuid ## PRODUCES gEdkiiSmmCpuRendezvousProtocolGuid ## PRODUCES gEfiMpServiceProtocolGuid ## CONSUMES + gEfiSmmVariableProtocolGuid ## CONSUMES [Guids] gEfiAcpiVariableGuid ## SOMETIMES_CONSUMES ## HOB # it is used for S3 boot. diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c index a0ebaf5131..19f3ba7000 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c @@ -753,16 +753,25 @@ InitSmmProfileCallBack ( IN EFI_HANDLE Handle ) { + EFI_STATUS Status; + EFI_SMM_VARIABLE_PROTOCOL *SmmProfileVariable; + + // + // Locate SmmVariableProtocol. + // + Status = gMmst->MmLocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID **)&SmmProfileVariable); + ASSERT_EFI_ERROR (Status); + // // Save to variable so that SMM profile data can be found. // - gRT->SetVariable ( - SMM_PROFILE_NAME, - &gEfiCallerIdGuid, - EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, - sizeof (mSmmProfileBase), - &mSmmProfileBase - ); + SmmProfileVariable->SmmSetVariable ( + SMM_PROFILE_NAME, + &gEfiCallerIdGuid, + EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, + sizeof (mSmmProfileBase), + &mSmmProfileBase + ); // // Get Software SMI from FADT