platform.mk 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. #
  2. # Copyright (c) 2017-2024, Arm Limited and Contributors. All rights reserved.
  3. #
  4. # SPDX-License-Identifier: BSD-3-Clause
  5. #
  6. # Non-TF Boot ROM
  7. RESET_TO_BL2 := 1
  8. # On Hikey960, the TSP can execute from TZC secure area in DRAM.
  9. HIKEY960_TSP_RAM_LOCATION ?= dram
  10. ifeq (${HIKEY960_TSP_RAM_LOCATION}, dram)
  11. HIKEY960_TSP_RAM_LOCATION_ID = HIKEY960_DRAM_ID
  12. else ifeq (${HIKEY960_TSP_RAM_LOCATION}, sram)
  13. HIKEY960_TSP_RAM_LOCATION_ID = HIKEY960_SRAM_ID
  14. else
  15. $(error "Currently unsupported HIKEY960_TSP_RAM_LOCATION value")
  16. endif
  17. CRASH_CONSOLE_BASE := PL011_UART6_BASE
  18. COLD_BOOT_SINGLE_CPU := 1
  19. PLAT_PL061_MAX_GPIOS := 232
  20. PROGRAMMABLE_RESET_ADDRESS := 1
  21. ENABLE_SVE_FOR_NS := 0
  22. PLAT_PARTITION_BLOCK_SIZE := 4096
  23. # Process flags
  24. $(eval $(call add_define,HIKEY960_TSP_RAM_LOCATION_ID))
  25. $(eval $(call add_define,CRASH_CONSOLE_BASE))
  26. $(eval $(call add_define,PLAT_PL061_MAX_GPIOS))
  27. $(eval $(call add_define,PLAT_PARTITION_BLOCK_SIZE))
  28. # Add the build options to pack Trusted OS Extra1 and Trusted OS Extra2 images
  29. # in the FIP if the platform requires.
  30. ifneq ($(BL32_EXTRA1),)
  31. $(eval $(call TOOL_ADD_IMG,bl32_extra1,--tos-fw-extra1))
  32. endif
  33. ifneq ($(BL32_EXTRA2),)
  34. $(eval $(call TOOL_ADD_IMG,bl32_extra2,--tos-fw-extra2))
  35. endif
  36. USE_COHERENT_MEM := 1
  37. PLAT_INCLUDES := -Iplat/hisilicon/hikey960/include
  38. PLAT_BL_COMMON_SOURCES := drivers/arm/pl011/aarch64/pl011_console.S \
  39. drivers/delay_timer/delay_timer.c \
  40. drivers/delay_timer/generic_delay_timer.c \
  41. plat/hisilicon/hikey960/aarch64/hikey960_common.c \
  42. plat/hisilicon/hikey960/hikey960_boardid.c
  43. include lib/xlat_tables_v2/xlat_tables.mk
  44. PLAT_BL_COMMON_SOURCES += ${XLAT_TABLES_LIB_SRCS}
  45. HIKEY960_GIC_SOURCES := drivers/arm/gic/common/gic_common.c \
  46. drivers/arm/gic/v2/gicv2_main.c \
  47. drivers/arm/gic/v2/gicv2_helpers.c \
  48. plat/common/plat_gicv2.c
  49. BL1_SOURCES += bl1/tbbr/tbbr_img_desc.c \
  50. drivers/arm/pl061/pl061_gpio.c \
  51. drivers/gpio/gpio.c \
  52. drivers/io/io_block.c \
  53. drivers/io/io_fip.c \
  54. drivers/io/io_storage.c \
  55. drivers/synopsys/ufs/dw_ufs.c \
  56. drivers/ufs/ufs.c \
  57. lib/cpus/aarch64/cortex_a53.S \
  58. plat/hisilicon/hikey960/aarch64/hikey960_helpers.S \
  59. plat/hisilicon/hikey960/hikey960_bl1_setup.c \
  60. plat/hisilicon/hikey960/hikey960_bl_common.c \
  61. plat/hisilicon/hikey960/hikey960_io_storage.c \
  62. ${HIKEY960_GIC_SOURCES}
  63. BL2_SOURCES += common/desc_image_load.c \
  64. drivers/arm/pl061/pl061_gpio.c \
  65. drivers/gpio/gpio.c \
  66. drivers/io/io_block.c \
  67. drivers/io/io_fip.c \
  68. drivers/io/io_storage.c \
  69. drivers/partition/gpt.c \
  70. drivers/partition/partition.c \
  71. drivers/synopsys/ufs/dw_ufs.c \
  72. drivers/ufs/ufs.c \
  73. lib/cpus/aarch64/cortex_a53.S \
  74. plat/hisilicon/hikey960/aarch64/hikey960_helpers.S \
  75. plat/hisilicon/hikey960/hikey960_bl2_mem_params_desc.c \
  76. plat/hisilicon/hikey960/hikey960_bl2_setup.c \
  77. plat/hisilicon/hikey960/hikey960_bl_common.c \
  78. plat/hisilicon/hikey960/hikey960_image_load.c \
  79. plat/hisilicon/hikey960/hikey960_io_storage.c \
  80. plat/hisilicon/hikey960/hikey960_mcu_load.c
  81. ifeq (${SPD},opteed)
  82. BL2_SOURCES += lib/optee/optee_utils.c
  83. endif
  84. include lib/zlib/zlib.mk
  85. PLAT_INCLUDES += -Ilib/zlib
  86. BL2_SOURCES += $(ZLIB_SOURCES)
  87. BL31_SOURCES += drivers/arm/cci/cci.c \
  88. drivers/arm/pl061/pl061_gpio.c \
  89. drivers/gpio/gpio.c \
  90. lib/cpus/aarch64/cortex_a53.S \
  91. lib/cpus/aarch64/cortex_a72.S \
  92. lib/cpus/aarch64/cortex_a73.S \
  93. plat/common/plat_psci_common.c \
  94. plat/hisilicon/hikey960/aarch64/hikey960_helpers.S \
  95. plat/hisilicon/hikey960/hikey960_bl31_setup.c \
  96. plat/hisilicon/hikey960/hikey960_bl_common.c \
  97. plat/hisilicon/hikey960/hikey960_pm.c \
  98. plat/hisilicon/hikey960/hikey960_topology.c \
  99. plat/hisilicon/hikey960/drivers/pwrc/hisi_pwrc.c \
  100. plat/hisilicon/hikey960/drivers/ipc/hisi_ipc.c \
  101. ${HIKEY960_GIC_SOURCES}
  102. ifneq (${TRUSTED_BOARD_BOOT},0)
  103. include drivers/auth/mbedtls/mbedtls_crypto.mk
  104. include drivers/auth/mbedtls/mbedtls_x509.mk
  105. AUTH_SOURCES := drivers/auth/auth_mod.c \
  106. drivers/auth/crypto_mod.c \
  107. drivers/auth/img_parser_mod.c \
  108. drivers/auth/tbbr/tbbr_cot_common.c
  109. BL1_SOURCES += ${AUTH_SOURCES} \
  110. plat/common/tbbr/plat_tbbr.c \
  111. plat/hisilicon/hikey960/hikey960_tbbr.c \
  112. plat/hisilicon/hikey960/hikey960_rotpk.S \
  113. drivers/auth/tbbr/tbbr_cot_bl1.c
  114. BL2_SOURCES += ${AUTH_SOURCES} \
  115. plat/common/tbbr/plat_tbbr.c \
  116. plat/hisilicon/hikey960/hikey960_tbbr.c \
  117. plat/hisilicon/hikey960/hikey960_rotpk.S \
  118. drivers/auth/tbbr/tbbr_cot_bl2.c
  119. ROT_KEY = $(BUILD_PLAT)/rot_key.pem
  120. ROTPK_HASH = $(BUILD_PLAT)/rotpk_sha256.bin
  121. $(eval $(call add_define_val,ROTPK_HASH,'"$(ROTPK_HASH)"'))
  122. $(BUILD_PLAT)/bl1/hikey960_rotpk.o: $(ROTPK_HASH)
  123. $(BUILD_PLAT)/bl2/hikey960_rotpk.o: $(ROTPK_HASH)
  124. certificates: $(ROT_KEY)
  125. $(ROT_KEY): | $$(@D)/
  126. $(s)echo " OPENSSL $@"
  127. $(q)${OPENSSL_BIN_PATH}/openssl genrsa 2048 > $@ 2>/dev/null
  128. $(ROTPK_HASH): $(ROT_KEY) | $$(@D)/
  129. $(s)echo " OPENSSL $@"
  130. $(q)${OPENSSL_BIN_PATH}/openssl rsa -in $< -pubout -outform DER 2>/dev/null |\
  131. ${OPENSSL_BIN_PATH}/openssl dgst -sha256 -binary > $@ 2>/dev/null
  132. endif
  133. # Enable workarounds for selected Cortex-A53 errata.
  134. ERRATA_A53_836870 := 1
  135. ERRATA_A53_843419 := 1
  136. ERRATA_A53_855873 := 1
  137. FIP_ALIGN := 512
  138. # SPM dispatcher
  139. ifeq (${SPD},spmd)
  140. ifeq (${SPMC_AT_EL3},1)
  141. # include device tree helper library
  142. include lib/libfdt/libfdt.mk
  143. BL31_SOURCES += common/fdt_wrappers.c \
  144. ${LIBFDT_SRCS} \
  145. common/uuid.c
  146. # Add support for platform supplied linker script for BL31 build
  147. $(eval $(call add_define,PLAT_EXTRA_LD_SCRIPT))
  148. endif
  149. ifeq ($(PLAT_SP_MANIFEST_DTS),)
  150. $(error "Error: A SP manifest is required for the SPMC.")
  151. endif
  152. FDT_SOURCES += ${PLAT_SP_MANIFEST_DTS}
  153. endif