bl31.mk 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. #
  2. # Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved.
  3. #
  4. # SPDX-License-Identifier: BSD-3-Clause
  5. #
  6. ################################################################################
  7. # Include Makefile for the SPM-MM implementation
  8. ################################################################################
  9. ifeq (${SUPPORT_UNKNOWN_MPID},1)
  10. ifeq (${DEBUG},0)
  11. $(warning WARNING: SUPPORT_UNKNOWN_MPID enabled)
  12. endif
  13. endif
  14. ifeq (${SPM_MM},1)
  15. ifeq (${EL3_EXCEPTION_HANDLING},0)
  16. $(error EL3_EXCEPTION_HANDLING must be 1 for SPM-MM support)
  17. else
  18. $(info Including SPM Management Mode (MM) makefile)
  19. include services/std_svc/spm/common/spm.mk
  20. include services/std_svc/spm/spm_mm/spm_mm.mk
  21. endif
  22. endif
  23. include lib/extensions/amu/amu.mk
  24. include lib/mpmm/mpmm.mk
  25. ifeq (${SPMC_AT_EL3},1)
  26. $(warning "EL3 SPMC is an experimental feature")
  27. $(info Including EL3 SPMC makefile)
  28. include services/std_svc/spm/common/spm.mk
  29. include services/std_svc/spm/el3_spmc/spmc.mk
  30. endif
  31. include lib/psci/psci_lib.mk
  32. BL31_SOURCES += bl31/bl31_main.c \
  33. bl31/interrupt_mgmt.c \
  34. bl31/aarch64/bl31_entrypoint.S \
  35. bl31/aarch64/crash_reporting.S \
  36. bl31/aarch64/ea_delegate.S \
  37. bl31/aarch64/runtime_exceptions.S \
  38. bl31/bl31_context_mgmt.c \
  39. bl31/bl31_traps.c \
  40. common/runtime_svc.c \
  41. lib/cpus/aarch64/dsu_helpers.S \
  42. plat/common/aarch64/platform_mp_stack.S \
  43. services/arm_arch_svc/arm_arch_svc_setup.c \
  44. services/std_svc/std_svc_setup.c \
  45. ${PSCI_LIB_SOURCES} \
  46. ${SPMD_SOURCES} \
  47. ${SPM_MM_SOURCES} \
  48. ${SPMC_SOURCES} \
  49. ${SPM_SOURCES}
  50. ifeq (${ENABLE_PMF}, 1)
  51. BL31_SOURCES += lib/pmf/pmf_main.c
  52. endif
  53. include lib/debugfs/debugfs.mk
  54. ifeq (${USE_DEBUGFS},1)
  55. BL31_SOURCES += $(DEBUGFS_SRCS)
  56. endif
  57. ifeq (${EL3_EXCEPTION_HANDLING},1)
  58. BL31_SOURCES += bl31/ehf.c
  59. endif
  60. ifeq (${SDEI_SUPPORT},1)
  61. ifeq (${EL3_EXCEPTION_HANDLING},0)
  62. $(error EL3_EXCEPTION_HANDLING must be 1 for SDEI support)
  63. endif
  64. BL31_SOURCES += services/std_svc/sdei/sdei_dispatch.S \
  65. services/std_svc/sdei/sdei_event.c \
  66. services/std_svc/sdei/sdei_intr_mgmt.c \
  67. services/std_svc/sdei/sdei_main.c \
  68. services/std_svc/sdei/sdei_state.c
  69. endif
  70. ifeq (${TRNG_SUPPORT},1)
  71. BL31_SOURCES += services/std_svc/trng/trng_main.c \
  72. services/std_svc/trng/trng_entropy_pool.c
  73. endif
  74. ifneq (${ENABLE_SPE_FOR_NS},0)
  75. BL31_SOURCES += lib/extensions/spe/spe.c
  76. endif
  77. ifeq (${ERRATA_ABI_SUPPORT},1)
  78. BL31_SOURCES += services/std_svc/errata_abi/errata_abi_main.c
  79. endif
  80. ifneq (${ENABLE_FEAT_AMU},0)
  81. BL31_SOURCES += ${AMU_SOURCES}
  82. endif
  83. ifeq (${ENABLE_MPMM},1)
  84. BL31_SOURCES += ${MPMM_SOURCES}
  85. endif
  86. ifneq (${ENABLE_SME_FOR_NS},0)
  87. BL31_SOURCES += lib/extensions/sme/sme.c
  88. endif
  89. ifneq (${ENABLE_SVE_FOR_NS},0)
  90. BL31_SOURCES += lib/extensions/sve/sve.c
  91. endif
  92. ifneq (${ENABLE_MPAM_FOR_LOWER_ELS},0)
  93. BL31_SOURCES += lib/extensions/mpam/mpam.c
  94. endif
  95. ifneq (${ENABLE_TRBE_FOR_NS},0)
  96. BL31_SOURCES += lib/extensions/trbe/trbe.c
  97. endif
  98. ifneq (${ENABLE_BRBE_FOR_NS},0)
  99. BL31_SOURCES += lib/extensions/brbe/brbe.c
  100. endif
  101. ifneq (${ENABLE_SYS_REG_TRACE_FOR_NS},0)
  102. BL31_SOURCES += lib/extensions/sys_reg_trace/aarch64/sys_reg_trace.c
  103. endif
  104. ifneq (${ENABLE_TRF_FOR_NS},0)
  105. BL31_SOURCES += lib/extensions/trf/aarch64/trf.c
  106. endif
  107. ifeq (${WORKAROUND_CVE_2017_5715},1)
  108. BL31_SOURCES += lib/cpus/aarch64/wa_cve_2017_5715_bpiall.S \
  109. lib/cpus/aarch64/wa_cve_2017_5715_mmu.S
  110. endif
  111. ifeq ($(SMC_PCI_SUPPORT),1)
  112. BL31_SOURCES += services/std_svc/pci_svc.c
  113. endif
  114. ifeq (${ENABLE_RME},1)
  115. include lib/gpt_rme/gpt_rme.mk
  116. BL31_SOURCES += ${GPT_LIB_SRCS} \
  117. ${RMMD_SOURCES}
  118. endif
  119. ifeq ($(FEATURE_DETECTION),1)
  120. BL31_SOURCES += common/feat_detect.c
  121. endif
  122. ifeq (${DRTM_SUPPORT},1)
  123. BL31_SOURCES += services/std_svc/drtm/drtm_main.c \
  124. services/std_svc/drtm/drtm_dma_prot.c \
  125. services/std_svc/drtm/drtm_res_address_map.c \
  126. services/std_svc/drtm/drtm_measurements.c \
  127. services/std_svc/drtm/drtm_remediation.c \
  128. ${MBEDTLS_SOURCES}
  129. endif
  130. BL31_DEFAULT_LINKER_SCRIPT_SOURCE := bl31/bl31.ld.S
  131. ifneq ($(findstring gcc,$(notdir $(LD))),)
  132. BL31_LDFLAGS += -Wl,--sort-section=alignment
  133. else ifneq ($(findstring ld,$(notdir $(LD))),)
  134. BL31_LDFLAGS += --sort-section=alignment
  135. endif
  136. # Flag used to indicate if Crash reporting via console should be included
  137. # in BL31. This defaults to being present in DEBUG builds only
  138. ifndef CRASH_REPORTING
  139. CRASH_REPORTING := $(DEBUG)
  140. endif
  141. $(eval $(call assert_booleans,\
  142. $(sort \
  143. CRASH_REPORTING \
  144. EL3_EXCEPTION_HANDLING \
  145. SDEI_SUPPORT \
  146. )))
  147. $(eval $(call add_defines,\
  148. $(sort \
  149. CRASH_REPORTING \
  150. EL3_EXCEPTION_HANDLING \
  151. SDEI_SUPPORT \
  152. )))