Dualcpu: Set mailbox message owner in NS mailbox queue slot

NSPE mailbox sets the task handle into the owner field of the
queue slot.
After the PSA Client result is returned, the task handle can be
fetched from the owner filed and the waiting task can be woken
up according to the handle value.

Declare tfm_ns_mailbox_get_task_handle() to fetch the handle of
current NS task executing the mailbox functionalities.
Implement a dummy tfm_ns_mailbox_get_task_handle() which returns
NULL when sleep/wake-up mechanism is not required.

Change-Id: I58731dea26db5446bac35d6b4800bff936120ebd
Signed-off-by: David Hu <david.hu@arm.com>
diff --git a/interface/include/tfm_mailbox.h b/interface/include/tfm_mailbox.h
index 9342ed6..bb23b7a 100644
--- a/interface/include/tfm_mailbox.h
+++ b/interface/include/tfm_mailbox.h
@@ -108,8 +108,7 @@
 struct ns_mailbox_slot_t {
     struct mailbox_msg_t   msg;
     struct mailbox_reply_t reply;
-
-    void                   *owner;     /* Identification of the owner of this
+    const void             *owner;     /* Handle of the owner task of this
                                         * slot
                                         */
 };
diff --git a/interface/include/tfm_ns_mailbox.h b/interface/include/tfm_ns_mailbox.h
index d2bbd3f..a846e76 100644
--- a/interface/include/tfm_ns_mailbox.h
+++ b/interface/include/tfm_ns_mailbox.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  *
@@ -67,6 +67,26 @@
  */
 int32_t tfm_ns_mailbox_init(struct ns_mailbox_queue_t *queue);
 
+#ifdef TFM_MULTI_CORE_MULTI_CLIENT_CALL
+/**
+ * \brief Get the handle of the current non-secure task executing mailbox
+ *        functionalities
+ *
+ * \note This function should be implemented according to platform, NS OS
+ *       and actual use scenario.
+ *       This function can be ignored or return NULL if sleep/wake-up mechanism
+ *       is not required in PSA Client API implementation.
+ *
+ * \return Return the handle of task.
+ */
+const void *tfm_ns_mailbox_get_task_handle(void);
+#else
+static inline const void *tfm_ns_mailbox_get_task_handle(void)
+{
+    return NULL;
+}
+#endif
+
 /**
  * \brief Platform specific NSPE mailbox initialization.
  *        Invoked by \ref tfm_ns_mailbox_init().