Cactus: Map RXTX region to third partion.
When the third cactus partition is booted, map the RXTX
region using the FFA_RXTX_MAP ABI. If this is successful,
point the mailbox to this RXTX region.
Signed-off-by: Ruari Phipps <ruari.phipps@arm.com>
Change-Id: Ifbe3bc70b187f75f29ef66356e714e8a905d2db8
diff --git a/spm/cactus/cactus_main.c b/spm/cactus/cactus_main.c
index 31906d5..e833310 100644
--- a/spm/cactus/cactus_main.c
+++ b/spm/cactus/cactus_main.c
@@ -185,8 +185,32 @@
} else {
set_putc_impl(HVC_CALL_AS_STDOUT);
- NOTICE("Booting Secondary Cactus Secure Partition\n%s\n%s\n",
- build_message, version_string);
+ NOTICE("Booting Secondary Cactus Secure Partition (ID: %u)\n%s\n%s\n",
+ ffa_id, build_message, version_string);
+
+ if (ffa_id == SPM_VM_ID_THIRD) {
+ NOTICE("Mapping RXTX Region\n");
+
+ /* Declare RX/TX buffers at virtual FF-A instance */
+ static struct {
+ uint8_t rx[PAGE_SIZE];
+ uint8_t tx[PAGE_SIZE];
+ } __aligned(PAGE_SIZE) ffa_buffers;
+
+ /* Map RX/TX buffers */
+ smc_ret_values ret = ffa_rxtx_map((uintptr_t) &ffa_buffers.tx,
+ (uintptr_t) &ffa_buffers.rx,
+ sizeof(ffa_buffers.rx) / PAGE_SIZE);
+
+ if (ret.ret0 != FFA_SUCCESS_SMC32) {
+ ERROR("ffa_rxtx_map error (%lu)\n", ret.ret2);
+ panic();
+ }
+
+ /* Update mailbox with RX/TX buffer */
+ mb.send = (void *) &ffa_buffers.tx;
+ mb.recv = (void *) &ffa_buffers.rx;
+ }
}
NOTICE("FFA id: %u\n", ffa_id);