el3_spmc_logical_sp.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. #include <common/bl_common.h>
  9. #include <lib/cassert.h>
  10. /*******************************************************************************
  11. * Structure definition, typedefs & constants for the Logical SPs.
  12. ******************************************************************************/
  13. typedef uint64_t (*direct_msg_handler)(uint32_t smc_fid, bool secure_origin,
  14. uint64_t x1, uint64_t x2, uint64_t x3,
  15. uint64_t x4, void *cookie, void *handle,
  16. uint64_t flags);
  17. /* Prototype for logical partition initializing function. */
  18. typedef int32_t (*ffa_partition_init_t)(void);
  19. /* Logical Partition Descriptor. */
  20. struct el3_lp_desc {
  21. ffa_partition_init_t init;
  22. uint16_t sp_id;
  23. uint32_t properties;
  24. uint32_t uuid[4]; /* Little Endian. */
  25. direct_msg_handler direct_req;
  26. const char *debug_name;
  27. };
  28. /* Convenience macro to declare a logical partition descriptor. */
  29. #define DECLARE_LOGICAL_PARTITION(_name, _init, _sp_id, _uuid, _properties, \
  30. _direct_req) \
  31. static const struct el3_lp_desc __partition_desc_ ## _name \
  32. __section(".el3_lp_descs") __used = { \
  33. .debug_name = #_name, \
  34. .init = (_init), \
  35. .sp_id = (_sp_id), \
  36. .uuid = _uuid, \
  37. .properties = (_properties), \
  38. .direct_req = (_direct_req), \
  39. }
  40. /*******************************************************************************
  41. * Function & variable prototypes.
  42. ******************************************************************************/
  43. int el3_sp_desc_validate(void);
  44. uintptr_t handle_el3_sp(uint32_t smc_fid, void *cookie, void *handle,
  45. unsigned int flags);
  46. IMPORT_SYM(uintptr_t, __EL3_LP_DESCS_START__, EL3_LP_DESCS_START);
  47. IMPORT_SYM(uintptr_t, __EL3_LP_DESCS_END__, EL3_LP_DESCS_END);
  48. #define EL3_LP_DESCS_COUNT ((EL3_LP_DESCS_END - EL3_LP_DESCS_START) \
  49. / sizeof(struct el3_lp_desc))
  50. #endif /* EL3_SP_H */