bl31.mk 4.9 KB

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