platform_def.h 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. /*
  2. * Copyright (c) 2018-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 0x2A400000
  13. #define PLAT_ARM_BOOT_UART_CLK_IN_HZ 50000000
  14. /* IOFPGA UART0 */
  15. #define PLAT_ARM_RUN_UART_BASE 0x1C090000
  16. #define PLAT_ARM_RUN_UART_CLK_IN_HZ 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 0x18200000
  24. #define PLAT_ARM_FLASH_IMAGE_MAX_SIZE 0x00800000
  25. #define PLAT_ARM_NVM_BASE 0x18200000
  26. #define PLAT_ARM_NVM_SIZE 0x00800000
  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. /* Non-volatile counters */
  32. #define SOC_TRUSTED_NVCTR_BASE 0x7fe70000
  33. #define TFW_NVCTR_BASE (SOC_TRUSTED_NVCTR_BASE)
  34. #define TFW_NVCTR_SIZE U(4)
  35. #define NTFW_CTR_BASE (SOC_TRUSTED_NVCTR_BASE + 0x0004)
  36. #define NTFW_CTR_SIZE U(4)
  37. /* N1SDP remote chip at 4 TB offset */
  38. #define PLAT_ARM_REMOTE_CHIP_OFFSET (ULL(1) << 42)
  39. #define N1SDP_REMOTE_DRAM1_BASE ARM_DRAM1_BASE + \
  40. PLAT_ARM_REMOTE_CHIP_OFFSET
  41. #define N1SDP_REMOTE_DRAM1_SIZE ARM_DRAM1_SIZE
  42. #define N1SDP_REMOTE_DRAM2_BASE PLAT_ARM_DRAM2_BASE + \
  43. PLAT_ARM_REMOTE_CHIP_OFFSET
  44. #define N1SDP_REMOTE_DRAM2_SIZE PLAT_ARM_DRAM2_SIZE
  45. /*
  46. * N1SDP platform supports RDIMMs with ECC capability. To use the ECC
  47. * capability, the entire DDR memory space has to be zeroed out before
  48. * enabling the ECC bits in DMC620. To access the complete DDR memory
  49. * along with remote chip's DDR memory, which is at 4 TB offset, physical
  50. * and virtual address space limits are extended to 43-bits.
  51. */
  52. #ifdef __aarch64__
  53. #define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 43)
  54. #define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 43)
  55. #else
  56. #define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 32)
  57. #define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 32)
  58. #endif
  59. #if CSS_USE_SCMI_SDS_DRIVER
  60. #define N1SDP_SCMI_PAYLOAD_BASE 0x45400000
  61. /*
  62. * Index of SDS region used in the communication with SCP
  63. */
  64. #define SDS_SCP_AP_REGION_ID U(0)
  65. #else
  66. #define PLAT_CSS_SCP_COM_SHARED_MEM_BASE 0x45400000
  67. #endif
  68. /*
  69. * Trusted SRAM in N1SDP is 512 KB but only the bottom 384 KB
  70. * is used for trusted board boot flow. The top 128 KB is used
  71. * to load AP-BL1 image.
  72. */
  73. #define PLAT_ARM_TRUSTED_SRAM_SIZE 0x00060000 /* 384 KB */
  74. /*
  75. * PLAT_ARM_MAX_BL1_RW_SIZE is calculated using the current BL1 RW debug size
  76. * plus a little space for growth.
  77. */
  78. #define PLAT_ARM_MAX_BL1_RW_SIZE 0xC000
  79. /*
  80. * PLAT_ARM_MAX_ROMLIB_RW_SIZE is define to use a full page
  81. */
  82. #if USE_ROMLIB
  83. # define PLAT_ARM_MAX_ROMLIB_RW_SIZE 0x1000
  84. # define PLAT_ARM_MAX_ROMLIB_RO_SIZE 0xe000
  85. #else
  86. # define PLAT_ARM_MAX_ROMLIB_RW_SIZE U(0)
  87. # define PLAT_ARM_MAX_ROMLIB_RO_SIZE U(0)
  88. #endif
  89. /*
  90. * PLAT_ARM_MAX_BL2_SIZE is calculated using the current BL2 debug size plus a
  91. * little space for growth.
  92. */
  93. #if TRUSTED_BOARD_BOOT
  94. # define PLAT_ARM_MAX_BL2_SIZE 0x22000
  95. #else
  96. # define PLAT_ARM_MAX_BL2_SIZE 0x14000
  97. #endif
  98. #define PLAT_ARM_MAX_BL31_SIZE UL(0x40000)
  99. #define PLAT_ARM_SPMC_BASE U(0x08000000)
  100. #define PLAT_ARM_SPMC_SIZE UL(0x02000000) /* 32 MB */
  101. /*******************************************************************************
  102. * N1SDP topology related constants
  103. ******************************************************************************/
  104. #define N1SDP_MAX_CPUS_PER_CLUSTER U(2)
  105. #define PLAT_ARM_CLUSTER_COUNT U(2)
  106. #define PLAT_N1SDP_CHIP_COUNT U(2)
  107. #define N1SDP_MAX_CLUSTERS_PER_CHIP U(2)
  108. #define N1SDP_MAX_PE_PER_CPU U(1)
  109. #define PLATFORM_CORE_COUNT (PLAT_N1SDP_CHIP_COUNT * \
  110. PLAT_ARM_CLUSTER_COUNT * \
  111. N1SDP_MAX_CPUS_PER_CLUSTER * \
  112. N1SDP_MAX_PE_PER_CPU)
  113. /* System power domain level */
  114. #define CSS_SYSTEM_PWR_DMN_LVL ARM_PWR_LVL3
  115. /*
  116. * PLAT_ARM_MMAP_ENTRIES depends on the number of entries in the
  117. * plat_arm_mmap array defined for each BL stage.
  118. */
  119. #ifdef IMAGE_BL1
  120. # define PLAT_ARM_MMAP_ENTRIES U(6)
  121. # define MAX_XLAT_TABLES U(5)
  122. #endif
  123. #ifdef IMAGE_BL2
  124. # define PLAT_ARM_MMAP_ENTRIES U(11)
  125. # define MAX_XLAT_TABLES U(10)
  126. #endif
  127. #ifdef IMAGE_BL31
  128. # define PLAT_ARM_MMAP_ENTRIES U(12)
  129. # define MAX_XLAT_TABLES U(12)
  130. #endif
  131. /*
  132. * Size of cacheable stacks
  133. */
  134. #if defined(IMAGE_BL1)
  135. # if TRUSTED_BOARD_BOOT
  136. # define PLATFORM_STACK_SIZE 0x1000
  137. # else
  138. # define PLATFORM_STACK_SIZE 0x440
  139. # endif
  140. #elif defined(IMAGE_BL2)
  141. # if TRUSTED_BOARD_BOOT
  142. # define PLATFORM_STACK_SIZE 0x1000
  143. # else
  144. # define PLATFORM_STACK_SIZE 0x400
  145. # endif
  146. #elif defined(IMAGE_BL2U)
  147. # define PLATFORM_STACK_SIZE 0x400
  148. #elif defined(IMAGE_BL31)
  149. # if SPM_MM
  150. # define PLATFORM_STACK_SIZE 0x500
  151. # else
  152. # define PLATFORM_STACK_SIZE 0x400
  153. # endif
  154. #elif defined(IMAGE_BL32)
  155. # define PLATFORM_STACK_SIZE 0x440
  156. #endif
  157. #define PLAT_ARM_NSTIMER_FRAME_ID 0
  158. #define PLAT_CSS_MHU_BASE 0x45000000
  159. #define PLAT_MAX_PWR_LVL 2
  160. /* Interrupt handling constants */
  161. #define N1SDP_IRQ_MMU_TCU1_EVENT_Q_SEC U(257)
  162. #define N1SDP_IRQ_MMU_TCU1_CMD_SYNC_SEC U(258)
  163. #define N1SDP_IRQ_MMU_TCU1_GLOBAL U(259)
  164. #define N1SDP_IRQ_MMU_TCU2_EVENT_Q_SEC U(264)
  165. #define N1SDP_IRQ_MMU_TCU2_CMD_SYNC_SEC U(265)
  166. #define N1SDP_IRQ_MMU_TCU2_GLOBAL U(266)
  167. #define N1SDP_IRQ_CLUSTER0_MHU U(349)
  168. #define N1SDP_IRQ_CLUSTER1_MHU U(351)
  169. #define N1SDP_IRQ_P0_REFCLK U(412)
  170. #define N1SDP_IRQ_P1_REFCLK U(413)
  171. #define PLAT_ARM_G1S_IRQ_PROPS(grp) \
  172. ARM_G1S_IRQ_PROPS(grp), \
  173. INTR_PROP_DESC(CSS_IRQ_MHU, \
  174. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  175. INTR_PROP_DESC(CSS_IRQ_TZ_WDOG, \
  176. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  177. INTR_PROP_DESC(CSS_IRQ_SEC_SYS_TIMER, \
  178. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  179. INTR_PROP_DESC(N1SDP_IRQ_MMU_TCU1_EVENT_Q_SEC, \
  180. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  181. INTR_PROP_DESC(N1SDP_IRQ_MMU_TCU1_CMD_SYNC_SEC, \
  182. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  183. INTR_PROP_DESC(N1SDP_IRQ_MMU_TCU1_GLOBAL, \
  184. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  185. INTR_PROP_DESC(N1SDP_IRQ_MMU_TCU2_EVENT_Q_SEC, \
  186. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  187. INTR_PROP_DESC(N1SDP_IRQ_MMU_TCU2_CMD_SYNC_SEC, \
  188. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  189. INTR_PROP_DESC(N1SDP_IRQ_MMU_TCU2_GLOBAL, \
  190. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  191. INTR_PROP_DESC(N1SDP_IRQ_CLUSTER0_MHU, \
  192. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  193. INTR_PROP_DESC(N1SDP_IRQ_CLUSTER1_MHU, \
  194. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  195. INTR_PROP_DESC(N1SDP_IRQ_P0_REFCLK, \
  196. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
  197. INTR_PROP_DESC(N1SDP_IRQ_P1_REFCLK, \
  198. GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL)
  199. #define PLAT_ARM_G0_IRQ_PROPS(grp) ARM_G0_IRQ_PROPS(grp)
  200. #define N1SDP_DEVICE_BASE ULL(0x08000000)
  201. #define N1SDP_DEVICE_SIZE ULL(0x48000000)
  202. #define N1SDP_REMOTE_DEVICE_BASE N1SDP_DEVICE_BASE + \
  203. PLAT_ARM_REMOTE_CHIP_OFFSET
  204. #define N1SDP_REMOTE_DEVICE_SIZE N1SDP_DEVICE_SIZE
  205. /* Real base is 0x0. Changed to load BL1 at this address */
  206. # define PLAT_ARM_TRUSTED_ROM_BASE 0x04060000
  207. # define PLAT_ARM_TRUSTED_ROM_SIZE 0x00020000 /* 128KB */
  208. #define N1SDP_MAP_DEVICE MAP_REGION_FLAT( \
  209. N1SDP_DEVICE_BASE, \
  210. N1SDP_DEVICE_SIZE, \
  211. MT_DEVICE | MT_RW | MT_SECURE)
  212. #define ARM_MAP_DRAM1 MAP_REGION_FLAT( \
  213. ARM_DRAM1_BASE, \
  214. ARM_DRAM1_SIZE, \
  215. MT_MEMORY | MT_RW | MT_NS)
  216. #define N1SDP_MAP_REMOTE_DEVICE MAP_REGION_FLAT( \
  217. N1SDP_REMOTE_DEVICE_BASE, \
  218. N1SDP_REMOTE_DEVICE_SIZE, \
  219. MT_DEVICE | MT_RW | MT_SECURE)
  220. #define N1SDP_MAP_REMOTE_DRAM1 MAP_REGION_FLAT( \
  221. N1SDP_REMOTE_DRAM1_BASE, \
  222. N1SDP_REMOTE_DRAM1_SIZE, \
  223. MT_MEMORY | MT_RW | MT_NS)
  224. #define N1SDP_MAP_REMOTE_DRAM2 MAP_REGION_FLAT( \
  225. N1SDP_REMOTE_DRAM2_BASE, \
  226. N1SDP_REMOTE_DRAM2_SIZE, \
  227. MT_MEMORY | MT_RW | MT_NS)
  228. /* GIC related constants */
  229. #define PLAT_ARM_GICD_BASE 0x30000000
  230. #define PLAT_ARM_GICC_BASE 0x2C000000
  231. #define PLAT_ARM_GICR_BASE 0x300C0000
  232. /* Platform ID address */
  233. #define SSC_VERSION (SSC_REG_BASE + SSC_VERSION_OFFSET)
  234. /* Secure Watchdog Constants */
  235. #define SBSA_SECURE_WDOG_BASE UL(0x2A480000)
  236. #define SBSA_SECURE_WDOG_TIMEOUT UL(100)
  237. /* Number of SCMI channels on the platform */
  238. #define PLAT_ARM_SCMI_CHANNEL_COUNT U(1)
  239. #endif /* PLATFORM_DEF_H */