xref: /rk3399_ARM-atf/bl31/bl31.mk (revision 8145e2fdf2891a24fbf6e7ac01060f324b4cc0e5)
1#
2# Copyright (c) 2013-2025, Arm Limited and Contributors. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
7################################################################################
8# Include Makefile for the SPM-MM implementation
9################################################################################
10ifeq (${SUPPORT_UNKNOWN_MPID},1)
11  ifeq (${DEBUG},0)
12    $(warning WARNING: SUPPORT_UNKNOWN_MPID enabled)
13  endif
14endif
15
16ifeq (${SPM_MM},1)
17  ifeq (${EL3_EXCEPTION_HANDLING},0)
18    $(error EL3_EXCEPTION_HANDLING must be 1 for SPM-MM support)
19  else
20    $(info Including SPM Management Mode (MM) makefile)
21    include services/std_svc/spm/common/spm.mk
22    include services/std_svc/spm/spm_mm/spm_mm.mk
23  endif
24endif
25
26include lib/extensions/amu/amu.mk
27
28ifeq (${SPMC_AT_EL3},1)
29  $(info Including EL3 SPMC makefile)
30  include services/std_svc/spm/common/spm.mk
31  include services/std_svc/spm/el3_spmc/spmc.mk
32endif
33
34include lib/psci/psci_lib.mk
35
36BL31_SOURCES		+=	bl31/bl31_main.c				\
37				bl31/interrupt_mgmt.c				\
38				bl31/aarch64/bl31_entrypoint.S			\
39				bl31/aarch64/crash_reporting.S			\
40				bl31/aarch64/runtime_exceptions.S		\
41				bl31/bl31_context_mgmt.c			\
42				bl31/bl31_traps.c				\
43				common/runtime_svc.c				\
44				lib/cpus/errata_common.c			\
45				plat/common/aarch64/platform_mp_stack.S		\
46				services/arm_arch_svc/arm_arch_svc_setup.c	\
47				services/std_svc/std_svc_setup.c		\
48				lib/el3_runtime/simd_ctx.c			\
49				${PSCI_LIB_SOURCES}				\
50				${SPMD_SOURCES}					\
51				${SPM_MM_SOURCES}				\
52				${SPMC_SOURCES}					\
53				${SPM_SOURCES}
54
55VENDOR_EL3_SRCS		+=	services/el3/ven_el3_svc.c
56
57ifeq (${ENABLE_PMF}, 1)
58BL31_SOURCES		+=	lib/pmf/pmf_main.c				\
59				${VENDOR_EL3_SRCS}
60endif
61
62include lib/debugfs/debugfs.mk
63ifeq (${USE_DEBUGFS},1)
64BL31_SOURCES		+=	${DEBUGFS_SRCS}					\
65				${VENDOR_EL3_SRCS}
66endif
67
68ifeq (${PLATFORM_REPORT_CTX_MEM_USE},1)
69BL31_SOURCES		+=	lib/el3_runtime/aarch64/context_debug.c
70endif
71
72ifeq (${EL3_EXCEPTION_HANDLING},1)
73BL31_SOURCES		+=	bl31/ehf.c
74endif
75
76ifeq (${FFH_SUPPORT},1)
77BL31_SOURCES		+=	bl31/aarch64/ea_delegate.S
78endif
79
80ifeq (${SDEI_SUPPORT},1)
81ifeq (${EL3_EXCEPTION_HANDLING},0)
82  $(error EL3_EXCEPTION_HANDLING must be 1 for SDEI support)
83endif
84BL31_SOURCES		+=	services/std_svc/sdei/sdei_dispatch.S	\
85				services/std_svc/sdei/sdei_event.c	\
86				services/std_svc/sdei/sdei_intr_mgmt.c	\
87				services/std_svc/sdei/sdei_main.c	\
88				services/std_svc/sdei/sdei_state.c
89endif
90
91ifeq (${TRNG_SUPPORT},1)
92BL31_SOURCES		+=	services/std_svc/trng/trng_main.c	\
93				services/std_svc/trng/trng_entropy_pool.c
94endif
95
96ifneq (${ENABLE_SPE_FOR_NS},0)
97BL31_SOURCES		+=	lib/extensions/spe/spe.c
98endif
99
100ifeq (${ERRATA_ABI_SUPPORT},1)
101BL31_SOURCES		+=	services/std_svc/errata_abi/errata_abi_main.c
102endif
103
104ifneq (${ENABLE_FEAT_AMU},0)
105BL31_SOURCES		+=	${AMU_SOURCES}
106endif
107
108ifneq (${ENABLE_FEAT_FGT2},0)
109BL31_SOURCES		+=	lib/extensions/fgt/fgt2.c
110endif
111
112ifneq (${ENABLE_FEAT_TCR2},0)
113BL31_SOURCES		+=	lib/extensions/tcr/tcr2.c
114endif
115
116ifneq (${ENABLE_SME_FOR_NS},0)
117BL31_SOURCES		+=	lib/extensions/sme/sme.c
118endif
119ifneq (${ENABLE_SVE_FOR_NS},0)
120BL31_SOURCES		+=	lib/extensions/sve/sve.c
121endif
122
123ifneq (${ENABLE_FEAT_MPAM},0)
124BL31_SOURCES		+=	lib/extensions/mpam/mpam.c
125endif
126
127ifneq (${ENABLE_FEAT_DEBUGV8P9},0)
128BL31_SOURCES		+=	lib/extensions/debug/debugv8p9.c
129endif
130
131ifneq (${ENABLE_TRBE_FOR_NS},0)
132BL31_SOURCES		+=	lib/extensions/trbe/trbe.c
133endif
134
135ifneq (${ENABLE_BRBE_FOR_NS},0)
136BL31_SOURCES		+=	lib/extensions/brbe/brbe.c
137endif
138
139ifneq (${ENABLE_SYS_REG_TRACE_FOR_NS},0)
140BL31_SOURCES		+=      lib/extensions/sys_reg_trace/aarch64/sys_reg_trace.c
141endif
142
143ifneq (${ENABLE_TRF_FOR_NS},0)
144BL31_SOURCES		+=	lib/extensions/trf/aarch64/trf.c
145endif
146
147ifneq (${ENABLE_FEAT_CPA2}, 0)
148BL31_SOURCES		+=	lib/extensions/cpa2/cpa2.c
149endif
150
151ifeq (${WORKAROUND_CVE_2017_5715},1)
152BL31_SOURCES		+=	lib/cpus/aarch64/wa_cve_2017_5715_bpiall.S	\
153				lib/cpus/aarch64/wa_cve_2017_5715_mmu.S
154endif
155
156ifeq ($(SMC_PCI_SUPPORT),1)
157BL31_SOURCES		+=	services/std_svc/pci_svc.c
158endif
159
160ifeq (${ENABLE_RME},1)
161include lib/gpt_rme/gpt_rme.mk
162
163BL31_SOURCES		+=	${GPT_LIB_SRCS}					\
164				${RMMD_SOURCES}
165endif
166
167ifeq (${USE_DSU_DRIVER},1)
168BL31_SOURCES		+=	drivers/arm/dsu/dsu.c
169endif
170
171# RAS sources
172ifeq (${ENABLE_FEAT_RAS}-${HANDLE_EA_EL3_FIRST_NS},1-1)
173BL31_SOURCES		+=	lib/extensions/ras/std_err_record.c		\
174				lib/extensions/ras/ras_common.c
175endif
176
177ifeq ($(FEATURE_DETECTION),1)
178BL31_SOURCES		+=	common/feat_detect.c
179endif
180
181ifeq (${DRTM_SUPPORT},1)
182BL31_SOURCES		+=	services/std_svc/drtm/drtm_main.c		\
183				services/std_svc/drtm/drtm_dma_prot.c		\
184				services/std_svc/drtm/drtm_res_address_map.c	\
185				services/std_svc/drtm/drtm_measurements.c	\
186				services/std_svc/drtm/drtm_remediation.c	\
187				${MBEDTLS_SOURCES}
188endif
189
190ifeq (${LFA_SUPPORT},1)
191include services/std_svc/lfa/lfa.mk
192BL31_SOURCES		+=	${LFA_SOURCES}
193endif
194
195ifeq ($(CROS_WIDEVINE_SMC),1)
196BL31_SOURCES		+=	services/oem/chromeos/widevine_smc_handlers.c
197endif
198
199BL31_DEFAULT_LINKER_SCRIPT_SOURCE := bl31/bl31.ld.S
200
201# CRYPTO_SUPPORT
202NEED_AUTH := 0
203NEED_HASH := $(if $(filter 1,$(MEASURED_BOOT) $(DRTM_SUPPORT)),1,)
204$(eval $(call set_crypto_support,NEED_AUTH,NEED_HASH))
205
206# Flag used to indicate if Crash reporting via console should be included
207# in BL31. This defaults to being present in DEBUG builds only
208ifndef CRASH_REPORTING
209CRASH_REPORTING		:=	$(DEBUG)
210endif
211
212# BL31_CPPFLAGS
213$(eval BL31_CPPFLAGS += $(call make_defines, \
214    $(sort \
215        CRYPTO_SUPPORT \
216)))
217
218$(eval $(call assert_booleans,\
219    $(sort \
220	CRASH_REPORTING \
221	EL3_EXCEPTION_HANDLING \
222	SDEI_SUPPORT \
223	USE_DSU_DRIVER \
224)))
225
226# Numeric_Flags
227$(eval $(call assert_numerics,\
228    $(sort \
229	CRYPTO_SUPPORT \
230)))
231
232$(eval $(call add_defines,\
233    $(sort \
234	CRASH_REPORTING \
235	EL3_EXCEPTION_HANDLING \
236	SDEI_SUPPORT \
237	USE_DSU_DRIVER \
238)))
239