Core: Detect the current handling handle in psa_close

When the connection is currently handling a request, the
psa_close should call tfm_panic().

Change-Id: Ic29c0dea33c11c97616086490d26e034a8b8cb11
Signed-off-by: Shawn Shan <shawn.shan@arm.com>
diff --git a/secure_fw/spm/spm_api.h b/secure_fw/spm/spm_api.h
index e1de88d..9929b3c 100644
--- a/secure_fw/spm/spm_api.h
+++ b/secure_fw/spm/spm_api.h
@@ -48,6 +48,9 @@
 #define SPM_PART_FLAG_PSA_ROT 0x02
 #define SPM_PART_FLAG_IPC     0x04
 
+#define TFM_HANDLE_STATUS_IDLE          0
+#define TFM_HANDLE_STATUS_ACTIVE        1
+
 #ifndef TFM_PSA_API
 /**
  * \brief Holds the iovec parameters that are passed to a service
@@ -115,6 +118,11 @@
 /* RoT connection handle list */
 struct tfm_conn_handle_t {
     void *rhandle;                      /* Reverse handle value              */
+    uint32_t status;                    /*
+                                         * Status of handle, two valid options:
+                                         * TFM_HANDLE_STATUS_ACTIVE and
+                                         * TFM_HANDLE_STATUS_IDLE
+                                         */
     struct tfm_msg_body_t internal_msg; /* Internal message for message queue */
     struct tfm_spm_service_t *service;  /* RoT service pointer               */
     struct tfm_list_node_t list;        /* list node                         */
@@ -127,8 +135,8 @@
     psa_signal_t signal;            /* Service signal                        */
     uint32_t sid;                   /* Service identifier                    */
     bool non_secure_client;         /* If can be called by non secure client */
-    uint32_t version;               /* Service version                         */
-    uint32_t version_policy;        /* Service version policy                  */
+    uint32_t version;               /* Service version                       */
+    uint32_t version_policy;        /* Service version policy                */
 };
 
 /* RoT Service data */