blob: 40e3df8b2857e97c18477e3c906f7a1fba570ad4 [file] [log] [blame]
Achin Gupta4f6ad662013-10-25 09:08:21 +01001#
Chris Kay68d28362023-01-16 16:53:45 +00002# Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved.
Achin Gupta4f6ad662013-10-25 09:08:21 +01003#
dp-armfa3cf0b2017-05-03 09:38:09 +01004# SPDX-License-Identifier: BSD-3-Clause
Achin Gupta4f6ad662013-10-25 09:08:21 +01005#
6
Antonio Nino Diazc41f2062017-10-24 10:07:35 +01007################################################################################
Paul Beesleydb4e25a2019-10-14 15:27:12 +00008# Include Makefile for the SPM-MM implementation
Antonio Nino Diazc41f2062017-10-24 10:07:35 +01009################################################################################
Javier Almansa Sobrinoe1ecd232020-08-20 18:48:09 +010010ifeq (${SUPPORT_UNKNOWN_MPID},1)
11 ifeq (${DEBUG},0)
12 $(warning WARNING: SUPPORT_UNKNOWN_MPID enabled)
13 endif
14endif
15
Paul Beesleyfe975b42019-09-16 11:29:03 +000016ifeq (${SPM_MM},1)
17 ifeq (${EL3_EXCEPTION_HANDLING},0)
Paul Beesleydb4e25a2019-10-14 15:27:12 +000018 $(error EL3_EXCEPTION_HANDLING must be 1 for SPM-MM support)
Antonio Nino Diaz8cd7ea32018-10-30 11:08:08 +000019 else
Paul Beesleyfe975b42019-09-16 11:29:03 +000020 $(info Including SPM Management Mode (MM) makefile)
Marc Bonnici758bd242021-12-19 21:37:50 +000021 include services/std_svc/spm/common/spm.mk
22 include services/std_svc/spm/spm_mm/spm_mm.mk
Antonio Nino Diaz8cd7ea32018-10-30 11:08:08 +000023 endif
Antonio Nino Diazc41f2062017-10-24 10:07:35 +010024endif
25
Chris Kay1000ea82021-05-19 19:24:37 +010026include lib/extensions/amu/amu.mk
Chris Kay03be39d2021-05-05 13:38:30 +010027include lib/mpmm/mpmm.mk
Marc Bonniciabaac162021-12-01 18:00:40 +000028
29ifeq (${SPMC_AT_EL3},1)
Marc Bonniciabaac162021-12-01 18:00:40 +000030 $(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
Soby Mathew0d786072016-03-24 16:56:29 +000035include lib/psci/psci_lib.mk
36
Dan Handley176e7b42014-04-15 18:20:09 +010037BL31_SOURCES += bl31/bl31_main.c \
Achin Gupta191e86e2014-05-09 10:03:15 +010038 bl31/interrupt_mgmt.c \
Dan Handley176e7b42014-04-15 18:20:09 +010039 bl31/aarch64/bl31_entrypoint.S \
Andrew Thoelke4d2d5532014-06-02 12:38:12 +010040 bl31/aarch64/crash_reporting.S \
Jeenu Viswambharan2de81532018-02-16 11:54:24 +000041 bl31/aarch64/runtime_exceptions.S \
Yatharth Kochar6c0566c2015-10-02 17:56:48 +010042 bl31/bl31_context_mgmt.c \
Andre Przywarafa914d82022-11-21 17:04:10 +000043 bl31/bl31_traps.c \
Soby Mathew0d786072016-03-24 16:56:29 +000044 common/runtime_svc.c \
John Tsichritzis4daa1de2018-07-23 09:11:59 +010045 lib/cpus/aarch64/dsu_helpers.S \
dp-arm230011c2017-03-07 11:02:47 +000046 plat/common/aarch64/platform_mp_stack.S \
Dimitris Papastamos0dcdb1a2018-01-19 16:58:29 +000047 services/arm_arch_svc/arm_arch_svc_setup.c \
Dan Handley176e7b42014-04-15 18:20:09 +010048 services/std_svc/std_svc_setup.c \
Antonio Nino Diazc41f2062017-10-24 10:07:35 +010049 ${PSCI_LIB_SOURCES} \
Achin Gupta60b7b8a2019-10-11 15:50:43 +010050 ${SPMD_SOURCES} \
Marc Bonnici758bd242021-12-19 21:37:50 +000051 ${SPM_MM_SOURCES} \
Marc Bonniciabaac162021-12-01 18:00:40 +000052 ${SPMC_SOURCES} \
Jeenu Viswambharan2de81532018-02-16 11:54:24 +000053 ${SPM_SOURCES}
Antonio Nino Diazc41f2062017-10-24 10:07:35 +010054
Yatharth Kochar9518d022016-03-11 14:20:19 +000055ifeq (${ENABLE_PMF}, 1)
56BL31_SOURCES += lib/pmf/pmf_main.c
57endif
58
Olivier Deprezcb4c5622019-09-19 17:46:46 +020059include lib/debugfs/debugfs.mk
60ifeq (${USE_DEBUGFS},1)
61 BL31_SOURCES += $(DEBUGFS_SRCS)
62endif
63
Juan Pablo Condeb5ec1382023-11-08 16:14:28 -060064ifeq (${PLATFORM_REPORT_CTX_MEM_USE},1)
65BL31_SOURCES += lib/el3_runtime/aarch64/context_debug.c
66endif
67
Jeenu Viswambharan10a67272017-09-22 08:32:10 +010068ifeq (${EL3_EXCEPTION_HANDLING},1)
69BL31_SOURCES += bl31/ehf.c
70endif
71
Manish Pandeya4752e22023-10-11 11:52:24 +010072ifeq (${FFH_SUPPORT},1)
73BL31_SOURCES += bl31/aarch64/ea_delegate.S
74endif
75
Jeenu Viswambharan04e3a7f2017-10-16 08:43:14 +010076ifeq (${SDEI_SUPPORT},1)
77ifeq (${EL3_EXCEPTION_HANDLING},0)
78 $(error EL3_EXCEPTION_HANDLING must be 1 for SDEI support)
79endif
Jeenu Viswambharan8b7e6bc2018-02-16 12:07:48 +000080BL31_SOURCES += services/std_svc/sdei/sdei_dispatch.S \
81 services/std_svc/sdei/sdei_event.c \
Jeenu Viswambharan04e3a7f2017-10-16 08:43:14 +010082 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
Jimmy Brisson26c5b5c2020-06-22 14:18:42 -050087ifeq (${TRNG_SUPPORT},1)
88BL31_SOURCES += services/std_svc/trng/trng_main.c \
89 services/std_svc/trng/trng_entropy_pool.c
90endif
91
Andre Przywaraf3e8cfc2022-11-17 16:42:09 +000092ifneq (${ENABLE_SPE_FOR_NS},0)
Dimitris Papastamos5bdbb472017-10-13 12:06:06 +010093BL31_SOURCES += lib/extensions/spe/spe.c
94endif
95
Sona Mathew7fe03522022-11-18 18:05:38 -060096ifeq (${ERRATA_ABI_SUPPORT},1)
97BL31_SOURCES += services/std_svc/errata_abi/errata_abi_main.c
98endif
99
Andre Przywara0b7f1b02023-03-21 13:53:19 +0000100ifneq (${ENABLE_FEAT_AMU},0)
Chris Kay1000ea82021-05-19 19:24:37 +0100101BL31_SOURCES += ${AMU_SOURCES}
Dimitris Papastamose08005a2017-10-12 13:02:29 +0100102endif
103
Chris Kay03be39d2021-05-05 13:38:30 +0100104ifeq (${ENABLE_MPMM},1)
105BL31_SOURCES += ${MPMM_SOURCES}
106endif
107
Jayanth Dodderi Chidanand605419a2023-03-06 23:56:14 +0000108ifneq (${ENABLE_SME_FOR_NS},0)
johpow019baade32021-07-08 14:14:00 -0500109BL31_SOURCES += lib/extensions/sme/sme.c
Boyan Karatotev7f5dcc72023-03-08 16:29:26 +0000110endif
Jayanth Dodderi Chidanandd62c6812023-03-07 10:43:19 +0000111ifneq (${ENABLE_SVE_FOR_NS},0)
David Cunadoce88eee2017-10-20 11:30:57 +0100112BL31_SOURCES += lib/extensions/sve/sve.c
113endif
114
Arvind Ram Prakashab28d4b2023-10-11 12:10:56 -0500115ifneq (${ENABLE_FEAT_MPAM},0)
Jeenu Viswambharan2da918c2018-07-31 16:13:33 +0100116BL31_SOURCES += lib/extensions/mpam/mpam.c
117endif
118
Andre Przywara191eff62022-11-17 16:42:09 +0000119ifneq (${ENABLE_TRBE_FOR_NS},0)
Manish V Badarkhe20df29c2021-07-02 09:10:56 +0100120BL31_SOURCES += lib/extensions/trbe/trbe.c
121endif
122
Andre Przywarac97c5512022-11-17 16:42:09 +0000123ifneq (${ENABLE_BRBE_FOR_NS},0)
johpow0181865962022-01-28 17:06:20 -0600124BL31_SOURCES += lib/extensions/brbe/brbe.c
125endif
126
Andre Przywara44e33e02022-11-17 16:42:09 +0000127ifneq (${ENABLE_SYS_REG_TRACE_FOR_NS},0)
Manish V Badarkhef356f7e2021-06-29 11:44:20 +0100128BL31_SOURCES += lib/extensions/sys_reg_trace/aarch64/sys_reg_trace.c
129endif
130
Andre Przywara06ea44e2022-11-17 17:30:43 +0000131ifneq (${ENABLE_TRF_FOR_NS},0)
Manish V Badarkhe51a97112021-07-08 09:33:18 +0100132BL31_SOURCES += lib/extensions/trf/aarch64/trf.c
133endif
134
Dimitris Papastamos446f7f12017-11-30 14:53:53 +0000135ifeq (${WORKAROUND_CVE_2017_5715},1)
Dimitris Papastamos570c06a2018-04-06 15:29:34 +0100136BL31_SOURCES += lib/cpus/aarch64/wa_cve_2017_5715_bpiall.S \
137 lib/cpus/aarch64/wa_cve_2017_5715_mmu.S
Dimitris Papastamos446f7f12017-11-30 14:53:53 +0000138endif
139
Jeremy Lintonc8c3e0d2020-11-18 10:17:57 -0600140ifeq ($(SMC_PCI_SUPPORT),1)
141BL31_SOURCES += services/std_svc/pci_svc.c
142endif
143
Zelalem Aweke13dc8f12021-07-09 14:20:03 -0500144ifeq (${ENABLE_RME},1)
johpow019d134022021-06-16 17:57:28 -0500145include lib/gpt_rme/gpt_rme.mk
Zelalem Aweke8e2e24b2021-07-13 14:05:20 -0500146
147BL31_SOURCES += ${GPT_LIB_SRCS} \
148 ${RMMD_SOURCES}
Zelalem Aweke13dc8f12021-07-09 14:20:03 -0500149endif
150
Jayanth Dodderi Chidanand9461a892022-01-17 18:57:17 +0000151ifeq ($(FEATURE_DETECTION),1)
152BL31_SOURCES += common/feat_detect.c
153endif
154
Manish V Badarkhe8a766032022-02-23 11:26:53 +0000155ifeq (${DRTM_SUPPORT},1)
johpow01baa3e6c2022-03-11 17:50:58 -0600156BL31_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 \
Manish V Badarkhe19b22f92022-06-17 11:42:17 +0100159 services/std_svc/drtm/drtm_measurements.c \
Manish V Badarkhe39dd5552022-06-21 09:41:32 +0100160 services/std_svc/drtm/drtm_remediation.c \
Manish V Badarkhec8168072022-02-25 09:11:12 +0000161 ${MBEDTLS_SOURCES}
Manish V Badarkhe8a766032022-02-23 11:26:53 +0000162endif
163
Chris Kay68d28362023-01-16 16:53:45 +0000164BL31_DEFAULT_LINKER_SCRIPT_SOURCE := bl31/bl31.ld.S
Achin Gupta9cf2bb72014-05-09 11:07:09 +0100165
Chris Kay60f805a2023-01-26 18:31:52 +0000166ifneq ($(findstring gcc,$(notdir $(LD))),)
167 BL31_LDFLAGS += -Wl,--sort-section=alignment
168else ifneq ($(findstring ld,$(notdir $(LD))),)
169 BL31_LDFLAGS += --sort-section=alignment
170endif
171
Sandrine Bailleuxf4119ec2015-12-17 13:58:58 +0000172# Flag used to indicate if Crash reporting via console should be included
Juan Castillo7d199412015-12-14 09:35:25 +0000173# in BL31. This defaults to being present in DEBUG builds only
Andrew Thoelke385f4d42014-06-03 11:50:53 +0100174ifndef CRASH_REPORTING
175CRASH_REPORTING := $(DEBUG)
176endif
177
Leonardo Sandoval65fca7c2020-09-10 12:18:27 -0500178$(eval $(call assert_booleans,\
179 $(sort \
180 CRASH_REPORTING \
181 EL3_EXCEPTION_HANDLING \
182 SDEI_SUPPORT \
183)))
Jeenu Viswambharan10a67272017-09-22 08:32:10 +0100184
Leonardo Sandoval65fca7c2020-09-10 12:18:27 -0500185$(eval $(call add_defines,\
186 $(sort \
187 CRASH_REPORTING \
188 EL3_EXCEPTION_HANDLING \
189 SDEI_SUPPORT \
190)))