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