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