xref: /rk3399_ARM-atf/plat/arm/board/fvp/platform.mk (revision e2469d823bfc633a32782a8c018d3b55eb2b23a1)
1#
2# Copyright (c) 2013-2020, ARM Limited and Contributors. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
7# Use the GICv3 driver on the FVP by default
8FVP_USE_GIC_DRIVER	:= FVP_GICV3
9
10# Use the SP804 timer instead of the generic one
11FVP_USE_SP804_TIMER	:= 0
12
13# Default cluster count for FVP
14FVP_CLUSTER_COUNT	:= 2
15
16# Default number of CPUs per cluster on FVP
17FVP_MAX_CPUS_PER_CLUSTER	:= 4
18
19# Default number of threads per CPU on FVP
20FVP_MAX_PE_PER_CPU	:= 1
21
22FVP_DT_PREFIX		:= fvp-base-gicv3-psci
23
24$(eval $(call assert_boolean,FVP_USE_SP804_TIMER))
25$(eval $(call add_define,FVP_USE_SP804_TIMER))
26
27# The FVP platform depends on this macro to build with correct GIC driver.
28$(eval $(call add_define,FVP_USE_GIC_DRIVER))
29
30# Pass FVP_CLUSTER_COUNT to the build system.
31$(eval $(call add_define,FVP_CLUSTER_COUNT))
32
33# Pass FVP_MAX_CPUS_PER_CLUSTER to the build system.
34$(eval $(call add_define,FVP_MAX_CPUS_PER_CLUSTER))
35
36# Pass FVP_MAX_PE_PER_CPU to the build system.
37$(eval $(call add_define,FVP_MAX_PE_PER_CPU))
38
39# Sanity check the cluster count and if FVP_CLUSTER_COUNT <= 2,
40# choose the CCI driver , else the CCN driver
41ifeq ($(FVP_CLUSTER_COUNT), 0)
42$(error "Incorrect cluster count specified for FVP port")
43else ifeq ($(FVP_CLUSTER_COUNT),$(filter $(FVP_CLUSTER_COUNT),1 2))
44FVP_INTERCONNECT_DRIVER := FVP_CCI
45else
46FVP_INTERCONNECT_DRIVER := FVP_CCN
47endif
48
49$(eval $(call add_define,FVP_INTERCONNECT_DRIVER))
50
51# Choose the GIC sources depending upon the how the FVP will be invoked
52ifeq (${FVP_USE_GIC_DRIVER}, FVP_GICV3)
53
54# The GIC model (GIC-600 or GIC-500) will be detected at runtime
55GICV3_SUPPORT_GIC600		:=	1
56GICV3_OVERRIDE_DISTIF_PWR_OPS	:=	1
57
58# Include GICv3 driver files
59include drivers/arm/gic/v3/gicv3.mk
60
61FVP_GIC_SOURCES		:=	${GICV3_SOURCES}			\
62				plat/common/plat_gicv3.c		\
63				plat/arm/common/arm_gicv3.c
64
65	ifeq ($(filter 1,${BL2_AT_EL3} ${RESET_TO_BL31} ${RESET_TO_SP_MIN}),)
66		FVP_GIC_SOURCES += plat/arm/board/fvp/fvp_gicv3.c
67	endif
68
69else ifeq (${FVP_USE_GIC_DRIVER}, FVP_GICV2)
70
71# No GICv4 extension
72GIC_ENABLE_V4_EXTN	:=	0
73$(eval $(call add_define,GIC_ENABLE_V4_EXTN))
74
75# Include GICv2 driver files
76include drivers/arm/gic/v2/gicv2.mk
77
78FVP_GIC_SOURCES		:=	${GICV2_SOURCES}			\
79				plat/common/plat_gicv2.c		\
80				plat/arm/common/arm_gicv2.c
81
82FVP_DT_PREFIX		:=	fvp-base-gicv2-psci
83else
84$(error "Incorrect GIC driver chosen on FVP port")
85endif
86
87ifeq (${FVP_INTERCONNECT_DRIVER}, FVP_CCI)
88FVP_INTERCONNECT_SOURCES	:= 	drivers/arm/cci/cci.c
89else ifeq (${FVP_INTERCONNECT_DRIVER}, FVP_CCN)
90FVP_INTERCONNECT_SOURCES	:= 	drivers/arm/ccn/ccn.c		\
91					plat/arm/common/arm_ccn.c
92else
93$(error "Incorrect CCN driver chosen on FVP port")
94endif
95
96FVP_SECURITY_SOURCES	:=	drivers/arm/tzc/tzc400.c		\
97				plat/arm/board/fvp/fvp_security.c	\
98				plat/arm/common/arm_tzc400.c
99
100
101PLAT_INCLUDES		:=	-Iplat/arm/board/fvp/include
102
103
104PLAT_BL_COMMON_SOURCES	:=	plat/arm/board/fvp/fvp_common.c
105
106FVP_CPU_LIBS		:=	lib/cpus/${ARCH}/aem_generic.S
107
108ifeq (${ARCH}, aarch64)
109
110# select a different set of CPU files, depending on whether we compile for
111# hardware assisted coherency cores or not
112ifeq (${HW_ASSISTED_COHERENCY}, 0)
113# Cores used without DSU
114	FVP_CPU_LIBS	+=	lib/cpus/aarch64/cortex_a35.S			\
115				lib/cpus/aarch64/cortex_a53.S			\
116				lib/cpus/aarch64/cortex_a57.S			\
117				lib/cpus/aarch64/cortex_a72.S			\
118				lib/cpus/aarch64/cortex_a73.S
119else
120# Cores used with DSU only
121	ifeq (${CTX_INCLUDE_AARCH32_REGS}, 0)
122	# AArch64-only cores
123		FVP_CPU_LIBS	+=	lib/cpus/aarch64/cortex_a76.S		\
124					lib/cpus/aarch64/cortex_a76ae.S		\
125					lib/cpus/aarch64/cortex_a77.S		\
126					lib/cpus/aarch64/cortex_a78.S		\
127					lib/cpus/aarch64/neoverse_n1.S		\
128					lib/cpus/aarch64/neoverse_e1.S		\
129					lib/cpus/aarch64/neoverse_zeus.S	\
130					lib/cpus/aarch64/cortex_hercules_ae.S	\
131					lib/cpus/aarch64/cortex_klein.S	        \
132					lib/cpus/aarch64/cortex_matterhorn.S	\
133					lib/cpus/aarch64/cortex_a65.S		\
134					lib/cpus/aarch64/cortex_a65ae.S
135	endif
136	# AArch64/AArch32 cores
137	FVP_CPU_LIBS	+=	lib/cpus/aarch64/cortex_a55.S		\
138				lib/cpus/aarch64/cortex_a75.S
139endif
140
141else
142FVP_CPU_LIBS		+=	lib/cpus/aarch32/cortex_a32.S
143endif
144
145BL1_SOURCES		+=	drivers/arm/smmu/smmu_v3.c			\
146				drivers/arm/sp805/sp805.c			\
147				drivers/delay_timer/delay_timer.c		\
148				drivers/io/io_semihosting.c			\
149				lib/semihosting/semihosting.c			\
150				lib/semihosting/${ARCH}/semihosting_call.S	\
151				plat/arm/board/fvp/${ARCH}/fvp_helpers.S	\
152				plat/arm/board/fvp/fvp_bl1_setup.c		\
153				plat/arm/board/fvp/fvp_err.c			\
154				plat/arm/board/fvp/fvp_io_storage.c		\
155				${FVP_CPU_LIBS}					\
156				${FVP_INTERCONNECT_SOURCES}
157
158ifeq (${FVP_USE_SP804_TIMER},1)
159BL1_SOURCES		+=	drivers/arm/sp804/sp804_delay_timer.c
160else
161BL1_SOURCES		+=	drivers/delay_timer/generic_delay_timer.c
162endif
163
164
165BL2_SOURCES		+=	drivers/arm/sp805/sp805.c			\
166				drivers/io/io_semihosting.c			\
167				lib/utils/mem_region.c				\
168				lib/semihosting/semihosting.c			\
169				lib/semihosting/${ARCH}/semihosting_call.S	\
170				plat/arm/board/fvp/fvp_bl2_setup.c		\
171				plat/arm/board/fvp/fvp_err.c			\
172				plat/arm/board/fvp/fvp_io_storage.c		\
173				plat/arm/common/arm_nor_psci_mem_protect.c	\
174				${FVP_SECURITY_SOURCES}
175
176
177
178ifeq (${BL2_AT_EL3},1)
179BL2_SOURCES		+=	plat/arm/board/fvp/${ARCH}/fvp_helpers.S	\
180				plat/arm/board/fvp/fvp_bl2_el3_setup.c		\
181				${FVP_CPU_LIBS}					\
182				${FVP_INTERCONNECT_SOURCES}
183endif
184
185ifeq (${FVP_USE_SP804_TIMER},1)
186BL2_SOURCES		+=	drivers/arm/sp804/sp804_delay_timer.c
187endif
188
189BL2U_SOURCES		+=	plat/arm/board/fvp/fvp_bl2u_setup.c		\
190				${FVP_SECURITY_SOURCES}
191
192ifeq (${FVP_USE_SP804_TIMER},1)
193BL2U_SOURCES		+=	drivers/arm/sp804/sp804_delay_timer.c
194endif
195
196BL31_SOURCES		+=	drivers/arm/fvp/fvp_pwrc.c			\
197				drivers/arm/smmu/smmu_v3.c			\
198				drivers/delay_timer/delay_timer.c		\
199				drivers/cfi/v2m/v2m_flash.c			\
200				lib/utils/mem_region.c				\
201				plat/arm/board/fvp/fvp_bl31_setup.c		\
202				plat/arm/board/fvp/fvp_console.c		\
203				plat/arm/board/fvp/fvp_pm.c			\
204				plat/arm/board/fvp/fvp_topology.c		\
205				plat/arm/board/fvp/aarch64/fvp_helpers.S	\
206				plat/arm/common/arm_nor_psci_mem_protect.c	\
207				${FVP_CPU_LIBS}					\
208				${FVP_GIC_SOURCES}				\
209				${FVP_INTERCONNECT_SOURCES}			\
210				${FVP_SECURITY_SOURCES}
211
212# Support for fconf in BL31
213# Added separately from the above list for better readability
214ifeq ($(filter 1,${BL2_AT_EL3} ${RESET_TO_BL31}),)
215BL31_SOURCES		+=	common/fdt_wrappers.c				\
216				lib/fconf/fconf.c				\
217				lib/fconf/fconf_dyn_cfg_getter.c		\
218				plat/arm/board/fvp/fconf/fconf_hw_config_getter.c
219
220ifeq (${SEC_INT_DESC_IN_FCONF},1)
221BL31_SOURCES		+=	plat/arm/common/fconf/fconf_sec_intr_config.c
222endif
223
224endif
225
226ifeq (${FVP_USE_SP804_TIMER},1)
227BL31_SOURCES		+=	drivers/arm/sp804/sp804_delay_timer.c
228else
229BL31_SOURCES		+=	drivers/delay_timer/generic_delay_timer.c
230endif
231
232# Add the FDT_SOURCES and options for Dynamic Config (only for Unix env)
233ifdef UNIX_MK
234FVP_HW_CONFIG_DTS	:=	fdts/${FVP_DT_PREFIX}.dts
235FDT_SOURCES		+=	$(addprefix plat/arm/board/fvp/fdts/,	\
236					${PLAT}_fw_config.dts		\
237					${PLAT}_tb_fw_config.dts	\
238					${PLAT}_soc_fw_config.dts	\
239					${PLAT}_nt_fw_config.dts	\
240				)
241
242FVP_FW_CONFIG		:=	${BUILD_PLAT}/fdts/${PLAT}_fw_config.dtb
243FVP_TB_FW_CONFIG	:=	${BUILD_PLAT}/fdts/${PLAT}_tb_fw_config.dtb
244FVP_SOC_FW_CONFIG	:=	${BUILD_PLAT}/fdts/${PLAT}_soc_fw_config.dtb
245FVP_NT_FW_CONFIG	:=	${BUILD_PLAT}/fdts/${PLAT}_nt_fw_config.dtb
246
247ifeq (${SPD},tspd)
248FDT_SOURCES		+=	plat/arm/board/fvp/fdts/${PLAT}_tsp_fw_config.dts
249FVP_TOS_FW_CONFIG	:=	${BUILD_PLAT}/fdts/${PLAT}_tsp_fw_config.dtb
250
251# Add the TOS_FW_CONFIG to FIP and specify the same to certtool
252$(eval $(call TOOL_ADD_PAYLOAD,${FVP_TOS_FW_CONFIG},--tos-fw-config))
253endif
254
255ifeq (${SPD},spmd)
256
257ifeq ($(ARM_SPMC_MANIFEST_DTS),)
258ARM_SPMC_MANIFEST_DTS	:=	plat/arm/board/fvp/fdts/${PLAT}_spmc_manifest.dts
259endif
260
261FDT_SOURCES		+=	${ARM_SPMC_MANIFEST_DTS}
262FVP_TOS_FW_CONFIG	:=	${BUILD_PLAT}/fdts/$(notdir $(basename ${ARM_SPMC_MANIFEST_DTS})).dtb
263
264# Add the TOS_FW_CONFIG to FIP and specify the same to certtool
265$(eval $(call TOOL_ADD_PAYLOAD,${FVP_TOS_FW_CONFIG},--tos-fw-config))
266endif
267
268# Add the FW_CONFIG to FIP and specify the same to certtool
269$(eval $(call TOOL_ADD_PAYLOAD,${FVP_FW_CONFIG},--fw-config))
270# Add the TB_FW_CONFIG to FIP and specify the same to certtool
271$(eval $(call TOOL_ADD_PAYLOAD,${FVP_TB_FW_CONFIG},--tb-fw-config))
272# Add the SOC_FW_CONFIG to FIP and specify the same to certtool
273$(eval $(call TOOL_ADD_PAYLOAD,${FVP_SOC_FW_CONFIG},--soc-fw-config))
274# Add the NT_FW_CONFIG to FIP and specify the same to certtool
275$(eval $(call TOOL_ADD_PAYLOAD,${FVP_NT_FW_CONFIG},--nt-fw-config))
276
277FDT_SOURCES		+=	${FVP_HW_CONFIG_DTS}
278$(eval FVP_HW_CONFIG	:=	${BUILD_PLAT}/$(patsubst %.dts,%.dtb,$(FVP_HW_CONFIG_DTS)))
279
280# Add the HW_CONFIG to FIP and specify the same to certtool
281$(eval $(call TOOL_ADD_PAYLOAD,${FVP_HW_CONFIG},--hw-config))
282endif
283
284# Enable Activity Monitor Unit extensions by default
285ENABLE_AMU			:=	1
286
287# Enable dynamic mitigation support by default
288DYNAMIC_WORKAROUND_CVE_2018_3639	:=	1
289
290# Enable reclaiming of BL31 initialisation code for secondary cores
291# stacks for FVP. However, don't enable reclaiming for clang.
292ifneq (${RESET_TO_BL31},1)
293ifeq ($(findstring clang,$(notdir $(CC))),)
294RECLAIM_INIT_CODE	:=	1
295endif
296endif
297
298ifeq (${ENABLE_AMU},1)
299BL31_SOURCES		+=	lib/cpus/aarch64/cpuamu.c		\
300				lib/cpus/aarch64/cpuamu_helpers.S
301
302ifeq (${HW_ASSISTED_COHERENCY}, 1)
303BL31_SOURCES		+=	lib/cpus/aarch64/cortex_a75_pubsub.c	\
304				lib/cpus/aarch64/neoverse_n1_pubsub.c
305endif
306endif
307
308ifeq (${RAS_EXTENSION},1)
309BL31_SOURCES		+=	plat/arm/board/fvp/aarch64/fvp_ras.c
310endif
311
312ifneq (${ENABLE_STACK_PROTECTOR},0)
313PLAT_BL_COMMON_SOURCES	+=	plat/arm/board/fvp/fvp_stack_protector.c
314endif
315
316ifeq (${ARCH},aarch32)
317    NEED_BL32 := yes
318endif
319
320# Enable the dynamic translation tables library.
321ifeq (${ARCH},aarch32)
322    ifeq (${RESET_TO_SP_MIN},1)
323        BL32_CPPFLAGS	+=	-DPLAT_XLAT_TABLES_DYNAMIC
324    endif
325else # AArch64
326    ifeq (${RESET_TO_BL31},1)
327        BL31_CPPFLAGS	+=	-DPLAT_XLAT_TABLES_DYNAMIC
328    endif
329    ifeq (${SPD},trusty)
330        BL31_CPPFLAGS	+=	-DPLAT_XLAT_TABLES_DYNAMIC
331    endif
332endif
333
334ifeq (${ALLOW_RO_XLAT_TABLES}, 1)
335    ifeq (${ARCH},aarch32)
336        BL32_CPPFLAGS	+=	-DPLAT_RO_XLAT_TABLES
337    else # AArch64
338        BL31_CPPFLAGS	+=	-DPLAT_RO_XLAT_TABLES
339        ifeq (${SPD},tspd)
340            BL32_CPPFLAGS +=	-DPLAT_RO_XLAT_TABLES
341        endif
342    endif
343endif
344
345ifeq (${USE_DEBUGFS},1)
346    BL31_CPPFLAGS	+=	-DPLAT_XLAT_TABLES_DYNAMIC
347endif
348
349# Add support for platform supplied linker script for BL31 build
350$(eval $(call add_define,PLAT_EXTRA_LD_SCRIPT))
351
352ifneq (${BL2_AT_EL3}, 0)
353    override BL1_SOURCES =
354endif
355
356include plat/arm/board/common/board_common.mk
357include plat/arm/common/arm_common.mk
358
359ifeq (${TRUSTED_BOARD_BOOT}, 1)
360BL1_SOURCES		+=	plat/arm/board/fvp/fvp_trusted_boot.c
361BL2_SOURCES		+=	plat/arm/board/fvp/fvp_trusted_boot.c
362
363ifeq (${MEASURED_BOOT},1)
364BL2_SOURCES		+=	plat/arm/board/fvp/fvp_measured_boot.c
365endif
366
367# FVP being a development platform, enable capability to disable Authentication
368# dynamically if TRUSTED_BOARD_BOOT is set.
369DYN_DISABLE_AUTH	:=	1
370endif
371