diff options
author | levi.yun <yeoreum.yun@arm.com> | 2024-01-25 16:48:05 +0000 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2025-01-17 14:55:42 +0000 |
commit | 6087382c62686130a6cb8bd397afe23bad9c4e67 (patch) | |
tree | 1a60924a24e17df87a8c75f94fcc6f75657b0cce /StandaloneMmPkg/Drivers | |
parent | 62127dfbc72e3303c58bd05a5995feaf5d0fd91c (diff) | |
download | edk2-6087382c62686130a6cb8bd397afe23bad9c4e67.tar.gz |
StandaloneMmPkg: Introduce PI_MM_CPU_DRIVER_EP protocol.
This patch introduces a PI_MM_CPU_DRIVER_EP protocol to handle
Mmcommunication request based on the CPU driver.
Previously the CPU driver entry point was retrieved using the
gEfiArmTfCpuDriverEntryPoint HOB.
However, this practice is incorrect as StandaloneMM must be a HOB
consumer and not a HOB producer.
Therefore, remove the CPU entry HOB gEfiArmTfCpuDriverEntryPoint,
and replace it with the CPU driver entry protocol
EDKII_PI_MM_CPU_DRIVER_EP_PROTOCOL.
The EDKII_PI_MM_CPU_DRIVER_EP_PROTOCOL installed in
StandaloneMmCpuInitialize() will be used by the code in
Arm/StandaloneMmCoreEntryPoint.
This protocol is used like below:
+=====+
|StandaloneMmCore|
+=====+
|
CEntryPoint()
===================
|
ProcessModuleEntryPointList()
|
+--> StandaloneMmMain()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| // Load StandaloneMmCpu driver which implements
| // CpuDriverEntryPoint used by DelegatedEventLoop().
| // and install the gEdkiiPiMmCpuDriverEpProtocolGuid.
--------------
|
... // Get CpuDriverEntryPoint implemented by
// StandaloneMmCpu driver with gEdkiiPiMmCpuDriverEpProtocolGuid
|
DelegatedEventLoop() // Handle request by delegating it to
// CpuDriverEntryPoint.
Signed-off-by: Levi Yun <yeoreum.yun@arm.com>
Diffstat (limited to 'StandaloneMmPkg/Drivers')
3 files changed, 24 insertions, 29 deletions
diff --git a/StandaloneMmPkg/Drivers/StandaloneMmCpu/EventHandle.c b/StandaloneMmPkg/Drivers/StandaloneMmCpu/EventHandle.c index dc11d4375a..1d61c45a35 100644 --- a/StandaloneMmPkg/Drivers/StandaloneMmCpu/EventHandle.c +++ b/StandaloneMmPkg/Drivers/StandaloneMmCpu/EventHandle.c @@ -54,6 +54,10 @@ EFI_MM_CONFIGURATION_PROTOCOL mMmConfig = { MmFoundationEntryRegister
};
+EDKII_PI_MM_CPU_DRIVER_EP_PROTOCOL mPiMmCpuDriverEpProtocol = {
+ PiMmStandaloneMmCpuDriverEntry
+};
+
STATIC EFI_MM_ENTRY_POINT mMmEntryPoint = NULL;
/**
diff --git a/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.c b/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.c index c5ec1a5a80..db9c2a899a 100644 --- a/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.c +++ b/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.c @@ -2,7 +2,7 @@ Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
Copyright (c) 2016 HP Development Company, L.P.
- Copyright (c) 2016 - 2021, Arm Limited. All rights reserved.
+ Copyright (c) 2016 - 2024, Arm Limited. All rights reserved.
Copyright (c) 2023, Ventana Micro System Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -26,10 +26,11 @@ // World
extern EFI_GUID gEfiStandaloneMmNonSecureBufferGuid;
-// GUID to identify HOB where the entry point of this CPU driver will be
-// populated to allow the entry point driver to invoke it upon receipt of an
-// event
-extern EFI_GUID gEfiMmCpuDriverEpDescriptorGuid;
+//
+// mPiMmCpuDriverEpProtocol for Cpu driver entry point to handle
+// mm communication event.
+//
+extern EDKII_PI_MM_CPU_DRIVER_EP_PROTOCOL mPiMmCpuDriverEpProtocol;
//
// Private copy of the MM system table for future use
@@ -94,7 +95,6 @@ StandaloneMmCpuInitialize ( IN EFI_MM_SYSTEM_TABLE *SystemTable // not actual systemtable
)
{
- MM_CPU_DRIVER_EP_DESCRIPTOR *CpuDriverEntryPointDesc;
EFI_CONFIGURATION_TABLE *ConfigurationTable;
MP_INFORMATION_HOB_DATA *MpInformationHobData;
EFI_MMRAM_DESCRIPTOR *NsCommBufMmramRange;
@@ -120,6 +120,19 @@ StandaloneMmCpuInitialize ( return Status;
}
+ // Install entry point of this CPU driver to allow
+ // the entry point driver to be invoked upon receipt of an event in
+ // DelegatedEventLoop.
+ Status = mMmst->MmInstallProtocolInterface (
+ &mMmCpuHandle,
+ &gEdkiiPiMmCpuDriverEpProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &mPiMmCpuDriverEpProtocol
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
// register the root MMI handler
Status = mMmst->MmiHandlerRegister (
PiMmCpuTpFwRootMmiHandler,
@@ -147,28 +160,6 @@ StandaloneMmCpuInitialize ( HobStart = ConfigurationTable[Index].VendorTable;
- //
- // Locate the HOB with the buffer to populate the entry point of this driver
- //
- Status = GetGuidedHobData (
- HobStart,
- &gEfiMmCpuDriverEpDescriptorGuid,
- (VOID **)&CpuDriverEntryPointDesc
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "MmCpuDriverEpDesc HOB data extraction failed - 0x%x\n", Status));
- return Status;
- }
-
- // Share the entry point of the CPU driver
- DEBUG ((
- DEBUG_INFO,
- "Sharing Cpu Driver EP *0x%lx = 0x%lx\n",
- (UINTN)CpuDriverEntryPointDesc->MmCpuDriverEpPtr,
- (UINTN)PiMmStandaloneMmCpuDriverEntry
- ));
- *(CpuDriverEntryPointDesc->MmCpuDriverEpPtr) = PiMmStandaloneMmCpuDriverEntry;
-
// Find the descriptor that contains the whereabouts of the buffer for
// communication with the Normal world.
Status = GetGuidedHobData (
diff --git a/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf b/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf index 486ccbac1b..36b70ba1b9 100644 --- a/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf +++ b/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf @@ -36,6 +36,7 @@ [Protocols]
gEfiMmConfigurationProtocolGuid # PROTOCOL ALWAYS_PRODUCED
gEfiMmCpuProtocolGuid # PROTOCOL ALWAYS_PRODUCED
+ gEdkiiPiMmCpuDriverEpProtocolGuid # PROTOCOL ALWAYS_PRODUCED
[Guids]
gEfiHobListGuid
@@ -43,7 +44,6 @@ gZeroGuid
gMpInformationHobGuid
gEfiStandaloneMmNonSecureBufferGuid
- gEfiMmCpuDriverEpDescriptorGuid
[Depex]
TRUE
|