1#
2# Copyright (c) 2013-2021, 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_mm/spm_mm.mk
22  endif
23endif
24
25include lib/extensions/amu/amu.mk
26include lib/mpmm/mpmm.mk
27include lib/psci/psci_lib.mk
28
29BL31_SOURCES		+=	bl31/bl31_main.c				\
30				bl31/interrupt_mgmt.c				\
31				bl31/aarch64/bl31_entrypoint.S			\
32				bl31/aarch64/crash_reporting.S			\
33				bl31/aarch64/ea_delegate.S			\
34				bl31/aarch64/runtime_exceptions.S		\
35				bl31/bl31_context_mgmt.c			\
36				common/runtime_svc.c				\
37				lib/cpus/aarch64/dsu_helpers.S			\
38				plat/common/aarch64/platform_mp_stack.S		\
39				services/arm_arch_svc/arm_arch_svc_setup.c	\
40				services/std_svc/std_svc_setup.c		\
41				${PSCI_LIB_SOURCES}				\
42				${SPMD_SOURCES}					\
43				${SPM_SOURCES}
44
45ifeq (${DISABLE_MTPMU},1)
46BL31_SOURCES		+=	lib/extensions/mtpmu/aarch64/mtpmu.S
47endif
48
49ifeq (${ENABLE_PMF}, 1)
50BL31_SOURCES		+=	lib/pmf/pmf_main.c
51endif
52
53include lib/debugfs/debugfs.mk
54ifeq (${USE_DEBUGFS},1)
55	BL31_SOURCES	+= $(DEBUGFS_SRCS)
56endif
57
58ifeq (${EL3_EXCEPTION_HANDLING},1)
59BL31_SOURCES		+=	bl31/ehf.c
60endif
61
62ifeq (${SDEI_SUPPORT},1)
63ifeq (${EL3_EXCEPTION_HANDLING},0)
64  $(error EL3_EXCEPTION_HANDLING must be 1 for SDEI support)
65endif
66BL31_SOURCES		+=	services/std_svc/sdei/sdei_dispatch.S	\
67				services/std_svc/sdei/sdei_event.c	\
68				services/std_svc/sdei/sdei_intr_mgmt.c	\
69				services/std_svc/sdei/sdei_main.c	\
70				services/std_svc/sdei/sdei_state.c
71endif
72
73ifeq (${TRNG_SUPPORT},1)
74BL31_SOURCES		+=	services/std_svc/trng/trng_main.c	\
75				services/std_svc/trng/trng_entropy_pool.c
76endif
77
78ifeq (${ENABLE_SPE_FOR_LOWER_ELS},1)
79BL31_SOURCES		+=	lib/extensions/spe/spe.c
80endif
81
82ifeq (${ENABLE_AMU},1)
83BL31_SOURCES		+=	${AMU_SOURCES}
84endif
85
86ifeq (${ENABLE_MPMM},1)
87BL31_SOURCES		+=	${MPMM_SOURCES}
88endif
89
90ifeq (${ENABLE_SME_FOR_NS},1)
91BL31_SOURCES		+=	lib/extensions/sme/sme.c
92BL31_SOURCES		+=	lib/extensions/sve/sve.c
93else
94ifeq (${ENABLE_SVE_FOR_NS},1)
95BL31_SOURCES		+=	lib/extensions/sve/sve.c
96endif
97endif
98
99ifeq (${ENABLE_MPAM_FOR_LOWER_ELS},1)
100BL31_SOURCES		+=	lib/extensions/mpam/mpam.c
101endif
102
103ifeq (${ENABLE_TRBE_FOR_NS},1)
104BL31_SOURCES		+=	lib/extensions/trbe/trbe.c
105endif
106
107ifeq (${ENABLE_SYS_REG_TRACE_FOR_NS},1)
108BL31_SOURCES		+=      lib/extensions/sys_reg_trace/aarch64/sys_reg_trace.c
109endif
110
111ifeq (${ENABLE_TRF_FOR_NS},1)
112BL31_SOURCES		+=	lib/extensions/trf/aarch64/trf.c
113endif
114
115ifeq (${WORKAROUND_CVE_2017_5715},1)
116BL31_SOURCES		+=	lib/cpus/aarch64/wa_cve_2017_5715_bpiall.S	\
117				lib/cpus/aarch64/wa_cve_2017_5715_mmu.S
118endif
119
120ifeq ($(SMC_PCI_SUPPORT),1)
121BL31_SOURCES		+=	services/std_svc/pci_svc.c
122endif
123
124ifeq (${ENABLE_RME},1)
125include lib/gpt_rme/gpt_rme.mk
126
127BL31_SOURCES		+=	${GPT_LIB_SRCS}					\
128				${RMMD_SOURCES}
129endif
130
131BL31_LINKERFILE		:=	bl31/bl31.ld.S
132
133# Flag used to indicate if Crash reporting via console should be included
134# in BL31. This defaults to being present in DEBUG builds only
135ifndef CRASH_REPORTING
136CRASH_REPORTING		:=	$(DEBUG)
137endif
138
139$(eval $(call assert_booleans,\
140    $(sort \
141	CRASH_REPORTING \
142	EL3_EXCEPTION_HANDLING \
143	SDEI_SUPPORT \
144)))
145
146$(eval $(call add_defines,\
147    $(sort \
148        CRASH_REPORTING \
149        EL3_EXCEPTION_HANDLING \
150        SDEI_SUPPORT \
151)))
152