Skip to content

Commit

Permalink
UefiPkg/PiSmmCpuDxeSmm: Set SmmProfile Variable only for DXE SMM
Browse files Browse the repository at this point in the history
Some platforms plan to move the Standalone MM CPU driver into the FSP.
However, there is no variable service support in FSP. Therefore, the
SetVariable logic for the Standalone MM CPU will be removed. With this
change, users can dump the SmmProfile data from the Memory Allocation
HOB: gMmProfileDataHobGuid.

This change does not impact the DXE SMM, which will still retrieve the
SmmProfile data from the variable service.

Signed-off-by: Yanxin Zhao <[email protected]>
  • Loading branch information
yanxinzh committed Dec 19, 2024
1 parent 4af5849 commit d22d89d
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,24 +714,29 @@ InitSmmProfileCallBack (
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.
//
SmmProfileVariable->SmmSetVariable (
SMM_PROFILE_NAME,
&gEfiCallerIdGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
sizeof (mSmmProfileBase),
&mSmmProfileBase
);
Status = EFI_SUCCESS;
if (!mIsStandaloneMm) {
//
// Locate SmmVariableProtocol.
//
Status = gMmst->MmLocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID **)&SmmProfileVariable);
ASSERT_EFI_ERROR (Status);

return EFI_SUCCESS;
//
// Save to variable so that SMM profile data can be found.
//
Status = SmmProfileVariable->SmmSetVariable (
SMM_PROFILE_NAME,
&gEfiCallerIdGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
sizeof (mSmmProfileBase),
&mSmmProfileBase
);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Set SmmProfile variable failure! Status = %r\n", Status));
}
}
return Status;
}

/**
Expand Down

0 comments on commit d22d89d

Please sign in to comment.