Core: Update the return status for psa_reply
Update the return status for a request message in psa_reply
according to PSA FF 1.0.0.
Change-Id: I95df7790c00923f950f180148bad54e91ff64ad6
Signed-off-by: Summer Qin <summer.qin@arm.com>
diff --git a/secure_fw/core/ipc/tfm_svcalls.c b/secure_fw/core/ipc/tfm_svcalls.c
index 955ff32..cc92cf4 100644
--- a/secure_fw/core/ipc/tfm_svcalls.c
+++ b/secure_fw/core/ipc/tfm_svcalls.c
@@ -655,8 +655,8 @@
}
/*
- * Three type of message are passed in this function: CONNECT, CALL,
- * DISCONNECT. It needs to process differently for each type.
+ * Three type of message are passed in this function: CONNECTION, REQUEST,
+ * DISCONNECTION. It needs to process differently for each type.
*/
switch (msg->msg.type) {
case PSA_IPC_CONNECT:
@@ -668,8 +668,11 @@
if (status == PSA_SUCCESS) {
ret = msg->handle;
} else if (status == PSA_ERROR_CONNECTION_REFUSED) {
+ /* Refuse the client connection, indicating a permanent error. */
+ tfm_spm_free_conn_handle(service, msg->handle);
ret = PSA_ERROR_CONNECTION_REFUSED;
} else if (status == PSA_ERROR_CONNECTION_BUSY) {
+ /* Fail the client connection, indicating a transient error. */
ret = PSA_ERROR_CONNECTION_BUSY;
} else {
tfm_panic();
@@ -687,18 +690,7 @@
default:
if (msg->msg.type >= PSA_IPC_CALL) {
/* Reply to a request message. Return values are based on status */
- if (status == PSA_SUCCESS) {
- ret = PSA_SUCCESS;
- } else if ((status >= (INT32_MIN + 1)) &&
- (status <= (INT32_MIN + 127))) {
- tfm_panic();
- } else if ((status >= (INT32_MIN + 128)) && (status <= -1)) {
- ret = status;
- } else if ((status >= 1) && (status <= INT32_MAX)) {
- ret = status;
- } else {
- tfm_panic();
- }
+ ret = status;
/*
* The total number of bytes written to a single parameter must be