StandaloneMmPkg: Make StandaloneMmCpu driver architecture independent

StandaloneMmCpu now can supports more architectures like RISC-V besides
ARM/AARCH64.

Signed-off-by: Tuan Phan <tphan@ventanamicro.com>
Reviewed-by: levi.yun <yeoreum.yun@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
This commit is contained in:
Tuan Phan
2023-09-28 14:14:03 -07:00
committed by mergify[bot]
parent 74b5309da9
commit e7a7169446
5 changed files with 46 additions and 54 deletions

View File

@@ -3,6 +3,7 @@
Copyright (c) 2016 HP Development Company, L.P.
Copyright (c) 2016 - 2021, Arm Limited. All rights reserved.
Copyright (c) 2021, Linaro Limited
Copyright (c) 2023, Ventana Micro System Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -11,8 +12,6 @@
#include <Base.h>
#include <Pi/PiMmCis.h>
#include <Library/ArmSvcLib.h>
#include <Library/ArmLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/HobLib.h>
@@ -22,10 +21,7 @@
#include <Guid/ZeroGuid.h>
#include <Guid/MmramMemoryReserve.h>
#include <IndustryStandard/ArmFfaSvc.h>
#include <IndustryStandard/ArmStdSmc.h>
#include "StandaloneMmCpu.h"
#include <StandaloneMmCpu.h>
EFI_STATUS
EFIAPI
@@ -108,7 +104,7 @@ CheckBufferAddr (
}
/**
The PI Standalone MM entry point for the TF-A CPU driver.
The PI Standalone MM entry point for the CPU driver.
@param [in] EventId The event Id.
@param [in] CpuNumber The CPU number.
@@ -121,7 +117,7 @@ CheckBufferAddr (
@retval EFI_UNSUPPORTED Operation not supported.
**/
EFI_STATUS
PiMmStandaloneArmTfCpuDriverEntry (
PiMmStandaloneMmCpuDriverEntry (
IN UINTN EventId,
IN UINTN CpuNumber,
IN UINTN NsCommBufferAddr
@@ -135,17 +131,6 @@ PiMmStandaloneArmTfCpuDriverEntry (
DEBUG ((DEBUG_INFO, "Received event - 0x%x on cpu %d\n", EventId, CpuNumber));
Status = EFI_SUCCESS;
//
// ARM TF passes SMC FID of the MM_COMMUNICATE interface as the Event ID upon
// receipt of a synchronous MM request. Use the Event ID to distinguish
// between synchronous and asynchronous events.
//
if ((ARM_SMC_ID_MM_COMMUNICATE != EventId) &&
(ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ != EventId))
{
DEBUG ((DEBUG_ERROR, "UnRecognized Event - 0x%x\n", EventId));
return EFI_INVALID_PARAMETER;
}
// Perform parameter validation of NsCommBufferAddr
if (NsCommBufferAddr == (UINTN)NULL) {
@@ -177,7 +162,7 @@ PiMmStandaloneArmTfCpuDriverEntry (
}
// X1 contains the VA of the normal world memory accessible from
// S-EL0
// secure world.
CopyMem (GuidedEventContext, (CONST VOID *)NsCommBufferAddr, NsCommBufferSize);
// Stash the pointer to the allocated Event Context for this CPU