]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
feat(spmc): add helper function to obtain endpoint mailbox
authorMarc Bonnici <marc.bonnici@arm.com>
Wed, 24 Nov 2021 10:33:48 +0000 (10:33 +0000)
committerMarc Bonnici <marc.bonnici@arm.com>
Tue, 10 May 2022 08:36:20 +0000 (09:36 +0100)
Add a helper function to obtain the relevant mailbox buffers
depending on which entity was last run. This will be used in
subsequent functionality to populate requested information in
the callers RX buffer.

Signed-off-by: Marc Bonnici <marc.bonnici@arm.com>
Change-Id: I85959ced4d1454be05a7b3fb6853ed3ab7f0cf3e

services/std_svc/spm/el3_spmc/spmc.h
services/std_svc/spm/el3_spmc/spmc_main.c

index 0915d0b4c5cbc90d84dd7fc80f41c4079e1cc976..faa604f5361f284340574f622f7cebc503aea308 100644 (file)
@@ -221,4 +221,10 @@ bool is_ffa_secure_id_valid(uint16_t partition_id);
  */
 struct el3_lp_desc *get_el3_lp_array(void);
 
+/*
+ * Helper function to obtain the RX/TX buffer pair descriptor of the Hypervisor
+ * or OS kernel in the normal world or the last SP that was run.
+ */
+struct mailbox *spmc_get_mbox_desc(bool secure_origin);
+
 #endif /* SPMC_H */
index efa9da8048480088c85dbbd29bd143b777ad72dd..ed42a29d7e3570c0e006a6c001252eda69139849 100644 (file)
@@ -90,6 +90,20 @@ struct ns_endpoint_desc *spmc_get_hyp_ctx(void)
        return &(ns_ep_desc[0]);
 }
 
+/*
+ * Helper function to obtain the RX/TX buffer pair descriptor of the Hypervisor
+ * or OS kernel in the normal world or the last SP that was run.
+ */
+struct mailbox *spmc_get_mbox_desc(bool secure_origin)
+{
+       /* Obtain the RX/TX buffer pair descriptor. */
+       if (secure_origin) {
+               return &(spmc_get_current_sp_ctx()->mailbox);
+       } else {
+               return &(spmc_get_hyp_ctx()->mailbox);
+       }
+}
+
 /******************************************************************************
  * This function returns to the place where spmc_sp_synchronous_entry() was
  * called originally.