UefiCpuPkg/PiSmmCpuDxeSmm: Use SMM Variable to set SmmProfileBase
MM can not use the gRT service, so use SMM Variable protocol to set SmmProfileBase instead of gRT->SetVariable for both SMM and MM. Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Dun Tan <dun.tan@intel.com> Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com> Cc: Wei6 Xu <wei6.xu@intel.com> Cc: Yuanhao Xie <yuanhao.xie@intel.com>
This commit is contained in:
parent
c8a1295d3e
commit
89fe9c5d79
|
@ -20,6 +20,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||
#include <Protocol/SmmCpuService.h>
|
||||
#include <Protocol/SmmMemoryAttribute.h>
|
||||
#include <Protocol/MmMp.h>
|
||||
#include <Protocol/SmmVariable.h>
|
||||
|
||||
#include <Guid/AcpiS3Context.h>
|
||||
#include <Guid/MemoryAttributesTable.h>
|
||||
|
|
|
@ -110,6 +110,7 @@
|
|||
gEfiMmMpProtocolGuid ## PRODUCES
|
||||
gEdkiiSmmCpuRendezvousProtocolGuid ## PRODUCES
|
||||
gEfiMpServiceProtocolGuid ## CONSUMES
|
||||
gEfiSmmVariableProtocolGuid ## CONSUMES
|
||||
|
||||
[Guids]
|
||||
gEfiAcpiVariableGuid ## SOMETIMES_CONSUMES ## HOB # it is used for S3 boot.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue