bl31.mk 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. #
  2. # Copyright (c) 2013-2024, 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. $(info Including EL3 SPMC makefile)
  27. include services/std_svc/spm/common/spm.mk
  28. include services/std_svc/spm/el3_spmc/spmc.mk
  29. endif
  30. include lib/psci/psci_lib.mk
  31. BL31_SOURCES += bl31/bl31_main.c \
  32. bl31/interrupt_mgmt.c \
  33. bl31/aarch64/bl31_entrypoint.S \
  34. bl31/aarch64/crash_reporting.S \
  35. bl31/aarch64/runtime_exceptions.S \
  36. bl31/bl31_context_mgmt.c \
  37. bl31/bl31_traps.c \
  38. common/runtime_svc.c \
  39. lib/cpus/errata_common.c \
  40. lib/cpus/aarch64/dsu_helpers.S \
  41. plat/common/aarch64/platform_mp_stack.S \
  42. services/arm_arch_svc/arm_arch_svc_setup.c \
  43. services/std_svc/std_svc_setup.c \
  44. lib/el3_runtime/simd_ctx.c \
  45. ${PSCI_LIB_SOURCES} \
  46. ${SPMD_SOURCES} \
  47. ${SPM_MM_SOURCES} \
  48. ${SPMC_SOURCES} \
  49. ${SPM_SOURCES}
  50. VENDOR_EL3_SRCS += services/el3/ven_el3_svc.c
  51. ifeq (${ENABLE_PMF}, 1)
  52. BL31_SOURCES += lib/pmf/pmf_main.c \
  53. ${VENDOR_EL3_SRCS}
  54. endif
  55. include lib/debugfs/debugfs.mk
  56. ifeq (${USE_DEBUGFS},1)
  57. BL31_SOURCES += ${DEBUGFS_SRCS} \
  58. ${VENDOR_EL3_SRCS}
  59. endif
  60. ifeq (${PLATFORM_REPORT_CTX_MEM_USE},1)
  61. BL31_SOURCES += lib/el3_runtime/aarch64/context_debug.c
  62. endif
  63. ifeq (${EL3_EXCEPTION_HANDLING},1)
  64. BL31_SOURCES += bl31/ehf.c
  65. endif
  66. ifeq (${FFH_SUPPORT},1)
  67. BL31_SOURCES += bl31/aarch64/ea_delegate.S
  68. endif
  69. ifeq (${SDEI_SUPPORT},1)
  70. ifeq (${EL3_EXCEPTION_HANDLING},0)
  71. $(error EL3_EXCEPTION_HANDLING must be 1 for SDEI support)
  72. endif
  73. BL31_SOURCES += services/std_svc/sdei/sdei_dispatch.S \
  74. services/std_svc/sdei/sdei_event.c \
  75. services/std_svc/sdei/sdei_intr_mgmt.c \
  76. services/std_svc/sdei/sdei_main.c \
  77. services/std_svc/sdei/sdei_state.c
  78. endif
  79. ifeq (${TRNG_SUPPORT},1)
  80. BL31_SOURCES += services/std_svc/trng/trng_main.c \
  81. services/std_svc/trng/trng_entropy_pool.c
  82. endif
  83. ifneq (${ENABLE_SPE_FOR_NS},0)
  84. BL31_SOURCES += lib/extensions/spe/spe.c
  85. endif
  86. ifeq (${ERRATA_ABI_SUPPORT},1)
  87. BL31_SOURCES += services/std_svc/errata_abi/errata_abi_main.c
  88. endif
  89. ifneq (${ENABLE_FEAT_AMU},0)
  90. BL31_SOURCES += ${AMU_SOURCES}
  91. endif
  92. ifneq (${ENABLE_FEAT_FGT2},0)
  93. BL31_SOURCES += lib/extensions/fgt/fgt2.c
  94. endif
  95. ifneq (${ENABLE_FEAT_TCR2},0)
  96. BL31_SOURCES += lib/extensions/tcr/tcr2.c
  97. endif
  98. ifeq (${ENABLE_MPMM},1)
  99. BL31_SOURCES += ${MPMM_SOURCES}
  100. endif
  101. ifneq (${ENABLE_SME_FOR_NS},0)
  102. BL31_SOURCES += lib/extensions/sme/sme.c
  103. endif
  104. ifneq (${ENABLE_SVE_FOR_NS},0)
  105. BL31_SOURCES += lib/extensions/sve/sve.c
  106. endif
  107. ifneq (${ENABLE_FEAT_MPAM},0)
  108. BL31_SOURCES += lib/extensions/mpam/mpam.c
  109. endif
  110. ifneq (${ENABLE_FEAT_DEBUGV8P9},0)
  111. BL31_SOURCES += lib/extensions/debug/debugv8p9.c
  112. endif
  113. ifneq (${ENABLE_TRBE_FOR_NS},0)
  114. BL31_SOURCES += lib/extensions/trbe/trbe.c
  115. endif
  116. ifneq (${ENABLE_BRBE_FOR_NS},0)
  117. BL31_SOURCES += lib/extensions/brbe/brbe.c
  118. endif
  119. ifneq (${ENABLE_SYS_REG_TRACE_FOR_NS},0)
  120. BL31_SOURCES += lib/extensions/sys_reg_trace/aarch64/sys_reg_trace.c
  121. endif
  122. ifneq (${ENABLE_TRF_FOR_NS},0)
  123. BL31_SOURCES += lib/extensions/trf/aarch64/trf.c
  124. endif
  125. ifeq (${WORKAROUND_CVE_2017_5715},1)
  126. BL31_SOURCES += lib/cpus/aarch64/wa_cve_2017_5715_bpiall.S \
  127. lib/cpus/aarch64/wa_cve_2017_5715_mmu.S
  128. endif
  129. ifeq ($(SMC_PCI_SUPPORT),1)
  130. BL31_SOURCES += services/std_svc/pci_svc.c
  131. endif
  132. ifeq (${ENABLE_RME},1)
  133. include lib/gpt_rme/gpt_rme.mk
  134. BL31_SOURCES += ${GPT_LIB_SRCS} \
  135. ${RMMD_SOURCES}
  136. endif
  137. ifeq ($(FEATURE_DETECTION),1)
  138. BL31_SOURCES += common/feat_detect.c
  139. endif
  140. ifeq (${DRTM_SUPPORT},1)
  141. BL31_SOURCES += services/std_svc/drtm/drtm_main.c \
  142. services/std_svc/drtm/drtm_dma_prot.c \
  143. services/std_svc/drtm/drtm_res_address_map.c \
  144. services/std_svc/drtm/drtm_measurements.c \
  145. services/std_svc/drtm/drtm_remediation.c \
  146. ${MBEDTLS_SOURCES}
  147. endif
  148. ifeq ($(CROS_WIDEVINE_SMC),1)
  149. BL31_SOURCES += services/oem/chromeos/widevine_smc_handlers.c
  150. endif
  151. BL31_DEFAULT_LINKER_SCRIPT_SOURCE := bl31/bl31.ld.S
  152. ifeq ($($(ARCH)-ld-id),gnu-gcc)
  153. BL31_LDFLAGS += -Wl,--sort-section=alignment
  154. else ifneq ($(filter llvm-lld gnu-ld,$($(ARCH)-ld-id)),)
  155. BL31_LDFLAGS += --sort-section=alignment
  156. endif
  157. # Flag used to indicate if Crash reporting via console should be included
  158. # in BL31. This defaults to being present in DEBUG builds only
  159. ifndef CRASH_REPORTING
  160. CRASH_REPORTING := $(DEBUG)
  161. endif
  162. $(eval $(call assert_booleans,\
  163. $(sort \
  164. CRASH_REPORTING \
  165. EL3_EXCEPTION_HANDLING \
  166. SDEI_SUPPORT \
  167. )))
  168. $(eval $(call add_defines,\
  169. $(sort \
  170. CRASH_REPORTING \
  171. EL3_EXCEPTION_HANDLING \
  172. SDEI_SUPPORT \
  173. )))