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