blob: 398b224cf77a0631225ca861088d69fca1d39bcd [file] [log] [blame]
Haojian Zhuang5f281b32017-05-24 08:45:05 +08001#
Masahiro Yamada4d156802018-01-26 11:42:01 +09002# Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
Haojian Zhuang5f281b32017-05-24 08:45:05 +08003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
Haojian Zhuangb755da32018-01-25 16:10:14 +08007# Non-TF Boot ROM
8BL2_AT_EL3 := 1
9
Victor Chongb9a8db22017-05-28 00:14:25 +090010# On Hikey, the TSP can execute from TZC secure area in DRAM (default)
11# or SRAM.
Victor Chong4d64c2b2018-02-01 00:37:49 +090012HIKEY_TSP_RAM_LOCATION ?= dram
Victor Chongb9a8db22017-05-28 00:14:25 +090013ifeq (${HIKEY_TSP_RAM_LOCATION}, dram)
14 HIKEY_TSP_RAM_LOCATION_ID = HIKEY_DRAM_ID
15else ifeq (${HIKEY_TSP_RAM_LOCATION}, sram)
Victor Chong4d64c2b2018-02-01 00:37:49 +090016 HIKEY_TSP_RAM_LOCATION_ID = HIKEY_SRAM_ID
Victor Chongb9a8db22017-05-28 00:14:25 +090017else
18 $(error "Currently unsupported HIKEY_TSP_RAM_LOCATION value")
19endif
20
Haojian Zhuang5f281b32017-05-24 08:45:05 +080021CONSOLE_BASE := PL011_UART3_BASE
22CRASH_CONSOLE_BASE := PL011_UART3_BASE
Jerome Forissieraebe95d2018-11-08 10:17:47 +000023MULTI_CONSOLE_API := 1
Haojian Zhuang934ae712017-05-24 08:47:49 +080024PLAT_PARTITION_MAX_ENTRIES := 12
Haojian Zhuang5f281b32017-05-24 08:45:05 +080025PLAT_PL061_MAX_GPIOS := 160
26COLD_BOOT_SINGLE_CPU := 1
27PROGRAMMABLE_RESET_ADDRESS := 1
David Cunadoc5b0c0f2017-10-31 23:19:21 +000028ENABLE_SVE_FOR_NS := 0
Haojian Zhuang5f281b32017-05-24 08:45:05 +080029
30# Process flags
Victor Chongb9a8db22017-05-28 00:14:25 +090031$(eval $(call add_define,HIKEY_TSP_RAM_LOCATION_ID))
Haojian Zhuang5f281b32017-05-24 08:45:05 +080032$(eval $(call add_define,CONSOLE_BASE))
33$(eval $(call add_define,CRASH_CONSOLE_BASE))
34$(eval $(call add_define,PLAT_PL061_MAX_GPIOS))
Haojian Zhuang934ae712017-05-24 08:47:49 +080035$(eval $(call add_define,PLAT_PARTITION_MAX_ENTRIES))
Haojian Zhuang5f281b32017-05-24 08:45:05 +080036
Victor Chong7d787f52017-08-16 13:53:56 +090037# Add the build options to pack Trusted OS Extra1 and Trusted OS Extra2 images
38# in the FIP if the platform requires.
39ifneq ($(BL32_EXTRA1),)
Masahiro Yamada9c5ca522018-01-26 11:42:01 +090040$(eval $(call TOOL_ADD_IMG,bl32_extra1,--tos-fw-extra1))
Victor Chong7d787f52017-08-16 13:53:56 +090041endif
42ifneq ($(BL32_EXTRA2),)
Masahiro Yamada9c5ca522018-01-26 11:42:01 +090043$(eval $(call TOOL_ADD_IMG,bl32_extra2,--tos-fw-extra2))
Victor Chong7d787f52017-08-16 13:53:56 +090044endif
45
Haojian Zhuang5f281b32017-05-24 08:45:05 +080046USE_COHERENT_MEM := 1
47
48PLAT_INCLUDES := -Iinclude/common/tbbr \
49 -Iinclude/drivers/synopsys \
50 -Iplat/hisilicon/hikey/include
51
Antonio Nino Diaz42c7bbd2018-09-24 17:15:05 +010052PLAT_BL_COMMON_SOURCES := drivers/arm/pl011/aarch64/pl011_console.S \
53 lib/xlat_tables/aarch64/xlat_tables.c \
54 lib/xlat_tables/xlat_tables_common.c \
Haojian Zhuang5f281b32017-05-24 08:45:05 +080055 plat/hisilicon/hikey/aarch64/hikey_common.c
56
57BL1_SOURCES += bl1/tbbr/tbbr_img_desc.c \
58 drivers/arm/pl061/pl061_gpio.c \
59 drivers/arm/sp804/sp804_delay_timer.c \
60 drivers/delay_timer/delay_timer.c \
61 drivers/gpio/gpio.c \
62 drivers/io/io_block.c \
63 drivers/io/io_fip.c \
64 drivers/io/io_storage.c \
Haojian Zhuange9713772018-08-04 18:07:10 +080065 drivers/mmc/mmc.c \
Haojian Zhuang5f281b32017-05-24 08:45:05 +080066 drivers/synopsys/emmc/dw_mmc.c \
67 lib/cpus/aarch64/cortex_a53.S \
68 plat/hisilicon/hikey/aarch64/hikey_helpers.S \
69 plat/hisilicon/hikey/hikey_bl1_setup.c \
Haojian Zhuang590188a2018-03-05 13:03:53 +080070 plat/hisilicon/hikey/hikey_bl_common.c \
Haojian Zhuang5f281b32017-05-24 08:45:05 +080071 plat/hisilicon/hikey/hikey_io_storage.c
Haojian Zhuang934ae712017-05-24 08:47:49 +080072
Haojian Zhuang3bd94382018-01-28 23:33:02 +080073BL2_SOURCES += common/desc_image_load.c \
Haojian Zhuangb755da32018-01-25 16:10:14 +080074 drivers/arm/pl061/pl061_gpio.c \
Haojian Zhuang3bd94382018-01-28 23:33:02 +080075 drivers/arm/sp804/sp804_delay_timer.c \
Haojian Zhuang934ae712017-05-24 08:47:49 +080076 drivers/delay_timer/delay_timer.c \
Haojian Zhuangb755da32018-01-25 16:10:14 +080077 drivers/gpio/gpio.c \
Haojian Zhuang934ae712017-05-24 08:47:49 +080078 drivers/io/io_block.c \
79 drivers/io/io_fip.c \
80 drivers/io/io_storage.c \
Haojian Zhuange9713772018-08-04 18:07:10 +080081 drivers/mmc/mmc.c \
Haojian Zhuang934ae712017-05-24 08:47:49 +080082 drivers/synopsys/emmc/dw_mmc.c \
Haojian Zhuangb755da32018-01-25 16:10:14 +080083 lib/cpus/aarch64/cortex_a53.S \
Haojian Zhuang934ae712017-05-24 08:47:49 +080084 plat/hisilicon/hikey/aarch64/hikey_helpers.S \
Haojian Zhuang3bd94382018-01-28 23:33:02 +080085 plat/hisilicon/hikey/hikey_bl2_mem_params_desc.c \
Haojian Zhuang934ae712017-05-24 08:47:49 +080086 plat/hisilicon/hikey/hikey_bl2_setup.c \
Haojian Zhuang590188a2018-03-05 13:03:53 +080087 plat/hisilicon/hikey/hikey_bl_common.c \
Jerome Forissierc52e55f2015-05-04 09:40:03 +020088 plat/hisilicon/hikey/hikey_security.c \
Haojian Zhuang934ae712017-05-24 08:47:49 +080089 plat/hisilicon/hikey/hikey_ddr.c \
Haojian Zhuang3bd94382018-01-28 23:33:02 +080090 plat/hisilicon/hikey/hikey_image_load.c \
Haojian Zhuang934ae712017-05-24 08:47:49 +080091 plat/hisilicon/hikey/hikey_io_storage.c \
92 plat/hisilicon/hikey/hisi_dvfs.c \
93 plat/hisilicon/hikey/hisi_mcu.c
Haojian Zhuang3846f142017-05-24 08:49:26 +080094
Victor Chong7d787f52017-08-16 13:53:56 +090095ifeq (${SPD},opteed)
96BL2_SOURCES += lib/optee/optee_utils.c
97endif
Victor Chong2d9a42d2017-08-17 15:21:10 +090098
Haojian Zhuang3846f142017-05-24 08:49:26 +080099HIKEY_GIC_SOURCES := drivers/arm/gic/common/gic_common.c \
100 drivers/arm/gic/v2/gicv2_main.c \
101 drivers/arm/gic/v2/gicv2_helpers.c \
102 plat/common/plat_gicv2.c
103
104BL31_SOURCES += drivers/arm/cci/cci.c \
Leo Yand5e2d1a2017-05-27 13:17:45 +0800105 drivers/arm/sp804/sp804_delay_timer.c \
106 drivers/delay_timer/delay_timer.c \
Haojian Zhuang3846f142017-05-24 08:49:26 +0800107 lib/cpus/aarch64/cortex_a53.S \
Antonio Nino Diaz42c7bbd2018-09-24 17:15:05 +0100108 plat/common/plat_psci_common.c \
Haojian Zhuang3846f142017-05-24 08:49:26 +0800109 plat/hisilicon/hikey/aarch64/hikey_helpers.S \
110 plat/hisilicon/hikey/hikey_bl31_setup.c \
111 plat/hisilicon/hikey/hikey_pm.c \
112 plat/hisilicon/hikey/hikey_topology.c \
113 plat/hisilicon/hikey/hisi_ipc.c \
114 plat/hisilicon/hikey/hisi_pwrc.c \
115 plat/hisilicon/hikey/hisi_pwrc_sram.S \
116 ${HIKEY_GIC_SOURCES}
Vincent Guittot492acec2017-06-07 10:12:05 +0200117ifeq (${ENABLE_PMF}, 1)
118BL31_SOURCES += plat/hisilicon/hikey/hisi_sip_svc.c \
119 lib/pmf/pmf_smc.c
120endif
121
Teddy Reed349cf892018-06-22 22:23:36 -0400122ifneq (${TRUSTED_BOARD_BOOT},0)
123
124include drivers/auth/mbedtls/mbedtls_crypto.mk
125include drivers/auth/mbedtls/mbedtls_x509.mk
126
Teddy Reed349cf892018-06-22 22:23:36 -0400127AUTH_SOURCES := drivers/auth/auth_mod.c \
128 drivers/auth/crypto_mod.c \
129 drivers/auth/img_parser_mod.c \
130 drivers/auth/tbbr/tbbr_cot.c
131
Haojian Zhuangc104f192018-07-18 17:07:00 +0800132BL1_SOURCES += ${AUTH_SOURCES} \
133 plat/common/tbbr/plat_tbbr.c \
134 plat/hisilicon/hikey/hikey_tbbr.c \
135 plat/hisilicon/hikey/hikey_rotpk.S
136
Teddy Reed349cf892018-06-22 22:23:36 -0400137BL2_SOURCES += ${AUTH_SOURCES} \
138 plat/common/tbbr/plat_tbbr.c \
139 plat/hisilicon/hikey/hikey_tbbr.c \
140 plat/hisilicon/hikey/hikey_rotpk.S
141
142ROT_KEY = $(BUILD_PLAT)/rot_key.pem
143ROTPK_HASH = $(BUILD_PLAT)/rotpk_sha256.bin
144
145$(eval $(call add_define_val,ROTPK_HASH,'"$(ROTPK_HASH)"'))
Haojian Zhuangc104f192018-07-18 17:07:00 +0800146$(BUILD_PLAT)/bl1/hikey_rotpk.o: $(ROTPK_HASH)
Teddy Reed349cf892018-06-22 22:23:36 -0400147$(BUILD_PLAT)/bl2/hikey_rotpk.o: $(ROTPK_HASH)
148
149certificates: $(ROT_KEY)
150$(ROT_KEY): | $(BUILD_PLAT)
151 @echo " OPENSSL $@"
152 $(Q)openssl genrsa 2048 > $@ 2>/dev/null
153
154$(ROTPK_HASH): $(ROT_KEY)
155 @echo " OPENSSL $@"
156 $(Q)openssl rsa -in $< -pubout -outform DER 2>/dev/null |\
157 openssl dgst -sha256 -binary > $@ 2>/dev/null
Teddy Reed349cf892018-06-22 22:23:36 -0400158endif
159
Haojian Zhuang66430832017-06-30 16:21:54 +0800160# Enable workarounds for selected Cortex-A53 errata.
161ERRATA_A53_836870 := 1
162ERRATA_A53_843419 := 1
163ERRATA_A53_855873 := 1
Leo Yan75c83832017-11-22 17:07:09 +0800164
Dimitris Papastamos8e5bd5e2018-01-24 16:41:14 +0000165WORKAROUND_CVE_2017_5715 := 0
166
Leo Yan75c83832017-11-22 17:07:09 +0800167FIP_ALIGN := 512