juno_common.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*
  2. * Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <drivers/arm/css/sds.h>
  7. #include <lib/smccc.h>
  8. #include <lib/utils_def.h>
  9. #include <services/arm_arch_svc.h>
  10. #include <plat/arm/common/plat_arm.h>
  11. #include <platform_def.h>
  12. /*
  13. * Table of memory regions for different BL stages to map using the MMU.
  14. * This doesn't include Trusted SRAM as setup_page_tables() already takes care
  15. * of mapping it.
  16. */
  17. #ifdef IMAGE_BL1
  18. const mmap_region_t plat_arm_mmap[] = {
  19. ARM_MAP_SHARED_RAM,
  20. V2M_MAP_FLASH0_RW,
  21. V2M_MAP_IOFPGA,
  22. CSS_MAP_DEVICE,
  23. SOC_CSS_MAP_DEVICE,
  24. #if TRUSTED_BOARD_BOOT
  25. /* Map DRAM to authenticate NS_BL2U image. */
  26. ARM_MAP_NS_DRAM1,
  27. #endif
  28. {0}
  29. };
  30. #endif
  31. #ifdef IMAGE_BL2
  32. const mmap_region_t plat_arm_mmap[] = {
  33. ARM_MAP_SHARED_RAM,
  34. V2M_MAP_FLASH0_RW,
  35. #ifdef PLAT_ARM_MEM_PROT_ADDR
  36. ARM_V2M_MAP_MEM_PROTECT,
  37. #endif
  38. V2M_MAP_IOFPGA,
  39. CSS_MAP_DEVICE,
  40. SOC_CSS_MAP_DEVICE,
  41. ARM_MAP_NS_DRAM1,
  42. #ifdef __aarch64__
  43. ARM_MAP_DRAM2,
  44. #endif
  45. #ifdef SPD_tspd
  46. ARM_MAP_TSP_SEC_MEM,
  47. #endif
  48. #ifdef SPD_opteed
  49. ARM_MAP_OPTEE_CORE_MEM,
  50. ARM_OPTEE_PAGEABLE_LOAD_MEM,
  51. #endif
  52. #if TRUSTED_BOARD_BOOT && !RESET_TO_BL2
  53. ARM_MAP_BL1_RW,
  54. #endif
  55. #ifdef JUNO_ETHOSN_TZMP1
  56. JUNO_ETHOSN_PROT_FW_RW,
  57. #endif
  58. {0}
  59. };
  60. #endif
  61. #ifdef IMAGE_BL2U
  62. const mmap_region_t plat_arm_mmap[] = {
  63. ARM_MAP_SHARED_RAM,
  64. CSS_MAP_DEVICE,
  65. CSS_MAP_SCP_BL2U,
  66. V2M_MAP_IOFPGA,
  67. SOC_CSS_MAP_DEVICE,
  68. {0}
  69. };
  70. #endif
  71. #ifdef IMAGE_BL31
  72. const mmap_region_t plat_arm_mmap[] = {
  73. ARM_MAP_SHARED_RAM,
  74. V2M_MAP_IOFPGA,
  75. CSS_MAP_DEVICE,
  76. #ifdef PLAT_ARM_MEM_PROT_ADDR
  77. ARM_V2M_MAP_MEM_PROTECT,
  78. #endif
  79. SOC_CSS_MAP_DEVICE,
  80. ARM_DTB_DRAM_NS,
  81. #ifdef JUNO_ETHOSN_TZMP1
  82. JUNO_ETHOSN_PROT_FW_RO,
  83. #endif
  84. {0}
  85. };
  86. #endif
  87. #ifdef IMAGE_BL32
  88. const mmap_region_t plat_arm_mmap[] = {
  89. #ifndef __aarch64__
  90. ARM_MAP_SHARED_RAM,
  91. #ifdef PLAT_ARM_MEM_PROT_ADDR
  92. ARM_V2M_MAP_MEM_PROTECT,
  93. #endif
  94. #endif
  95. V2M_MAP_IOFPGA,
  96. CSS_MAP_DEVICE,
  97. SOC_CSS_MAP_DEVICE,
  98. {0}
  99. };
  100. #endif
  101. ARM_CASSERT_MMAP
  102. /*****************************************************************************
  103. * plat_is_smccc_feature_available() - This function checks whether SMCCC
  104. * feature is availabile for platform.
  105. * @fid: SMCCC function id
  106. *
  107. * Return SMC_ARCH_CALL_SUCCESS if SMCCC feature is available and
  108. * SMC_ARCH_CALL_NOT_SUPPORTED otherwise.
  109. *****************************************************************************/
  110. int32_t plat_is_smccc_feature_available(u_register_t fid)
  111. {
  112. switch (fid) {
  113. case SMCCC_ARCH_SOC_ID:
  114. return SMC_ARCH_CALL_SUCCESS;
  115. default:
  116. return SMC_ARCH_CALL_NOT_SUPPORTED;
  117. }
  118. }
  119. /* Get SOC version */
  120. int32_t plat_get_soc_version(void)
  121. {
  122. return (int32_t)
  123. (SOC_ID_SET_JEP_106(ARM_SOC_CONTINUATION_CODE,
  124. ARM_SOC_IDENTIFICATION_CODE) |
  125. (JUNO_SOC_ID & SOC_ID_IMPL_DEF_MASK));
  126. }
  127. /* Get SOC revision */
  128. int32_t plat_get_soc_revision(void)
  129. {
  130. unsigned int sys_id;
  131. sys_id = mmio_read_32(V2M_SYSREGS_BASE + V2M_SYS_ID);
  132. return (int32_t)(((sys_id >> V2M_SYS_ID_REV_SHIFT) &
  133. V2M_SYS_ID_REV_MASK) & SOC_ID_REV_MASK);
  134. }
  135. #if CSS_USE_SCMI_SDS_DRIVER
  136. static sds_region_desc_t juno_sds_regions[] = {
  137. { .base = PLAT_ARM_SDS_MEM_BASE },
  138. };
  139. sds_region_desc_t *plat_sds_get_regions(unsigned int *region_count)
  140. {
  141. *region_count = ARRAY_SIZE(juno_sds_regions);
  142. return juno_sds_regions;
  143. }
  144. #endif /* CSS_USE_SCMI_SDS_DRIVER */