TF-M Reference Manual  1.2.0
TrustedFirmware-M
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
tfm_platform_ipc_api.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #include <stdbool.h>
9 #include "tfm_platform_api.h"
10 #include "psa_manifest/sid.h"
11 
13 {
16 
19  if (handle <= 0) {
21  }
22 
23  status = psa_call(handle, PSA_IPC_CALL,
24  NULL, 0, NULL, 0);
25  psa_close(handle);
26 
27  if (status < PSA_SUCCESS) {
29  } else {
30  return (enum tfm_platform_err_t) status;
31  }
32 
33 }
34 
37  psa_invec *input, psa_outvec *output)
38 {
39  tfm_platform_ioctl_req_t req = request;
40  struct psa_invec in_vec[2] = { {0} };
41  size_t inlen, outlen;
44 
45  in_vec[0].base = &req;
46  in_vec[0].len = sizeof(req);
47  if (input != NULL) {
48  in_vec[1].base = input->base;
49  in_vec[1].len = input->len;
50  inlen = 2;
51  } else {
52  inlen = 1;
53  }
54 
55  if (output != NULL) {
56  outlen = 1;
57  } else {
58  outlen = 0;
59  }
60 
63  if (handle <= 0) {
65  }
66 
67  status = psa_call(handle, PSA_IPC_CALL,
68  in_vec, inlen,
69  output, outlen);
70  psa_close(handle);
71 
72  if (status < PSA_SUCCESS) {
74  } else {
75  return (enum tfm_platform_err_t) status;
76  }
77 }
78 
#define TFM_SP_PLATFORM_IOCTL_SID
Definition: sid.h:46
#define PSA_SUCCESS
Definition: crypto_values.h:35
enum tfm_platform_err_t tfm_platform_system_reset(void)
Resets the system.
#define TFM_SP_PLATFORM_SYSTEM_RESET_VERSION
Definition: sid.h:45
int32_t tfm_platform_ioctl_req_t
size_t len
Definition: client.h:68
void psa_close(psa_handle_t handle)
Close a connection to an RoT Service.
Definition: psa_client.c:63
psa_handle_t psa_connect(uint32_t sid, uint32_t version)
Connect to an RoT Service by its SID.
Definition: psa_client.c:30
#define PSA_NULL_HANDLE
Definition: client.h:38
#define PSA_ERROR_CONNECTION_REFUSED
Definition: error.h:33
int32_t psa_handle_t
Definition: client.h:61
enum tfm_platform_err_t tfm_platform_ioctl(tfm_platform_ioctl_req_t request, psa_invec *input, psa_outvec *output)
Performs a platform-specific service.
#define PSA_IPC_CALL
Definition: client.h:59
#define TFM_SP_PLATFORM_SYSTEM_RESET_SID
Definition: sid.h:44
tfm_platform_err_t
Platform service error types.
const void * base
Definition: client.h:67
int32_t psa_status_t
Function return status.
Definition: crypto_types.h:43
psa_status_t psa_call(psa_handle_t handle, int32_t type, const psa_invec *in_vec, size_t in_len, psa_outvec *out_vec, size_t out_len)
Call an RoT Service on an established connection.
Definition: psa_client.c:47
#define TFM_SP_PLATFORM_IOCTL_VERSION
Definition: sid.h:47