bl1.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef BL1_H
  7. #define BL1_H
  8. #include <common/bl_common.h>
  9. /*
  10. * Defines for BL1 SMC function ids.
  11. */
  12. #define BL1_SMC_CALL_COUNT 0x0
  13. #define BL1_SMC_UID 0x1
  14. /* SMC #0x2 reserved */
  15. #define BL1_SMC_VERSION 0x3
  16. /*
  17. * Corresponds to the function ID of the SMC that
  18. * the BL1 exception handler service to execute BL31.
  19. */
  20. #define BL1_SMC_RUN_IMAGE 0x4
  21. /*
  22. * BL1 SMC version
  23. */
  24. #define BL1_SMC_MAJOR_VER UL(0x0)
  25. #define BL1_SMC_MINOR_VER UL(0x1)
  26. /*
  27. * Defines for FWU SMC function ids.
  28. */
  29. #define FWU_SMC_IMAGE_COPY 0x10
  30. #define FWU_SMC_IMAGE_AUTH 0x11
  31. #define FWU_SMC_IMAGE_EXECUTE 0x12
  32. #define FWU_SMC_IMAGE_RESUME 0x13
  33. #define FWU_SMC_SEC_IMAGE_DONE 0x14
  34. #define FWU_SMC_UPDATE_DONE 0x15
  35. #define FWU_SMC_IMAGE_RESET 0x16
  36. /*
  37. * Number of FWU calls (above) implemented
  38. */
  39. #define FWU_NUM_SMC_CALLS 7
  40. #if TRUSTED_BOARD_BOOT
  41. # define BL1_NUM_SMC_CALLS (FWU_NUM_SMC_CALLS + 4)
  42. #else
  43. # define BL1_NUM_SMC_CALLS 4
  44. #endif
  45. /*
  46. * The macros below are used to identify FWU
  47. * calls from the SMC function ID
  48. */
  49. #define FWU_SMC_FID_START FWU_SMC_IMAGE_COPY
  50. #define FWU_SMC_FID_END FWU_SMC_IMAGE_RESET
  51. #define is_fwu_fid(_fid) \
  52. ((_fid >= FWU_SMC_FID_START) && (_fid <= FWU_SMC_FID_END))
  53. #ifndef __ASSEMBLER__
  54. #include <lib/cassert.h>
  55. struct entry_point_info;
  56. u_register_t bl1_smc_wrapper(uint32_t smc_fid,
  57. void *cookie,
  58. void *handle,
  59. unsigned int flags);
  60. u_register_t bl1_smc_handler(unsigned int smc_fid,
  61. u_register_t x1,
  62. u_register_t x2,
  63. u_register_t x3,
  64. u_register_t x4,
  65. void *cookie,
  66. void *handle,
  67. unsigned int flags);
  68. void bl1_print_next_bl_ep_info(const struct entry_point_info *bl_ep_info);
  69. void bl1_setup(void);
  70. void bl1_main(void);
  71. void bl1_plat_prepare_exit(entry_point_info_t *ep_info);
  72. /*
  73. * Check if the total number of FWU SMC calls are as expected.
  74. */
  75. CASSERT(FWU_NUM_SMC_CALLS ==
  76. (FWU_SMC_FID_END - FWU_SMC_FID_START + 1),
  77. assert_FWU_NUM_SMC_CALLS_mismatch);
  78. #endif /* __ASSEMBLER__ */
  79. #endif /* BL1_H */