SPM: Partial implementation of PSA interrupt control APIs

This patch implements two of the Secure Partition APIs for
interrupt control defined by FF-M v1.1:
 - psa_irq_enable
 - psa_irq_disable
Implement only these two for SLIH for the time being.

Change-Id: Ia1103b2d70f1406e2ad0100d856f9e11568c2430
Signed-off-by: Kevin Peng <kevin.peng@arm.com>
diff --git a/interface/include/psa/service.h b/interface/include/psa/service.h
index 94eb082..8cd6556 100644
--- a/interface/include/psa/service.h
+++ b/interface/include/psa/service.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  *
@@ -49,6 +49,9 @@
 /* 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;
+
 /**
  * Describe a message received by an RoT Service after calling \ref psa_get().
  */
@@ -260,6 +263,40 @@
  */
 void psa_panic(void);
 
+/**
+ * \brief Enable an interrupt.
+ *
+ * \param[in] irq_signal The signal for the interrupt to be enabled.
+ *                       This must have a single bit set, which must be the
+ *                       signal value for an interrupt in the calling Secure
+ *                       Partition.
+ *
+ * \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.
+ */
+void psa_irq_enable(psa_signal_t irq_signal);
+
+/**
+ * \brief Disable an interrupt and return the status of the interrupt prior to
+ *        being disabled by this call.
+ *
+ * \param[in] irq_signal The signal for the interrupt to be disabled.
+ *                       This must have a single bit set, which must be the
+ *                       signal value for an interrupt in the calling Secure
+ *                       Partition.
+ *
+ * \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.
+ *
+ * \note The current implementation always return 1. Do not use the return.
+ */
+psa_irq_status_t psa_irq_disable(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 ece17d0..7ae3bd1 100644
--- a/interface/src/psa/psa_service.c
+++ b/interface/src/psa/psa_service.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  *
@@ -102,3 +102,19 @@
                    "BX LR            \n"
                    : : "I" (TFM_SVC_PSA_PANIC));
 }
+
+__attribute__((naked))
+void psa_irq_enable(psa_signal_t irq_signal)
+{
+    __ASM volatile("SVC %0           \n"
+                   "BX LR            \n"
+                   : : "I" (TFM_SVC_PSA_IRQ_ENABLE));
+}
+
+__attribute__((naked))
+psa_irq_status_t psa_irq_disable(psa_signal_t irq_signal)
+{
+    __ASM volatile("SVC %0           \n"
+                   "BX LR            \n"
+                   : : "I" (TFM_SVC_PSA_IRQ_DISABLE));
+}