platform_def.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /*
  2. * Copyright (c) 2015-2024, 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 <drivers/arm/gic_common.h>
  10. #include <lib/utils_def.h>
  11. #include <plat/common/common_def.h>
  12. #include "../stm32mp1_def.h"
  13. /*******************************************************************************
  14. * Generic platform constants
  15. ******************************************************************************/
  16. /* Size of cacheable stacks */
  17. #if defined(IMAGE_BL32)
  18. #define PLATFORM_STACK_SIZE 0x600
  19. #else
  20. #define PLATFORM_STACK_SIZE 0xC00
  21. #endif
  22. #define STM32MP_PRIMARY_CPU U(0x0)
  23. #define STM32MP_SECONDARY_CPU U(0x1)
  24. #define PLATFORM_CLUSTER_COUNT U(1)
  25. #define PLATFORM_CLUSTER0_CORE_COUNT U(2)
  26. #define PLATFORM_CLUSTER1_CORE_COUNT U(0)
  27. #define PLATFORM_CORE_COUNT (PLATFORM_CLUSTER1_CORE_COUNT + \
  28. PLATFORM_CLUSTER0_CORE_COUNT)
  29. #define PLATFORM_MAX_CPUS_PER_CLUSTER 2
  30. #define MAX_IO_DEVICES U(4)
  31. #define MAX_IO_HANDLES U(4)
  32. #define MAX_IO_BLOCK_DEVICES U(1)
  33. #define MAX_IO_MTD_DEVICES U(1)
  34. /*******************************************************************************
  35. * BL2 specific defines.
  36. ******************************************************************************/
  37. /*
  38. * Put BL2 just below BL3-1. BL2_BASE is calculated using the current BL2 debug
  39. * size plus a little space for growth.
  40. */
  41. #define BL2_BASE STM32MP_BL2_BASE
  42. #define BL2_LIMIT (STM32MP_BL2_BASE + \
  43. STM32MP_BL2_SIZE)
  44. #define BL2_RO_BASE STM32MP_BL2_RO_BASE
  45. #define BL2_RO_LIMIT (STM32MP_BL2_RO_BASE + \
  46. STM32MP_BL2_RO_SIZE)
  47. #define BL2_RW_BASE STM32MP_BL2_RW_BASE
  48. #define BL2_RW_LIMIT (STM32MP_BL2_RW_BASE + \
  49. STM32MP_BL2_RW_SIZE)
  50. /*******************************************************************************
  51. * BL32 specific defines.
  52. ******************************************************************************/
  53. #if defined(IMAGE_BL32)
  54. #if ENABLE_PIE
  55. #define BL32_BASE 0
  56. #define BL32_LIMIT STM32MP_BL32_SIZE
  57. #else
  58. #define BL32_BASE STM32MP_BL32_BASE
  59. #define BL32_LIMIT (STM32MP_BL32_BASE + \
  60. STM32MP_BL32_SIZE)
  61. #endif
  62. #endif /* defined(IMAGE_BL32) */
  63. /*******************************************************************************
  64. * BL33 specific defines.
  65. ******************************************************************************/
  66. #define BL33_BASE STM32MP_BL33_BASE
  67. /*******************************************************************************
  68. * DTB specific defines.
  69. ******************************************************************************/
  70. #define DTB_BASE STM32MP_DTB_BASE
  71. #define DTB_LIMIT (STM32MP_DTB_BASE + \
  72. STM32MP_DTB_SIZE)
  73. /*******************************************************************************
  74. * Platform specific page table and MMU setup constants
  75. ******************************************************************************/
  76. #define PLAT_PHY_ADDR_SPACE_SIZE (ULL(1) << 32)
  77. #define PLAT_VIRT_ADDR_SPACE_SIZE (ULL(1) << 32)
  78. /*******************************************************************************
  79. * Declarations and constants to access the mailboxes safely. Each mailbox is
  80. * aligned on the biggest cache line size in the platform. This is known only
  81. * to the platform as it might have a combination of integrated and external
  82. * caches. Such alignment ensures that two maiboxes do not sit on the same cache
  83. * line at any cache level. They could belong to different cpus/clusters &
  84. * get written while being protected by different locks causing corruption of
  85. * a valid mailbox address.
  86. ******************************************************************************/
  87. #define CACHE_WRITEBACK_SHIFT 6
  88. #define CACHE_WRITEBACK_GRANULE (U(1) << CACHE_WRITEBACK_SHIFT)
  89. /*
  90. * Secure Interrupt: based on the standard ARM mapping
  91. */
  92. #define ARM_IRQ_SEC_PHY_TIMER U(29)
  93. #define ARM_IRQ_SEC_SGI_0 U(8)
  94. #define ARM_IRQ_SEC_SGI_1 U(9)
  95. #define ARM_IRQ_SEC_SGI_2 U(10)
  96. #define ARM_IRQ_SEC_SGI_3 U(11)
  97. #define ARM_IRQ_SEC_SGI_4 U(12)
  98. #define ARM_IRQ_SEC_SGI_5 U(13)
  99. #define ARM_IRQ_SEC_SGI_6 U(14)
  100. #define ARM_IRQ_SEC_SGI_7 U(15)
  101. #define STM32MP1_IRQ_TZC400 U(36)
  102. #define STM32MP1_IRQ_TAMPSERRS U(229)
  103. #define STM32MP1_IRQ_AXIERRIRQ U(244)
  104. /*
  105. * Define a list of Group 1 Secure and Group 0 interrupts as per GICv3
  106. * terminology. On a GICv2 system or mode, the lists will be merged and treated
  107. * as Group 0 interrupts.
  108. */
  109. #define PLATFORM_G1S_PROPS(grp) \
  110. INTR_PROP_DESC(ARM_IRQ_SEC_PHY_TIMER, \
  111. GIC_HIGHEST_SEC_PRIORITY, \
  112. grp, GIC_INTR_CFG_LEVEL), \
  113. INTR_PROP_DESC(STM32MP1_IRQ_AXIERRIRQ, \
  114. GIC_HIGHEST_SEC_PRIORITY, \
  115. grp, GIC_INTR_CFG_LEVEL), \
  116. INTR_PROP_DESC(STM32MP1_IRQ_TZC400, \
  117. GIC_HIGHEST_SEC_PRIORITY, \
  118. grp, GIC_INTR_CFG_LEVEL), \
  119. INTR_PROP_DESC(ARM_IRQ_SEC_SGI_1, \
  120. GIC_HIGHEST_SEC_PRIORITY, \
  121. grp, GIC_INTR_CFG_EDGE), \
  122. INTR_PROP_DESC(ARM_IRQ_SEC_SGI_2, \
  123. GIC_HIGHEST_SEC_PRIORITY, \
  124. grp, GIC_INTR_CFG_EDGE), \
  125. INTR_PROP_DESC(ARM_IRQ_SEC_SGI_3, \
  126. GIC_HIGHEST_SEC_PRIORITY, \
  127. grp, GIC_INTR_CFG_EDGE), \
  128. INTR_PROP_DESC(ARM_IRQ_SEC_SGI_4, \
  129. GIC_HIGHEST_SEC_PRIORITY, \
  130. grp, GIC_INTR_CFG_EDGE), \
  131. INTR_PROP_DESC(ARM_IRQ_SEC_SGI_5, \
  132. GIC_HIGHEST_SEC_PRIORITY, \
  133. grp, GIC_INTR_CFG_EDGE), \
  134. INTR_PROP_DESC(ARM_IRQ_SEC_SGI_7, \
  135. GIC_HIGHEST_SEC_PRIORITY, \
  136. grp, GIC_INTR_CFG_EDGE)
  137. #define PLATFORM_G0_PROPS(grp) \
  138. INTR_PROP_DESC(ARM_IRQ_SEC_SGI_0, \
  139. GIC_HIGHEST_SEC_PRIORITY, \
  140. grp, GIC_INTR_CFG_EDGE), \
  141. INTR_PROP_DESC(ARM_IRQ_SEC_SGI_6, \
  142. GIC_HIGHEST_SEC_PRIORITY, \
  143. grp, GIC_INTR_CFG_EDGE)
  144. /*
  145. * Power
  146. */
  147. #define PLAT_MAX_PWR_LVL U(1)
  148. /* Local power state for power domains in Run state. */
  149. #define ARM_LOCAL_STATE_RUN U(0)
  150. /* Local power state for retention. Valid only for CPU power domains */
  151. #define ARM_LOCAL_STATE_RET U(1)
  152. /* Local power state for power-down. Valid for CPU and cluster power domains */
  153. #define ARM_LOCAL_STATE_OFF U(2)
  154. /*
  155. * This macro defines the deepest retention state possible.
  156. * A higher state id will represent an invalid or a power down state.
  157. */
  158. #define PLAT_MAX_RET_STATE ARM_LOCAL_STATE_RET
  159. /*
  160. * This macro defines the deepest power down states possible. Any state ID
  161. * higher than this is invalid.
  162. */
  163. #define PLAT_MAX_OFF_STATE ARM_LOCAL_STATE_OFF
  164. /*******************************************************************************
  165. * Size of the per-cpu data in bytes that should be reserved in the generic
  166. * per-cpu data structure for the FVP port.
  167. ******************************************************************************/
  168. #define PLAT_PCPU_DATA_SIZE 2
  169. /*******************************************************************************
  170. * Number of parallel entry slots in SMT SCMI server entry context. For this
  171. * platform, SCMI server is reached through SMC only, hence the number of
  172. * entry slots.
  173. ******************************************************************************/
  174. #define PLAT_SMT_ENTRY_COUNT PLATFORM_CORE_COUNT
  175. #endif /* PLATFORM_DEF_H */