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