Marc Bonnici | 9a29704 | 2022-02-14 17:06:09 +0000 | [diff] [blame] | 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 | uintptr_t handle_el3_sp(uint32_t smc_fid, void *cookie, void *handle, |
| 53 | unsigned int flags); |
| 54 | IMPORT_SYM(uintptr_t, __EL3_LP_DESCS_START__, EL3_LP_DESCS_START); |
| 55 | IMPORT_SYM(uintptr_t, __EL3_LP_DESCS_END__, EL3_LP_DESCS_END); |
| 56 | |
| 57 | #define EL3_LP_DESCS_COUNT ((EL3_LP_DESCS_END - EL3_LP_DESCS_START) \ |
| 58 | / sizeof(struct el3_lp_desc)) |
| 59 | |
| 60 | #endif /* EL3_SP_H */ |