1# 2# Copyright (c) 2013-2023, 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 bl31/bl31_traps.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 90ifneq (${ENABLE_SPE_FOR_NS},0) 91BL31_SOURCES += lib/extensions/spe/spe.c 92endif 93 94ifeq (${ERRATA_ABI_SUPPORT},1) 95BL31_SOURCES += services/std_svc/errata_abi/errata_abi_main.c 96endif 97 98ifneq (${ENABLE_FEAT_AMU},0) 99BL31_SOURCES += ${AMU_SOURCES} 100endif 101 102ifeq (${ENABLE_MPMM},1) 103BL31_SOURCES += ${MPMM_SOURCES} 104endif 105 106ifneq (${ENABLE_SME_FOR_NS},0) 107BL31_SOURCES += lib/extensions/sme/sme.c 108endif 109ifneq (${ENABLE_SVE_FOR_NS},0) 110BL31_SOURCES += lib/extensions/sve/sve.c 111endif 112 113ifneq (${ENABLE_MPAM_FOR_LOWER_ELS},0) 114BL31_SOURCES += lib/extensions/mpam/mpam.c 115endif 116 117ifneq (${ENABLE_TRBE_FOR_NS},0) 118BL31_SOURCES += lib/extensions/trbe/trbe.c 119endif 120 121ifneq (${ENABLE_BRBE_FOR_NS},0) 122BL31_SOURCES += lib/extensions/brbe/brbe.c 123endif 124 125ifneq (${ENABLE_SYS_REG_TRACE_FOR_NS},0) 126BL31_SOURCES += lib/extensions/sys_reg_trace/aarch64/sys_reg_trace.c 127endif 128 129ifneq (${ENABLE_TRF_FOR_NS},0) 130BL31_SOURCES += lib/extensions/trf/aarch64/trf.c 131endif 132 133ifeq (${WORKAROUND_CVE_2017_5715},1) 134BL31_SOURCES += lib/cpus/aarch64/wa_cve_2017_5715_bpiall.S \ 135 lib/cpus/aarch64/wa_cve_2017_5715_mmu.S 136endif 137 138ifeq ($(SMC_PCI_SUPPORT),1) 139BL31_SOURCES += services/std_svc/pci_svc.c 140endif 141 142ifeq (${ENABLE_RME},1) 143include lib/gpt_rme/gpt_rme.mk 144 145BL31_SOURCES += ${GPT_LIB_SRCS} \ 146 ${RMMD_SOURCES} 147endif 148 149ifeq ($(FEATURE_DETECTION),1) 150BL31_SOURCES += common/feat_detect.c 151endif 152 153ifeq (${DRTM_SUPPORT},1) 154BL31_SOURCES += services/std_svc/drtm/drtm_main.c \ 155 services/std_svc/drtm/drtm_dma_prot.c \ 156 services/std_svc/drtm/drtm_res_address_map.c \ 157 services/std_svc/drtm/drtm_measurements.c \ 158 services/std_svc/drtm/drtm_remediation.c \ 159 ${MBEDTLS_SOURCES} 160endif 161 162BL31_DEFAULT_LINKER_SCRIPT_SOURCE := bl31/bl31.ld.S 163 164ifneq ($(findstring gcc,$(notdir $(LD))),) 165 BL31_LDFLAGS += -Wl,--sort-section=alignment 166else ifneq ($(findstring ld,$(notdir $(LD))),) 167 BL31_LDFLAGS += --sort-section=alignment 168endif 169 170# Flag used to indicate if Crash reporting via console should be included 171# in BL31. This defaults to being present in DEBUG builds only 172ifndef CRASH_REPORTING 173CRASH_REPORTING := $(DEBUG) 174endif 175 176$(eval $(call assert_booleans,\ 177 $(sort \ 178 CRASH_REPORTING \ 179 EL3_EXCEPTION_HANDLING \ 180 SDEI_SUPPORT \ 181))) 182 183$(eval $(call add_defines,\ 184 $(sort \ 185 CRASH_REPORTING \ 186 EL3_EXCEPTION_HANDLING \ 187 SDEI_SUPPORT \ 188))) 189