platform_def.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. /*
  2. * Copyright (c) 2017-2018, 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 <arch.h>
  9. #include <plat/common/common_def.h>
  10. #include <board_def.h>
  11. /*******************************************************************************
  12. * Generic platform constants
  13. ******************************************************************************/
  14. /* Size of cacheable stack */
  15. #if IMAGE_BL31
  16. #define PLATFORM_STACK_SIZE 0x800
  17. #else
  18. #define PLATFORM_STACK_SIZE 0x1000
  19. #endif
  20. #define PLATFORM_SYSTEM_COUNT 1
  21. #define PLATFORM_CORE_COUNT (K3_CLUSTER0_CORE_COUNT + \
  22. K3_CLUSTER1_CORE_COUNT + \
  23. K3_CLUSTER2_CORE_COUNT + \
  24. K3_CLUSTER3_CORE_COUNT)
  25. #define PLATFORM_CLUSTER_COUNT ((K3_CLUSTER0_CORE_COUNT != 0) + \
  26. (K3_CLUSTER1_CORE_COUNT != 0) + \
  27. (K3_CLUSTER2_CORE_COUNT != 0) + \
  28. (K3_CLUSTER3_CORE_COUNT != 0))
  29. #define PLAT_NUM_PWR_DOMAINS (PLATFORM_SYSTEM_COUNT + \
  30. PLATFORM_CLUSTER_COUNT + \
  31. PLATFORM_CORE_COUNT)
  32. #define PLAT_MAX_PWR_LVL MPIDR_AFFLVL2
  33. #define PLAT_MAX_OFF_STATE U(2)
  34. #define PLAT_MAX_RET_STATE U(1)
  35. /*******************************************************************************
  36. * Memory layout constants
  37. ******************************************************************************/
  38. /*
  39. * This RAM will be used for the bootloader including code, bss, and stacks.
  40. * It may need to be increased if BL31 grows in size.
  41. *
  42. * The link addresses are determined by BL31_BASE + offset.
  43. * When ENABLE_PIE is set, the TF images can be loaded anywhere, so
  44. * BL31_BASE is really arbitrary.
  45. *
  46. * When ENABLE_PIE is unset, BL31_BASE should be chosen so that
  47. * it matches to the physical address where BL31 is loaded, that is,
  48. * BL31_BASE should be the base address of the RAM region.
  49. *
  50. * Lets make things explicit by mapping BL31_BASE to 0x0 since ENABLE_PIE is
  51. * defined as default for our platform.
  52. */
  53. #define BL31_BASE UL(0x00000000) /* PIE remapped on fly */
  54. #define BL31_SIZE UL(0x00020000) /* 128k */
  55. #define BL31_LIMIT (BL31_BASE + BL31_SIZE)
  56. /*
  57. * Defines the maximum number of translation tables that are allocated by the
  58. * translation table library code. To minimize the amount of runtime memory
  59. * used, choose the smallest value needed to map the required virtual addresses
  60. * for each BL stage.
  61. */
  62. #define MAX_XLAT_TABLES 4
  63. /*
  64. * Defines the maximum number of regions that are allocated by the translation
  65. * table library code. A region consists of physical base address, virtual base
  66. * address, size and attributes (Device/Memory, RO/RW, Secure/Non-Secure), as
  67. * defined in the `mmap_region_t` structure. The platform defines the regions
  68. * that should be mapped. Then, the translation table library will create the
  69. * corresponding tables and descriptors at runtime. To minimize the amount of
  70. * runtime memory used, choose the smallest value needed to register the
  71. * required regions for each BL stage.
  72. */
  73. #if USE_COHERENT_MEM
  74. #define MAX_MMAP_REGIONS 11
  75. #else
  76. #define MAX_MMAP_REGIONS 10
  77. #endif
  78. /*
  79. * Defines the total size of the address space in bytes. For example, for a 32
  80. * bit address space, this value should be `(1ull << 32)`.
  81. */
  82. #define PLAT_PHY_ADDR_SPACE_SIZE (1ull << 32)
  83. #define PLAT_VIRT_ADDR_SPACE_SIZE (1ull << 32)
  84. /*
  85. * Some data must be aligned on the biggest cache line size in the platform.
  86. * This is known only to the platform as it might have a combination of
  87. * integrated and external caches.
  88. */
  89. #define CACHE_WRITEBACK_SHIFT 6
  90. #define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT)
  91. /* Platform default console definitions */
  92. #ifndef K3_USART_BASE
  93. #define K3_USART_BASE (0x02800000 + 0x10000 * K3_USART)
  94. #endif
  95. /* USART has a default size for address space */
  96. #define K3_USART_SIZE 0x1000
  97. #ifndef K3_USART_CLK_SPEED
  98. #define K3_USART_CLK_SPEED 48000000
  99. #endif
  100. /* Crash console defaults */
  101. #define CRASH_CONSOLE_BASE K3_USART_BASE
  102. #define CRASH_CONSOLE_CLK K3_USART_CLK_SPEED
  103. #define CRASH_CONSOLE_BAUD_RATE K3_USART_BAUD
  104. /* Timer frequency */
  105. #ifndef SYS_COUNTER_FREQ_IN_TICKS
  106. #define SYS_COUNTER_FREQ_IN_TICKS 200000000
  107. #endif
  108. /* Interrupt numbers */
  109. #define ARM_IRQ_SEC_PHY_TIMER 29
  110. #define ARM_IRQ_SEC_SGI_0 8
  111. #define ARM_IRQ_SEC_SGI_1 9
  112. #define ARM_IRQ_SEC_SGI_2 10
  113. #define ARM_IRQ_SEC_SGI_3 11
  114. #define ARM_IRQ_SEC_SGI_4 12
  115. #define ARM_IRQ_SEC_SGI_5 13
  116. #define ARM_IRQ_SEC_SGI_6 14
  117. #define ARM_IRQ_SEC_SGI_7 15
  118. /*
  119. * Define properties of Group 1 Secure and Group 0 interrupts as per GICv3
  120. * terminology. On a GICv2 system or mode, the lists will be merged and treated
  121. * as Group 0 interrupts.
  122. */
  123. #define PLAT_ARM_G1S_IRQ_PROPS(grp) \
  124. INTR_PROP_DESC(ARM_IRQ_SEC_PHY_TIMER, GIC_HIGHEST_SEC_PRIORITY, grp, \
  125. GIC_INTR_CFG_LEVEL), \
  126. INTR_PROP_DESC(ARM_IRQ_SEC_SGI_1, GIC_HIGHEST_SEC_PRIORITY, grp, \
  127. GIC_INTR_CFG_EDGE), \
  128. INTR_PROP_DESC(ARM_IRQ_SEC_SGI_2, GIC_HIGHEST_SEC_PRIORITY, grp, \
  129. GIC_INTR_CFG_EDGE), \
  130. INTR_PROP_DESC(ARM_IRQ_SEC_SGI_3, GIC_HIGHEST_SEC_PRIORITY, grp, \
  131. GIC_INTR_CFG_EDGE), \
  132. INTR_PROP_DESC(ARM_IRQ_SEC_SGI_4, GIC_HIGHEST_SEC_PRIORITY, grp, \
  133. GIC_INTR_CFG_EDGE), \
  134. INTR_PROP_DESC(ARM_IRQ_SEC_SGI_5, GIC_HIGHEST_SEC_PRIORITY, grp, \
  135. GIC_INTR_CFG_EDGE), \
  136. INTR_PROP_DESC(ARM_IRQ_SEC_SGI_7, GIC_HIGHEST_SEC_PRIORITY, grp, \
  137. GIC_INTR_CFG_EDGE)
  138. #define PLAT_ARM_G0_IRQ_PROPS(grp) \
  139. INTR_PROP_DESC(ARM_IRQ_SEC_SGI_0, GIC_HIGHEST_SEC_PRIORITY, grp, \
  140. GIC_INTR_CFG_EDGE), \
  141. INTR_PROP_DESC(ARM_IRQ_SEC_SGI_6, GIC_HIGHEST_SEC_PRIORITY, grp, \
  142. GIC_INTR_CFG_EDGE)
  143. #define K3_GTC_BASE 0x00A90000
  144. /* We just need 20 byte offset, but simpler to just remap the 64K page in */
  145. #define K3_GTC_SIZE 0x10000
  146. #define K3_GTC_CNTCR_OFFSET 0x00
  147. #define K3_GTC_CNTCR_EN_MASK 0x01
  148. #define K3_GTC_CNTCR_HDBG_MASK 0x02
  149. #define K3_GTC_CNTFID0_OFFSET 0x20
  150. #define K3_GIC_BASE 0x01800000
  151. #define K3_GIC_SIZE 0x200000
  152. #if !K3_SEC_PROXY_LITE
  153. #define SEC_PROXY_DATA_BASE 0x32C00000
  154. #define SEC_PROXY_DATA_SIZE 0x80000
  155. #define SEC_PROXY_SCFG_BASE 0x32800000
  156. #define SEC_PROXY_SCFG_SIZE 0x80000
  157. #define SEC_PROXY_RT_BASE 0x32400000
  158. #define SEC_PROXY_RT_SIZE 0x80000
  159. #else
  160. #define SEC_PROXY_DATA_BASE 0x4D000000
  161. #define SEC_PROXY_DATA_SIZE 0x80000
  162. #define SEC_PROXY_SCFG_BASE 0x4A400000
  163. #define SEC_PROXY_SCFG_SIZE 0x80000
  164. #define SEC_PROXY_RT_BASE 0x4A600000
  165. #define SEC_PROXY_RT_SIZE 0x80000
  166. #endif /* K3_SEC_PROXY_LITE */
  167. #define SEC_PROXY_TIMEOUT_US 1000000
  168. #define SEC_PROXY_MAX_MESSAGE_SIZE 56
  169. #define TI_SCI_HOST_ID 10
  170. #define TI_SCI_MAX_MESSAGE_SIZE 52
  171. #endif /* PLATFORM_DEF_H */