xref: /rk3399_ARM-atf/bl31/bl31.mk (revision f7679d437d5f27a3168f017db8d42bc561ac0c59)
1#
2# Copyright (c) 2013-2024, 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
27include lib/mpmm/mpmm.mk
28
29ifeq (${SPMC_AT_EL3},1)
30  $(info Including EL3 SPMC makefile)
31  include services/std_svc/spm/common/spm.mk
32  include services/std_svc/spm/el3_spmc/spmc.mk
33endif
34
35include lib/psci/psci_lib.mk
36
37BL31_SOURCES		+=	bl31/bl31_main.c				\
38				bl31/interrupt_mgmt.c				\
39				bl31/aarch64/bl31_entrypoint.S			\
40				bl31/aarch64/crash_reporting.S			\
41				bl31/aarch64/runtime_exceptions.S		\
42				bl31/bl31_context_mgmt.c			\
43				bl31/bl31_traps.c				\
44				common/runtime_svc.c				\
45				lib/cpus/aarch64/dsu_helpers.S			\
46				plat/common/aarch64/platform_mp_stack.S		\
47				services/arm_arch_svc/arm_arch_svc_setup.c	\
48				services/el3/ven_el3_svc.c			\
49				services/std_svc/std_svc_setup.c		\
50				${PSCI_LIB_SOURCES}				\
51				${SPMD_SOURCES}					\
52				${SPM_MM_SOURCES}				\
53				${SPMC_SOURCES}					\
54				${SPM_SOURCES}
55
56ifeq (${ENABLE_PMF}, 1)
57BL31_SOURCES		+=	lib/pmf/pmf_main.c
58endif
59
60include lib/debugfs/debugfs.mk
61ifeq (${USE_DEBUGFS},1)
62	BL31_SOURCES	+= $(DEBUGFS_SRCS)
63endif
64
65ifeq (${PLATFORM_REPORT_CTX_MEM_USE},1)
66BL31_SOURCES		+=	lib/el3_runtime/aarch64/context_debug.c
67endif
68
69ifeq (${EL3_EXCEPTION_HANDLING},1)
70BL31_SOURCES		+=	bl31/ehf.c
71endif
72
73ifeq (${FFH_SUPPORT},1)
74BL31_SOURCES		+=	bl31/aarch64/ea_delegate.S
75endif
76
77ifeq (${SDEI_SUPPORT},1)
78ifeq (${EL3_EXCEPTION_HANDLING},0)
79  $(error EL3_EXCEPTION_HANDLING must be 1 for SDEI support)
80endif
81BL31_SOURCES		+=	services/std_svc/sdei/sdei_dispatch.S	\
82				services/std_svc/sdei/sdei_event.c	\
83				services/std_svc/sdei/sdei_intr_mgmt.c	\
84				services/std_svc/sdei/sdei_main.c	\
85				services/std_svc/sdei/sdei_state.c
86endif
87
88ifeq (${TRNG_SUPPORT},1)
89BL31_SOURCES		+=	services/std_svc/trng/trng_main.c	\
90				services/std_svc/trng/trng_entropy_pool.c
91endif
92
93ifneq (${ENABLE_SPE_FOR_NS},0)
94BL31_SOURCES		+=	lib/extensions/spe/spe.c
95endif
96
97ifeq (${ERRATA_ABI_SUPPORT},1)
98BL31_SOURCES		+=	services/std_svc/errata_abi/errata_abi_main.c
99endif
100
101ifneq (${ENABLE_FEAT_AMU},0)
102BL31_SOURCES		+=	${AMU_SOURCES}
103endif
104
105ifeq (${ENABLE_MPMM},1)
106BL31_SOURCES		+=	${MPMM_SOURCES}
107endif
108
109ifneq (${ENABLE_SME_FOR_NS},0)
110BL31_SOURCES		+=	lib/extensions/sme/sme.c
111endif
112ifneq (${ENABLE_SVE_FOR_NS},0)
113BL31_SOURCES		+=	lib/extensions/sve/sve.c
114endif
115
116ifneq (${ENABLE_FEAT_MPAM},0)
117BL31_SOURCES		+=	lib/extensions/mpam/mpam.c
118endif
119
120ifneq (${ENABLE_TRBE_FOR_NS},0)
121BL31_SOURCES		+=	lib/extensions/trbe/trbe.c
122endif
123
124ifneq (${ENABLE_BRBE_FOR_NS},0)
125BL31_SOURCES		+=	lib/extensions/brbe/brbe.c
126endif
127
128ifneq (${ENABLE_SYS_REG_TRACE_FOR_NS},0)
129BL31_SOURCES		+=      lib/extensions/sys_reg_trace/aarch64/sys_reg_trace.c
130endif
131
132ifneq (${ENABLE_TRF_FOR_NS},0)
133BL31_SOURCES		+=	lib/extensions/trf/aarch64/trf.c
134endif
135
136ifeq (${WORKAROUND_CVE_2017_5715},1)
137BL31_SOURCES		+=	lib/cpus/aarch64/wa_cve_2017_5715_bpiall.S	\
138				lib/cpus/aarch64/wa_cve_2017_5715_mmu.S
139endif
140
141ifeq ($(SMC_PCI_SUPPORT),1)
142BL31_SOURCES		+=	services/std_svc/pci_svc.c
143endif
144
145ifeq (${ENABLE_RME},1)
146include lib/gpt_rme/gpt_rme.mk
147
148BL31_SOURCES		+=	${GPT_LIB_SRCS}					\
149				${RMMD_SOURCES}
150endif
151
152ifeq ($(FEATURE_DETECTION),1)
153BL31_SOURCES		+=	common/feat_detect.c
154endif
155
156ifeq (${DRTM_SUPPORT},1)
157BL31_SOURCES		+=	services/std_svc/drtm/drtm_main.c		\
158				services/std_svc/drtm/drtm_dma_prot.c		\
159				services/std_svc/drtm/drtm_res_address_map.c	\
160				services/std_svc/drtm/drtm_measurements.c	\
161				services/std_svc/drtm/drtm_remediation.c	\
162				${MBEDTLS_SOURCES}
163endif
164
165ifeq ($(CROS_WIDEVINE_SMC),1)
166BL31_SOURCES		+=	services/oem/chromeos/widevine_smc_handlers.c
167endif
168
169BL31_DEFAULT_LINKER_SCRIPT_SOURCE := bl31/bl31.ld.S
170
171ifeq ($($(ARCH)-ld-id),gnu-gcc)
172        BL31_LDFLAGS	+=	-Wl,--sort-section=alignment
173else ifneq ($(filter llvm-lld gnu-ld,$($(ARCH)-ld-id)),)
174        BL31_LDFLAGS	+=	--sort-section=alignment
175endif
176
177# Flag used to indicate if Crash reporting via console should be included
178# in BL31. This defaults to being present in DEBUG builds only
179ifndef CRASH_REPORTING
180CRASH_REPORTING		:=	$(DEBUG)
181endif
182
183$(eval $(call assert_booleans,\
184    $(sort \
185	CRASH_REPORTING \
186	EL3_EXCEPTION_HANDLING \
187	SDEI_SUPPORT \
188)))
189
190$(eval $(call add_defines,\
191    $(sort \
192        CRASH_REPORTING \
193        EL3_EXCEPTION_HANDLING \
194        SDEI_SUPPORT \
195)))
196