1 /* 2 * Copyright (c) 2013-2019, 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 10 #include <common/uuid.h> 11 #include <common/bl_common.h> 12 #include <lib/cassert.h> 13 14 /******************************************************************************* 15 * Structure definition, typedefs & constants for the Logical SPs 16 ******************************************************************************/ 17 18 #define MAX_EL3_LP_DESCS_COUNT U(2) 19 #define EL3_LP_ID_RANGE_START 0xC0000 20 #define EL3_LP_ID_RANGE_END (EL3_LP_ID_RANGE_START + MAX_EL3_LP_DESCS_COUNT) 21 22 typedef uint64_t (*direct_msg_handler)(uint32_t smc_fid, bool secure_origin, uint64_t x1, uint64_t x2, 23 uint64_t x3, uint64_t x4, void *cookie, void *handle, uint64_t flags); 24 25 /* Prototype for logical partition initializing function */ 26 typedef int64_t (*ffa_partition_init_t)(void); 27 28 /* Logical Partition Descriptor. */ 29 typedef struct el3_lp_desc { 30 ffa_partition_init_t init; 31 uint16_t sp_id; 32 uint32_t properties; 33 uint32_t uuid[4]; // Little Endian 34 direct_msg_handler direct_req; 35 const char *debug_name; 36 } el3_lp_desc_t; 37 38 /* 39 * Convenience macros to declare a logical partition descriptor 40 */ 41 #define DECLARE_LOGICAL_PARTITION(_name, _init, _sp_id, _uuid, _properties, \ 42 _direct_req) \ 43 static const el3_lp_desc_t __partition_desc_ ## _name \ 44 __section("el3_lp_descs") __used = { \ 45 .debug_name = #_name, \ 46 .init = (_init), \ 47 .sp_id = (_sp_id), \ 48 .uuid = _uuid, \ 49 .properties = (_properties), \ 50 .direct_req = (_direct_req), \ 51 } 52 53 54 /******************************************************************************* 55 * Function & variable prototypes 56 ******************************************************************************/ 57 void el3_sp_desc_init(void); 58 uintptr_t handle_el3_sp(uint32_t smc_fid, void *cookie, void *handle, 59 unsigned int flags); 60 IMPORT_SYM(uintptr_t, __EL3_LP_DESCS_START__, EL3_LP_DESCS_START); 61 IMPORT_SYM(uintptr_t, __EL3_LP_DESCS_END__, EL3_LP_DESCS_END); 62 63 #define EL3_LP_DESCS_NUM ((EL3_LP_DESCS_END - EL3_LP_DESCS_START)\ 64 / sizeof(el3_lp_desc_t)) 65 66 #endif /* El3_SP_H */ 67