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