StandaloneMmPkg/MmIpl: Dispatch StandaloneMm drivers in MM

MmIpl will issue a SWSMI by MM communicate to call gEventMmDispatchGuid
handler to dispatch all StandaloneMm drivers

Signed-off-by: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
This commit is contained in:
Hongbin1 Zhang 2024-05-09 19:26:24 +08:00 committed by mergify[bot]
parent 3ac296def1
commit 5aa5ecd5ff
2 changed files with 44 additions and 0 deletions

View File

@ -498,6 +498,43 @@ EndOfPeiCallback (
return Status;
}
/**
Dispatch StandaloneMm drivers in MM.
StandaloneMm core will exit when MmEntryPoint was registered in CPU
StandaloneMm driver, and issue a software SMI by communicate mode to
dispatch other StandaloneMm drivers.
@retval EFI_SUCCESS Dispatch StandaloneMm drivers successfully.
@retval Other Dispatch StandaloneMm drivers failed.
**/
EFI_STATUS
MmIplDispatchMmDrivers (
VOID
)
{
EFI_STATUS Status;
UINTN Size;
EFI_MM_COMMUNICATE_HEADER CommunicateHeader;
//
// Use Guid to initialize EFI_MM_COMMUNICATE_HEADER structure
//
CopyGuid (&CommunicateHeader.HeaderGuid, &gEventMmDispatchGuid);
CommunicateHeader.MessageLength = 1;
CommunicateHeader.Data[0] = 0;
//
// Generate the Software SMI and return the result
//
Size = sizeof (CommunicateHeader);
Status = Communicate (NULL, &CommunicateHeader, &Size);
ASSERT_EFI_ERROR (Status);
return Status;
}
/**
Build communication buffer HOB.
@ -603,5 +640,11 @@ StandaloneMmIplPeiEntry (
Status = PeiServicesNotifyPpi (&mNotifyList);
ASSERT_EFI_ERROR (Status);
//
// Dispatch StandaloneMm drivers in MM
//
Status = MmIplDispatchMmDrivers ();
ASSERT_EFI_ERROR (Status);
return EFI_SUCCESS;
}

View File

@ -45,6 +45,7 @@
[Guids]
gMmCommBufferHobGuid
gEfiSmmSmramMemoryGuid
gEventMmDispatchGuid
[Ppis]
gEfiPeiMmControlPpiGuid