Mistake on this page?
Report an issue in GitHub or email us
psa_defs.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_PSA_DEFS_H__
19 #define __MBED_PSA_DEFS_H__
20 
21 /** @addtogroup SPM
22  * @{
23  */
24 
25 /* -------------------------------------- Includes ----------------------------------- */
26 
27 #include <stdint.h>
28 #include <stdlib.h>
29 #include "psa/error.h"
30 
31 /* --------------------------------- extern "C" wrapper ------------------------------ */
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /* ------------------------------------ Definitions ---------------------------------- */
38 
39 #if !defined(UINT32_MAX)
40 #define UINT32_MAX ((uint32_t)-1)
41 #endif
42 
43 #if !defined(INT32_MIN)
44 #define INT32_MIN (-0x7fffffff - 1)
45 #endif
46 
47 #define PSA_FRAMEWORK_VERSION (0x0100) /**< Version of the PSA Framework API. */
48 #define PSA_VERSION_NONE (0L) /**< Identifier for an unimplemented Root of Trust (RoT) Service. */
49 
50 #define PSA_NSPE_IDENTIFIER (-1L) /**< "Partition" identifier of the NSPE.*/
51 
52 #define PSA_NULL_HANDLE ((psa_handle_t)0) /**< Denotes an invalid handle.*/
53 
54 #define PSA_MAX_IOVEC (4UL) /**< Maximum number of psa_invec and psa_outvec structures allowed for psa_call().*/
55 
56 #define PSA_POLL (0x00000000UL) /**< Returns immediately even if none of the requested signals is asserted.*/
57 #define PSA_BLOCK (0x80000000UL) /**< Block the caller until one of the requested signals is asserted.*/
58 #define PSA_WAIT_ANY (0xFFFFFFFFUL) /**< A mask value that includes all Secure Partition signals.*/
59 
60 #define PSA_MINOR_VERSION_POLICY_RELAXED (0UL) /**< Don't perform minor version check during psa_connect().*/
61 #define PSA_MINOR_VERSION_POLICY_STRICT (1UL) /**< Force minor version check during psa_connect().*/
62 
63 #define PSA_DOORBELL (0x00000008UL) /**< Mask for PSA_DOORBELL signal.*/
64 
65 #define PSA_IPC_CONNECT (1) /**< The IPC message type that indicates a new connection.*/
66 #define PSA_IPC_CALL (2) /**< The IPC message type that indicates a client request.*/
67 #define PSA_IPC_DISCONNECT (3) /**< The IPC message type that indicates the end of a connection.*/
68 #define PSA_IPC_VERSION (4) /**< The IPC message type that indicates a client query for a specific sid.*/
69 
70 /* Error codes */
71 #define PSA_DROP_CONNECTION (INT32_MIN) /**< The result code in a call to psa_reply() to indicate a nonrecoverable error in the client.*/
72 #define PSA_CONNECTION_REFUSED (INT32_MIN + 1) /**< The return value from psa_connect() if the RoT Service or SPM was unable to establish a connection.*/
73 #define PSA_CONNECTION_BUSY (INT32_MIN + 2) /**< The return value from psa_connect() if the RoT Service rejects the connection for a transient reason.*/
74 #define PSA_UNUSED(var) ((void)(var))
75 
76 /* -------------------------------------- Typedefs ----------------------------------- */
77 
78 typedef uint32_t psa_signal_t;
79 typedef int32_t psa_handle_t;
80 
81 /* -------------------------------------- Structs ------------------------------------ */
82 
83 /**
84  * Structure containing the PSA IPC message sent from a client partition to an RoT Service.
85  */
86 typedef struct psa_msg {
87  uint32_t type; /**< The message type.*/
88  psa_handle_t handle; /**< Handle for the internal message structure.*/
89  int32_t client_id; /**< Message origin.*/
90  void *rhandle; /**< Reverse handle.*/
91  size_t in_size[PSA_MAX_IOVEC]; /**< Array of sizes in bytes of the message payloads.*/
92  size_t out_size[PSA_MAX_IOVEC]; /**< Array of sizes in bytes of the response buffers.*/
93 } psa_msg_t;
94 
95 /**
96  * Structure that describes a scatter-gather input buffer.
97  */
98 typedef struct psa_invec {
99  const void *base; /**< Starting address of the buffer.*/
100  size_t len; /**< Length in bytes of the buffer.*/
101 } psa_invec;
102 
103 /**
104  * Structure which describes a scatter-gather output buffer.
105  */
106 typedef struct psa_outvec {
107  void *base; /**< Starting address of the buffer.*/
108  size_t len; /**< Length in bytes of the buffer.*/
109 } psa_outvec;
110 
111 #ifdef __cplusplus
112 }
113 #endif
114 
115 /** @}*/ // end of SPM group
116 
117 #endif /* __MBED_PSA_DEFS_H__ */
size_t out_size[(4UL)]
Array of sizes in bytes of the response buffers.
Definition: psa_defs.h:92
size_t in_size[(4UL)]
Array of sizes in bytes of the message payloads.
Definition: psa_defs.h:91
struct psa_outvec psa_outvec
Structure which describes a scatter-gather output buffer.
uint32_t type
The message type.
Definition: psa_defs.h:87
Structure which describes a scatter-gather output buffer.
Definition: client.h:54
Structure that describes a scatter-gather input buffer.
Definition: client.h:48
int32_t client_id
Message origin.
Definition: psa_defs.h:89
struct psa_msg psa_msg_t
Structure containing the PSA IPC message sent from a client partition to an RoT Service.
void * rhandle
Reverse handle.
Definition: psa_defs.h:90
#define PSA_MAX_IOVEC
Maximum number of psa_invec and psa_outvec structures allowed for psa_call().
Definition: psa_defs.h:54
struct psa_invec psa_invec
Structure that describes a scatter-gather input buffer.
Structure containing the PSA IPC message sent from a client partition to an RoT Service.
Definition: psa_defs.h:86
psa_handle_t handle
Handle for the internal message structure.
Definition: psa_defs.h:88
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.