1# 2# Copyright (c) 2013-2026, 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 27 28ifeq (${SPMC_AT_EL3},1) 29 $(info Including EL3 SPMC makefile) 30 include services/std_svc/spm/common/spm.mk 31 include services/std_svc/spm/el3_spmc/spmc.mk 32endif 33 34include lib/psci/psci_lib.mk 35 36BL31_SOURCES += bl31/bl31_main.c \ 37 bl31/interrupt_mgmt.c \ 38 bl31/aarch64/bl31_entrypoint.S \ 39 bl31/aarch64/crash_reporting.S \ 40 bl31/aarch64/runtime_exceptions.S \ 41 bl31/bl31_context_mgmt.c \ 42 bl31/bl31_traps.c \ 43 common/runtime_svc.c \ 44 lib/cpus/errata_common.c \ 45 lib/per_cpu/aarch64/per_cpu_asm.S \ 46 lib/per_cpu/per_cpu.c \ 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 lib/el3_runtime/simd_ctx.c \ 51 ${PSCI_LIB_SOURCES} \ 52 ${SPMD_SOURCES} \ 53 ${SPM_MM_SOURCES} \ 54 ${SPMC_SOURCES} \ 55 ${SPM_SOURCES} 56 57VENDOR_EL3_SRCS += services/el3/ven_el3_svc.c 58 59ifeq (${ENABLE_PMF}, 1) 60BL31_SOURCES += lib/pmf/pmf_main.c \ 61 ${VENDOR_EL3_SRCS} 62endif 63 64include lib/debugfs/debugfs.mk 65ifeq (${USE_DEBUGFS},1) 66BL31_SOURCES += ${DEBUGFS_SRCS} \ 67 ${VENDOR_EL3_SRCS} 68endif 69 70ifeq (${PLATFORM_REPORT_CTX_MEM_USE},1) 71BL31_SOURCES += lib/el3_runtime/aarch64/context_debug.c 72endif 73 74ifeq (${EL3_EXCEPTION_HANDLING},1) 75BL31_SOURCES += bl31/ehf.c 76endif 77 78ifeq (${FFH_SUPPORT},1) 79BL31_SOURCES += bl31/aarch64/ea_delegate.S 80endif 81 82ifeq (${SDEI_SUPPORT},1) 83ifeq (${EL3_EXCEPTION_HANDLING},0) 84 $(error EL3_EXCEPTION_HANDLING must be 1 for SDEI support) 85endif 86BL31_SOURCES += services/std_svc/sdei/sdei_dispatch.S \ 87 services/std_svc/sdei/sdei_event.c \ 88 services/std_svc/sdei/sdei_intr_mgmt.c \ 89 services/std_svc/sdei/sdei_main.c \ 90 services/std_svc/sdei/sdei_state.c 91endif 92 93ifeq (${TRNG_SUPPORT},1) 94BL31_SOURCES += services/std_svc/trng/trng_main.c \ 95 services/std_svc/trng/trng_entropy_pool.c 96endif 97 98ifneq (${ENABLE_SPE_FOR_NS},0) 99BL31_SOURCES += lib/extensions/spe/spe.c 100endif 101 102ifeq (${ERRATA_ABI_SUPPORT},1) 103BL31_SOURCES += services/std_svc/errata_abi/errata_abi_main.c 104endif 105 106ifneq (${ENABLE_FEAT_AMU},0) 107BL31_SOURCES += ${AMU_SOURCES} 108endif 109 110ifneq (${ENABLE_FEAT_FGT2},0) 111BL31_SOURCES += lib/extensions/fgt/fgt2.c 112endif 113 114ifneq (${ENABLE_FEAT_IDTE3},0) 115BL31_SOURCES += lib/extensions/idte/idte3.c 116endif 117 118ifneq (${ENABLE_FEAT_TCR2},0) 119BL31_SOURCES += lib/extensions/tcr/tcr2.c 120endif 121 122ifneq (${ENABLE_SME_FOR_NS},0) 123BL31_SOURCES += lib/extensions/sme/sme.c 124endif 125ifneq (${ENABLE_SVE_FOR_NS},0) 126BL31_SOURCES += lib/extensions/sve/sve.c 127endif 128 129ifneq (${ENABLE_FEAT_MPAM},0) 130BL31_SOURCES += lib/extensions/mpam/mpam.c 131endif 132 133ifneq (${ENABLE_FEAT_DEBUGV8P9},0) 134BL31_SOURCES += lib/extensions/debug/debugv8p9.c 135endif 136 137ifneq (${ENABLE_TRBE_FOR_NS},0) 138BL31_SOURCES += lib/extensions/trbe/trbe.c 139endif 140 141ifneq (${ENABLE_BRBE_FOR_NS},0) 142BL31_SOURCES += lib/extensions/brbe/brbe.c 143endif 144 145ifneq (${ENABLE_SYS_REG_TRACE_FOR_NS},0) 146BL31_SOURCES += lib/extensions/sys_reg_trace/aarch64/sys_reg_trace.c 147endif 148 149ifneq (${ENABLE_TRF_FOR_NS},0) 150BL31_SOURCES += lib/extensions/trf/aarch64/trf.c 151endif 152 153ifneq (${ENABLE_FEAT_CPA2}, 0) 154BL31_SOURCES += lib/extensions/cpa2/cpa2.c 155endif 156 157ifeq (${WORKAROUND_CVE_2017_5715},1) 158BL31_SOURCES += lib/cpus/aarch64/wa_cve_2017_5715_bpiall.S \ 159 lib/cpus/aarch64/wa_cve_2017_5715_mmu.S 160endif 161 162ifeq (${WORKAROUND_CVE_2025_0647},1) 163BL31_SOURCES += lib/cpus/aarch64/wa_cve_2025_0647_cpprctx.S 164endif 165 166ifeq ($(SMC_PCI_SUPPORT),1) 167BL31_SOURCES += services/std_svc/pci_svc.c 168endif 169 170ifneq (${ENABLE_FEAT_RME},0) 171include lib/gpt_rme/gpt_rme.mk 172 173BL31_SOURCES += ${GPT_LIB_SRCS} 174endif 175 176ifeq (${ENABLE_RMM},1) 177BL31_SOURCES += ${RMMD_SOURCES} 178endif 179 180ifeq (${USE_DSU_DRIVER},1) 181BL31_SOURCES += drivers/arm/dsu/dsu.c 182endif 183 184# RAS sources 185ifneq (${ENABLE_FEAT_RAS},0) 186ifeq (${HANDLE_EA_EL3_FIRST_NS},1) 187BL31_SOURCES += lib/extensions/ras/std_err_record.c \ 188 lib/extensions/ras/ras_common.c 189endif 190endif 191 192ifeq ($(FEATURE_DETECTION),1) 193BL31_SOURCES += common/feat_detect.c 194endif 195 196ifeq (${DRTM_SUPPORT},1) 197BL31_SOURCES += services/std_svc/drtm/drtm_main.c \ 198 services/std_svc/drtm/drtm_dma_prot.c \ 199 services/std_svc/drtm/drtm_res_address_map.c \ 200 services/std_svc/drtm/drtm_measurements.c \ 201 services/std_svc/drtm/drtm_remediation.c \ 202 ${MBEDTLS_SOURCES} 203endif 204 205ifeq (${LFA_SUPPORT},1) 206include services/std_svc/lfa/lfa.mk 207BL31_SOURCES += ${LFA_SOURCES} 208endif 209 210ifeq ($(CROS_WIDEVINE_SMC),1) 211BL31_SOURCES += services/oem/chromeos/widevine_smc_handlers.c 212endif 213 214ifeq (${FIRME_SUPPORT},1) 215BL31_SOURCES += services/std_svc/firme/firme_main.c \ 216 services/std_svc/firme/firme_base_service.c \ 217 services/std_svc/firme/firme_granule_management_service.c 218endif 219 220BL31_DEFAULT_LINKER_SCRIPT_SOURCE := bl31/bl31.ld.S 221 222# CRYPTO_SUPPORT 223NEED_AUTH := 0 224NEED_HASH := $(if $(filter 1,$(MEASURED_BOOT) $(DRTM_SUPPORT)),1,) 225$(eval $(call set_crypto_support,NEED_AUTH,NEED_HASH)) 226 227# Flag used to indicate if Crash reporting via console should be included 228# in BL31. This defaults to being present in DEBUG builds only 229ifndef CRASH_REPORTING 230CRASH_REPORTING := $(DEBUG) 231endif 232 233# BL31_CPPFLAGS 234$(eval BL31_CPPFLAGS += $(call make_defines, \ 235 $(sort \ 236 CRYPTO_SUPPORT \ 237))) 238 239$(eval $(call assert_booleans,\ 240 $(sort \ 241 CRASH_REPORTING \ 242 EL3_EXCEPTION_HANDLING \ 243 FIRME_SUPPORT \ 244 SDEI_SUPPORT \ 245 USE_DSU_DRIVER \ 246))) 247 248# Numeric_Flags 249$(eval $(call assert_numerics,\ 250 $(sort \ 251 CRYPTO_SUPPORT \ 252))) 253 254$(eval $(call add_defines,\ 255 $(sort \ 256 CRASH_REPORTING \ 257 EL3_EXCEPTION_HANDLING \ 258 SDEI_SUPPORT \ 259 USE_DSU_DRIVER \ 260 FIRME_SUPPORT \ 261))) 262