fvp_r_bl1_entrypoint.S 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * Copyright (c) 2021, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <arch.h>
  7. #include <asm_macros.S>
  8. #include <common/bl_common.h>
  9. #include <el2_common_macros.S>
  10. #include <lib/xlat_mpu/xlat_mpu.h>
  11. .globl bl1_entrypoint
  12. .globl bl1_run_next_image
  13. /* -----------------------------------------------------
  14. * bl1_entrypoint() is the entry point into the trusted
  15. * firmware code when a cpu is released from warm or
  16. * cold reset.
  17. * -----------------------------------------------------
  18. */
  19. func bl1_entrypoint
  20. /* ---------------------------------------------------------------------
  21. * If the reset address is programmable then bl1_entrypoint() is
  22. * executed only on the cold boot path. Therefore, we can skip the warm
  23. * boot mailbox mechanism.
  24. * ---------------------------------------------------------------------
  25. */
  26. el2_entrypoint_common \
  27. _init_sctlr=1 \
  28. _warm_boot_mailbox=!PROGRAMMABLE_RESET_ADDRESS \
  29. _secondary_cold_boot=!COLD_BOOT_SINGLE_CPU \
  30. _init_memory=1 \
  31. _init_c_runtime=1 \
  32. _exception_vectors=bl1_exceptions \
  33. _pie_fixup_size=0
  34. /* --------------------------------------------------------------------
  35. * Perform BL1 setup
  36. * --------------------------------------------------------------------
  37. */
  38. bl bl1_setup
  39. /* --------------------------------------------------------------------
  40. * Initialize platform and jump to our c-entry point
  41. * for this type of reset.
  42. * --------------------------------------------------------------------
  43. */
  44. bl bl1_main
  45. /* ---------------------------------------------
  46. * Should never reach this point.
  47. * ---------------------------------------------
  48. */
  49. no_ret plat_panic_handler
  50. endfunc bl1_entrypoint
  51. func bl1_run_next_image
  52. mov x20,x0
  53. /* ---------------------------------------------
  54. * MPU needs to be disabled because both BL1 and BL33 execute
  55. * in EL2, and therefore share the same address space.
  56. * BL33 will initialize the address space according to its
  57. * own requirement.
  58. * ---------------------------------------------
  59. */
  60. bl disable_mpu_icache_el2
  61. /* ---------------------------------------------
  62. * Wipe clean and disable all MPU regions. This function expects
  63. * that the MPU has already been turned off, and caching concerns
  64. * addressed, but it also explicitly turns off the MPU.
  65. * ---------------------------------------------
  66. */
  67. bl clear_all_mpu_regions
  68. /* --------------------------------------------------
  69. * Do the transition to next boot image.
  70. * --------------------------------------------------
  71. */
  72. ldp x0, x1, [x20, #ENTRY_POINT_INFO_PC_OFFSET]
  73. msr elr_el2, x0
  74. msr spsr_el2, x1
  75. ldp x6, x7, [x20, #(ENTRY_POINT_INFO_ARGS_OFFSET + 0x30)]
  76. ldp x4, x5, [x20, #(ENTRY_POINT_INFO_ARGS_OFFSET + 0x20)]
  77. ldp x2, x3, [x20, #(ENTRY_POINT_INFO_ARGS_OFFSET + 0x10)]
  78. ldp x0, x1, [x20, #(ENTRY_POINT_INFO_ARGS_OFFSET + 0x0)]
  79. exception_return
  80. endfunc bl1_run_next_image