platform.mk 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. # Copyright (c) 2021-2024, Arm Limited. All rights reserved.
  2. #
  3. # SPDX-License-Identifier: BSD-3-Clause
  4. #
  5. include common/fdt_wrappers.mk
  6. TARGET_FLAVOUR := fvp
  7. # DPU with SCMI may not necessarily work, so allow its independence
  8. TC_DPU_USE_SCMI_CLK := 1
  9. # SCMI power domain control enable
  10. TC_SCMI_PD_CTRL_EN := 1
  11. # System setup
  12. CSS_USE_SCMI_SDS_DRIVER := 1
  13. HW_ASSISTED_COHERENCY := 1
  14. USE_COHERENT_MEM := 0
  15. GIC_ENABLE_V4_EXTN := 1
  16. GICV3_SUPPORT_GIC600 := 1
  17. override NEED_BL2U := no
  18. override ARM_PLAT_MT := 1
  19. # CPU setup
  20. ARM_ARCH_MINOR := 7
  21. BRANCH_PROTECTION := 1
  22. ENABLE_FEAT_MPAM := 1 # default is 2, optimise
  23. ENABLE_SVE_FOR_NS := 2 # to show we use it
  24. ENABLE_SVE_FOR_SWD := 1
  25. ENABLE_SME_FOR_NS := 2
  26. ENABLE_SME2_FOR_NS := 2
  27. ENABLE_SME_FOR_SWD := 1
  28. ENABLE_TRBE_FOR_NS := 1
  29. ENABLE_SYS_REG_TRACE_FOR_NS := 1
  30. ENABLE_FEAT_AMU := 1
  31. ENABLE_AMU_FCONF := 1
  32. ENABLE_AMU_AUXILIARY_COUNTERS := 1
  33. ENABLE_MPMM := 1
  34. ENABLE_MPMM_FCONF := 1
  35. ENABLE_FEAT_MTE2 := 2
  36. ENABLE_SPE_FOR_NS := 3
  37. ENABLE_FEAT_TCR2 := 3
  38. CTX_INCLUDE_AARCH32_REGS := 0
  39. ifeq (${SPD},spmd)
  40. SPMD_SPM_AT_SEL2 := 1
  41. CTX_INCLUDE_PAUTH_REGS := 1
  42. endif
  43. # TC RESOLUTION - LIST OF VALID OPTIONS (this impacts only FVP)
  44. TC_RESOLUTION_OPTIONS := 640x480p60 \
  45. 1920x1080p60
  46. # Set default to the 640x480p60 resolution mode
  47. TC_RESOLUTION ?= $(firstword $(TC_RESOLUTION_OPTIONS))
  48. # Check resolution option for FVP
  49. ifneq ($(filter ${TARGET_FLAVOUR}, fvp),)
  50. ifeq ($(filter ${TC_RESOLUTION}, ${TC_RESOLUTION_OPTIONS}),)
  51. $(error TC_RESOLUTION is ${TC_RESOLUTION}, it must be: ${TC_RESOLUTION_OPTIONS})
  52. endif
  53. endif
  54. ifneq ($(shell expr $(TARGET_PLATFORM) \<= 1), 0)
  55. $(error Platform ${PLAT}$(TARGET_PLATFORM) is no longer available.)
  56. endif
  57. ifneq ($(shell expr $(TARGET_PLATFORM) = 2), 0)
  58. $(warning Platform ${PLAT}$(TARGET_PLATFORM) is deprecated. \
  59. Some of the features might not work as expected)
  60. endif
  61. ifeq ($(shell expr $(TARGET_PLATFORM) \<= 4), 0)
  62. $(error TARGET_PLATFORM must be less than or equal to 4)
  63. endif
  64. ifeq ($(filter ${TARGET_FLAVOUR}, fvp fpga),)
  65. $(error TARGET_FLAVOUR must be fvp or fpga)
  66. endif
  67. $(eval $(call add_defines, \
  68. TARGET_PLATFORM \
  69. TARGET_FLAVOUR_$(call uppercase,${TARGET_FLAVOUR}) \
  70. TC_RESOLUTION_$(call uppercase,${TC_RESOLUTION}) \
  71. TC_DPU_USE_SCMI_CLK \
  72. TC_SCMI_PD_CTRL_EN \
  73. ))
  74. CSS_LOAD_SCP_IMAGES := 1
  75. # Save DSU PMU registers on cluster off and restore them on cluster on
  76. PRESERVE_DSU_PMU_REGS := 1
  77. # Specify MHU type based on platform
  78. ifneq ($(filter ${TARGET_PLATFORM}, 2),)
  79. PLAT_MHU_VERSION := 2
  80. else
  81. PLAT_MHU_VERSION := 3
  82. endif
  83. # Include GICv3 driver files
  84. include drivers/arm/gic/v3/gicv3.mk
  85. ENT_GIC_SOURCES := ${GICV3_SOURCES} \
  86. plat/common/plat_gicv3.c \
  87. plat/arm/common/arm_gicv3.c
  88. TC_BASE = plat/arm/board/tc
  89. PLAT_INCLUDES += -I${TC_BASE}/include/ \
  90. -I${TC_BASE}/fdts/
  91. # CPU libraries for TARGET_PLATFORM=1
  92. ifeq (${TARGET_PLATFORM}, 1)
  93. TC_CPU_SOURCES += lib/cpus/aarch64/cortex_a510.S \
  94. lib/cpus/aarch64/cortex_a715.S \
  95. lib/cpus/aarch64/cortex_x3.S
  96. endif
  97. # CPU libraries for TARGET_PLATFORM=2
  98. ifeq (${TARGET_PLATFORM}, 2)
  99. ERRATA_A520_2938996 := 1
  100. ERRATA_X4_2726228 := 1
  101. TC_CPU_SOURCES += lib/cpus/aarch64/cortex_a520.S \
  102. lib/cpus/aarch64/cortex_a720.S \
  103. lib/cpus/aarch64/cortex_x4.S
  104. endif
  105. # CPU libraries for TARGET_PLATFORM=3
  106. ifeq (${TARGET_PLATFORM}, 3)
  107. ERRATA_A520_2938996 := 1
  108. TC_CPU_SOURCES += lib/cpus/aarch64/cortex_a520.S \
  109. lib/cpus/aarch64/cortex_a725.S \
  110. lib/cpus/aarch64/cortex_x925.S
  111. endif
  112. # CPU libraries for TARGET_PLATFORM=4
  113. ifeq (${TARGET_PLATFORM}, 4)
  114. TC_CPU_SOURCES += lib/cpus/aarch64/cortex_gelas.S \
  115. lib/cpus/aarch64/nevis.S \
  116. lib/cpus/aarch64/travis.S
  117. endif
  118. INTERCONNECT_SOURCES := ${TC_BASE}/tc_interconnect.c \
  119. plat/arm/common/arm_ni.c
  120. PLAT_BL_COMMON_SOURCES += ${TC_BASE}/tc_plat.c \
  121. ${TC_BASE}/include/tc_helpers.S
  122. BL1_SOURCES += ${INTERCONNECT_SOURCES} \
  123. ${TC_CPU_SOURCES} \
  124. ${TC_BASE}/tc_trusted_boot.c \
  125. ${TC_BASE}/tc_bl1_setup.c \
  126. ${TC_BASE}/tc_err.c \
  127. drivers/arm/sbsa/sbsa.c
  128. BL2_SOURCES += ${TC_BASE}/tc_security.c \
  129. ${TC_BASE}/tc_err.c \
  130. ${TC_BASE}/tc_trusted_boot.c \
  131. ${TC_BASE}/tc_bl2_setup.c \
  132. lib/utils/mem_region.c \
  133. drivers/arm/tzc/tzc400.c \
  134. plat/arm/common/arm_nor_psci_mem_protect.c
  135. ifeq ($(shell test $(TARGET_PLATFORM) -le 2; echo $$?),0)
  136. BL2_SOURCES += plat/arm/common/arm_tzc400.c
  137. endif
  138. BL31_SOURCES += ${INTERCONNECT_SOURCES} \
  139. ${TC_CPU_SOURCES} \
  140. ${ENT_GIC_SOURCES} \
  141. ${TC_BASE}/tc_bl31_setup.c \
  142. ${TC_BASE}/tc_topology.c \
  143. lib/fconf/fconf.c \
  144. lib/fconf/fconf_dyn_cfg_getter.c \
  145. drivers/arm/css/dsu/dsu.c \
  146. drivers/cfi/v2m/v2m_flash.c \
  147. lib/utils/mem_region.c \
  148. plat/arm/common/arm_nor_psci_mem_protect.c \
  149. drivers/arm/sbsa/sbsa.c
  150. BL31_SOURCES += ${FDT_WRAPPERS_SOURCES}
  151. # Add the FDT_SOURCES and options for Dynamic Config
  152. FDT_SOURCES += ${TC_BASE}/fdts/${PLAT}_fw_config.dts \
  153. ${TC_BASE}/fdts/${PLAT}_tb_fw_config.dts \
  154. ${TC_BASE}/fdts/${PLAT}_nt_fw_config.dts
  155. FW_CONFIG := ${BUILD_PLAT}/fdts/${PLAT}_fw_config.dtb
  156. TB_FW_CONFIG := ${BUILD_PLAT}/fdts/${PLAT}_tb_fw_config.dtb
  157. FVP_NT_FW_CONFIG := ${BUILD_PLAT}/fdts/${PLAT}_nt_fw_config.dtb
  158. # Add the FW_CONFIG to FIP and specify the same to certtool
  159. $(eval $(call TOOL_ADD_PAYLOAD,${FW_CONFIG},--fw-config,${FW_CONFIG}))
  160. # Add the TB_FW_CONFIG to FIP and specify the same to certtool
  161. $(eval $(call TOOL_ADD_PAYLOAD,${TB_FW_CONFIG},--tb-fw-config,${TB_FW_CONFIG}))
  162. # Add the NT_FW_CONFIG to FIP and specify the same to certtool
  163. $(eval $(call TOOL_ADD_PAYLOAD,${FVP_NT_FW_CONFIG},--nt-fw-config,${FVP_NT_FW_CONFIG}))
  164. ifeq (${SPD},spmd)
  165. ifeq ($(ARM_SPMC_MANIFEST_DTS),)
  166. ARM_SPMC_MANIFEST_DTS := ${TC_BASE}/fdts/${PLAT}_spmc_test_manifest.dts
  167. endif
  168. FDT_SOURCES += ${ARM_SPMC_MANIFEST_DTS}
  169. TC_TOS_FW_CONFIG := ${BUILD_PLAT}/fdts/$(notdir $(basename ${ARM_SPMC_MANIFEST_DTS})).dtb
  170. # Add the TOS_FW_CONFIG to FIP and specify the same to certtool
  171. $(eval $(call TOOL_ADD_PAYLOAD,${TC_TOS_FW_CONFIG},--tos-fw-config,${TC_TOS_FW_CONFIG}))
  172. endif
  173. #Device tree
  174. TC_HW_CONFIG_DTS := fdts/${PLAT}${TARGET_PLATFORM}.dts
  175. TC_HW_CONFIG := ${BUILD_PLAT}/fdts/${PLAT}.dtb
  176. FDT_SOURCES += ${TC_HW_CONFIG_DTS}
  177. $(eval TC_HW_CONFIG := ${BUILD_PLAT}/$(patsubst %.dts,%.dtb,$(TC_HW_CONFIG_DTS)))
  178. # Add the HW_CONFIG to FIP and specify the same to certtool
  179. $(eval $(call TOOL_ADD_PAYLOAD,${TC_HW_CONFIG},--hw-config,${TC_HW_CONFIG}))
  180. # Include Measured Boot makefile before any Crypto library makefile.
  181. # Crypto library makefile may need default definitions of Measured Boot build
  182. # flags present in Measured Boot makefile.
  183. $(info Including rse_comms.mk)
  184. ifeq (${MEASURED_BOOT},1)
  185. $(info Including rse_comms.mk)
  186. include drivers/arm/rse/rse_comms.mk
  187. BL1_SOURCES += ${RSE_COMMS_SOURCES}
  188. BL2_SOURCES += ${RSE_COMMS_SOURCES}
  189. PLAT_INCLUDES += -Iinclude/lib/psa
  190. ifeq (${DICE_PROTECTION_ENVIRONMENT},1)
  191. $(info Including qcbor.mk)
  192. include drivers/measured_boot/rse/qcbor.mk
  193. $(info Including dice_prot_env.mk)
  194. include drivers/measured_boot/rse/dice_prot_env.mk
  195. BL1_SOURCES += ${QCBOR_SOURCES} \
  196. ${DPE_SOURCES} \
  197. plat/arm/board/tc/tc_common_dpe.c \
  198. plat/arm/board/tc/tc_bl1_dpe.c \
  199. lib/psa/dice_protection_environment.c \
  200. drivers/arm/css/sds/sds.c \
  201. drivers/delay_timer/delay_timer.c \
  202. drivers/delay_timer/generic_delay_timer.c
  203. BL2_SOURCES += ${QCBOR_SOURCES} \
  204. ${DPE_SOURCES} \
  205. plat/arm/board/tc/tc_common_dpe.c \
  206. plat/arm/board/tc/tc_bl2_dpe.c \
  207. lib/psa/dice_protection_environment.c
  208. PLAT_INCLUDES += -I${QCBOR_INCLUDES} \
  209. -Iinclude/lib/dice
  210. else
  211. $(info Including rse_measured_boot.mk)
  212. include drivers/measured_boot/rse/rse_measured_boot.mk
  213. BL1_SOURCES += ${MEASURED_BOOT_SOURCES} \
  214. plat/arm/board/tc/tc_common_measured_boot.c \
  215. plat/arm/board/tc/tc_bl1_measured_boot.c \
  216. lib/psa/measured_boot.c
  217. BL2_SOURCES += ${MEASURED_BOOT_SOURCES} \
  218. plat/arm/board/tc/tc_common_measured_boot.c \
  219. plat/arm/board/tc/tc_bl2_measured_boot.c \
  220. lib/psa/measured_boot.c
  221. endif
  222. endif
  223. ifeq (${TRNG_SUPPORT},1)
  224. BL31_SOURCES += plat/arm/board/tc/tc_trng.c
  225. endif
  226. ifneq (${PLATFORM_TEST},)
  227. # Add this include as first, before arm_common.mk. This is necessary
  228. # because arm_common.mk builds Mbed TLS, and platform_test.mk can
  229. # change the list of Mbed TLS files that are to be compiled
  230. # (LIBMBEDTLS_SRCS).
  231. include plat/arm/board/tc/platform_test.mk
  232. endif
  233. include plat/arm/common/arm_common.mk
  234. include plat/arm/css/common/css_common.mk
  235. include plat/arm/board/common/board_common.mk