From: Achin Gupta <achin.gu...@arm.com> This patch statically allocates an FF-A RX/TX buffer pair and registers them with the framework. This enables discovery of the StMM SP in a subsequent patch.
Signed-off-by: Achin Gupta <achin.gu...@arm.com> Signed-off-by: Nishant Sharma <nishant.sha...@arm.com> --- ArmPkg/Include/IndustryStandard/ArmFfaSvc.h | 2 ++ ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ArmPkg/Include/IndustryStandard/ArmFfaSvc.h b/ArmPkg/Include/IndustryStandard/ArmFfaSvc.h index 20eeb822ea56..ebdf29e8d69a 100644 --- a/ArmPkg/Include/IndustryStandard/ArmFfaSvc.h +++ b/ArmPkg/Include/IndustryStandard/ArmFfaSvc.h @@ -17,6 +17,8 @@ #define ARM_FFA_SVC_H_ #define ARM_SVC_ID_FFA_VERSION_AARCH32 0x84000063 +#define ARM_SVC_ID_FFA_RXTX_MAP_AARCH32 0x84000066 +#define ARM_SVC_ID_FFA_RXTX_MAP_AARCH64 0xC4000066 #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 diff --git a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c index f907ccf7349f..8a4d46e4f80a 100644 --- a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c +++ b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c @@ -28,6 +28,12 @@ // STATIC UINT16 mFfaPartId; +// +// RX/TX pair if FF-A support is enabled +// +STATIC UINT8 FfaRxBuf[EFI_PAGE_SIZE] __attribute__ ((aligned (EFI_PAGE_SIZE))); +STATIC UINT8 FfaTxBuf[EFI_PAGE_SIZE] __attribute__ ((aligned (EFI_PAGE_SIZE))); + // // Address, Length of the pre-allocated buffer for communication with the secure // world. @@ -293,9 +299,8 @@ GetMmCompatibility ( Status = EFI_UNSUPPORTED; } - // If FF-A is supported then discover our ID. + // If FF-A is supported then discover our ID and register our RX/TX buffers. if (FixedPcdGet32 (PcdFfaEnable) != 0) { - // Get our ID ZeroMem(&SmcArgs, sizeof(SmcArgs)); SmcArgs.Arg0 = ARM_SVC_ID_FFA_ID_GET_AARCH32; @@ -307,6 +312,17 @@ GetMmCompatibility ( DEBUG ((DEBUG_INFO, "FF-A partition ID = 0x%lx.\n", SmcArgs.Arg2)); mFfaPartId = SmcArgs.Arg2; + // Register our RX/TX pair + SmcArgs.Arg0 = ARM_SVC_ID_FFA_RXTX_MAP_AARCH64; + SmcArgs.Arg1 = (UINTN) FfaTxBuf; + SmcArgs.Arg2 = (UINTN) FfaRxBuf; + SmcArgs.Arg3 = EFI_PAGE_SIZE / SIZE_4KB; + ArmCallSmc (&SmcArgs); + if (SmcArgs.Arg0 == ARM_SVC_ID_FFA_ERROR_AARCH32) { + DEBUG ((DEBUG_ERROR, "Unable to register FF-A RX/TX buffers (%d).\n", SmcArgs.Arg2)); + return EFI_UNSUPPORTED; + } + return EFI_SUCCESS; } -- 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#106808): https://edk2.groups.io/g/devel/message/106808 Mute This Topic: https://groups.io/mt/100079889/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-