platform.mk 5.06 KB
Newer Older
Haojian Zhuang's avatar
Haojian Zhuang committed
1
#
2
# Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
Haojian Zhuang's avatar
Haojian Zhuang committed
3
4
5
6
#
# SPDX-License-Identifier: BSD-3-Clause
#

Haojian Zhuang's avatar
Haojian Zhuang committed
7
8
9
# Non-TF Boot ROM
BL2_AT_EL3	:=	1

10
11
# On Hikey, the TSP can execute from TZC secure area in DRAM (default)
# or SRAM.
12
HIKEY_TSP_RAM_LOCATION	?=	dram
13
14
15
ifeq (${HIKEY_TSP_RAM_LOCATION}, dram)
  HIKEY_TSP_RAM_LOCATION_ID = HIKEY_DRAM_ID
else ifeq (${HIKEY_TSP_RAM_LOCATION}, sram)
16
  HIKEY_TSP_RAM_LOCATION_ID = HIKEY_SRAM_ID
17
18
19
20
else
  $(error "Currently unsupported HIKEY_TSP_RAM_LOCATION value")
endif

Haojian Zhuang's avatar
Haojian Zhuang committed
21
22
CONSOLE_BASE			:=	PL011_UART3_BASE
CRASH_CONSOLE_BASE		:=	PL011_UART3_BASE
Jerome Forissier's avatar
Jerome Forissier committed
23
MULTI_CONSOLE_API		:=	1
Haojian Zhuang's avatar
Haojian Zhuang committed
24
PLAT_PARTITION_MAX_ENTRIES	:=	12
Haojian Zhuang's avatar
Haojian Zhuang committed
25
26
27
PLAT_PL061_MAX_GPIOS		:=	160
COLD_BOOT_SINGLE_CPU		:=	1
PROGRAMMABLE_RESET_ADDRESS	:=	1
28
ENABLE_SVE_FOR_NS		:=	0
Haojian Zhuang's avatar
Haojian Zhuang committed
29
30

# Process flags
31
$(eval $(call add_define,HIKEY_TSP_RAM_LOCATION_ID))
Haojian Zhuang's avatar
Haojian Zhuang committed
32
33
34
$(eval $(call add_define,CONSOLE_BASE))
$(eval $(call add_define,CRASH_CONSOLE_BASE))
$(eval $(call add_define,PLAT_PL061_MAX_GPIOS))
Haojian Zhuang's avatar
Haojian Zhuang committed
35
$(eval $(call add_define,PLAT_PARTITION_MAX_ENTRIES))
Haojian Zhuang's avatar
Haojian Zhuang committed
36

37
38
39
# Add the build options to pack Trusted OS Extra1 and Trusted OS Extra2 images
# in the FIP if the platform requires.
ifneq ($(BL32_EXTRA1),)
40
$(eval $(call TOOL_ADD_IMG,bl32_extra1,--tos-fw-extra1))
41
42
endif
ifneq ($(BL32_EXTRA2),)
43
$(eval $(call TOOL_ADD_IMG,bl32_extra2,--tos-fw-extra2))
44
45
endif

Haojian Zhuang's avatar
Haojian Zhuang committed
46
47
48
49
50
USE_COHERENT_MEM	:=	1

PLAT_INCLUDES		:=	-Iinclude/common/tbbr			\
				-Iplat/hisilicon/hikey/include

51
52
53
PLAT_BL_COMMON_SOURCES	:=	drivers/arm/pl011/aarch64/pl011_console.S \
				lib/xlat_tables/aarch64/xlat_tables.c	\
				lib/xlat_tables/xlat_tables_common.c	\
Haojian Zhuang's avatar
Haojian Zhuang committed
54
55
56
57
58
59
60
61
62
63
				plat/hisilicon/hikey/aarch64/hikey_common.c

BL1_SOURCES		+=	bl1/tbbr/tbbr_img_desc.c		\
				drivers/arm/pl061/pl061_gpio.c		\
				drivers/arm/sp804/sp804_delay_timer.c	\
				drivers/delay_timer/delay_timer.c	\
				drivers/gpio/gpio.c			\
				drivers/io/io_block.c			\
				drivers/io/io_fip.c			\
				drivers/io/io_storage.c			\
64
				drivers/mmc/mmc.c			\
Haojian Zhuang's avatar
Haojian Zhuang committed
65
66
67
68
				drivers/synopsys/emmc/dw_mmc.c		\
				lib/cpus/aarch64/cortex_a53.S		\
				plat/hisilicon/hikey/aarch64/hikey_helpers.S \
				plat/hisilicon/hikey/hikey_bl1_setup.c	\
69
				plat/hisilicon/hikey/hikey_bl_common.c	\
Haojian Zhuang's avatar
Haojian Zhuang committed
70
				plat/hisilicon/hikey/hikey_io_storage.c
Haojian Zhuang's avatar
Haojian Zhuang committed
71

Haojian Zhuang's avatar
Haojian Zhuang committed
72
BL2_SOURCES		+=	common/desc_image_load.c		\
Haojian Zhuang's avatar
Haojian Zhuang committed
73
				drivers/arm/pl061/pl061_gpio.c		\
Haojian Zhuang's avatar
Haojian Zhuang committed
74
				drivers/arm/sp804/sp804_delay_timer.c	\
Haojian Zhuang's avatar
Haojian Zhuang committed
75
				drivers/delay_timer/delay_timer.c	\
Haojian Zhuang's avatar
Haojian Zhuang committed
76
				drivers/gpio/gpio.c			\
Haojian Zhuang's avatar
Haojian Zhuang committed
77
78
79
				drivers/io/io_block.c			\
				drivers/io/io_fip.c			\
				drivers/io/io_storage.c			\
80
				drivers/mmc/mmc.c			\
