cactus: Use RXTX mapping helper macros
Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: I2774435d85dd9a5c697c19f759994eecd349a236
diff --git a/spm/cactus/cactus_main.c b/spm/cactus/cactus_main.c
index 7c70d67..58b7dad 100644
--- a/spm/cactus/cactus_main.c
+++ b/spm/cactus/cactus_main.c
@@ -218,6 +218,7 @@
NOTICE("Booting Primary Cactus Secure Partition\n%s\n%s\n",
build_message, version_string);
} else {
+ smc_ret_values ret;
set_putc_impl(HVC_CALL_AS_STDOUT);
NOTICE("Booting Secondary Cactus Secure Partition (ID: %u)\n%s\n%s\n",
@@ -225,26 +226,13 @@
if (ffa_id == (SPM_VM_ID_FIRST + 2)) {
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);
-
+ CONFIGURE_AND_MAP_MAILBOX(mb, PAGE_SIZE, ret);
if (ret.ret0 != FFA_SUCCESS_SMC32) {
- ERROR("ffa_rxtx_map error (%lu)\n", ret.ret2);
+ ERROR(
+ "Failed to map RXTX buffers. Error: %lx\n",
+ ret.ret2);
panic();
}
-
- /* Update mailbox with RX/TX buffer */
- mb.send = (void *) &ffa_buffers.tx;
- mb.recv = (void *) &ffa_buffers.rx;
}
}