Dualcpu: Add general NSPE mailbox wait function

Add tfm_ns_mailbox_wait_reply() to wait for mailbox message reply
from SPE.
tfm_ns_mailbox_wait_reply() calls tfm_ns_mailbox_hal_wait_reply()
to perform platform and NS OS specific waiting mechanism
implemented based on use scenario.

Update the wait function in PSA Client APIs implementations in
dual-core system.
If the system can support multiple outstanding NS PSA Client calls,
call tfm_ns_mailbox_wait_reply() to sleep and wait for reply.
Otherwise, still call tfm_ns_mailbox_is_msg_replied() to simply
poll the reply status of the mailbox message of current thread.

Change-Id: I2a3e808b05d7644465b20f7f4160b9872f2bdb63
Signed-off-by: David Hu <david.hu@arm.com>
diff --git a/interface/include/tfm_ns_mailbox.h b/interface/include/tfm_ns_mailbox.h
index 49c4ca6..48901f0 100644
--- a/interface/include/tfm_ns_mailbox.h
+++ b/interface/include/tfm_ns_mailbox.h
@@ -113,6 +113,19 @@
  */
 const void *tfm_ns_mailbox_get_msg_owner(mailbox_msg_handle_t handle);
 
+#ifdef TFM_MULTI_CORE_MULTI_CLIENT_CALL
+/**
+ * \brief Wait for the reply returned from SPE to the mailbox message specified
+ *        by handle
+ *
+ * \param[in] handle            The handle of mailbox message.
+ *
+ * \retval MAILBOX_SUCCESS      Return from waiting successfully.
+ * \retval Other return code    Failed to wait with an error code.
+ */
+int32_t tfm_ns_mailbox_wait_reply(mailbox_msg_handle_t handle);
+#endif
+
 /**
  * \brief Platform specific NSPE mailbox initialization.
  *        Invoked by \ref tfm_ns_mailbox_init().
@@ -163,6 +176,19 @@
  */
 void tfm_ns_mailbox_hal_exit_critical_isr(void);
 
+#ifdef TFM_MULTI_CORE_MULTI_CLIENT_CALL
+/**
+ * \brief Performs platform and NS OS specific waiting mechanism to wait for
+ *        the reply of the specified mailbox message to be returned from SPE.
+ *
+ * \note This function is implemented by platform and NS OS specific waiting
+ *       mechanism accroding to use scenario.
+ *
+ * \param[in] handle            The handle of mailbox message.
+ */
+void tfm_ns_mailbox_hal_wait_reply(mailbox_msg_handle_t handle);
+#endif
+
 #ifdef __cplusplus
 }
 #endif