Haojian Zhuang's avatar
Haojian Zhuang committed
81
				drivers/synopsys/emmc/dw_mmc.c		\
Haojian Zhuang's avatar
Haojian Zhuang committed
82
				lib/cpus/aarch64/cortex_a53.S		\
Haojian Zhuang's avatar
Haojian Zhuang committed
83
				plat/hisilicon/hikey/aarch64/hikey_helpers.S \
Haojian Zhuang's avatar
Haojian Zhuang committed
84
				plat/hisilicon/hikey/hikey_bl2_mem_params_desc.c \
Haojian Zhuang's avatar
Haojian Zhuang committed
85
				plat/hisilicon/hikey/hikey_bl2_setup.c	\
86
				plat/hisilicon/hikey/hikey_bl_common.c	\
87
				plat/hisilicon/hikey/hikey_security.c   \
Haojian Zhuang's avatar
Haojian Zhuang committed
88
				plat/hisilicon/hikey/hikey_ddr.c	\
Haojian Zhuang's avatar
Haojian Zhuang committed
89
				plat/hisilicon/hikey/hikey_image_load.c \
Haojian Zhuang's avatar
Haojian Zhuang committed
90
91
92
				plat/hisilicon/hikey/hikey_io_storage.c	\
				plat/hisilicon/hikey/hisi_dvfs.c	\
				plat/hisilicon/hikey/hisi_mcu.c
Haojian Zhuang's avatar
Haojian Zhuang committed
93

94
95
96
ifeq (${SPD},opteed)
BL2_SOURCES		+=	lib/optee/optee_utils.c
endif
97

Haojian Zhuang's avatar
Haojian Zhuang committed
98
99
100
101
102
103
HIKEY_GIC_SOURCES	:=	drivers/arm/gic/common/gic_common.c	\
				drivers/arm/gic/v2/gicv2_main.c		\
				drivers/arm/gic/v2/gicv2_helpers.c	\
				plat/common/plat_gicv2.c

BL31_SOURCES		+=	drivers/arm/cci/cci.c			\
104
105
				drivers/arm/sp804/sp804_delay_timer.c	\
				drivers/delay_timer/delay_timer.c	\
Haojian Zhuang's avatar
Haojian Zhuang committed
106
				lib/cpus/aarch64/cortex_a53.S		\
107
				plat/common/plat_psci_common.c	\
Haojian Zhuang's avatar
Haojian Zhuang committed
108
109
110
111
112
113
114
115
				plat/hisilicon/hikey/aarch64/hikey_helpers.S \
				plat/hisilicon/hikey/hikey_bl31_setup.c	\
				plat/hisilicon/hikey/hikey_pm.c		\
				plat/hisilicon/hikey/hikey_topology.c	\
				plat/hisilicon/hikey/hisi_ipc.c		\
				plat/hisilicon/hikey/hisi_pwrc.c	\
				plat/hisilicon/hikey/hisi_pwrc_sram.S	\
				${HIKEY_GIC_SOURCES}
116
117
118
119
120
ifeq (${ENABLE_PMF}, 1)
BL31_SOURCES		+=	plat/hisilicon/hikey/hisi_sip_svc.c			\
				lib/pmf/pmf_smc.c
endif

121
122
123
124
125
126
127
128
129
130
ifneq (${TRUSTED_BOARD_BOOT},0)

include drivers/auth/mbedtls/mbedtls_crypto.mk
include drivers/auth/mbedtls/mbedtls_x509.mk

AUTH_SOURCES		:=	drivers/auth/auth_mod.c			\
				drivers/auth/crypto_mod.c		\
				drivers/auth/img_parser_mod.c		\
				drivers/auth/tbbr/tbbr_cot.c

Haojian Zhuang's avatar
Haojian Zhuang committed
131
132
133
134
135
BL1_SOURCES		+=	${AUTH_SOURCES}				\
				plat/common/tbbr/plat_tbbr.c		\
				plat/hisilicon/hikey/hikey_tbbr.c	\
				plat/hisilicon/hikey/hikey_rotpk.S

136
137
138
139
140
141
142
143
144
BL2_SOURCES		+=	${AUTH_SOURCES}				\
				plat/common/tbbr/plat_tbbr.c		\
				plat/hisilicon/hikey/hikey_tbbr.c	\
				plat/hisilicon/hikey/hikey_rotpk.S

ROT_KEY		=	$(BUILD_PLAT)/rot_key.pem
ROTPK_HASH		=	$(BUILD_PLAT)/rotpk_sha256.bin

$(eval $(call add_define_val,ROTPK_HASH,'"$(ROTPK_HASH)"'))
Haojian Zhuang's avatar
Haojian Zhuang committed
145
$(BUILD_PLAT)/bl1/hikey_rotpk.o: $(ROTPK_HASH)
146
147
148
149
150
151
152
153
154
155
156
157
158
$(BUILD_PLAT)/bl2/hikey_rotpk.o: $(ROTPK_HASH)

certificates: $(ROT_KEY)
$(ROT_KEY): | $(BUILD_PLAT)
	@echo "  OPENSSL $@"
	$(Q)openssl genrsa 2048 > $@ 2>/dev/null

$(ROTPK_HASH): $(ROT_KEY)
	@echo "  OPENSSL $@"
	$(Q)openssl rsa -in $< -pubout -outform DER 2>/dev/null |\
	openssl dgst -sha256 -binary > $@ 2>/dev/null
endif

159
160
161
162
# Enable workarounds for selected Cortex-A53 errata.
ERRATA_A53_836870		:=	1
ERRATA_A53_843419		:=	1
ERRATA_A53_855873		:=	1
163

164
165
WORKAROUND_CVE_2017_5715	:=	0

166
FIP_ALIGN			:=	512