msm8916_bl31_setup.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright (c) 2021-2023, Stephan Gerhold <stephan@gerhold.net>
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <assert.h>
  7. #include <arch.h>
  8. #include <common/debug.h>
  9. #include <plat/common/platform.h>
  10. #include "msm8916_config.h"
  11. #include "msm8916_setup.h"
  12. static struct {
  13. entry_point_info_t bl32;
  14. entry_point_info_t bl33;
  15. } image_ep_info = {
  16. /* BL32 entry point */
  17. SET_STATIC_PARAM_HEAD(bl32, PARAM_EP, VERSION_1,
  18. entry_point_info_t, SECURE),
  19. .bl32.pc = BL32_BASE,
  20. /* BL33 entry point */
  21. SET_STATIC_PARAM_HEAD(bl33, PARAM_EP, VERSION_1,
  22. entry_point_info_t, NON_SECURE),
  23. .bl33.pc = PRELOADED_BL33_BASE,
  24. .bl33.spsr = SPSR_64(MODE_EL2, MODE_SP_ELX, DISABLE_ALL_EXCEPTIONS),
  25. };
  26. void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
  27. u_register_t arg2, u_register_t arg3)
  28. {
  29. msm8916_early_platform_setup();
  30. msm8916_configure_early();
  31. }
  32. void bl31_plat_arch_setup(void)
  33. {
  34. msm8916_plat_arch_setup(BL31_BASE, BL31_END - BL31_BASE);
  35. enable_mmu_el3(0);
  36. }
  37. void bl31_platform_setup(void)
  38. {
  39. INFO("BL31: Platform setup start\n");
  40. msm8916_platform_setup();
  41. msm8916_configure();
  42. INFO("BL31: Platform setup done\n");
  43. }
  44. entry_point_info_t *bl31_plat_get_next_image_ep_info(uint32_t type)
  45. {
  46. switch (type) {
  47. case SECURE:
  48. return &image_ep_info.bl32;
  49. case NON_SECURE:
  50. return &image_ep_info.bl33;
  51. default:
  52. assert(sec_state_is_valid(type));
  53. return NULL;
  54. }
  55. }