sq_bl2_setup.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * Copyright (c) 2022, Socionext Inc. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <errno.h>
  7. #include <common/bl_common.h>
  8. #include <common/debug.h>
  9. #include <common/desc_image_load.h>
  10. #include <common/image_decompress.h>
  11. #include <drivers/arm/pl011.h>
  12. #include <drivers/io/io_storage.h>
  13. #include <lib/xlat_tables/xlat_tables_v2.h>
  14. #include <plat/common/platform.h>
  15. #include <platform_def.h>
  16. #include <sq_common.h>
  17. static console_t console;
  18. void bl2_el3_early_platform_setup(u_register_t x0, u_register_t x1,
  19. u_register_t x2, u_register_t x3)
  20. {
  21. /* Initialize the console to provide early debug support */
  22. (void)console_pl011_register(PLAT_SQ_BOOT_UART_BASE,
  23. PLAT_SQ_BOOT_UART_CLK_IN_HZ,
  24. SQ_CONSOLE_BAUDRATE, &console);
  25. console_set_scope(&console, CONSOLE_FLAG_BOOT);
  26. }
  27. void bl2_el3_plat_arch_setup(void)
  28. {
  29. int ret;
  30. sq_mmap_setup(BL2_BASE, BL2_SIZE, NULL);
  31. ret = sq_io_setup();
  32. if (ret) {
  33. ERROR("failed to setup io devices\n");
  34. plat_error_handler(ret);
  35. }
  36. }
  37. void bl2_platform_setup(void)
  38. {
  39. }
  40. void plat_flush_next_bl_params(void)
  41. {
  42. flush_bl_params_desc();
  43. }
  44. bl_load_info_t *plat_get_bl_image_load_info(void)
  45. {
  46. return get_bl_load_info_from_mem_params_desc();
  47. }
  48. bl_params_t *plat_get_next_bl_params(void)
  49. {
  50. return get_next_bl_params_from_mem_params_desc();
  51. }
  52. void bl2_plat_preload_setup(void)
  53. {
  54. }
  55. int bl2_plat_handle_pre_image_load(unsigned int image_id)
  56. {
  57. struct image_info *image_info;
  58. image_info = sq_get_image_info(image_id);
  59. return mmap_add_dynamic_region(image_info->image_base,
  60. image_info->image_base,
  61. image_info->image_max_size,
  62. MT_MEMORY | MT_RW | MT_NS);
  63. }
  64. int bl2_plat_handle_post_image_load(unsigned int image_id)
  65. {
  66. return 0;
  67. }