Haojian Zhuang | 602362d | 2017-06-01 12:15:14 +0800 | [diff] [blame] | 1 | # |
Arvind Ram Prakash | 11b9b49 | 2022-11-22 14:41:00 -0600 | [diff] [blame] | 2 | # Copyright (c) 2017-2023, ARM Limited and Contributors. All rights reserved. |
Haojian Zhuang | 602362d | 2017-06-01 12:15:14 +0800 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | |
Haojian Zhuang | 1b4b412 | 2018-01-25 16:13:05 +0800 | [diff] [blame] | 7 | # Non-TF Boot ROM |
Arvind Ram Prakash | 11b9b49 | 2022-11-22 14:41:00 -0600 | [diff] [blame] | 8 | RESET_TO_BL2 := 1 |
Haojian Zhuang | 1b4b412 | 2018-01-25 16:13:05 +0800 | [diff] [blame] | 9 | |
Victor Chong | 9128768 | 2017-05-28 00:14:37 +0900 | [diff] [blame] | 10 | # On Hikey960, the TSP can execute from TZC secure area in DRAM. |
Victor Chong | 4d64c2b | 2018-02-01 00:37:49 +0900 | [diff] [blame] | 11 | HIKEY960_TSP_RAM_LOCATION ?= dram |
Victor Chong | 9128768 | 2017-05-28 00:14:37 +0900 | [diff] [blame] | 12 | ifeq (${HIKEY960_TSP_RAM_LOCATION}, dram) |
| 13 | HIKEY960_TSP_RAM_LOCATION_ID = HIKEY960_DRAM_ID |
| 14 | else ifeq (${HIKEY960_TSP_RAM_LOCATION}, sram) |
Victor Chong | 4d64c2b | 2018-02-01 00:37:49 +0900 | [diff] [blame] | 15 | HIKEY960_TSP_RAM_LOCATION_ID = HIKEY960_SRAM_ID |
Victor Chong | 9128768 | 2017-05-28 00:14:37 +0900 | [diff] [blame] | 16 | else |
| 17 | $(error "Currently unsupported HIKEY960_TSP_RAM_LOCATION value") |
| 18 | endif |
| 19 | |
Haojian Zhuang | 602362d | 2017-06-01 12:15:14 +0800 | [diff] [blame] | 20 | CRASH_CONSOLE_BASE := PL011_UART6_BASE |
| 21 | COLD_BOOT_SINGLE_CPU := 1 |
Leo Yan | 3886dc6 | 2020-03-02 22:15:08 +0800 | [diff] [blame] | 22 | PLAT_PL061_MAX_GPIOS := 232 |
Haojian Zhuang | 602362d | 2017-06-01 12:15:14 +0800 | [diff] [blame] | 23 | PROGRAMMABLE_RESET_ADDRESS := 1 |
David Cunado | c5b0c0f | 2017-10-31 23:19:21 +0000 | [diff] [blame] | 24 | ENABLE_SVE_FOR_NS := 0 |
Haojian Zhuang | 32052ab | 2019-09-14 18:43:51 +0800 | [diff] [blame] | 25 | PLAT_PARTITION_BLOCK_SIZE := 4096 |
Haojian Zhuang | 602362d | 2017-06-01 12:15:14 +0800 | [diff] [blame] | 26 | |
| 27 | # Process flags |
Victor Chong | 9128768 | 2017-05-28 00:14:37 +0900 | [diff] [blame] | 28 | $(eval $(call add_define,HIKEY960_TSP_RAM_LOCATION_ID)) |
Haojian Zhuang | 602362d | 2017-06-01 12:15:14 +0800 | [diff] [blame] | 29 | $(eval $(call add_define,CRASH_CONSOLE_BASE)) |
Kaihua Zhong | 39ff2ee | 2018-07-16 17:33:48 +0800 | [diff] [blame] | 30 | $(eval $(call add_define,PLAT_PL061_MAX_GPIOS)) |
Haojian Zhuang | 32052ab | 2019-09-14 18:43:51 +0800 | [diff] [blame] | 31 | $(eval $(call add_define,PLAT_PARTITION_BLOCK_SIZE)) |
Haojian Zhuang | 602362d | 2017-06-01 12:15:14 +0800 | [diff] [blame] | 32 | |
Victor Chong | 7d787f5 | 2017-08-16 13:53:56 +0900 | [diff] [blame] | 33 | # Add the build options to pack Trusted OS Extra1 and Trusted OS Extra2 images |
| 34 | # in the FIP if the platform requires. |
| 35 | ifneq ($(BL32_EXTRA1),) |
Masahiro Yamada | 9c5ca52 | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 36 | $(eval $(call TOOL_ADD_IMG,bl32_extra1,--tos-fw-extra1)) |
Victor Chong | 7d787f5 | 2017-08-16 13:53:56 +0900 | [diff] [blame] | 37 | endif |
| 38 | ifneq ($(BL32_EXTRA2),) |
Masahiro Yamada | 9c5ca52 | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 39 | $(eval $(call TOOL_ADD_IMG,bl32_extra2,--tos-fw-extra2)) |
Victor Chong | 7d787f5 | 2017-08-16 13:53:56 +0900 | [diff] [blame] | 40 | endif |
| 41 | |
Haojian Zhuang | 602362d | 2017-06-01 12:15:14 +0800 | [diff] [blame] | 42 | USE_COHERENT_MEM := 1 |
| 43 | |
Antonio Nino Diaz | 50a4d1a | 2019-02-01 12:22:22 +0000 | [diff] [blame] | 44 | PLAT_INCLUDES := -Iplat/hisilicon/hikey960/include |
Haojian Zhuang | 602362d | 2017-06-01 12:15:14 +0800 | [diff] [blame] | 45 | |
Antonio Nino Diaz | 582c2d7 | 2018-09-24 17:23:47 +0100 | [diff] [blame] | 46 | PLAT_BL_COMMON_SOURCES := drivers/arm/pl011/aarch64/pl011_console.S \ |
Haojian Zhuang | 602362d | 2017-06-01 12:15:14 +0800 | [diff] [blame] | 47 | drivers/delay_timer/delay_timer.c \ |
| 48 | drivers/delay_timer/generic_delay_timer.c \ |
Haojian Zhuang | 602362d | 2017-06-01 12:15:14 +0800 | [diff] [blame] | 49 | plat/hisilicon/hikey960/aarch64/hikey960_common.c \ |
| 50 | plat/hisilicon/hikey960/hikey960_boardid.c |
| 51 | |
Lukas Hanel | ed62e84 | 2021-04-23 18:45:57 +0200 | [diff] [blame] | 52 | include lib/xlat_tables_v2/xlat_tables.mk |
| 53 | PLAT_BL_COMMON_SOURCES += ${XLAT_TABLES_LIB_SRCS} |
| 54 | |
Haojian Zhuang | 602362d | 2017-06-01 12:15:14 +0800 | [diff] [blame] | 55 | HIKEY960_GIC_SOURCES := drivers/arm/gic/common/gic_common.c \ |
| 56 | drivers/arm/gic/v2/gicv2_main.c \ |
| 57 | drivers/arm/gic/v2/gicv2_helpers.c \ |
| 58 | plat/common/plat_gicv2.c |
| 59 | |
| 60 | BL1_SOURCES += bl1/tbbr/tbbr_img_desc.c \ |
Kaihua Zhong | 39ff2ee | 2018-07-16 17:33:48 +0800 | [diff] [blame] | 61 | drivers/arm/pl061/pl061_gpio.c \ |
| 62 | drivers/gpio/gpio.c \ |
Haojian Zhuang | 602362d | 2017-06-01 12:15:14 +0800 | [diff] [blame] | 63 | drivers/io/io_block.c \ |
| 64 | drivers/io/io_fip.c \ |
| 65 | drivers/io/io_storage.c \ |
| 66 | drivers/synopsys/ufs/dw_ufs.c \ |
| 67 | drivers/ufs/ufs.c \ |
| 68 | lib/cpus/aarch64/cortex_a53.S \ |
| 69 | plat/hisilicon/hikey960/aarch64/hikey960_helpers.S \ |
Haojian Zhuang | d82e29d | 2018-03-05 13:20:33 +0800 | [diff] [blame] | 70 | plat/hisilicon/hikey960/hikey960_bl1_setup.c \ |
| 71 | plat/hisilicon/hikey960/hikey960_bl_common.c \ |
Haojian Zhuang | 602362d | 2017-06-01 12:15:14 +0800 | [diff] [blame] | 72 | plat/hisilicon/hikey960/hikey960_io_storage.c \ |
| 73 | ${HIKEY960_GIC_SOURCES} |
Haojian Zhuang | 1f73c0c | 2017-06-01 14:03:22 +0800 | [diff] [blame] | 74 | |
Haojian Zhuang | a94d75d | 2018-01-29 12:45:28 +0800 | [diff] [blame] | 75 | BL2_SOURCES += common/desc_image_load.c \ |
Kaihua Zhong | 39ff2ee | 2018-07-16 17:33:48 +0800 | [diff] [blame] | 76 | drivers/arm/pl061/pl061_gpio.c \ |
| 77 | drivers/gpio/gpio.c \ |
Haojian Zhuang | a94d75d | 2018-01-29 12:45:28 +0800 | [diff] [blame] | 78 | drivers/io/io_block.c \ |
Haojian Zhuang | 1f73c0c | 2017-06-01 14:03:22 +0800 | [diff] [blame] | 79 | drivers/io/io_fip.c \ |
| 80 | drivers/io/io_storage.c \ |
Haojian Zhuang | 32052ab | 2019-09-14 18:43:51 +0800 | [diff] [blame] | 81 | drivers/partition/gpt.c \ |
| 82 | drivers/partition/partition.c \ |
Haojian Zhuang | 1b4b412 | 2018-01-25 16:13:05 +0800 | [diff] [blame] | 83 | drivers/synopsys/ufs/dw_ufs.c \ |
Haojian Zhuang | 1f73c0c | 2017-06-01 14:03:22 +0800 | [diff] [blame] | 84 | drivers/ufs/ufs.c \ |
Haojian Zhuang | 1b4b412 | 2018-01-25 16:13:05 +0800 | [diff] [blame] | 85 | lib/cpus/aarch64/cortex_a53.S \ |
| 86 | plat/hisilicon/hikey960/aarch64/hikey960_helpers.S \ |
Haojian Zhuang | a94d75d | 2018-01-29 12:45:28 +0800 | [diff] [blame] | 87 | plat/hisilicon/hikey960/hikey960_bl2_mem_params_desc.c \ |
Haojian Zhuang | 1f73c0c | 2017-06-01 14:03:22 +0800 | [diff] [blame] | 88 | plat/hisilicon/hikey960/hikey960_bl2_setup.c \ |
Haojian Zhuang | d82e29d | 2018-03-05 13:20:33 +0800 | [diff] [blame] | 89 | plat/hisilicon/hikey960/hikey960_bl_common.c \ |
Haojian Zhuang | a94d75d | 2018-01-29 12:45:28 +0800 | [diff] [blame] | 90 | plat/hisilicon/hikey960/hikey960_image_load.c \ |
Haojian Zhuang | 1f73c0c | 2017-06-01 14:03:22 +0800 | [diff] [blame] | 91 | plat/hisilicon/hikey960/hikey960_io_storage.c \ |
| 92 | plat/hisilicon/hikey960/hikey960_mcu_load.c |
Haojian Zhuang | 1b5c225 | 2017-06-01 15:20:46 +0800 | [diff] [blame] | 93 | |
Victor Chong | 7d787f5 | 2017-08-16 13:53:56 +0900 | [diff] [blame] | 94 | ifeq (${SPD},opteed) |
| 95 | BL2_SOURCES += lib/optee/optee_utils.c |
| 96 | endif |
Victor Chong | 2d9a42d | 2017-08-17 15:21:10 +0900 | [diff] [blame] | 97 | |
Rohit Ner | b9bed28 | 2022-05-11 03:06:07 -0700 | [diff] [blame] | 98 | include lib/zlib/zlib.mk |
| 99 | PLAT_INCLUDES += -Ilib/zlib |
| 100 | BL2_SOURCES += $(ZLIB_SOURCES) |
| 101 | |
Haojian Zhuang | 1b5c225 | 2017-06-01 15:20:46 +0800 | [diff] [blame] | 102 | BL31_SOURCES += drivers/arm/cci/cci.c \ |
Leo Yan | 3886dc6 | 2020-03-02 22:15:08 +0800 | [diff] [blame] | 103 | drivers/arm/pl061/pl061_gpio.c \ |
| 104 | drivers/gpio/gpio.c \ |
Haojian Zhuang | 1b5c225 | 2017-06-01 15:20:46 +0800 | [diff] [blame] | 105 | lib/cpus/aarch64/cortex_a53.S \ |
| 106 | lib/cpus/aarch64/cortex_a72.S \ |
| 107 | lib/cpus/aarch64/cortex_a73.S \ |
Antonio Nino Diaz | 582c2d7 | 2018-09-24 17:23:47 +0100 | [diff] [blame] | 108 | plat/common/plat_psci_common.c \ |
Haojian Zhuang | 1b5c225 | 2017-06-01 15:20:46 +0800 | [diff] [blame] | 109 | plat/hisilicon/hikey960/aarch64/hikey960_helpers.S \ |
| 110 | plat/hisilicon/hikey960/hikey960_bl31_setup.c \ |
Leo Yan | 3886dc6 | 2020-03-02 22:15:08 +0800 | [diff] [blame] | 111 | plat/hisilicon/hikey960/hikey960_bl_common.c \ |
Haojian Zhuang | 1b5c225 | 2017-06-01 15:20:46 +0800 | [diff] [blame] | 112 | plat/hisilicon/hikey960/hikey960_pm.c \ |
| 113 | plat/hisilicon/hikey960/hikey960_topology.c \ |
| 114 | plat/hisilicon/hikey960/drivers/pwrc/hisi_pwrc.c \ |
| 115 | plat/hisilicon/hikey960/drivers/ipc/hisi_ipc.c \ |
| 116 | ${HIKEY960_GIC_SOURCES} |
Victor Chong | cb27a35 | 2017-07-12 01:07:29 +0900 | [diff] [blame] | 117 | |
Teddy Reed | dd3f0a8 | 2018-09-03 17:38:50 -0400 | [diff] [blame] | 118 | ifneq (${TRUSTED_BOARD_BOOT},0) |
| 119 | |
| 120 | include drivers/auth/mbedtls/mbedtls_crypto.mk |
| 121 | include drivers/auth/mbedtls/mbedtls_x509.mk |
| 122 | |
Teddy Reed | dd3f0a8 | 2018-09-03 17:38:50 -0400 | [diff] [blame] | 123 | AUTH_SOURCES := drivers/auth/auth_mod.c \ |
| 124 | drivers/auth/crypto_mod.c \ |
| 125 | drivers/auth/img_parser_mod.c \ |
Manish V Badarkhe | 043fd62 | 2020-05-16 16:36:39 +0100 | [diff] [blame] | 126 | drivers/auth/tbbr/tbbr_cot_common.c |
Teddy Reed | dd3f0a8 | 2018-09-03 17:38:50 -0400 | [diff] [blame] | 127 | |
| 128 | BL1_SOURCES += ${AUTH_SOURCES} \ |
| 129 | plat/common/tbbr/plat_tbbr.c \ |
| 130 | plat/hisilicon/hikey960/hikey960_tbbr.c \ |
Manish V Badarkhe | 043fd62 | 2020-05-16 16:36:39 +0100 | [diff] [blame] | 131 | plat/hisilicon/hikey960/hikey960_rotpk.S \ |
| 132 | drivers/auth/tbbr/tbbr_cot_bl1.c |
Teddy Reed | dd3f0a8 | 2018-09-03 17:38:50 -0400 | [diff] [blame] | 133 | |
| 134 | BL2_SOURCES += ${AUTH_SOURCES} \ |
| 135 | plat/common/tbbr/plat_tbbr.c \ |
| 136 | plat/hisilicon/hikey960/hikey960_tbbr.c \ |
Manish V Badarkhe | 043fd62 | 2020-05-16 16:36:39 +0100 | [diff] [blame] | 137 | plat/hisilicon/hikey960/hikey960_rotpk.S \ |
| 138 | drivers/auth/tbbr/tbbr_cot_bl2.c |
Teddy Reed | dd3f0a8 | 2018-09-03 17:38:50 -0400 | [diff] [blame] | 139 | |
| 140 | ROT_KEY = $(BUILD_PLAT)/rot_key.pem |
| 141 | ROTPK_HASH = $(BUILD_PLAT)/rotpk_sha256.bin |
| 142 | |
| 143 | $(eval $(call add_define_val,ROTPK_HASH,'"$(ROTPK_HASH)"')) |
| 144 | $(BUILD_PLAT)/bl1/hikey960_rotpk.o: $(ROTPK_HASH) |
| 145 | $(BUILD_PLAT)/bl2/hikey960_rotpk.o: $(ROTPK_HASH) |
| 146 | |
| 147 | certificates: $(ROT_KEY) |
| 148 | $(ROT_KEY): | $(BUILD_PLAT) |
| 149 | @echo " OPENSSL $@" |
Salome Thirot | 0b35da3 | 2022-07-14 16:14:15 +0100 | [diff] [blame] | 150 | $(Q)${OPENSSL_BIN_PATH}/openssl genrsa 2048 > $@ 2>/dev/null |
Teddy Reed | dd3f0a8 | 2018-09-03 17:38:50 -0400 | [diff] [blame] | 151 | |
| 152 | $(ROTPK_HASH): $(ROT_KEY) |
| 153 | @echo " OPENSSL $@" |
Salome Thirot | 0b35da3 | 2022-07-14 16:14:15 +0100 | [diff] [blame] | 154 | $(Q)${OPENSSL_BIN_PATH}/openssl rsa -in $< -pubout -outform DER 2>/dev/null |\ |
| 155 | ${OPENSSL_BIN_PATH}/openssl dgst -sha256 -binary > $@ 2>/dev/null |
Teddy Reed | dd3f0a8 | 2018-09-03 17:38:50 -0400 | [diff] [blame] | 156 | endif |
| 157 | |
Victor Chong | cb27a35 | 2017-07-12 01:07:29 +0900 | [diff] [blame] | 158 | # Enable workarounds for selected Cortex-A53 errata. |
| 159 | ERRATA_A53_836870 := 1 |
| 160 | ERRATA_A53_843419 := 1 |
| 161 | ERRATA_A53_855873 := 1 |
Leo Yan | 453940d | 2017-11-22 17:10:39 +0800 | [diff] [blame] | 162 | |
| 163 | FIP_ALIGN := 512 |
Lukas Hanel | 8a4de61 | 2022-03-01 14:18:22 +0100 | [diff] [blame] | 164 | |
| 165 | # SPM dispatcher |
| 166 | ifeq (${SPD},spmd) |
Lukas Hanel | 5258be1 | 2022-03-01 17:02:31 +0100 | [diff] [blame] | 167 | ifeq (${SPMC_AT_EL3},1) |
Lukas Hanel | cb91cb1 | 2022-03-01 15:40:39 +0100 | [diff] [blame] | 168 | # include device tree helper library |
| 169 | include lib/libfdt/libfdt.mk |
| 170 | BL31_SOURCES += common/fdt_wrappers.c \ |
| 171 | ${LIBFDT_SRCS} \ |
| 172 | common/uuid.c |
| 173 | |
Lukas Hanel | 5258be1 | 2022-03-01 17:02:31 +0100 | [diff] [blame] | 174 | # Add support for platform supplied linker script for BL31 build |
| 175 | $(eval $(call add_define,PLAT_EXTRA_LD_SCRIPT)) |
| 176 | endif |
| 177 | |
Lukas Hanel | 8a4de61 | 2022-03-01 14:18:22 +0100 | [diff] [blame] | 178 | ifeq ($(PLAT_SP_MANIFEST_DTS),) |
| 179 | $(error "Error: A SP manifest is required for the SPMC.") |
| 180 | endif |
| 181 | FDT_SOURCES += ${PLAT_SP_MANIFEST_DTS} |
| 182 | endif |