bl2u_main.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright (c) 2015-2020, 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/debug.h>
  15. #include <drivers/auth/auth_mod.h>
  16. #include <drivers/console.h>
  17. #include <plat/common/platform.h>
  18. /*******************************************************************************
  19. * This function is responsible to:
  20. * Load SCP_BL2U if platform has defined SCP_BL2U_BASE
  21. * Perform platform setup.
  22. * Go back to EL3.
  23. ******************************************************************************/
  24. void bl2u_main(void)
  25. {
  26. NOTICE("BL2U: %s\n", version_string);
  27. NOTICE("BL2U: %s\n", build_message);
  28. #if SCP_BL2U_BASE
  29. int rc;
  30. /* Load the subsequent bootloader images */
  31. rc = bl2u_plat_handle_scp_bl2u();
  32. if (rc != 0) {
  33. ERROR("Failed to load SCP_BL2U (%i)\n", rc);
  34. panic();
  35. }
  36. #endif
  37. /* Perform platform setup in BL2U after loading SCP_BL2U */
  38. bl2u_platform_setup();
  39. console_flush();
  40. #ifndef __aarch64__
  41. /*
  42. * For AArch32 state BL1 and BL2U share the MMU setup.
  43. * Given that BL2U does not map BL1 regions, MMU needs
  44. * to be disabled in order to go back to BL1.
  45. */
  46. disable_mmu_icache_secure();
  47. #endif /* !__aarch64__ */
  48. /*
  49. * Indicate that BL2U is done and resume back to
  50. * normal world via an SMC to BL1.
  51. * x1 could be passed to Normal world,
  52. * so DO NOT pass any secret information.
  53. */
  54. smc(FWU_SMC_SEC_IMAGE_DONE, 0, 0, 0, 0, 0, 0, 0);
  55. wfi();
  56. }