platform_def.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. /*
  2. * Copyright (c) 2020-2024, Arm Limited. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef PLATFORM_DEF_H
  7. #define PLATFORM_DEF_H
  8. #include <plat/arm/board/common/v2m_def.h>
  9. #include <plat/arm/common/arm_def.h>
  10. #include <plat/arm/css/common/css_def.h>
  11. /* UART related constants */
  12. #define PLAT_ARM_BOOT_UART_BASE ULL(0x2A400000)
  13. #define PLAT_ARM_BOOT_UART_CLK_IN_HZ U(50000000)
  14. /* IOFPGA UART0 */
  15. #define PLAT_ARM_RUN_UART_BASE ULL(0x1C090000)
  16. #define PLAT_ARM_RUN_UART_CLK_IN_HZ U(24000000)
  17. #define PLAT_ARM_CRASH_UART_BASE PLAT_ARM_RUN_UART_BASE
  18. #define PLAT_ARM_CRASH_UART_CLK_IN_HZ PLAT_ARM_RUN_UART_CLK_IN_HZ
  19. #define PLAT_ARM_DRAM2_BASE ULL(0x8080000000)
  20. #define PLAT_ARM_DRAM2_SIZE ULL(0xF80000000)
  21. #define MAX_IO_DEVICES U(3)
  22. #define MAX_IO_HANDLES U(4)
  23. #define PLAT_ARM_FLASH_IMAGE_BASE ULL(0x1A000000)
  24. #define PLAT_ARM_FLASH_IMAGE_MAX_SIZE ULL(0x01000000)
  25. #define PLAT_ARM_NVM_BASE ULL(0x1A000000)
  26. #define PLAT_ARM_NVM_SIZE ULL(0x01000000)
  27. #if defined NS_BL1U_BASE
  28. #undef NS_BL1U_BASE
  29. #define NS_BL1U_BASE (PLAT_ARM_NVM_BASE + UL(0x00800000))
  30. #endif
  31. /*
  32. * There are no non-volatile counters in morello, these macros points
  33. * to unused addresses.
  34. */
  35. #define SOC_TRUSTED_NVCTR_BASE ULL(0x7FE70000)
  36. #define TFW_NVCTR_BASE (SOC_TRUSTED_NVCTR_BASE + U(0x0000))
  37. #define TFW_NVCTR_SIZE U(4)
  38. #define NTFW_CTR_BASE (SOC_TRUSTED_NVCTR_BASE + U(0x0004))
  39. #define NTFW_CTR_SIZE U(4)
  40. /*
  41. * To access the complete DDR memory along with remote chip's DDR memory,
  42. * which is at 4 TB offset, physical and virtual address space limits are
  43. * extended to 43-bits.
  44. */
  45. #define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 43)
  46. #define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 43)
  47. #if CSS_USE_SCMI_SDS_DRIVER
  48. #define MORELLO_SCMI_PAYLOAD_BASE ULL(0x45400000)
  49. /*
  50. * Index of SDS region used in the communication with SCP
  51. */
  52. #define SDS_SCP_AP_REGION_ID U(0)
  53. #else
  54. #define PLAT_CSS_SCP_COM_SHARED_MEM_BASE ULL(0x45400000)
  55. #endif
  56. #define PLAT_ARM_TRUSTED_SRAM_SIZE UL(0x00080000)
  57. /*
  58. * PLAT_ARM_MAX_BL1_RW_SIZE is calculated using the current BL1 RW debug size
  59. * plus a little space for growth.
  60. */
  61. #define PLAT_ARM_MAX_BL1_RW_SIZE UL(0xC000)
  62. /* Define memory configuration for device tree files. */
  63. #define PLAT_ARM_HW_CONFIG_SIZE U(0x8000)
  64. /*
  65. * PLAT_ARM_MAX_ROMLIB_RW_SIZE is define to use a full page
  66. */
  67. #if USE_ROMLIB
  68. #define PLAT_ARM_MAX_ROMLIB_RW_SIZE UL(0x1000)
  69. #define PLAT_ARM_MAX_ROMLIB_RO_SIZE UL(0xE000)
  70. #else
  71. #define PLAT_ARM_MAX_ROMLIB_RW_SIZE U(0)
  72. #define PLAT_ARM_MAX_ROMLIB_RO_SIZE U(0)
  73. #endif
  74. /*
  75. * PLAT_ARM_MAX_BL2_SIZE is calculated using the current BL2 debug size plus a
  76. * little space for growth.
  77. */
  78. #if TRUSTED_BOARD_BOOT
  79. # define PLAT_ARM_MAX_BL2_SIZE UL(0x1D000)
  80. #else
  81. # define PLAT_ARM_MAX_BL2_SIZE UL(0x14000)
  82. #endif
  83. #define PLAT_ARM_MAX_BL31_SIZE UL(0x3B000)
  84. /*******************************************************************************
  85. * MORELLO topology related constants
  86. ******************************************************************************/
  87. #define MORELLO_MAX_CPUS_PER_CLUSTER U(2)
  88. #define PLAT_ARM_CLUSTER_COUNT U(2)
  89. #define PLAT_MORELLO_CHIP_COUNT U(1)
  90. #define MORELLO_MAX_CLUSTERS_PER_CHIP U(2)
  91. #define MORELLO_MAX_PE_PER_CPU U(1)
  92. #define PLATFORM_CORE_COUNT (PLAT_MORELLO_CHIP_COUNT * \
  93. PLAT_ARM_CLUSTER_COUNT * \
  94. MORELLO_MAX_CPUS_PER_CLUSTER * \
  95. MORELLO_MAX_PE_PER_CPU)
  96. /* System power domain level */
  97. #define CSS_SYSTEM_PWR_DMN_LVL ARM_PWR_LVL3
  98. /*
  99. * PLAT_ARM_MMAP_ENTRIES depends on the number of entries in the
  100. * plat_arm_mmap array defined for each BL stage.
  101. */
  102. #if IMAGE_BL1 || IMAGE_BL31
  103. # define PLAT_ARM_MMAP_ENTRIES U(6)
  104. # define MAX_XLAT_TABLES U(7)
  105. #else
  106. # define PLAT_ARM_MMAP_ENTRIES U(5)
  107. # define MAX_XLAT_TABLES U(6)
  108. #endif
  109. /*
  110. * Size of cacheable stacks
  111. */
  112. #if defined(IMAGE_BL1)
  113. # if TRUSTED_BOARD_BOOT
  114. # define PLATFORM_STACK_SIZE UL(0x1000)
  115. # else
  116. # define PLATFORM_STACK_SIZE UL(0x440)
  117. # endif
  118. #elif defined(IMAGE_BL2)
  119. # if TRUSTED_BOARD_BOOT
  120. # define PLATFORM_STACK_SIZE UL(0x1000)
  121. # else
  122. # define PLATFORM_STACK_SIZE UL(0x400)
  123. # endif
  124. #elif defined(IMAGE_BL2U)
  125. # define PLATFORM_STACK_SIZE UL(0x400)
  126. #elif defined(IMAGE_BL31)
  127. # if SPM_MM
  128. # define PLATFORM_STACK_SIZE UL(0x500)
  129. # else
  130. # define PLATFORM_STACK_SIZE UL(0x400)
  131. # endif
  132. #elif defined(IMAGE_BL32)
  133. # define PLATFORM_STACK_SIZE UL(0x440)
  134. #endif
  135. #define PLAT_ARM_NSTIMER_FRAME_ID U(0)
  136. #define PLAT_ARM_TRUSTED_ROM_BASE U(0x0)
  137. #define PLAT_ARM_TRUSTED_ROM_SIZE UL(0x00020000) /* 128KB */
  138. #define PLAT_ARM_NSRAM_BASE ULL(0x06000000)
  139. #define PLAT_ARM_NSRAM_SIZE UL(0x00010000) /* 64KB */
  140. #define PLAT_CSS_MHU_BASE UL(0x45000000)
  141. #define PLAT_MHUV2_BASE PLAT_CSS_MHU_BASE
  142. #define PLAT_MAX_PWR_LVL U(2)
  143. /* Interrupt handling constants */
  144. #define MORELLO_IRQ_SEC_UART U(87)
  145. #define MORELLO_IRQ_DISPLAY_TCU_EVENT_Q U(107)
  146. #define MORELLO_IRQ_DISPLAY_TCU_CMD_SYNC U(111)
  147. #define MORELLO_IRQ_DISPLAY_TCU_GLOBAL U(113)
  148. #define MORELLO_IRQ_MMU_TCU1_EVENT_Q U(257)
  149. #define MORELLO_IRQ_MMU_TCU1_CMD_SYNC U(258)
  150. #define MORELLO_IRQ_MMU_TCU1_GLOBAL U(259)
  151. #define MORELLO_IRQ_MMU_TCU2_EVENT_Q U(264)
  152. #define MORELLO_IRQ_MMU_TCU2_CMD_SYNC U(265)
  153. #define MORELLO_IRQ_MMU_TCU2_GLOBAL U(266)
  154. #define MORELLO_IRQ_CLUSTER0_MHU U(349)
  155. #define MORELLO_IRQ_CLUSTER1_MHU U(351)
  156. #define MORELLO_IRQ_P0_REFCLK U(412)
  157. #define MORELLO_IRQ_P1_REFCLK U(413)
  158. #define PLAT_ARM_G1S_IRQ_PROPS(grp) \
  159. ARM_G1S_IRQ_PROPS(grp), \
  160. INTR_PROP_DESC(CSS_IRQ_MHU, \
  161. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  162. INTR_PROP_DESC(CSS_IRQ_TZ_WDOG, \
  163. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  164. INTR_PROP_DESC(CSS_IRQ_SEC_SYS_TIMER, \
  165. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  166. INTR_PROP_DESC(MORELLO_IRQ_SEC_UART, \
  167. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  168. INTR_PROP_DESC(MORELLO_IRQ_DISPLAY_TCU_EVENT_Q, \
  169. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  170. INTR_PROP_DESC(MORELLO_IRQ_DISPLAY_TCU_CMD_SYNC, \
  171. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  172. INTR_PROP_DESC(MORELLO_IRQ_DISPLAY_TCU_GLOBAL, \
  173. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  174. INTR_PROP_DESC(MORELLO_IRQ_MMU_TCU1_EVENT_Q, \
  175. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  176. INTR_PROP_DESC(MORELLO_IRQ_MMU_TCU1_CMD_SYNC, \
  177. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  178. INTR_PROP_DESC(MORELLO_IRQ_MMU_TCU1_GLOBAL, \
  179. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  180. INTR_PROP_DESC(MORELLO_IRQ_MMU_TCU2_EVENT_Q, \
  181. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  182. INTR_PROP_DESC(MORELLO_IRQ_MMU_TCU2_CMD_SYNC, \
  183. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  184. INTR_PROP_DESC(MORELLO_IRQ_MMU_TCU2_GLOBAL, \
  185. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  186. INTR_PROP_DESC(MORELLO_IRQ_CLUSTER0_MHU, \
  187. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  188. INTR_PROP_DESC(MORELLO_IRQ_CLUSTER1_MHU, \
  189. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  190. INTR_PROP_DESC(MORELLO_IRQ_P0_REFCLK, \
  191. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  192. INTR_PROP_DESC(MORELLO_IRQ_P1_REFCLK, \
  193. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL)
  194. #define PLAT_ARM_G0_IRQ_PROPS(grp) ARM_G0_IRQ_PROPS(grp)
  195. #define MORELLO_DEVICE_BASE ULL(0x08000000)
  196. #define MORELLO_DEVICE_SIZE ULL(0x48000000)
  197. /*Secure Watchdog Constants */
  198. #define SBSA_SECURE_WDOG_BASE UL(0x2A480000)
  199. #define SBSA_SECURE_WDOG_TIMEOUT UL(1000)
  200. #define MORELLO_MAP_DEVICE MAP_REGION_FLAT( \
  201. MORELLO_DEVICE_BASE, \
  202. MORELLO_DEVICE_SIZE, \
  203. MT_DEVICE | MT_RW | MT_SECURE)
  204. #define ARM_MAP_DRAM1 MAP_REGION_FLAT( \
  205. ARM_DRAM1_BASE, \
  206. ARM_DRAM1_SIZE, \
  207. MT_MEMORY | MT_RW | MT_NS)
  208. /* GIC related constants */
  209. #define PLAT_ARM_GICD_BASE UL(0x30000000)
  210. #define PLAT_ARM_GICC_BASE UL(0x2C000000)
  211. #define PLAT_ARM_GICR_BASE UL(0x300C0000)
  212. /* Number of SCMI channels on the platform */
  213. #define PLAT_ARM_SCMI_CHANNEL_COUNT U(1)
  214. /* Platform ID address */
  215. #define SSC_VERSION (SSC_REG_BASE + SSC_VERSION_OFFSET)
  216. #endif /* PLATFORM_DEF_H */