TF-M Reference Manual  1.2.0
TrustedFirmware-M
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
psa_service.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #include <inttypes.h>
9 #include <stdio.h>
10 #include "tfm/tfm_core_svc.h"
11 #include "psa/client.h"
12 #include "psa/service.h"
13 
14 __attribute__((naked))
15 psa_signal_t psa_wait(psa_signal_t signal_mask, uint32_t timeout)
16 
17 {
18  __ASM volatile("SVC %0 \n"
19  "BX LR \n"
20  : : "I" (TFM_SVC_PSA_WAIT));
21 }
22 
23 __attribute__((naked))
25 {
26  __ASM volatile("SVC %0 \n"
27  "BX LR \n"
28  : : "I" (TFM_SVC_PSA_GET));
29 }
30 
31 __attribute__((naked))
32 void psa_set_rhandle(psa_handle_t msg_handle, void *rhandle)
33 {
34  __ASM volatile("SVC %0 \n"
35  "BX LR \n"
36  : : "I" (TFM_SVC_PSA_SET_RHANDLE));
37 }
38 
39 __attribute__((naked))
40 size_t psa_read(psa_handle_t msg_handle, uint32_t invec_idx,
41  void *buffer, size_t num_bytes)
42 
43 {
44  __ASM volatile("SVC %0 \n"
45  "BX LR \n"
46  : : "I" (TFM_SVC_PSA_READ));
47 }
48 
49 __attribute__((naked))
50 size_t psa_skip(psa_handle_t msg_handle, uint32_t invec_idx, size_t num_bytes)
51 {
52  __ASM volatile("SVC %0 \n"
53  "BX LR \n"
54  : : "I" (TFM_SVC_PSA_SKIP));
55 }
56 
57 __attribute__((naked))
58 void psa_write(psa_handle_t msg_handle, uint32_t outvec_idx,
59  const void *buffer, size_t num_bytes)
60 {
61  __ASM volatile("SVC %0 \n"
62  "BX LR \n"
63  : : "I" (TFM_SVC_PSA_WRITE));
64 }
65 
66 __attribute__((naked))
67 void psa_reply(psa_handle_t msg_handle, psa_status_t retval)
68 {
69  __ASM volatile("SVC %0 \n"
70  "BX LR \n"
71  : : "I" (TFM_SVC_PSA_REPLY));
72 }
73 
74 __attribute__((naked))
75 void psa_notify(int32_t partition_id)
76 {
77  __ASM volatile("SVC %0 \n"
78  "BX LR \n"
79  : : "I" (TFM_SVC_PSA_NOTIFY));
80 }
81 
82 __attribute__((naked))
83 void psa_clear(void)
84 {
85  __ASM volatile("SVC %0 \n"
86  "BX LR \n"
87  : : "I" (TFM_SVC_PSA_CLEAR));
88 }
89 
90 __attribute__((naked))
91 void psa_eoi(psa_signal_t irq_signal)
92 {
93  __ASM volatile("SVC %0 \n"
94  "BX LR \n"
95  : : "I" (TFM_SVC_PSA_EOI));
96 }
97 
98 __attribute__((naked))
99 void psa_panic(void)
100 {
101  __ASM volatile("SVC %0 \n"
102  "BX LR \n"
103  : : "I" (TFM_SVC_PSA_PANIC));
104 }
void psa_set_rhandle(psa_handle_t msg_handle, void *rhandle)
Associate some RoT Service private data with a client connection.
Definition: psa_service.c:32
uint32_t psa_signal_t
Definition: service.h:50
void psa_reply(psa_handle_t msg_handle, psa_status_t retval)
Complete handling of a specific message and unblock the client.
Definition: psa_service.c:67
void psa_notify(int32_t partition_id)
Send a PSA_DOORBELL signal to a specific Secure Partition.
Definition: psa_service.c:75
size_t psa_read(psa_handle_t msg_handle, uint32_t invec_idx, void *buffer, size_t num_bytes)
Read a message parameter or part of a message parameter from a client input vector.
Definition: psa_service.c:40
void psa_clear(void)
Clear the PSA_DOORBELL signal.
Definition: psa_service.c:83
void psa_panic(void)
Terminate execution within the calling Secure Partition and will not return.
Definition: psa_service.c:99
void psa_write(psa_handle_t msg_handle, uint32_t outvec_idx, const void *buffer, size_t num_bytes)
Write a message response to a client output vector.
Definition: psa_service.c:58
psa_status_t psa_get(psa_signal_t signal, psa_msg_t *msg)
Retrieve the message which corresponds to a given RoT Service signal and remove the message from the ...
Definition: psa_service.c:24
psa_signal_t psa_wait(psa_signal_t signal_mask, uint32_t timeout)
Return the Secure Partition interrupt signals that have been asserted from a subset of signals provid...
Definition: psa_service.c:15
void psa_eoi(psa_signal_t irq_signal)
Inform the SPM that an interrupt has been handled (end of interrupt).
Definition: psa_service.c:91
int32_t psa_handle_t
Definition: client.h:61
int32_t psa_status_t
Function return status.
Definition: crypto_types.h:43
size_t psa_skip(psa_handle_t msg_handle, uint32_t invec_idx, size_t num_bytes)
Skip over part of a client input vector.
Definition: psa_service.c:50