css_bl2u_setup.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <common/bl_common.h>
  7. #include <common/debug.h>
  8. #include <drivers/arm/css/css_scp.h>
  9. #include <plat/arm/common/plat_arm.h>
  10. #include <plat/common/platform.h>
  11. /* Weak definition may be overridden in specific CSS based platform */
  12. #pragma weak bl2u_plat_handle_scp_bl2u
  13. /* Data structure which holds the SCP_BL2U image info for BL2U */
  14. static image_info_t scp_bl2u_image_info;
  15. /*******************************************************************************
  16. * BL1 can pass platform dependent information to BL2U in x1.
  17. * In case of ARM CSS platforms x1 contains SCP_BL2U image info.
  18. * In case of ARM FVP platforms x1 is not used.
  19. * In both cases, x0 contains the extents of the memory available to BL2U
  20. ******************************************************************************/
  21. void bl2u_early_platform_setup(meminfo_t *mem_layout, void *plat_info)
  22. {
  23. if (!plat_info)
  24. panic();
  25. arm_bl2u_early_platform_setup(mem_layout, plat_info);
  26. scp_bl2u_image_info = *(image_info_t *)plat_info;
  27. }
  28. /*******************************************************************************
  29. * Transfer SCP_BL2U from Trusted RAM using the SCP Download protocol.
  30. ******************************************************************************/
  31. int bl2u_plat_handle_scp_bl2u(void)
  32. {
  33. int ret;
  34. INFO("BL2U: Initiating SCP_BL2U transfer to SCP\n");
  35. ret = css_scp_boot_image_xfer((void *)scp_bl2u_image_info.image_base,
  36. scp_bl2u_image_info.image_size);
  37. if (ret == 0)
  38. ret = css_scp_boot_ready();
  39. if (ret == 0)
  40. INFO("BL2U: SCP_BL2U transferred to SCP\n");
  41. else
  42. ERROR("BL2U: SCP_BL2U transfer failure\n");
  43. return ret;
  44. }