Mistake on this page?
Report an issue in GitHub or email us
spm_server.h
1 /* Copyright (c) 2017-2018 ARM Limited
2  *
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef __MBED_SPM_SERVER_H__
19 #define __MBED_SPM_SERVER_H__
20 
21 /** @addtogroup SPM
22  * The Secure Partition Manager (SPM) is responsible for isolating software in partitions,@n
23  * managing the execution of software within partitions and providing IPC between partitions.
24  * @{
25  */
26 
27 /* -------------------------------------- Includes ----------------------------------- */
28 
29 #include "psa_defs.h"
30 
31 /* --------------------------------- extern "C" wrapper ------------------------------ */
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /** @addtogroup RoT-Service-API
38  * The C interface for a root of trust (RoT) Service in a partition.
39  * @{
40  */
41 
42 /**
43  * Return the signals that have been asserted.@n
44  *
45  * @param[in] signal_mask A set of signals to query.
46  * @param[in] timeout timeout value:@n
47  * @a PSA_BLOCK block the caller until any signal is asserted.@n
48  * @a PSA_POLL Returns immediately.
49  * @return asserted signals.
50  */
51 psa_signal_t psa_wait(psa_signal_t signal_mask, uint32_t timeout);
52 
53 /**
54  * Get the message that corresponds to a given signal.
55  *
56  * @param[in] signal An asserted signal returned from psa_wait().
57  * @param[out] msg Pointer to a psa_msg structure.
58  * @return 0 for success or@n
59  * @a PSA_ERR_NOMSG if the message could not be delivered.
60  */
61 psa_status_t psa_get(psa_signal_t signal, psa_msg_t *msg);
62 
63 /**
64  * Associate the caller-provided private data with a specified handle.
65  *
66  * @param[in] msg_handle Handle for the caller's message.
67  * @param[in] rhandle Reverse handle allocated by the Root of Trust Service.
68  */
69 void psa_set_rhandle(psa_handle_t msg_handle, void *rhandle);
70 
71 /**
72  * Copy up to @a len bytes from position @a offset within the client message
73  * payload into the Secure Partition buffer @a buffer.@n
74  *
75  * @note Callers should know how much data is available to read based on the@n
76  * @a size attribute of the psa_msg structure returned from psa_get().@n
77  * The copy is truncated if the requested range extends beyond the end of the payload.@n
78  * In such a case, the remaining space in @a buffer is not modified.
79  *
80  * @param[in] msg_handle Handle for the client's message.
81  * @param[in] invec_idx ::psa_invec index to be read.
82  * @param[out] buf Buffer to copy the requested data to.
83  * @param[in] num_bytes Number of bytes to read from the client's message payload.
84  * @return Number of bytes copied or 0 if offset is greater than the size attribute of psa_msg.
85  */
86 size_t psa_read(psa_handle_t msg_handle, uint32_t invec_idx, void *buf, size_t num_bytes);
87 
88 /**
89  * Advance the current read offset by skipping @a num_bytes bytes for input vector
90  * indexed by @а invec_idx.@n
91  * If @a num_bytes is greater than the remaining number of bytes in the vector, then
92  * all the remaining bytes are skipped.
93  *
94  * @param[in] msg_handle Handle for the client's message.
95  * @param[in] invec_idx ::psa_invec index to be skipped.
96  * @param[in] num_bytes Number of bytes to skip.
97  * @return Number of bytes skipped or 0 if offset is greater than the size attribute of psa_msg.
98  */
99 size_t psa_skip(psa_handle_t msg_handle, uint32_t invec_idx, size_t num_bytes);
100 
101 /**
102  * Write a response payload of @a bytes bytes starting at position @a offset in the client's response buffer.
103  *
104  * @note If the caller writes data beyond the client's response buffer size
105  * (@a response_size attribute of the psa_msg structure returned from psa_get()) a fatal error occurs.
106  *
107  * @param[in] msg_handle Handle for the client's message.
108  * @param[in] outvec_idx ::psa_outvec index to be written to.
109  * @param[in] buffer Buffer with the data to write.
110  * @param[in] num_bytes Number of bytes to write.
111  */
112 void psa_write(psa_handle_t msg_handle, uint32_t outvec_idx, const void *buffer, size_t num_bytes);
113 
114 /**
115  * Complete handling of specific message and unblocks the client.
116  *
117  * A return code must be specified, which is sent to the client.@n
118  * Negative return code represent errors; positive integers are application-specific.
119  *
120  * @param[in] msg_handle Handle for the client's message.
121  * @param[in] status Message result value to be reported to the client.
122  */
123 void psa_reply(psa_handle_t msg_handle, psa_status_t status);
124 
125 /**
126  * Send a doorbell signal to a specific partition that is listening for that signal type.
127  *
128  * @param[in] partition_id partition ID of the target partition.
129  */
130 void psa_notify(int32_t partition_id);
131 
132 /**
133  * Clear the doorbell signal.
134  */
135 void psa_clear(void);
136 
137 /**
138  * Inform the SPM that an interrupt has been handled (end of interrupt).
139  *
140  * @param[in] irq_signal The interrupt signal that has been processed.
141  */
142 void psa_eoi(uint32_t irq_signal);
143 
144 /** @}*/ // end of RoT-Service-API group
145 
146 #ifdef __cplusplus
147 }
148 #endif
149 
150 /** @}*/ // end of SPM group
151 
152 #endif /* __MBED_SPM_SERVER_H__ */
void psa_eoi(uint32_t irq_signal)
Inform the SPM that an interrupt has been handled (end of interrupt).
size_t psa_skip(psa_handle_t msg_handle, uint32_t invec_idx, size_t num_bytes)
Advance the current read offset by skipping num_bytes bytes for input vector indexed by @а invec_idx...
Describe a message received by an RoT Service after calling psa_get().
Definition: psa_service.h:46
void psa_reply(psa_handle_t msg_handle, psa_status_t status)
Complete handling of specific message and unblocks the client.
size_t psa_read(psa_handle_t msg_handle, uint32_t invec_idx, void *buf, size_t num_bytes)
Copy up to len bytes from position offset within the client message payload into the Secure Partition...
void psa_set_rhandle(psa_handle_t msg_handle, void *rhandle)
Associate the caller-provided private data with a specified handle.
psa_signal_t psa_wait(psa_signal_t signal_mask, uint32_t timeout)
Return the signals that have been asserted.
psa_status_t psa_get(psa_signal_t signal, psa_msg_t *msg)
Get the message that corresponds to a given signal.
void psa_write(psa_handle_t msg_handle, uint32_t outvec_idx, const void *buffer, size_t num_bytes)
Write a response payload of bytes bytes starting at position offset in the client's response buffer...
void psa_clear(void)
Clear the doorbell signal.
void psa_notify(int32_t partition_id)
Send a doorbell signal to a specific partition that is listening for that signal type.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.