marvell_bl1_setup.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * Copyright (C) 2018 Marvell International Ltd.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. * https://spdx.org/licenses
  6. */
  7. #include <platform_def.h>
  8. #include <bl1/bl1.h>
  9. #include <common/bl_common.h>
  10. #include <common/debug.h>
  11. #include <drivers/arm/sp805.h>
  12. #include <drivers/console.h>
  13. #include <plat/common/platform.h>
  14. #include <plat_marvell.h>
  15. /* Weak definitions may be overridden in specific Marvell standard platform */
  16. #pragma weak bl1_early_platform_setup
  17. #pragma weak bl1_plat_arch_setup
  18. #pragma weak bl1_platform_setup
  19. #pragma weak bl1_plat_sec_mem_layout
  20. /* Data structure which holds the extents of the RAM for BL1*/
  21. static meminfo_t bl1_ram_layout;
  22. meminfo_t *bl1_plat_sec_mem_layout(void)
  23. {
  24. return &bl1_ram_layout;
  25. }
  26. /*
  27. * BL1 specific platform actions shared between Marvell standard platforms.
  28. */
  29. void marvell_bl1_early_platform_setup(void)
  30. {
  31. /* Initialize the console to provide early debug support */
  32. marvell_console_boot_init();
  33. /* Allow BL1 to see the whole Trusted RAM */
  34. bl1_ram_layout.total_base = MARVELL_BL_RAM_BASE;
  35. bl1_ram_layout.total_size = MARVELL_BL_RAM_SIZE;
  36. }
  37. void bl1_early_platform_setup(void)
  38. {
  39. marvell_bl1_early_platform_setup();
  40. }
  41. /*
  42. * Perform the very early platform specific architecture setup shared between
  43. * MARVELL standard platforms. This only does basic initialization. Later
  44. * architectural setup (bl1_arch_setup()) does not do anything platform
  45. * specific.
  46. */
  47. void marvell_bl1_plat_arch_setup(void)
  48. {
  49. marvell_setup_page_tables(bl1_ram_layout.total_base,
  50. bl1_ram_layout.total_size,
  51. BL1_RO_BASE,
  52. BL1_RO_LIMIT,
  53. BL1_RO_DATA_BASE,
  54. BL1_RO_DATA_END
  55. #if USE_COHERENT_MEM
  56. , BL_COHERENT_RAM_BASE,
  57. BL_COHERENT_RAM_END
  58. #endif
  59. );
  60. enable_mmu_el3(0);
  61. }
  62. void bl1_plat_arch_setup(void)
  63. {
  64. marvell_bl1_plat_arch_setup();
  65. }
  66. /*
  67. * Perform the platform specific architecture setup shared between
  68. * MARVELL standard platforms.
  69. */
  70. void marvell_bl1_platform_setup(void)
  71. {
  72. /* Initialise the IO layer and register platform IO devices */
  73. plat_marvell_io_setup();
  74. }
  75. void bl1_platform_setup(void)
  76. {
  77. marvell_bl1_platform_setup();
  78. }
  79. void bl1_plat_prepare_exit(entry_point_info_t *ep_info)
  80. {
  81. #ifdef EL3_PAYLOAD_BASE
  82. /*
  83. * Program the EL3 payload's entry point address into the CPUs mailbox
  84. * in order to release secondary CPUs from their holding pen and make
  85. * them jump there.
  86. */
  87. marvell_program_trusted_mailbox(ep_info->pc);
  88. dsbsy();
  89. sev();
  90. #endif
  91. }