1 /*
2 * SPDX-FileCopyrightText: Copyright The TrustedFirmware-M Contributors
3 * Copyright (c) 2023 Cypress Semiconductor Corporation (an Infineon company)
4 * or an affiliate of Cypress Semiconductor Corporation. All rights reserved.
5 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 *
8 */
9
10 #include <assert.h>
11
12 #include "config_impl.h"
13 #include "ffm/mailbox_agent_api.h"
14 #include "ffm/psa_api.h"
15 #include "tfm_rpc.h"
16 #include "tfm_psa_call_pack.h"
17
tfm_rpc_psa_framework_version(void)18 uint32_t tfm_rpc_psa_framework_version(void)
19 {
20 return tfm_spm_client_psa_framework_version();
21 }
22
tfm_rpc_psa_version(uint32_t sid)23 uint32_t tfm_rpc_psa_version(uint32_t sid)
24 {
25 return tfm_spm_client_psa_version(sid);
26 }
27
tfm_rpc_psa_call(psa_handle_t handle,uint32_t control,const struct client_params_t * params,const void * client_data_stateless)28 psa_status_t tfm_rpc_psa_call(psa_handle_t handle, uint32_t control,
29 const struct client_params_t *params,
30 const void *client_data_stateless)
31 {
32 assert(params != NULL);
33 assert(client_data_stateless != NULL);
34
35 return agent_psa_call(handle, control, params, client_data_stateless);
36 }
37
38 /* Following PSA APIs are only needed by connection-based services */
39 #if CONFIG_TFM_CONNECTION_BASED_SERVICE_API == 1
40
tfm_rpc_psa_connect(uint32_t sid,uint32_t version,int32_t ns_client_id,const void * client_data)41 psa_status_t tfm_rpc_psa_connect(uint32_t sid,
42 uint32_t version,
43 int32_t ns_client_id,
44 const void *client_data)
45 {
46 assert(client_data != NULL);
47
48 return agent_psa_connect(sid, version, ns_client_id, client_data);
49 }
50
tfm_rpc_psa_close(psa_handle_t handle,int32_t ns_client_id)51 psa_status_t tfm_rpc_psa_close(psa_handle_t handle, int32_t ns_client_id)
52 {
53 return agent_psa_close(handle, ns_client_id);
54 }
55
56 #endif /* CONFIG_TFM_CONNECTION_BASED_SERVICE_API */
57