1#
2# Copyright (c) 2013-2022, 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  $(warning "EL3 SPMC is an experimental feature")
31  $(info Including EL3 SPMC makefile)
32  include services/std_svc/spm/common/spm.mk
33  include services/std_svc/spm/el3_spmc/spmc.mk
34endif
35
36include lib/psci/psci_lib.mk
37
38BL31_SOURCES		+=	bl31/bl31_main.c				\
39				bl31/interrupt_mgmt.c				\
40				bl31/aarch64/bl31_entrypoint.S			\
41				bl31/aarch64/crash_reporting.S			\
42				bl31/aarch64/ea_delegate.S			\
43				bl31/aarch64/runtime_exceptions.S		\
44				bl31/bl31_context_mgmt.c			\
45				common/runtime_svc.c				\
46				lib/cpus/aarch64/dsu_helpers.S			\
47				plat/common/aarch64/platform_mp_stack.S		\
48				services/arm_arch_svc/arm_arch_svc_setup.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 (${DISABLE_MTPMU},1)
57BL31_SOURCES		+=	lib/extensions/mtpmu/aarch64/mtpmu.S
58endif
59
60ifeq (${ENABLE_PMF}, 1)
61BL31_SOURCES		+=	lib/pmf/pmf_main.c
62endif
63
64include lib/debugfs/debugfs.mk
65ifeq (${USE_DEBUGFS},1)
66	BL31_SOURCES	+= $(DEBUGFS_SRCS)
67endif
68
69ifeq (${EL3_EXCEPTION_HANDLING},1)
70BL31_SOURCES		+=	bl31/ehf.c
71endif
72
73ifeq (${SDEI_SUPPORT},1)
74ifeq (${EL3_EXCEPTION_HANDLING},0)
75  $(error EL3_EXCEPTION_HANDLING must be 1 for SDEI support)
76endif
77BL31_SOURCES		+=	services/std_svc/sdei/sdei_dispatch.S	\
78				services/std_svc/sdei/sdei_event.c	\
79				services/std_svc/sdei/sdei_intr_mgmt.c	\
80				services/std_svc/sdei/sdei_main.c	\
81				services/std_svc/sdei/sdei_state.c
82endif
83
84ifeq (${TRNG_SUPPORT},1)
85BL31_SOURCES		+=	services/std_svc/trng/trng_main.c	\
86				services/std_svc/trng/trng_entropy_pool.c
87endif
88
89ifeq (${ENABLE_SPE_FOR_LOWER_ELS},1)
90BL31_SOURCES		+=	lib/extensions/spe/spe.c
91endif
92
93ifeq (${ENABLE_AMU},1)
94BL31_SOURCES		+=	${AMU_SOURCES}
95endif
96
97ifeq (${ENABLE_MPMM},1)
98BL31_SOURCES		+=	${MPMM_SOURCES}
99endif
100
101ifeq (${ENABLE_SME_FOR_NS},1)
102BL31_SOURCES		+=	lib/extensions/sme/sme.c
103BL31_SOURCES		+=	lib/extensions/sve/sve.c
104else
105ifeq (${ENABLE_SVE_FOR_NS},1)
106BL31_SOURCES		+=	lib/extensions/sve/sve.c
107endif
108endif
109
110ifeq (${ENABLE_MPAM_FOR_LOWER_ELS},1)
111BL31_SOURCES		+=	lib/extensions/mpam/mpam.c
112endif
113
114ifeq (${ENABLE_TRBE_FOR_NS},1)
115BL31_SOURCES		+=	lib/extensions/trbe/trbe.c
116endif
117
118ifeq (${ENABLE_BRBE_FOR_NS},1)
119BL31_SOURCES		+=	lib/extensions/brbe/brbe.c
120endif
121
122ifeq (${ENABLE_SYS_REG_TRACE_FOR_NS},1)
123BL31_SOURCES		+=      lib/extensions/sys_reg_trace/aarch64/sys_reg_trace.c
124endif
125
126ifeq (${ENABLE_TRF_FOR_NS},1)
127BL31_SOURCES		+=	lib/extensions/trf/aarch64/trf.c
128endif
129
130ifeq (${WORKAROUND_CVE_2017_5715},1)
131BL31_SOURCES		+=	lib/cpus/aarch64/wa_cve_2017_5715_bpiall.S	\
132				lib/cpus/aarch64/wa_cve_2017_5715_mmu.S
133endif
134
135ifeq ($(SMC_PCI_SUPPORT),1)
136BL31_SOURCES		+=	services/std_svc/pci_svc.c
137endif
138
139ifeq (${ENABLE_RME},1)
140include lib/gpt_rme/gpt_rme.mk
141
142BL31_SOURCES		+=	${GPT_LIB_SRCS}					\
143				${RMMD_SOURCES}
144endif
145
146ifeq ($(FEATURE_DETECTION),1)
147BL31_SOURCES		+=	common/feat_detect.c
148endif
149
150BL31_LINKERFILE		:=	bl31/bl31.ld.S
151
152# Flag used to indicate if Crash reporting via console should be included
153# in BL31. This defaults to being present in DEBUG builds only
154ifndef CRASH_REPORTING
155CRASH_REPORTING		:=	$(DEBUG)
156endif
157
158$(eval $(call assert_booleans,\
159    $(sort \
160	CRASH_REPORTING \
161	EL3_EXCEPTION_HANDLING \
162	SDEI_SUPPORT \
163)))
164
165$(eval $(call add_defines,\
166    $(sort \
167        CRASH_REPORTING \
168        EL3_EXCEPTION_HANDLING \
169        SDEI_SUPPORT \
170)))
171