1 /* 2 * Copyright (c) 2022, ARM Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 #ifndef EL3_SP_H 7 #define EL3_SP_H 8 9 #include <common/bl_common.h> 10 #include <lib/cassert.h> 11 12 /******************************************************************************* 13 * Structure definition, typedefs & constants for the Logical SPs. 14 ******************************************************************************/ 15 16 typedef uint64_t (*direct_msg_handler)(uint32_t smc_fid, bool secure_origin, 17 uint64_t x1, uint64_t x2, uint64_t x3, 18 uint64_t x4, void *cookie, void *handle, 19 uint64_t flags); 20 21 /* Prototype for logical partition initializing function. */ 22 typedef int32_t (*ffa_partition_init_t)(void); 23 24 /* Logical Partition Descriptor. */ 25 struct el3_lp_desc { 26 ffa_partition_init_t init; 27 uint16_t sp_id; 28 uint32_t properties; 29 uint32_t uuid[4]; /* Little Endian. */ 30 direct_msg_handler direct_req; 31 const char *debug_name; 32 }; 33 34 /* Convenience macro to declare a logical partition descriptor. */ 35 #define DECLARE_LOGICAL_PARTITION(_name, _init, _sp_id, _uuid, _properties, \ 36 _direct_req) \ 37 static const struct el3_lp_desc __partition_desc_ ## _name \ 38 __section(".el3_lp_descs") __used = { \ 39 .debug_name = #_name, \ 40 .init = (_init), \ 41 .sp_id = (_sp_id), \ 42 .uuid = _uuid, \ 43 .properties = (_properties), \ 44 .direct_req = (_direct_req), \ 45 } 46 47 48 /******************************************************************************* 49 * Function & variable prototypes. 50 ******************************************************************************/ 51 int el3_sp_desc_validate(void); 52 53 IMPORT_SYM(uintptr_t, __EL3_LP_DESCS_START__, EL3_LP_DESCS_START); 54 IMPORT_SYM(uintptr_t, __EL3_LP_DESCS_END__, EL3_LP_DESCS_END); 55 56 #define EL3_LP_DESCS_COUNT ((EL3_LP_DESCS_END - EL3_LP_DESCS_START) \ 57 / sizeof(struct el3_lp_desc)) 58 59 #endif /* EL3_SP_H */ 60