diff options
author | J-Alves <joao.alves@arm.com> | 2020-11-02 17:26:02 +0000 |
---|---|---|
committer | J-Alves <joao.alves@arm.com> | 2020-12-10 17:15:15 +0000 |
commit | c031cc08ebd9948bb8b42423c13f9257cd4bafb9 (patch) | |
tree | 39c9b8e3f4b9188ae6be1735ffcedac5b4fe37a8 | |
parent | 23e031b4822ad96753e8bae8f8586f034e38a5ab (diff) | |
download | tf-a-tests-c031cc08ebd9948bb8b42423c13f9257cd4bafb9.tar.gz |
FFA: RXTX map/configure helper macros
Configuring/mapping RXTX buffers results in repetitive code, therefore
created helper macros.
Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: I089b072b8b8fc49a445dcfb3967ddd4783b97628
-rw-r--r-- | include/runtime_services/ffa_helpers.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/include/runtime_services/ffa_helpers.h b/include/runtime_services/ffa_helpers.h index c68a01413..c91ed5f09 100644 --- a/include/runtime_services/ffa_helpers.h +++ b/include/runtime_services/ffa_helpers.h @@ -33,10 +33,31 @@ typedef uint8_t ffa_memory_receiver_flags_t; #include <stdint.h> struct mailbox_buffers { - const void *recv; + void *recv; void *send; }; +#define CONFIGURE_MAILBOX(mb_name, buffers_size) \ + do { \ + /* Declare RX/TX buffers at virtual FF-A instance */ \ + static struct { \ + uint8_t rx[buffers_size]; \ + uint8_t tx[buffers_size]; \ + } __aligned(PAGE_SIZE) mb_buffers; \ + mb_name.recv = (void *)mb_buffers.rx; \ + mb_name.send = (void *)mb_buffers.tx; \ + } while (false) + +#define CONFIGURE_AND_MAP_MAILBOX(mb_name, buffers_size, smc_ret) \ + do { \ + CONFIGURE_MAILBOX(mb_name, buffers_size); \ + smc_ret = ffa_rxtx_map( \ + (uintptr_t)mb_name.send, \ + (uintptr_t)mb_name.recv, \ + buffers_size / PAGE_SIZE \ + ); \ + } while (false) + struct ffa_partition_info { /** The ID of the VM the information is about */ ffa_vm_id_t id; |