SPM: Changes to Secure Partition API for FLIH

The patch includes the changes to Secure Partition API for FLIH
defined by FF-M v1.1 alpha:
 - Adding psa_reset_signal() which is for FLIH signals
 - Limiting psa_eoi() to SLIH signals

Change-Id: I6b99eb6df3013c898627a48fa98d41c0e7bc5888
Signed-off-by: Kevin Peng <kevin.peng@arm.com>
diff --git a/interface/include/psa/service.h b/interface/include/psa/service.h
index 8cd6556..12efd2e 100644
--- a/interface/include/psa/service.h
+++ b/interface/include/psa/service.h
@@ -46,12 +46,19 @@
 /* An IPC message type that indicates the end of a connection. */
 #define PSA_IPC_DISCONNECT      (-2)
 
+/* FLIH return types */
+#define PSA_FLIH_NO_SIGNAL      ((psa_flih_result_t) 0)
+#define PSA_FLIH_SIGNAL         ((psa_flih_result_t) 1)
+
 /* Store a set of one or more Secure Partition signals */
 typedef uint32_t psa_signal_t;
 
 /* A type used to temporarily store a previous interrupt state. */
 typedef uint32_t psa_irq_status_t;
 
+/* The type of the return value from an FLIH function */
+typedef uint32_t psa_flih_result_t;
+
 /**
  * Describe a message received by an RoT Service after calling \ref psa_get().
  */
@@ -252,6 +259,7 @@
  * \arg                           irq_signal is not an interrupt signal.
  * \arg                           irq_signal indicates more than one signal.
  * \arg                           irq_signal is not currently asserted.
+ * \arg                           The interrupt is not using SLIH.
  */
 void psa_eoi(psa_signal_t irq_signal);
 
@@ -273,8 +281,8 @@
  *
  * \retval void
  * \retval "PROGRAMMER ERROR" If one or more of the following are true:
- *                            \ref irq_signal is not an interrupt signal.
- *                            \ref irq_signal indicates more than one signal.
+ * \arg                       \a irq_signal is not an interrupt signal.
+ * \arg                       \a irq_signal indicates more than one signal.
  */
 void psa_irq_enable(psa_signal_t irq_signal);
 
@@ -290,13 +298,31 @@
  * \retval 0                  The interrupt was disabled prior to this call.
  *         1                  The interrupt was enabled prior to this call.
  * \retval "PROGRAMMER ERROR" If one or more of the following are true:
- *                            \ref irq_signal is not an interrupt signal.
- *                            \ref irq_signal indicates more than one signal.
+ * \arg                       \a irq_signal is not an interrupt signal.
+ * \arg                       \a irq_signal indicates more than one signal.
  *
  * \note The current implementation always return 1. Do not use the return.
  */
 psa_irq_status_t psa_irq_disable(psa_signal_t irq_signal);
 
+/**
+ * \brief Reset the signal for an interrupt that is using FLIH handling.
+ *
+ * \param[in] irq_signal    The interrupt signal to be reset.
+ *                          This must have a single bit set, corresponding to a
+ *                          currently asserted signal for an interrupt that is
+ *                          defined to use FLIH handling.
+ *
+ * \retval void
+ * \retval "Programmer Error" if one or more of the following are true:
+ * \arg                       \a irq_signal is not a signal for an interrupt
+ *                            that is specified with FLIH handling in the Secure
+ *                            Partition manifest.
+ * \arg                       \a irq_signal indicates more than one signal.
+ * \arg                       \a irq_signal is not currently asserted.
+ */
+void psa_reset_signal(psa_signal_t irq_signal);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/interface/src/psa/psa_service.c b/interface/src/psa/psa_service.c
index a8ecef4..211c36f 100644
--- a/interface/src/psa/psa_service.c
+++ b/interface/src/psa/psa_service.c
@@ -119,3 +119,11 @@
                    "BX LR            \n"
                    : : "I" (TFM_SVC_PSA_IRQ_DISABLE));
 }
+
+__attribute__((naked))
+void psa_reset_signal(psa_signal_t irq_signal)
+{
+    __ASM volatile("SVC %0           \n"
+                   "BX LR            \n"
+                   : : "I" (TFM_SVC_PSA_RESET_SIGNAL));
+}