Core: Update parameter packing mechanism
The existing parameter packing mechanism wrappers the vectors and
length into the new defined structure, and marks the 'out_vec' as
input is confusing. Move the type and length into a new defined
'control' parameter to clear the confusion. And this could be expanded
easily to welcome more extra parameters.
Change-Id: Id63f4c48af90231480a3238570b0c1956a2918d8
Signed-off-by: Summer Qin <summer.qin@arm.com>
diff --git a/interface/include/tfm_api.h b/interface/include/tfm_api.h
index af2b492..5e2aacb 100644
--- a/interface/include/tfm_api.h
+++ b/interface/include/tfm_api.h
@@ -58,6 +58,16 @@
TFM_ERROR_GENERIC = 0x1F,
};
+/*
+ * Structure to package type, in_len and out_len, it is mainly used for
+ * psa_call.
+ */
+struct tfm_control_parameter_t {
+ int32_t type;
+ size_t in_len;
+ size_t out_len;
+};
+
/********************* Secure function declarations ***************************/
/**
@@ -102,16 +112,17 @@
* \brief Call a secure function referenced by a connection handle.
*
* \param[in] handle Handle to connection.
- * \param[in] type The reuqest type. Must be zero(PSA_IPC_CALL) or
- * positive.
+ * \param[in] ctrl_param Parameter structure, includes reuqest type,
+ * in_num and out_num.
* \param[in] in_vec Array of input \ref psa_invec structures.
- * \param[in] out_vec Array of output \ref psa_invec structures.
+ * \param[in/out] out_vec Array of output \ref psa_outvec structures.
*
* \return Returns \ref psa_status_t status code.
*/
-psa_status_t tfm_psa_call_veneer(psa_handle_t handle, int32_t type,
- const psa_invec *in_vec,
- const psa_invec *out_vec);
+psa_status_t tfm_psa_call_veneer(psa_handle_t handle,
+ const struct tfm_control_parameter_t *ctrl_param,
+ const psa_invec *in_vec,
+ psa_outvec *out_vec);
/**
* \brief Close connection to secure function referenced by a connection handle.