xref: /rk3399_ARM-atf/plat/hisilicon/hikey960/platform.mk (revision c948f77136c42a92d0bb660543a3600c36dcf7f1)
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		:=	-Iinclude/common/tbbr			\
44				-Iplat/hisilicon/hikey960/include
45
46PLAT_BL_COMMON_SOURCES	:=	drivers/arm/pl011/aarch64/pl011_console.S \
47				drivers/delay_timer/delay_timer.c	\
48				drivers/delay_timer/generic_delay_timer.c \
49				lib/xlat_tables/aarch64/xlat_tables.c	\
50				lib/xlat_tables/xlat_tables_common.c	\
51				plat/hisilicon/hikey960/aarch64/hikey960_common.c \
52				plat/hisilicon/hikey960/hikey960_boardid.c
53
54HIKEY960_GIC_SOURCES	:=	drivers/arm/gic/common/gic_common.c	\
55				drivers/arm/gic/v2/gicv2_main.c		\
56				drivers/arm/gic/v2/gicv2_helpers.c	\
57				plat/common/plat_gicv2.c
58
59BL1_SOURCES		+=	bl1/tbbr/tbbr_img_desc.c		\
60				drivers/arm/pl061/pl061_gpio.c		\
61				drivers/gpio/gpio.c			\
62				drivers/io/io_block.c			\
63				drivers/io/io_fip.c			\
64				drivers/io/io_storage.c			\
65				drivers/synopsys/ufs/dw_ufs.c		\
66				drivers/ufs/ufs.c 			\
67				lib/cpus/aarch64/cortex_a53.S		\
68				plat/hisilicon/hikey960/aarch64/hikey960_helpers.S \
69				plat/hisilicon/hikey960/hikey960_bl1_setup.c \
70				plat/hisilicon/hikey960/hikey960_bl_common.c \
71				plat/hisilicon/hikey960/hikey960_io_storage.c \
72				${HIKEY960_GIC_SOURCES}
73
74BL2_SOURCES		+=	common/desc_image_load.c		\
75				drivers/arm/pl061/pl061_gpio.c		\
76				drivers/gpio/gpio.c			\
77				drivers/io/io_block.c			\
78				drivers/io/io_fip.c			\
79				drivers/io/io_storage.c			\
80				drivers/synopsys/ufs/dw_ufs.c		\
81				drivers/ufs/ufs.c			\
82				lib/cpus/aarch64/cortex_a53.S		\
83				plat/hisilicon/hikey960/aarch64/hikey960_helpers.S \
84				plat/hisilicon/hikey960/hikey960_bl2_mem_params_desc.c \
85				plat/hisilicon/hikey960/hikey960_bl2_setup.c \
86				plat/hisilicon/hikey960/hikey960_bl_common.c \
87				plat/hisilicon/hikey960/hikey960_image_load.c \
88				plat/hisilicon/hikey960/hikey960_io_storage.c \
89				plat/hisilicon/hikey960/hikey960_mcu_load.c
90
91ifeq (${SPD},opteed)
92BL2_SOURCES		+=	lib/optee/optee_utils.c
93endif
94
95BL31_SOURCES		+=	drivers/arm/cci/cci.c			\
96				lib/cpus/aarch64/cortex_a53.S           \
97				lib/cpus/aarch64/cortex_a72.S		\
98				lib/cpus/aarch64/cortex_a73.S		\
99				plat/common/plat_psci_common.c  \
100				plat/hisilicon/hikey960/aarch64/hikey960_helpers.S \
101				plat/hisilicon/hikey960/hikey960_bl31_setup.c \
102				plat/hisilicon/hikey960/hikey960_pm.c	\
103				plat/hisilicon/hikey960/hikey960_topology.c \
104				plat/hisilicon/hikey960/drivers/pwrc/hisi_pwrc.c \
105				plat/hisilicon/hikey960/drivers/ipc/hisi_ipc.c \
106				${HIKEY960_GIC_SOURCES}
107
108ifneq (${TRUSTED_BOARD_BOOT},0)
109
110include drivers/auth/mbedtls/mbedtls_crypto.mk
111include drivers/auth/mbedtls/mbedtls_x509.mk
112
113AUTH_SOURCES		:=	drivers/auth/auth_mod.c			\
114				drivers/auth/crypto_mod.c		\
115				drivers/auth/img_parser_mod.c		\
116				drivers/auth/tbbr/tbbr_cot.c
117
118BL1_SOURCES		+=	${AUTH_SOURCES}				\
119				plat/common/tbbr/plat_tbbr.c		\
120				plat/hisilicon/hikey960/hikey960_tbbr.c	\
121				plat/hisilicon/hikey960/hikey960_rotpk.S
122
123BL2_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
128ROT_KEY		=	$(BUILD_PLAT)/rot_key.pem
129ROTPK_HASH		=	$(BUILD_PLAT)/rotpk_sha256.bin
130
131$(eval $(call add_define_val,ROTPK_HASH,'"$(ROTPK_HASH)"'))
132$(BUILD_PLAT)/bl1/hikey960_rotpk.o: $(ROTPK_HASH)
133$(BUILD_PLAT)/bl2/hikey960_rotpk.o: $(ROTPK_HASH)
134
135certificates: $(ROT_KEY)
136$(ROT_KEY): | $(BUILD_PLAT)
137	@echo "  OPENSSL $@"
138	$(Q)openssl genrsa 2048 > $@ 2>/dev/null
139
140$(ROTPK_HASH): $(ROT_KEY)
141	@echo "  OPENSSL $@"
142	$(Q)openssl rsa -in $< -pubout -outform DER 2>/dev/null |\
143	openssl dgst -sha256 -binary > $@ 2>/dev/null
144endif
145
146# Enable workarounds for selected Cortex-A53 errata.
147ERRATA_A53_836870		:=	1
148ERRATA_A53_843419		:=	1
149ERRATA_A53_855873		:=	1
150
151FIP_ALIGN			:=	512
152