Haojian Zhuang | 5f281b3 | 2017-05-24 08:45:05 +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 | 5f281b3 | 2017-05-24 08:45:05 +0800 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | |
Haojian Zhuang | b755da3 | 2018-01-25 16:10:14 +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 | b755da3 | 2018-01-25 16:10:14 +0800 | [diff] [blame] | 9 | |
Victor Chong | b9a8db2 | 2017-05-28 00:14:25 +0900 | [diff] [blame] | 10 | # On Hikey, the TSP can execute from TZC secure area in DRAM (default) |
| 11 | # or SRAM. |
Victor Chong | 4d64c2b | 2018-02-01 00:37:49 +0900 | [diff] [blame] | 12 | HIKEY_TSP_RAM_LOCATION ?= dram |
Victor Chong | b9a8db2 | 2017-05-28 00:14:25 +0900 | [diff] [blame] | 13 | ifeq (${HIKEY_TSP_RAM_LOCATION}, dram) |
| 14 | HIKEY_TSP_RAM_LOCATION_ID = HIKEY_DRAM_ID |
| 15 | else ifeq (${HIKEY_TSP_RAM_LOCATION}, sram) |
Victor Chong | 4d64c2b | 2018-02-01 00:37:49 +0900 | [diff] [blame] | 16 | HIKEY_TSP_RAM_LOCATION_ID = HIKEY_SRAM_ID |
Victor Chong | b9a8db2 | 2017-05-28 00:14:25 +0900 | [diff] [blame] | 17 | else |
| 18 | $(error "Currently unsupported HIKEY_TSP_RAM_LOCATION value") |
| 19 | endif |
| 20 | |
Haojian Zhuang | 5f281b3 | 2017-05-24 08:45:05 +0800 | [diff] [blame] | 21 | CONSOLE_BASE := PL011_UART3_BASE |
| 22 | CRASH_CONSOLE_BASE := PL011_UART3_BASE |
Haojian Zhuang | 934ae71 | 2017-05-24 08:47:49 +0800 | [diff] [blame] | 23 | PLAT_PARTITION_MAX_ENTRIES := 12 |
Haojian Zhuang | 5f281b3 | 2017-05-24 08:45:05 +0800 | [diff] [blame] | 24 | PLAT_PL061_MAX_GPIOS := 160 |
| 25 | COLD_BOOT_SINGLE_CPU := 1 |
| 26 | PROGRAMMABLE_RESET_ADDRESS := 1 |
David Cunado | c5b0c0f | 2017-10-31 23:19:21 +0000 | [diff] [blame] | 27 | ENABLE_SVE_FOR_NS := 0 |
Haojian Zhuang | 5f281b3 | 2017-05-24 08:45:05 +0800 | [diff] [blame] | 28 | |
| 29 | # Process flags |
Victor Chong | b9a8db2 | 2017-05-28 00:14:25 +0900 | [diff] [blame] | 30 | $(eval $(call add_define,HIKEY_TSP_RAM_LOCATION_ID)) |
Haojian Zhuang | 5f281b3 | 2017-05-24 08:45:05 +0800 | [diff] [blame] | 31 | $(eval $(call add_define,CONSOLE_BASE)) |
| 32 | $(eval $(call add_define,CRASH_CONSOLE_BASE)) |
| 33 | $(eval $(call add_define,PLAT_PL061_MAX_GPIOS)) |
Haojian Zhuang | 934ae71 | 2017-05-24 08:47:49 +0800 | [diff] [blame] | 34 | $(eval $(call add_define,PLAT_PARTITION_MAX_ENTRIES)) |
Haojian Zhuang | 5f281b3 | 2017-05-24 08:45:05 +0800 | [diff] [blame] | 35 | |
Victor Chong | 7d787f5 | 2017-08-16 13:53:56 +0900 | [diff] [blame] | 36 | # Add the build options to pack Trusted OS Extra1 and Trusted OS Extra2 images |
| 37 | # in the FIP if the platform requires. |
| 38 | ifneq ($(BL32_EXTRA1),) |
Masahiro Yamada | 9c5ca52 | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 39 | $(eval $(call TOOL_ADD_IMG,bl32_extra1,--tos-fw-extra1)) |
Victor Chong | 7d787f5 | 2017-08-16 13:53:56 +0900 | [diff] [blame] | 40 | endif |
| 41 | ifneq ($(BL32_EXTRA2),) |
Masahiro Yamada | 9c5ca52 | 2018-01-26 11:42:01 +0900 | [diff] [blame] | 42 | $(eval $(call TOOL_ADD_IMG,bl32_extra2,--tos-fw-extra2)) |
Victor Chong | 7d787f5 | 2017-08-16 13:53:56 +0900 | [diff] [blame] | 43 | endif |
| 44 | |
Haojian Zhuang | 5f281b3 | 2017-05-24 08:45:05 +0800 | [diff] [blame] | 45 | USE_COHERENT_MEM := 1 |
| 46 | |
Antonio Nino Diaz | 50a4d1a | 2019-02-01 12:22:22 +0000 | [diff] [blame] | 47 | PLAT_INCLUDES := -Iplat/hisilicon/hikey/include |
Haojian Zhuang | 5f281b3 | 2017-05-24 08:45:05 +0800 | [diff] [blame] | 48 | |
Antonio Nino Diaz | 42c7bbd | 2018-09-24 17:15:05 +0100 | [diff] [blame] | 49 | PLAT_BL_COMMON_SOURCES := drivers/arm/pl011/aarch64/pl011_console.S \ |
| 50 | lib/xlat_tables/aarch64/xlat_tables.c \ |
| 51 | lib/xlat_tables/xlat_tables_common.c \ |
Haojian Zhuang | 5f281b3 | 2017-05-24 08:45:05 +0800 | [diff] [blame] | 52 | plat/hisilicon/hikey/aarch64/hikey_common.c |
| 53 | |
| 54 | BL1_SOURCES += bl1/tbbr/tbbr_img_desc.c \ |
| 55 | drivers/arm/pl061/pl061_gpio.c \ |
| 56 | drivers/arm/sp804/sp804_delay_timer.c \ |
| 57 | drivers/delay_timer/delay_timer.c \ |
| 58 | drivers/gpio/gpio.c \ |
| 59 | drivers/io/io_block.c \ |
| 60 | drivers/io/io_fip.c \ |
| 61 | drivers/io/io_storage.c \ |
Haojian Zhuang | e971377 | 2018-08-04 18:07:10 +0800 | [diff] [blame] | 62 | drivers/mmc/mmc.c \ |
Haojian Zhuang | 5f281b3 | 2017-05-24 08:45:05 +0800 | [diff] [blame] | 63 | drivers/synopsys/emmc/dw_mmc.c \ |
| 64 | lib/cpus/aarch64/cortex_a53.S \ |
| 65 | plat/hisilicon/hikey/aarch64/hikey_helpers.S \ |
| 66 | plat/hisilicon/hikey/hikey_bl1_setup.c \ |
Haojian Zhuang | 590188a | 2018-03-05 13:03:53 +0800 | [diff] [blame] | 67 | plat/hisilicon/hikey/hikey_bl_common.c \ |
Haojian Zhuang | 5f281b3 | 2017-05-24 08:45:05 +0800 | [diff] [blame] | 68 | plat/hisilicon/hikey/hikey_io_storage.c |
Haojian Zhuang | 934ae71 | 2017-05-24 08:47:49 +0800 | [diff] [blame] | 69 | |
Haojian Zhuang | 3bd9438 | 2018-01-28 23:33:02 +0800 | [diff] [blame] | 70 | BL2_SOURCES += common/desc_image_load.c \ |
Haojian Zhuang | b755da3 | 2018-01-25 16:10:14 +0800 | [diff] [blame] | 71 | drivers/arm/pl061/pl061_gpio.c \ |
Haojian Zhuang | 3bd9438 | 2018-01-28 23:33:02 +0800 | [diff] [blame] | 72 | drivers/arm/sp804/sp804_delay_timer.c \ |
Haojian Zhuang | 934ae71 | 2017-05-24 08:47:49 +0800 | [diff] [blame] | 73 | drivers/delay_timer/delay_timer.c \ |
Haojian Zhuang | b755da3 | 2018-01-25 16:10:14 +0800 | [diff] [blame] | 74 | drivers/gpio/gpio.c \ |
Haojian Zhuang | 934ae71 | 2017-05-24 08:47:49 +0800 | [diff] [blame] | 75 | drivers/io/io_block.c \ |
| 76 | drivers/io/io_fip.c \ |
| 77 | drivers/io/io_storage.c \ |
Haojian Zhuang | e971377 | 2018-08-04 18:07:10 +0800 | [diff] [blame] | 78 | drivers/mmc/mmc.c \ |
Haojian Zhuang | 53e70df | 2019-09-14 19:18:01 +0800 | [diff] [blame] | 79 | drivers/partition/gpt.c \ |
| 80 | drivers/partition/partition.c \ |
Haojian Zhuang | 934ae71 | 2017-05-24 08:47:49 +0800 | [diff] [blame] | 81 | drivers/synopsys/emmc/dw_mmc.c \ |
Haojian Zhuang | b755da3 | 2018-01-25 16:10:14 +0800 | [diff] [blame] | 82 | lib/cpus/aarch64/cortex_a53.S \ |
Haojian Zhuang | 934ae71 | 2017-05-24 08:47:49 +0800 | [diff] [blame] | 83 | plat/hisilicon/hikey/aarch64/hikey_helpers.S \ |
Haojian Zhuang | 3bd9438 | 2018-01-28 23:33:02 +0800 | [diff] [blame] | 84 | plat/hisilicon/hikey/hikey_bl2_mem_params_desc.c \ |
Haojian Zhuang | 934ae71 | 2017-05-24 08:47:49 +0800 | [diff] [blame] | 85 | plat/hisilicon/hikey/hikey_bl2_setup.c \ |
Haojian Zhuang | 590188a | 2018-03-05 13:03:53 +0800 | [diff] [blame] | 86 | plat/hisilicon/hikey/hikey_bl_common.c \ |
Jerome Forissier | c52e55f | 2015-05-04 09:40:03 +0200 | [diff] [blame] | 87 | plat/hisilicon/hikey/hikey_security.c \ |
Haojian Zhuang | 934ae71 | 2017-05-24 08:47:49 +0800 | [diff] [blame] | 88 | plat/hisilicon/hikey/hikey_ddr.c \ |
Haojian Zhuang | 3bd9438 | 2018-01-28 23:33:02 +0800 | [diff] [blame] | 89 | plat/hisilicon/hikey/hikey_image_load.c \ |
Haojian Zhuang | 934ae71 | 2017-05-24 08:47:49 +0800 | [diff] [blame] | 90 | plat/hisilicon/hikey/hikey_io_storage.c \ |
| 91 | plat/hisilicon/hikey/hisi_dvfs.c \ |
| 92 | plat/hisilicon/hikey/hisi_mcu.c |
Haojian Zhuang | 3846f14 | 2017-05-24 08:49:26 +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 | 3846f14 | 2017-05-24 08:49:26 +0800 | [diff] [blame] | 102 | HIKEY_GIC_SOURCES := drivers/arm/gic/common/gic_common.c \ |
| 103 | drivers/arm/gic/v2/gicv2_main.c \ |
| 104 | drivers/arm/gic/v2/gicv2_helpers.c \ |
| 105 | plat/common/plat_gicv2.c |
| 106 | |
| 107 | BL31_SOURCES += drivers/arm/cci/cci.c \ |
Leo Yan | d5e2d1a | 2017-05-27 13:17:45 +0800 | [diff] [blame] | 108 | drivers/arm/sp804/sp804_delay_timer.c \ |
| 109 | drivers/delay_timer/delay_timer.c \ |
Haojian Zhuang | 3846f14 | 2017-05-24 08:49:26 +0800 | [diff] [blame] | 110 | lib/cpus/aarch64/cortex_a53.S \ |
Antonio Nino Diaz | 42c7bbd | 2018-09-24 17:15:05 +0100 | [diff] [blame] | 111 | plat/common/plat_psci_common.c \ |
Haojian Zhuang | 3846f14 | 2017-05-24 08:49:26 +0800 | [diff] [blame] | 112 | plat/hisilicon/hikey/aarch64/hikey_helpers.S \ |
| 113 | plat/hisilicon/hikey/hikey_bl31_setup.c \ |
| 114 | plat/hisilicon/hikey/hikey_pm.c \ |
| 115 | plat/hisilicon/hikey/hikey_topology.c \ |
| 116 | plat/hisilicon/hikey/hisi_ipc.c \ |
| 117 | plat/hisilicon/hikey/hisi_pwrc.c \ |
| 118 | plat/hisilicon/hikey/hisi_pwrc_sram.S \ |
| 119 | ${HIKEY_GIC_SOURCES} |
Vincent Guittot | 492acec | 2017-06-07 10:12:05 +0200 | [diff] [blame] | 120 | ifeq (${ENABLE_PMF}, 1) |
| 121 | BL31_SOURCES += plat/hisilicon/hikey/hisi_sip_svc.c \ |
| 122 | lib/pmf/pmf_smc.c |
| 123 | endif |
| 124 | |
Teddy Reed | 349cf89 | 2018-06-22 22:23:36 -0400 | [diff] [blame] | 125 | ifneq (${TRUSTED_BOARD_BOOT},0) |
| 126 | |
| 127 | include drivers/auth/mbedtls/mbedtls_crypto.mk |
| 128 | include drivers/auth/mbedtls/mbedtls_x509.mk |
| 129 | |
Teddy Reed | 349cf89 | 2018-06-22 22:23:36 -0400 | [diff] [blame] | 130 | AUTH_SOURCES := drivers/auth/auth_mod.c \ |
| 131 | drivers/auth/crypto_mod.c \ |
| 132 | drivers/auth/img_parser_mod.c \ |
Manish V Badarkhe | 043fd62 | 2020-05-16 16:36:39 +0100 | [diff] [blame] | 133 | drivers/auth/tbbr/tbbr_cot_common.c |
Teddy Reed | 349cf89 | 2018-06-22 22:23:36 -0400 | [diff] [blame] | 134 | |
Haojian Zhuang | c104f19 | 2018-07-18 17:07:00 +0800 | [diff] [blame] | 135 | BL1_SOURCES += ${AUTH_SOURCES} \ |
| 136 | plat/common/tbbr/plat_tbbr.c \ |
| 137 | plat/hisilicon/hikey/hikey_tbbr.c \ |
Manish V Badarkhe | 043fd62 | 2020-05-16 16:36:39 +0100 | [diff] [blame] | 138 | plat/hisilicon/hikey/hikey_rotpk.S \ |
| 139 | drivers/auth/tbbr/tbbr_cot_bl1.c |
Haojian Zhuang | c104f19 | 2018-07-18 17:07:00 +0800 | [diff] [blame] | 140 | |
Teddy Reed | 349cf89 | 2018-06-22 22:23:36 -0400 | [diff] [blame] | 141 | BL2_SOURCES += ${AUTH_SOURCES} \ |
| 142 | plat/common/tbbr/plat_tbbr.c \ |
| 143 | plat/hisilicon/hikey/hikey_tbbr.c \ |
Manish V Badarkhe | 043fd62 | 2020-05-16 16:36:39 +0100 | [diff] [blame] | 144 | plat/hisilicon/hikey/hikey_rotpk.S \ |
| 145 | drivers/auth/tbbr/tbbr_cot_bl2.c |
Teddy Reed | 349cf89 | 2018-06-22 22:23:36 -0400 | [diff] [blame] | 146 | |
| 147 | ROT_KEY = $(BUILD_PLAT)/rot_key.pem |
| 148 | ROTPK_HASH = $(BUILD_PLAT)/rotpk_sha256.bin |
| 149 | |
| 150 | $(eval $(call add_define_val,ROTPK_HASH,'"$(ROTPK_HASH)"')) |
Haojian Zhuang | c104f19 | 2018-07-18 17:07:00 +0800 | [diff] [blame] | 151 | $(BUILD_PLAT)/bl1/hikey_rotpk.o: $(ROTPK_HASH) |
Teddy Reed | 349cf89 | 2018-06-22 22:23:36 -0400 | [diff] [blame] | 152 | $(BUILD_PLAT)/bl2/hikey_rotpk.o: $(ROTPK_HASH) |
| 153 | |
| 154 | certificates: $(ROT_KEY) |
| 155 | $(ROT_KEY): | $(BUILD_PLAT) |
| 156 | @echo " OPENSSL $@" |
Salome Thirot | 0b35da3 | 2022-07-14 16:14:15 +0100 | [diff] [blame] | 157 | $(Q)${OPENSSL_BIN_PATH}/openssl genrsa 2048 > $@ 2>/dev/null |
Teddy Reed | 349cf89 | 2018-06-22 22:23:36 -0400 | [diff] [blame] | 158 | |
| 159 | $(ROTPK_HASH): $(ROT_KEY) |
| 160 | @echo " OPENSSL $@" |
Salome Thirot | 0b35da3 | 2022-07-14 16:14:15 +0100 | [diff] [blame] | 161 | $(Q)${OPENSSL_BIN_PATH}/openssl rsa -in $< -pubout -outform DER 2>/dev/null |\ |
| 162 | ${OPENSSL_BIN_PATH}/openssl dgst -sha256 -binary > $@ 2>/dev/null |
Teddy Reed | 349cf89 | 2018-06-22 22:23:36 -0400 | [diff] [blame] | 163 | endif |
| 164 | |
Haojian Zhuang | 6643083 | 2017-06-30 16:21:54 +0800 | [diff] [blame] | 165 | # Enable workarounds for selected Cortex-A53 errata. |
| 166 | ERRATA_A53_836870 := 1 |
| 167 | ERRATA_A53_843419 := 1 |
| 168 | ERRATA_A53_855873 := 1 |
Leo Yan | 75c8383 | 2017-11-22 17:07:09 +0800 | [diff] [blame] | 169 | |
Dimitris Papastamos | 8e5bd5e | 2018-01-24 16:41:14 +0000 | [diff] [blame] | 170 | WORKAROUND_CVE_2017_5715 := 0 |
| 171 | |
Leo Yan | 75c8383 | 2017-11-22 17:07:09 +0800 | [diff] [blame] | 172 | FIP_ALIGN := 512 |