xref: /optee_os/core/arch/arm/include/ffa.h (revision 9fc2442cc66c279cb962c90c4375746fc9b28bb9)
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /*
3  * Copyright (c) 2020, Linaro Limited
4  * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
5  */
6 
7 #ifndef __FFA_H
8 #define __FFA_H
9 
10 /* This is based on the FF-A 1.0 EAC specification */
11 
12 #include <smccc.h>
13 #include <stdint.h>
14 
15 /* Error codes */
16 #define FFA_NOT_SUPPORTED	-1
17 #define FFA_INVALID_PARAMETERS	-2
18 #define FFA_NO_MEMORY		-3
19 #define FFA_BUSY		-4
20 #define FFA_INTERRUPTED		-5
21 #define FFA_DENIED		-6
22 #define FFA_RETRY		-7
23 #define FFA_ABORTED		-8
24 
25 /* FFA_VERSION helpers */
26 #define FFA_VERSION_MAJOR		U(1)
27 #define FFA_VERSION_MAJOR_SHIFT		16
28 #define FFA_VERSION_MAJOR_MASK		U(0x7FFF)
29 #define FFA_VERSION_MINOR		U(0)
30 #define FFA_VERSION_MINOR_SHIFT		0
31 #define FFA_VERSION_MINOR_MASK		U(0xFFFF)
32 #define MAKE_FFA_VERSION(major, minor)	\
33 	((((major) & FFA_VERSION_MAJOR_MASK) << FFA_VERSION_MAJOR_SHIFT) | \
34 	 ((minor) & FFA_VERSION_MINOR_MASK))
35 
36 /* Function IDs */
37 #define FFA_ERROR			U(0x84000060)
38 #define FFA_SUCCESS_32			U(0x84000061)
39 #define FFA_SUCCESS_64			U(0xC4000061)
40 #define FFA_INTERRUPT			U(0x84000062)
41 #define FFA_VERSION			U(0x84000063)
42 #define FFA_FEATURES			U(0x84000064)
43 #define FFA_RX_RELEASE			U(0x84000065)
44 #define FFA_RXTX_MAP_32			U(0x84000066)
45 #define FFA_RXTX_MAP_64			U(0xC4000066)
46 #define FFA_RXTX_UNMAP			U(0x84000067)
47 #define FFA_PARTITION_INFO_GET		U(0x84000068)
48 #define FFA_ID_GET			U(0x84000069)
49 #define FFA_MSG_WAIT			U(0x8400006B)
50 #define FFA_MSG_YIELD			U(0x8400006C)
51 #define FFA_MSG_RUN			U(0x8400006D)
52 #define FFA_MSG_SEND			U(0x8400006E)
53 #define FFA_MSG_SEND_DIRECT_REQ_32	U(0x8400006F)
54 #define FFA_MSG_SEND_DIRECT_REQ_64	U(0xC400006F)
55 #define FFA_MSG_SEND_DIRECT_RESP_32	U(0x84000070)
56 #define FFA_MSG_SEND_DIRECT_RESP_64	U(0xC4000070)
57 #define FFA_MSG_POLL			U(0x8400006A)
58 #define FFA_MEM_DONATE_32		U(0x84000071)
59 #define FFA_MEM_DONATE_64		U(0xC4000071)
60 #define FFA_MEM_LEND_32			U(0x84000072)
61 #define FFA_MEM_LEND_64			U(0xC4000072)
62 #define FFA_MEM_SHARE_32		U(0x84000073)
63 #define FFA_MEM_SHARE_64		U(0xC4000073)
64 #define FFA_MEM_RETRIEVE_REQ_32		U(0x84000074)
65 #define FFA_MEM_RETRIEVE_REQ_64		U(0xC4000074)
66 #define FFA_MEM_RETRIEVE_RESP		U(0x84000075)
67 #define FFA_MEM_RELINQUISH		U(0x84000076)
68 #define FFA_MEM_RECLAIM			U(0x84000077)
69 #define FFA_MEM_FRAG_RX			U(0x8400007A)
70 #define FFA_MEM_FRAG_TX			U(0x8400007B)
71 
72 /* Special value for traffic targeted to the Hypervisor or SPM */
73 #define FFA_TARGET_INFO_MBZ		U(0x0)
74 
75 /* Special value for MBZ parameters */
76 #define FFA_PARAM_MBZ			U(0x0)
77 
78 #endif /* __FFA_H */
79