platform_def.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. /*
  2. * Copyright (c) 2018-2022, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef PLATFORM_DEF_H
  7. #define PLATFORM_DEF_H
  8. #include <lib/utils_def.h>
  9. #include <plat/common/common_def.h>
  10. /* CPU topology */
  11. #define PLAT_MAX_CORES_PER_CLUSTER U(2)
  12. #define PLAT_CLUSTER_COUNT U(12)
  13. #define PLATFORM_CORE_COUNT (PLAT_CLUSTER_COUNT * \
  14. PLAT_MAX_CORES_PER_CLUSTER)
  15. /* Macros to read the SQ power domain state */
  16. #define SQ_PWR_LVL0 MPIDR_AFFLVL0
  17. #define SQ_PWR_LVL1 MPIDR_AFFLVL1
  18. #define SQ_PWR_LVL2 MPIDR_AFFLVL2
  19. #define SQ_CORE_PWR_STATE(state) (state)->pwr_domain_state[SQ_PWR_LVL0]
  20. #define SQ_CLUSTER_PWR_STATE(state) (state)->pwr_domain_state[SQ_PWR_LVL1]
  21. #define SQ_SYSTEM_PWR_STATE(state) ((PLAT_MAX_PWR_LVL > SQ_PWR_LVL1) ?\
  22. (state)->pwr_domain_state[SQ_PWR_LVL2] : 0)
  23. #define PLAT_MAX_PWR_LVL U(1)
  24. #define PLAT_MAX_RET_STATE U(1)
  25. #define PLAT_MAX_OFF_STATE U(2)
  26. #define SQ_LOCAL_STATE_RUN 0
  27. #define SQ_LOCAL_STATE_RET 1
  28. #define SQ_LOCAL_STATE_OFF 2
  29. #define CACHE_WRITEBACK_SHIFT 6
  30. #define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT)
  31. #define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 32)
  32. #define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 32)
  33. #define MAX_XLAT_TABLES 8
  34. #define MAX_MMAP_REGIONS 8
  35. #if TRUSTED_BOARD_BOOT
  36. #define PLATFORM_STACK_SIZE 0x1000
  37. #else
  38. #define PLATFORM_STACK_SIZE 0x400
  39. #endif
  40. #if !RESET_TO_BL31
  41. /* A mailbox page will be mapped from BL2 and BL31 */
  42. #define BL2_MAILBOX_BASE 0x0403f000
  43. #define BL2_MAILBOX_SIZE 0x1000
  44. #define PLAT_SQ_BOOTIDX_BASE 0x08510000
  45. #define PLAT_SQ_MAX_BOOT_INDEX 2
  46. #define MAX_IO_HANDLES 2
  47. #define MAX_IO_DEVICES 2
  48. #define MAX_IO_BLOCK_DEVICES U(1)
  49. #define BL2_BASE 0x04000000
  50. #define BL2_SIZE (256 * 1024)
  51. #define BL2_LIMIT (BL2_BASE + BL2_SIZE)
  52. /* If BL2 is enabled, the BL31 is loaded on secure DRAM */
  53. #define BL31_BASE 0xfbe00000
  54. #define BL31_SIZE 0x00100000
  55. #else
  56. #define BL31_BASE 0x04000000
  57. #define BL31_SIZE 0x00080000
  58. #endif
  59. #define BL31_LIMIT (BL31_BASE + BL31_SIZE)
  60. #define BL32_BASE 0xfc000000
  61. #define BL32_SIZE 0x03c00000
  62. #define BL32_LIMIT (BL32_BASE + BL32_SIZE)
  63. /* Alternative BL33 */
  64. #define PLAT_SQ_BL33_BASE 0xe0000000
  65. #define PLAT_SQ_BL33_SIZE 0x00200000
  66. /* FWU FIP IO base */
  67. #define PLAT_SQ_FIP_IOBASE 0x08600000
  68. #define PLAT_SQ_FIP_MAXSIZE 0x00400000
  69. #define PLAT_SQ_CCN_BASE 0x32000000
  70. #define PLAT_SQ_CLUSTER_TO_CCN_ID_MAP \
  71. 0, /* Cluster 0 */ \
  72. 18, /* Cluster 1 */ \
  73. 11, /* Cluster 2 */ \
  74. 29, /* Cluster 3 */ \
  75. 35, /* Cluster 4 */ \
  76. 17, /* Cluster 5 */ \
  77. 12, /* Cluster 6 */ \
  78. 30, /* Cluster 7 */ \
  79. 14, /* Cluster 8 */ \
  80. 32, /* Cluster 9 */ \
  81. 15, /* Cluster 10 */ \
  82. 33 /* Cluster 11 */
  83. /* UART related constants */
  84. #define PLAT_SQ_BOOT_UART_BASE 0x2A400000
  85. #define PLAT_SQ_BOOT_UART_CLK_IN_HZ 62500000
  86. #define SQ_CONSOLE_BAUDRATE 115200
  87. #define SQ_SYS_CNTCTL_BASE 0x2a430000
  88. #define SQ_SYS_TIMCTL_BASE 0x2a810000
  89. #define PLAT_SQ_NSTIMER_FRAME_ID 0
  90. #define SQ_SYS_CNT_BASE_NS 0x2a830000
  91. #define DRAMINFO_BASE 0x2E00FFC0
  92. #define PLAT_SQ_MHU_BASE 0x45000000
  93. #define PLAT_SQ_SCP_COM_SHARED_MEM_BASE 0x45400000
  94. #define SCPI_CMD_GET_DRAMINFO 0x1
  95. #define SQ_BOOT_CFG_ADDR 0x45410000
  96. #define PLAT_SQ_PRIMARY_CPU_SHIFT 8
  97. #define PLAT_SQ_PRIMARY_CPU_BIT_WIDTH 6
  98. #define PLAT_SQ_GICD_BASE 0x30000000
  99. #define PLAT_SQ_GICR_BASE 0x30400000
  100. #define PLAT_SQ_GPIO_BASE 0x51000000
  101. #define PLAT_SPM_BUF_BASE (BL32_LIMIT - 32 * PLAT_SPM_BUF_SIZE)
  102. #define PLAT_SPM_BUF_SIZE ULL(0x10000)
  103. #define PLAT_SPM_SPM_BUF_EL0_MMAP MAP_REGION2(PLAT_SPM_BUF_BASE, \
  104. PLAT_SPM_BUF_BASE, \
  105. PLAT_SPM_BUF_SIZE, \
  106. MT_RO_DATA | MT_SECURE | \
  107. MT_USER, PAGE_SIZE)
  108. #define PLAT_SP_IMAGE_NS_BUF_BASE BL32_LIMIT
  109. #define PLAT_SP_IMAGE_NS_BUF_SIZE ULL(0x200000)
  110. #define PLAT_SP_IMAGE_NS_BUF_MMAP MAP_REGION2(PLAT_SP_IMAGE_NS_BUF_BASE, \
  111. PLAT_SP_IMAGE_NS_BUF_BASE, \
  112. PLAT_SP_IMAGE_NS_BUF_SIZE, \
  113. MT_RW_DATA | MT_NS | \
  114. MT_USER, PAGE_SIZE)
  115. #define PLAT_SP_IMAGE_STACK_PCPU_SIZE ULL(0x10000)
  116. #define PLAT_SP_IMAGE_STACK_SIZE (32 * PLAT_SP_IMAGE_STACK_PCPU_SIZE)
  117. #define PLAT_SP_IMAGE_STACK_BASE (PLAT_SQ_SP_HEAP_BASE + PLAT_SQ_SP_HEAP_SIZE)
  118. #define PLAT_SQ_SP_IMAGE_SIZE ULL(0x200000)
  119. #define PLAT_SQ_SP_IMAGE_MMAP MAP_REGION2(BL32_BASE, BL32_BASE, \
  120. PLAT_SQ_SP_IMAGE_SIZE, \
  121. MT_CODE | MT_SECURE | \
  122. MT_USER, PAGE_SIZE)
  123. #define PLAT_SQ_SP_HEAP_BASE (BL32_BASE + PLAT_SQ_SP_IMAGE_SIZE)
  124. #define PLAT_SQ_SP_HEAP_SIZE ULL(0x800000)
  125. #define PLAT_SQ_SP_IMAGE_RW_MMAP MAP_REGION2(PLAT_SQ_SP_HEAP_BASE, \
  126. PLAT_SQ_SP_HEAP_BASE, \
  127. (PLAT_SQ_SP_HEAP_SIZE + \
  128. PLAT_SP_IMAGE_STACK_SIZE), \
  129. MT_RW_DATA | MT_SECURE | \
  130. MT_USER, PAGE_SIZE)
  131. #define PLAT_SQ_SP_PRIV_BASE (PLAT_SP_IMAGE_STACK_BASE + \
  132. PLAT_SP_IMAGE_STACK_SIZE)
  133. #define PLAT_SQ_SP_PRIV_SIZE ULL(0x40000)
  134. #define PLAT_SP_PRI 0x20
  135. #define PLAT_PRI_BITS 2
  136. #define PLAT_SPM_COOKIE_0 ULL(0)
  137. #define PLAT_SPM_COOKIE_1 ULL(0)
  138. /* Total number of memory regions with distinct properties */
  139. #define PLAT_SP_IMAGE_NUM_MEM_REGIONS 6
  140. #define PLAT_SP_IMAGE_MMAP_REGIONS 30
  141. #define PLAT_SP_IMAGE_MAX_XLAT_TABLES 20
  142. #define PLAT_SP_IMAGE_XLAT_SECTION_NAME ".sp_xlat_table"
  143. #define PLAT_SP_IMAGE_BASE_XLAT_SECTION_NAME ".sp_xlat_table"
  144. #define PLAT_SQ_UART1_BASE PLAT_SQ_BOOT_UART_BASE
  145. #define PLAT_SQ_UART1_SIZE ULL(0x1000)
  146. #define PLAT_SQ_UART1_MMAP MAP_REGION_FLAT(PLAT_SQ_UART1_BASE, \
  147. PLAT_SQ_UART1_SIZE, \
  148. MT_DEVICE | MT_RW | \
  149. MT_NS | MT_PRIVILEGED)
  150. #define PLAT_SQ_PERIPH_BASE 0x50000000
  151. #define PLAT_SQ_PERIPH_SIZE ULL(0x8000000)
  152. #define PLAT_SQ_PERIPH_MMAP MAP_REGION_FLAT(PLAT_SQ_PERIPH_BASE, \
  153. PLAT_SQ_PERIPH_SIZE, \
  154. MT_DEVICE | MT_RW | \
  155. MT_NS | MT_USER)
  156. #define PLAT_SQ_FLASH_BASE 0x08000000
  157. #define PLAT_SQ_FLASH_SIZE ULL(0x8000000)
  158. #define PLAT_SQ_FLASH_MMAP MAP_REGION_FLAT(PLAT_SQ_FLASH_BASE, \
  159. PLAT_SQ_FLASH_SIZE, \
  160. MT_DEVICE | MT_RW | \
  161. MT_NS | MT_USER)
  162. #endif /* PLATFORM_DEF_H */