blob: 01dbea9797043f70dd5605a0e1a0ea430209eadb [file] [log] [blame]
J-Alves2672cde2020-05-07 18:42:25 +01001/*
Kathleen Capella9d826a12023-07-31 14:45:58 -04002 * Copyright (c) 2020-2024, Arm Limited. All rights reserved.
J-Alves2672cde2020-05-07 18:42:25 +01003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef FFA_SVC_H
8#define FFA_SVC_H
9
Marc Bonnici8e1a7552021-12-01 17:57:04 +000010#include <stdbool.h>
11
J-Alves2672cde2020-05-07 18:42:25 +010012#include <lib/smccc.h>
13#include <lib/utils_def.h>
14#include <tools_share/uuid.h>
15
16/* FFA error codes. */
J-Alves4c95c702020-05-26 14:03:05 +010017#define FFA_ERROR_NOT_SUPPORTED -1
J-Alves2672cde2020-05-07 18:42:25 +010018#define FFA_ERROR_INVALID_PARAMETER -2
19#define FFA_ERROR_NO_MEMORY -3
20#define FFA_ERROR_BUSY -4
21#define FFA_ERROR_INTERRUPTED -5
22#define FFA_ERROR_DENIED -6
J-Alves4c95c702020-05-26 14:03:05 +010023#define FFA_ERROR_RETRY -7
J-Alves2672cde2020-05-07 18:42:25 +010024
25/* The macros below are used to identify FFA calls from the SMC function ID */
26#define FFA_FNUM_MIN_VALUE U(0x60)
Kathleen Capellaa85a9d12023-09-08 17:45:45 -040027#define FFA_FNUM_MAX_VALUE U(0x8E)
J-Alves2672cde2020-05-07 18:42:25 +010028#define is_ffa_fid(fid) __extension__ ({ \
29 __typeof__(fid) _fid = (fid); \
30 ((GET_SMC_NUM(_fid) >= FFA_FNUM_MIN_VALUE) && \
31 (GET_SMC_NUM(_fid) <= FFA_FNUM_MAX_VALUE)); })
32
33/* FFA_VERSION helpers */
34#define FFA_VERSION_MAJOR U(1)
J-Alves4c95c702020-05-26 14:03:05 +010035#define FFA_VERSION_MAJOR_SHIFT 16
J-Alves2672cde2020-05-07 18:42:25 +010036#define FFA_VERSION_MAJOR_MASK U(0x7FFF)
Kathleen Capellafa435ea2023-09-05 14:33:29 -040037#define FFA_VERSION_MINOR U(2)
J-Alves4c95c702020-05-26 14:03:05 +010038#define FFA_VERSION_MINOR_SHIFT 0
J-Alves2672cde2020-05-07 18:42:25 +010039#define FFA_VERSION_MINOR_MASK U(0xFFFF)
J-Alves4c95c702020-05-26 14:03:05 +010040#define FFA_VERSION_BIT31_MASK U(0x1u << 31)
Marc Bonnicie95eb7c2021-12-08 14:24:03 +000041#define FFA_VERSION_MASK U(0xFFFFFFFF)
J-Alves4c95c702020-05-26 14:03:05 +010042
J-Alves2672cde2020-05-07 18:42:25 +010043
J-Alves4c95c702020-05-26 14:03:05 +010044#define MAKE_FFA_VERSION(major, minor) \
J-Alves2672cde2020-05-07 18:42:25 +010045 ((((major) & FFA_VERSION_MAJOR_MASK) << FFA_VERSION_MAJOR_SHIFT) | \
46 (((minor) & FFA_VERSION_MINOR_MASK) << FFA_VERSION_MINOR_SHIFT))
47#define FFA_VERSION_COMPILED MAKE_FFA_VERSION(FFA_VERSION_MAJOR, \
48 FFA_VERSION_MINOR)
49
50/* FFA_MSG_SEND helpers */
51#define FFA_MSG_SEND_ATTRS_BLK_SHIFT U(0)
52#define FFA_MSG_SEND_ATTRS_BLK_MASK U(0x1)
53#define FFA_MSG_SEND_ATTRS_BLK U(0)
54#define FFA_MSG_SEND_ATTRS_BLK_NOT U(1)
55#define FFA_MSG_SEND_ATTRS(blk) \
56 (((blk) & FFA_MSG_SEND_ATTRS_BLK_MASK) \
57 << FFA_MSG_SEND_ATTRS_BLK_SHIFT)
58
Marc Bonnici25f4b542022-04-12 17:18:13 +010059/* Defines for FF-A framework messages exchanged using direct messages. */
60#define FFA_FWK_MSG_BIT BIT(31)
61#define FFA_FWK_MSG_MASK 0xFF
62#define FFA_FWK_MSG_PSCI U(0x0)
63
64/* Defines for FF-A power management messages framework messages. */
65#define FFA_PM_MSG_WB_REQ U(0x1) /* Warm boot request. */
66#define FFA_PM_MSG_PM_RESP U(0x2) /* Response to PSCI or warmboot req. */
67
68/* FF-A warm boot types. */
69#define FFA_WB_TYPE_S2RAM 0x0
70#define FFA_WB_TYPE_NOTS2RAM 0x1
71
J-Alves2672cde2020-05-07 18:42:25 +010072/* Get FFA fastcall std FID from function number */
73#define FFA_FID(smc_cc, func_num) \
74 ((SMC_TYPE_FAST << FUNCID_TYPE_SHIFT) | \
75 ((smc_cc) << FUNCID_CC_SHIFT) | \
76 (OEN_STD_START << FUNCID_OEN_SHIFT) | \
77 ((func_num) << FUNCID_NUM_SHIFT))
78
79/* FFA function numbers */
J-Alves481c52f2021-03-11 17:46:47 +000080#define FFA_FNUM_ERROR U(0x60)
81#define FFA_FNUM_SUCCESS U(0x61)
82#define FFA_FNUM_INTERRUPT U(0x62)
83#define FFA_FNUM_VERSION U(0x63)
84#define FFA_FNUM_FEATURES U(0x64)
85#define FFA_FNUM_RX_RELEASE U(0x65)
86#define FFA_FNUM_RXTX_MAP U(0x66)
87#define FFA_FNUM_RXTX_UNMAP U(0x67)
88#define FFA_FNUM_PARTITION_INFO_GET U(0x68)
89#define FFA_FNUM_ID_GET U(0x69)
90#define FFA_FNUM_MSG_POLL U(0x6A) /* Legacy FF-A v1.0 */
91#define FFA_FNUM_MSG_WAIT U(0x6B)
92#define FFA_FNUM_MSG_YIELD U(0x6C)
93#define FFA_FNUM_MSG_RUN U(0x6D)
94#define FFA_FNUM_MSG_SEND U(0x6E) /* Legacy FF-A v1.0 */
95#define FFA_FNUM_MSG_SEND_DIRECT_REQ U(0x6F)
96#define FFA_FNUM_MSG_SEND_DIRECT_RESP U(0x70)
97#define FFA_FNUM_MEM_DONATE U(0x71)
98#define FFA_FNUM_MEM_LEND U(0x72)
99#define FFA_FNUM_MEM_SHARE U(0x73)
100#define FFA_FNUM_MEM_RETRIEVE_REQ U(0x74)
101#define FFA_FNUM_MEM_RETRIEVE_RESP U(0x75)
102#define FFA_FNUM_MEM_RELINQUISH U(0x76)
103#define FFA_FNUM_MEM_RECLAIM U(0x77)
Marc Bonnici9fa01e92021-09-23 09:44:14 +0100104#define FFA_FNUM_MEM_FRAG_RX U(0x7A)
105#define FFA_FNUM_MEM_FRAG_TX U(0x7B)
J-Alves481c52f2021-03-11 17:46:47 +0000106#define FFA_FNUM_NORMAL_WORLD_RESUME U(0x7C)
107
108/* FF-A v1.1 */
109#define FFA_FNUM_NOTIFICATION_BITMAP_CREATE U(0x7D)
110#define FFA_FNUM_NOTIFICATION_BITMAP_DESTROY U(0x7E)
111#define FFA_FNUM_NOTIFICATION_BIND U(0x7F)
112#define FFA_FNUM_NOTIFICATION_UNBIND U(0x80)
113#define FFA_FNUM_NOTIFICATION_SET U(0x81)
114#define FFA_FNUM_NOTIFICATION_GET U(0x82)
115#define FFA_FNUM_NOTIFICATION_INFO_GET U(0x83)
116#define FFA_FNUM_RX_ACQUIRE U(0x84)
117#define FFA_FNUM_SPM_ID_GET U(0x85)
118#define FFA_FNUM_MSG_SEND2 U(0x86)
119#define FFA_FNUM_SECONDARY_EP_REGISTER U(0x87)
Nishant Sharma789052c2022-03-25 23:52:34 +0000120#define FFA_FNUM_MEM_PERM_GET U(0x88)
121#define FFA_FNUM_MEM_PERM_SET U(0x89)
Kathleen Capellafa435ea2023-09-05 14:33:29 -0400122
123/* FF-A v1.2 */
Raghu Krishnamurthy435f11c2022-12-25 13:02:00 -0800124#define FFA_FNUM_PARTITION_INFO_GET_REGS U(0x8B)
Madhukar Pappireddy41416cc2023-03-02 16:04:38 -0600125#define FFA_FNUM_EL3_INTR_HANDLE U(0x8C)
Kathleen Capella9d826a12023-07-31 14:45:58 -0400126#define FFA_FNUM_MSG_SEND_DIRECT_REQ2 U(0x8D)
Kathleen Capellaa85a9d12023-09-08 17:45:45 -0400127#define FFA_FNUM_MSG_SEND_DIRECT_RESP2 U(0x8E)
J-Alves2672cde2020-05-07 18:42:25 +0100128
Shruti Guptaa5a1cbd2023-01-19 21:50:55 +0000129#define FFA_FNUM_CONSOLE_LOG U(0x8A)
130
J-Alves2672cde2020-05-07 18:42:25 +0100131/* FFA SMC32 FIDs */
132#define FFA_ERROR FFA_FID(SMC_32, FFA_FNUM_ERROR)
133#define FFA_SUCCESS_SMC32 FFA_FID(SMC_32, FFA_FNUM_SUCCESS)
134#define FFA_INTERRUPT FFA_FID(SMC_32, FFA_FNUM_INTERRUPT)
135#define FFA_VERSION FFA_FID(SMC_32, FFA_FNUM_VERSION)
136#define FFA_FEATURES FFA_FID(SMC_32, FFA_FNUM_FEATURES)
137#define FFA_RX_RELEASE FFA_FID(SMC_32, FFA_FNUM_RX_RELEASE)
Federico Recanati5c7c5c42022-03-18 10:30:00 +0100138#define FFA_RX_ACQUIRE FFA_FID(SMC_32, FFA_FNUM_RX_ACQUIRE)
J-Alves2672cde2020-05-07 18:42:25 +0100139#define FFA_RXTX_MAP_SMC32 FFA_FID(SMC_32, FFA_FNUM_RXTX_MAP)
140#define FFA_RXTX_UNMAP FFA_FID(SMC_32, FFA_FNUM_RXTX_UNMAP)
141#define FFA_PARTITION_INFO_GET FFA_FID(SMC_32, FFA_FNUM_PARTITION_INFO_GET)
142#define FFA_ID_GET FFA_FID(SMC_32, FFA_FNUM_ID_GET)
143#define FFA_MSG_POLL FFA_FID(SMC_32, FFA_FNUM_MSG_POLL)
144#define FFA_MSG_WAIT FFA_FID(SMC_32, FFA_FNUM_MSG_WAIT)
145#define FFA_MSG_YIELD FFA_FID(SMC_32, FFA_FNUM_MSG_YIELD)
146#define FFA_MSG_RUN FFA_FID(SMC_32, FFA_FNUM_MSG_RUN)
147#define FFA_MSG_SEND FFA_FID(SMC_32, FFA_FNUM_MSG_SEND)
Federico Recanatieecb4b02022-02-03 17:22:37 +0100148#define FFA_MSG_SEND2 FFA_FID(SMC_32, FFA_FNUM_MSG_SEND2)
J-Alves2672cde2020-05-07 18:42:25 +0100149#define FFA_MSG_SEND_DIRECT_REQ_SMC32 \
150 FFA_FID(SMC_32, FFA_FNUM_MSG_SEND_DIRECT_REQ)
151#define FFA_MSG_SEND_DIRECT_RESP_SMC32 \
152 FFA_FID(SMC_32, FFA_FNUM_MSG_SEND_DIRECT_RESP)
153#define FFA_MEM_DONATE_SMC32 FFA_FID(SMC_32, FFA_FNUM_MEM_DONATE)
154#define FFA_MEM_LEND_SMC32 FFA_FID(SMC_32, FFA_FNUM_MEM_LEND)
155#define FFA_MEM_SHARE_SMC32 FFA_FID(SMC_32, FFA_FNUM_MEM_SHARE)
156#define FFA_MEM_RETRIEVE_REQ_SMC32 \
157 FFA_FID(SMC_32, FFA_FNUM_MEM_RETRIEVE_REQ)
158#define FFA_MEM_RETRIEVE_RESP FFA_FID(SMC_32, FFA_FNUM_MEM_RETRIEVE_RESP)
159#define FFA_MEM_RELINQUISH FFA_FID(SMC_32, FFA_FNUM_MEM_RELINQUISH)
160#define FFA_MEM_RECLAIM FFA_FID(SMC_32, FFA_FNUM_MEM_RECLAIM)
J-Alves2621cfd2021-03-11 17:46:47 +0000161#define FFA_NOTIFICATION_BITMAP_CREATE \
162 FFA_FID(SMC_32, FFA_FNUM_NOTIFICATION_BITMAP_CREATE)
163#define FFA_NOTIFICATION_BITMAP_DESTROY \
164 FFA_FID(SMC_32, FFA_FNUM_NOTIFICATION_BITMAP_DESTROY)
165#define FFA_NOTIFICATION_BIND FFA_FID(SMC_32, FFA_FNUM_NOTIFICATION_BIND)
166#define FFA_NOTIFICATION_UNBIND FFA_FID(SMC_32, FFA_FNUM_NOTIFICATION_UNBIND)
167#define FFA_NOTIFICATION_SET FFA_FID(SMC_32, FFA_FNUM_NOTIFICATION_SET)
168#define FFA_NOTIFICATION_GET FFA_FID(SMC_32, FFA_FNUM_NOTIFICATION_GET)
169#define FFA_NOTIFICATION_INFO_GET \
170 FFA_FID(SMC_32, FFA_FNUM_NOTIFICATION_INFO_GET)
Marc Bonnici9fa01e92021-09-23 09:44:14 +0100171#define FFA_MEM_FRAG_RX FFA_FID(SMC_32, FFA_FNUM_MEM_FRAG_RX)
172#define FFA_MEM_FRAG_TX FFA_FID(SMC_32, FFA_FNUM_MEM_FRAG_TX)
Daniel Boulby27f35df2021-02-03 12:13:19 +0000173#define FFA_SPM_ID_GET FFA_FID(SMC_32, FFA_FNUM_SPM_ID_GET)
Olivier Depreza664c492020-08-05 11:27:42 +0200174#define FFA_NORMAL_WORLD_RESUME FFA_FID(SMC_32, FFA_FNUM_NORMAL_WORLD_RESUME)
Madhukar Pappireddy41416cc2023-03-02 16:04:38 -0600175#define FFA_EL3_INTR_HANDLE FFA_FID(SMC_32, FFA_FNUM_EL3_INTR_HANDLE)
Nishant Sharma789052c2022-03-25 23:52:34 +0000176#define FFA_MEM_PERM_GET FFA_FID(SMC_32, FFA_FNUM_MEM_PERM_GET)
177#define FFA_MEM_PERM_SET FFA_FID(SMC_32, FFA_FNUM_MEM_PERM_SET)
Shruti Guptaa5a1cbd2023-01-19 21:50:55 +0000178#define FFA_CONSOLE_LOG_SMC32 FFA_FID(SMC_32, FFA_FNUM_CONSOLE_LOG)
J-Alves2672cde2020-05-07 18:42:25 +0100179
180/* FFA SMC64 FIDs */
Olivier Deprezeae45962021-01-19 15:06:47 +0100181#define FFA_ERROR_SMC64 FFA_FID(SMC_64, FFA_FNUM_ERROR)
J-Alves2672cde2020-05-07 18:42:25 +0100182#define FFA_SUCCESS_SMC64 FFA_FID(SMC_64, FFA_FNUM_SUCCESS)
183#define FFA_RXTX_MAP_SMC64 FFA_FID(SMC_64, FFA_FNUM_RXTX_MAP)
184#define FFA_MSG_SEND_DIRECT_REQ_SMC64 \
185 FFA_FID(SMC_64, FFA_FNUM_MSG_SEND_DIRECT_REQ)
186#define FFA_MSG_SEND_DIRECT_RESP_SMC64 \
187 FFA_FID(SMC_64, FFA_FNUM_MSG_SEND_DIRECT_RESP)
188#define FFA_MEM_DONATE_SMC64 FFA_FID(SMC_64, FFA_FNUM_MEM_DONATE)
189#define FFA_MEM_LEND_SMC64 FFA_FID(SMC_64, FFA_FNUM_MEM_LEND)
190#define FFA_MEM_SHARE_SMC64 FFA_FID(SMC_64, FFA_FNUM_MEM_SHARE)
191#define FFA_MEM_RETRIEVE_REQ_SMC64 \
192 FFA_FID(SMC_64, FFA_FNUM_MEM_RETRIEVE_REQ)
Olivier Deprezeae45962021-01-19 15:06:47 +0100193#define FFA_SECONDARY_EP_REGISTER_SMC64 \
194 FFA_FID(SMC_64, FFA_FNUM_SECONDARY_EP_REGISTER)
J-Alves2621cfd2021-03-11 17:46:47 +0000195#define FFA_NOTIFICATION_INFO_GET_SMC64 \
196 FFA_FID(SMC_64, FFA_FNUM_NOTIFICATION_INFO_GET)
Raghu Krishnamurthy435f11c2022-12-25 13:02:00 -0800197#define FFA_PARTITION_INFO_GET_REGS_SMC64 \
198 FFA_FID(SMC_64, FFA_FNUM_PARTITION_INFO_GET_REGS)
Shruti Guptaa5a1cbd2023-01-19 21:50:55 +0000199#define FFA_CONSOLE_LOG_SMC64 FFA_FID(SMC_64, FFA_FNUM_CONSOLE_LOG)
Kathleen Capella9d826a12023-07-31 14:45:58 -0400200#define FFA_MSG_SEND_DIRECT_REQ2_SMC64 \
201 FFA_FID(SMC_64, FFA_FNUM_MSG_SEND_DIRECT_REQ2)
Kathleen Capellaa85a9d12023-09-08 17:45:45 -0400202#define FFA_MSG_SEND_DIRECT_RESP2_SMC64 \
203 FFA_FID(SMC_64, FFA_FNUM_MSG_SEND_DIRECT_RESP2)
J-Alves2672cde2020-05-07 18:42:25 +0100204
205/*
Marc Bonnici9a297042022-02-14 17:06:09 +0000206 * FF-A partition properties values.
207 */
208#define FFA_PARTITION_DIRECT_REQ_RECV U(1 << 0)
209#define FFA_PARTITION_DIRECT_REQ_SEND U(1 << 1)
210#define FFA_PARTITION_INDIRECT_MSG U(1 << 2)
211
212/*
J-Alves2672cde2020-05-07 18:42:25 +0100213 * Reserve a special value for traffic targeted to the Hypervisor or SPM.
214 */
215#define FFA_TARGET_INFO_MBZ U(0x0)
216
217/*
218 * Reserve a special value for MBZ parameters.
219 */
220#define FFA_PARAM_MBZ U(0x0)
221
Olivier Deprezebc34772020-04-16 16:59:21 +0200222/*
223 * Maximum FF-A endpoint id value
224 */
225#define FFA_ENDPOINT_ID_MAX U(1 << 16)
226
227/*
Marc Bonnici8e1a7552021-12-01 17:57:04 +0000228 * Reserve endpoint id for the SPMD.
229 */
230#define SPMD_DIRECT_MSG_ENDPOINT_ID U(FFA_ENDPOINT_ID_MAX - 1)
231
232/* Mask and shift to check valid secure FF-A Endpoint ID. */
233#define SPMC_SECURE_ID_MASK U(1)
234#define SPMC_SECURE_ID_SHIFT U(15)
235
236/*
Marc Bonnici37dd8e12021-08-17 18:00:07 +0100237 * Partition Count Flag in FFA_PARTITION_INFO_GET.
238 */
239#define FFA_PARTITION_INFO_GET_COUNT_FLAG_MASK U(1 << 0)
240
241/*
Olivier Deprezebc34772020-04-16 16:59:21 +0200242 * Mask for source and destination endpoint id in
243 * a direct message request/response.
244 */
245#define FFA_DIRECT_MSG_ENDPOINT_ID_MASK U(0xffff)
246
247/*
248 * Bit shift for destination endpoint id in a direct message request/response.
249 */
250#define FFA_DIRECT_MSG_DESTINATION_SHIFT U(0)
251
252/*
253 * Bit shift for source endpoint id in a direct message request/response.
254 */
255#define FFA_DIRECT_MSG_SOURCE_SHIFT U(16)
256
257/******************************************************************************
258 * ffa_endpoint_destination
259 *****************************************************************************/
260static inline uint16_t ffa_endpoint_destination(unsigned int ep)
261{
262 return (ep >> FFA_DIRECT_MSG_DESTINATION_SHIFT) &
263 FFA_DIRECT_MSG_ENDPOINT_ID_MASK;
264}
265
266/******************************************************************************
267 * ffa_endpoint_source
268 *****************************************************************************/
269static inline uint16_t ffa_endpoint_source(unsigned int ep)
270{
271 return (ep >> FFA_DIRECT_MSG_SOURCE_SHIFT) &
272 FFA_DIRECT_MSG_ENDPOINT_ID_MASK;
273}
274
Marc Bonnici8e1a7552021-12-01 17:57:04 +0000275/******************************************************************************
276 * FF-A helper functions to determine partition ID world.
277 *****************************************************************************/
278
279/*
280 * Determine if provided ID is in the secure world.
281 */
282static inline bool ffa_is_secure_world_id(uint16_t id)
283{
284 return ((id >> SPMC_SECURE_ID_SHIFT) & SPMC_SECURE_ID_MASK) == 1;
285}
286
287/*
288 * Determine if provided ID is in the normal world.
289 */
290static inline bool ffa_is_normal_world_id(uint16_t id)
291{
292 return !ffa_is_secure_world_id(id);
293}
294
Achin Guptaeaf17162021-10-19 12:21:16 +0100295
296/******************************************************************************
297 * Boot information protocol as per the FF-A v1.1 spec.
298 *****************************************************************************/
299#define FFA_INIT_DESC_SIGNATURE 0x00000FFA
300
301/* Boot information type. */
302#define FFA_BOOT_INFO_TYPE_STD U(0x0)
303#define FFA_BOOT_INFO_TYPE_IMPL U(0x1)
304
305#define FFA_BOOT_INFO_TYPE_MASK U(0x1)
306#define FFA_BOOT_INFO_TYPE_SHIFT U(0x7)
307#define FFA_BOOT_INFO_TYPE(type) \
308 (((type) & FFA_BOOT_INFO_TYPE_MASK) \
309 << FFA_BOOT_INFO_TYPE_SHIFT)
310
311/* Boot information identifier. */
312#define FFA_BOOT_INFO_TYPE_ID_FDT U(0x0)
313#define FFA_BOOT_INFO_TYPE_ID_HOB U(0x1)
314
315#define FFA_BOOT_INFO_TYPE_ID_MASK U(0x3F)
316#define FFA_BOOT_INFO_TYPE_ID_SHIFT U(0x0)
317#define FFA_BOOT_INFO_TYPE_ID(type) \
318 (((type) & FFA_BOOT_INFO_TYPE_ID_MASK) \
319 << FFA_BOOT_INFO_TYPE_ID_SHIFT)
320
321/* Format of Flags Name field. */
322#define FFA_BOOT_INFO_FLAG_NAME_STRING U(0x0)
323#define FFA_BOOT_INFO_FLAG_NAME_UUID U(0x1)
324
325#define FFA_BOOT_INFO_FLAG_NAME_MASK U(0x3)
326#define FFA_BOOT_INFO_FLAG_NAME_SHIFT U(0x0)
327#define FFA_BOOT_INFO_FLAG_NAME(type) \
328 (((type) & FFA_BOOT_INFO_FLAG_NAME_MASK)\
329 << FFA_BOOT_INFO_FLAG_NAME_SHIFT)
330
331/* Format of Flags Contents field. */
332#define FFA_BOOT_INFO_FLAG_CONTENT_ADR U(0x0)
333#define FFA_BOOT_INFO_FLAG_CONTENT_VAL U(0x1)
334
335#define FFA_BOOT_INFO_FLAG_CONTENT_MASK U(0x1)
336#define FFA_BOOT_INFO_FLAG_CONTENT_SHIFT U(0x2)
337#define FFA_BOOT_INFO_FLAG_CONTENT(content) \
338 (((content) & FFA_BOOT_INFO_FLAG_CONTENT_MASK) \
339 << FFA_BOOT_INFO_FLAG_CONTENT_SHIFT)
340
341/* Boot information descriptor. */
342struct ffa_boot_info_desc {
343 uint8_t name[16];
344 uint8_t type;
345 uint8_t reserved;
346 uint16_t flags;
347 uint32_t size_boot_info;
348 uint64_t content;
349};
350
351/* Boot information header. */
352struct ffa_boot_info_header {
353 uint32_t signature; /* 0xFFA */
354 uint32_t version;
355 uint32_t size_boot_info_blob;
356 uint32_t size_boot_info_desc;
357 uint32_t count_boot_info_desc;
358 uint32_t offset_boot_info_desc;
359 uint64_t reserved;
360};
361
Raghu Krishnamurthy2b7b5842023-04-22 11:21:58 -0700362/* FF-A Partition Info Get related macros. */
363#define FFA_PARTITION_INFO_GET_PROPERTIES_V1_0_MASK U(0x7)
364#define FFA_PARTITION_INFO_GET_EXEC_STATE_SHIFT U(8)
365#define FFA_PARTITION_INFO_GET_AARCH32_STATE U(0)
366#define FFA_PARTITION_INFO_GET_AARCH64_STATE U(1)
367
368/**
369 * Holds information returned for each partition by the FFA_PARTITION_INFO_GET
370 * interface.
371 */
372struct ffa_partition_info_v1_0 {
373 uint16_t ep_id;
374 uint16_t execution_ctx_count;
375 uint32_t properties;
376};
377
378/* Extended structure for FF-A v1.1. */
379struct ffa_partition_info_v1_1 {
380 uint16_t ep_id;
381 uint16_t execution_ctx_count;
382 uint32_t properties;
383 uint32_t uuid[4];
384};
385
J-Alves2672cde2020-05-07 18:42:25 +0100386#endif /* FFA_SVC_H */