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