SPM: Add condition check for rhandle related context
'rhandle' is not needed if no connection based service exists.
Signed-off-by: Sherry Zhang <sherry.zhang2@arm.com>
Change-Id: I7b95d1ebb9e34644d78e50a96101ebaface820f7
diff --git a/interface/include/psa/service.h b/interface/include/psa/service.h
index 8addb75..977f394 100644
--- a/interface/include/psa/service.h
+++ b/interface/include/psa/service.h
@@ -79,11 +79,13 @@
* - secure partition id;
* - non secure client endpoint id.
*/
+#if CONFIG_TFM_CONNECTION_BASED_SERVICE_API == 1
void *rhandle; /* Be useful for binding a connection to some
* application-specific data or function
* pointer within the RoT Service
* implementation.
*/
+#endif
size_t in_size[PSA_MAX_IOVEC]; /* Provide the size of each client input
* vector in bytes.
*/
diff --git a/secure_fw/spm/cmsis_psa/spm.h b/secure_fw/spm/cmsis_psa/spm.h
index b6ee170..6f6d9ee 100644
--- a/secure_fw/spm/cmsis_psa/spm.h
+++ b/secure_fw/spm/cmsis_psa/spm.h
@@ -63,7 +63,9 @@
/* RoT connection handle list */
struct connection_t {
+#if CONFIG_TFM_CONNECTION_BASED_SERVICE_API == 1
void *rhandle; /* Reverse handle value */
+#endif
uint32_t status; /*
* Status of handle, three valid
* options:
diff --git a/secure_fw/spm/cmsis_psa/spm_ipc.c b/secure_fw/spm/cmsis_psa/spm_ipc.c
index de771b4..b3a522e 100755
--- a/secure_fw/spm/cmsis_psa/spm_ipc.c
+++ b/secure_fw/spm/cmsis_psa/spm_ipc.c
@@ -397,7 +397,10 @@
/* Use the user connect handle as the message handle */
p_connection->msg.handle = handle;
+
+#if CONFIG_TFM_CONNECTION_BASED_SERVICE_API == 1
p_connection->msg.rhandle = p_connection->rhandle;
+#endif
/* Set the private data of NSPE client caller in multi-core topology */
if (TFM_CLIENT_ID_IS_NS(client_id)) {
diff --git a/secure_fw/spm/ffm/psa_call_api.c b/secure_fw/spm/ffm/psa_call_api.c
index 2ec895c..17560f3 100644
--- a/secure_fw/spm/ffm/psa_call_api.c
+++ b/secure_fw/spm/ffm/psa_call_api.c
@@ -90,7 +90,9 @@
return PSA_ERROR_CONNECTION_BUSY;
}
+#if CONFIG_TFM_CONNECTION_BASED_SERVICE_API == 1
p_connection->rhandle = NULL;
+#endif
handle = connection_to_handle(p_connection);
} else {
#if CONFIG_TFM_CONNECTION_BASED_SERVICE_API == 1