platform.mk 5.12 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
#

7
8
9
# Enable version2 of image loading
LOAD_IMAGE_V2	:=	1

Haojian Zhuang's avatar
Haojian Zhuang committed
10
11
12
# Non-TF Boot ROM
BL2_AT_EL3	:=	1

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

Haojian Zhuang's avatar
Haojian Zhuang committed
24
25
CONSOLE_BASE			:=	PL011_UART3_BASE
CRASH_CONSOLE_BASE		:=	PL011_UART3_BASE
Haojian Zhuang's avatar
Haojian Zhuang committed
26
PLAT_PARTITION_MAX_ENTRIES	:=	12
Haojian Zhuang's avatar
Haojian Zhuang committed
27
28
29
PLAT_PL061_MAX_GPIOS		:=	160
COLD_BOOT_SINGLE_CPU		:=	1
PROGRAMMABLE_RESET_ADDRESS	:=	1
30
ENABLE_SVE_FOR_NS		:=	0
Haojian Zhuang's avatar
Haojian Zhuang committed
31
32

# Process flags
33
$(eval $(call add_define,HIKEY_TSP_RAM_LOCATION_ID))
Haojian Zhuang's avatar
Haojian Zhuang committed
34
35
36
$(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
37
$(eval $(call add_define,PLAT_PARTITION_MAX_ENTRIES))
Haojian Zhuang's avatar
Haojian Zhuang committed
38

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

Haojian Zhuang's avatar
Haojian Zhuang committed
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
ENABLE_PLAT_COMPAT	:=	0

USE_COHERENT_MEM	:=	1

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

PLAT_BL_COMMON_SOURCES	:=	drivers/arm/pl011/pl011_console.S	\
				lib/aarch64/xlat_tables.c		\
				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			\
				drivers/emmc/emmc.c			\
				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	\
73
				plat/hisilicon/hikey/hikey_bl_common.c	\
Haojian Zhuang's avatar
Haojian Zhuang committed
74
				plat/hisilicon/hikey/hikey_io_storage.c
Haojian Zhuang's avatar
Haojian Zhuang committed
75

Haojian Zhuang's avatar
Haojian Zhuang committed
76
BL2_SOURCES		+=	common/desc_image_load.c		\
Haojian Zhuang's avatar
Haojian Zhuang committed
77
				drivers/arm/pl061/pl061_gpio.c		\
Haojian Zhuang's avatar
Haojian Zhuang committed
78
				drivers/arm/sp804/sp804_delay_timer.c	\
Haojian Zhuang's avatar
Haojian Zhuang committed
79
				drivers/delay_timer/delay_timer.c	\
Haojian Zhuang's avatar
Haojian Zhuang committed
80
				drivers/gpio/gpio.c			\
Haojian Zhuang's avatar
Haojian Zhuang committed
81
82
83
84
85
				drivers/io/io_block.c			\
				drivers/io/io_fip.c			\
				drivers/io/io_storage.c			\
				drivers/emmc/emmc.c			\
				drivers/synopsys/emmc/dw_mmc.c		\
Haojian Zhuang's avatar
Haojian Zhuang committed
86
				lib/cpus/aarch64/cortex_a53.S		\
Haojian Zhuang's avatar
Haojian Zhuang committed
87
				plat/hisilicon/hikey/aarch64/hikey_helpers.S \
Haojian Zhuang's avatar
Haojian Zhuang committed
88
				plat/hisilicon/hikey/hikey_bl2_mem_params_desc.c \
Haojian Zhuang's avatar
Haojian Zhuang committed
89
				plat/hisilicon/hikey/hikey_bl2_setup.c	\
90
				plat/hisilicon/hikey/hikey_bl_common.c	\
91
				plat/hisilicon/hikey/hikey_security.c   \
Haojian Zhuang's avatar
Haojian Zhuang committed
92
				plat/hisilicon/hikey/hikey_ddr.c	\
Haojian Zhuang's avatar
Haojian Zhuang committed
93
				plat/hisilicon/hikey/hikey_image_load.c \
Haojian Zhuang's avatar
Haojian Zhuang committed
94
95
96
				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
97

98
99
100
ifeq (${SPD},opteed)
BL2_SOURCES		+=	lib/optee/optee_utils.c
endif
101

Haojian Zhuang's avatar
Haojian Zhuang committed
102
103
104
105
106
107
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			\
108
109
				drivers/arm/sp804/sp804_delay_timer.c	\
				drivers/delay_timer/delay_timer.c	\
Haojian Zhuang's avatar
Haojian Zhuang committed
110
111
112
113
114
115
116
117
118
119
				lib/cpus/aarch64/cortex_a53.S		\
				plat/common/aarch64/plat_psci_common.c	\
				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}
120
121
122
123
124
ifeq (${ENABLE_PMF}, 1)
BL31_SOURCES		+=	plat/hisilicon/hikey/hisi_sip_svc.c			\
				lib/pmf/pmf_smc.c
endif

125
126
127
128
129
130
131
132
133
134
135
136
ifneq (${TRUSTED_BOARD_BOOT},0)

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

USE_TBBR_DEFS		:=	1

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
137
138
139
140
141
BL1_SOURCES		+=	${AUTH_SOURCES}				\
				plat/common/tbbr/plat_tbbr.c		\
				plat/hisilicon/hikey/hikey_tbbr.c	\
				plat/hisilicon/hikey/hikey_rotpk.S

142
143
144
145
146
147
148
149
150
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
151
$(BUILD_PLAT)/bl1/hikey_rotpk.o: $(ROTPK_HASH)
152
153
154
155
156
157
158
159
160
161
162
163
164
$(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

165
166
167
168
# Enable workarounds for selected Cortex-A53 errata.
ERRATA_A53_836870		:=	1
ERRATA_A53_843419		:=	1
ERRATA_A53_855873		:=	1
169

170
171
WORKAROUND_CVE_2017_5715	:=	0

172
FIP_ALIGN			:=	512