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