From: Achin Gupta <achin.gu...@arm.com> This patch invokes the FFA_ID_GET to obtain and stash the ID of the the FF-A partition that implements the DXE MM communication driver. This ID is used in subsequent patches for sending and receiving MM communication protocol requests and responses that are packaged as FF-A messages.
Signed-off-by: Achin Gupta <achin.gu...@arm.com> Signed-off-by: Nishant Sharma <nishant.sha...@arm.com> --- ArmPkg/Include/IndustryStandard/ArmFfaSvc.h | 1 + ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c | 22 ++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/ArmPkg/Include/IndustryStandard/ArmFfaSvc.h b/ArmPkg/Include/IndustryStandard/ArmFfaSvc.h index 4a51f9fb56af..20eeb822ea56 100644 --- a/ArmPkg/Include/IndustryStandard/ArmFfaSvc.h +++ b/ArmPkg/Include/IndustryStandard/ArmFfaSvc.h @@ -17,6 +17,7 @@ #define ARM_FFA_SVC_H_ #define ARM_SVC_ID_FFA_VERSION_AARCH32 0x84000063 +#define ARM_SVC_ID_FFA_ID_GET_AARCH32 0x84000069 #define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH32 0x8400006F #define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH32 0x84000070 #define ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH64 0xC400006F diff --git a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c index a6fcd590a65b..f907ccf7349f 100644 --- a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c +++ b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c @@ -23,6 +23,11 @@ #include "MmCommunicate.h" +// +// Partition ID if FF-A support is enabled +// +STATIC UINT16 mFfaPartId; + // // Address, Length of the pre-allocated buffer for communication with the secure // world. @@ -288,6 +293,23 @@ GetMmCompatibility ( Status = EFI_UNSUPPORTED; } + // If FF-A is supported then discover our ID. + if (FixedPcdGet32 (PcdFfaEnable) != 0) { + + // Get our ID + ZeroMem(&SmcArgs, sizeof(SmcArgs)); + SmcArgs.Arg0 = ARM_SVC_ID_FFA_ID_GET_AARCH32; + ArmCallSmc (&SmcArgs); + if (SmcArgs.Arg0 == ARM_SVC_ID_FFA_ERROR_AARCH32) { + DEBUG ((DEBUG_ERROR, "Unable to retrieve FF-A partition ID (%d).\n", SmcArgs.Arg2)); + return EFI_UNSUPPORTED; + } + DEBUG ((DEBUG_INFO, "FF-A partition ID = 0x%lx.\n", SmcArgs.Arg2)); + mFfaPartId = SmcArgs.Arg2; + + return EFI_SUCCESS; + } + return Status; } -- 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#106807): https://edk2.groups.io/g/devel/message/106807 Mute This Topic: https://groups.io/mt/100079888/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-