bl2u_main.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <assert.h>
  7. #include <stdint.h>
  8. #include <platform_def.h>
  9. #include <arch.h>
  10. #include <arch_helpers.h>
  11. #include <bl1/bl1.h>
  12. #include <bl2u/bl2u.h>
  13. #include <common/bl_common.h>
  14. #include <common/build_message.h>
  15. #include <common/debug.h>
  16. #include <drivers/auth/auth_mod.h>
  17. #include <drivers/console.h>
  18. #include <plat/common/platform.h>
  19. /*******************************************************************************
  20. * This function is responsible to:
  21. * Load SCP_BL2U if platform has defined SCP_BL2U_BASE
  22. * Perform platform setup.
  23. * Go back to EL3.
  24. ******************************************************************************/
  25. void bl2u_main(void)
  26. {
  27. NOTICE("BL2U: %s\n", build_version_string);
  28. NOTICE("BL2U: %s\n", build_message);
  29. #if SCP_BL2U_BASE
  30. int rc;
  31. /* Load the subsequent bootloader images */
  32. rc = bl2u_plat_handle_scp_bl2u();
  33. if (rc != 0) {
  34. ERROR("Failed to load SCP_BL2U (%i)\n", rc);
  35. panic();
  36. }
  37. #endif
  38. /* Perform platform setup in BL2U after loading SCP_BL2U */
  39. bl2u_platform_setup();
  40. console_flush();
  41. #ifndef __aarch64__
  42. /*
  43. * For AArch32 state BL1 and BL2U share the MMU setup.
  44. * Given that BL2U does not map BL1 regions, MMU needs
  45. * to be disabled in order to go back to BL1.
  46. */
  47. disable_mmu_icache_secure();
  48. #endif /* !__aarch64__ */
  49. /*
  50. * Indicate that BL2U is done and resume back to
  51. * normal world via an SMC to BL1.
  52. * x1 could be passed to Normal world,
  53. * so DO NOT pass any secret information.
  54. */
  55. smc(FWU_SMC_SEC_IMAGE_DONE, 0, 0, 0, 0, 0, 0, 0);
  56. wfi();
  57. }