blob: a0112c516145071d0a5f05958f1e16d2ecd0a3e7 [file] [log] [blame]
Sheetal Tigadoli13680c92019-12-13 10:39:06 +05301#
2# Copyright (c) 2015 - 2020, Broadcom
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
7PLAT_BL_COMMON_SOURCES += plat/brcm/board/common/board_common.c
8
9# If no board config makefile, do not include it
10ifneq (${BOARD_CFG},)
11BOARD_CFG_MAKE := $(shell find plat/brcm/board/${PLAT} -name '${BOARD_CFG}.mk')
12$(eval $(call add_define,BOARD_CFG))
13ifneq (${BOARD_CFG_MAKE},)
14$(info Including ${BOARD_CFG_MAKE})
15include ${BOARD_CFG_MAKE}
16else
17$(error Error: File ${BOARD_CFG}.mk not found in plat/brcm/board/${PLAT})
18endif
19endif
20
21# To compile with highest log level (VERBOSE) set value to 50
22LOG_LEVEL := 40
23
24# Use custom generic timer clock
25ifneq (${GENTIMER_ACTUAL_CLOCK},)
26$(info Using GENTIMER_ACTUAL_CLOCK=$(GENTIMER_ACTUAL_CLOCK))
27SYSCNT_FREQ := $(GENTIMER_ACTUAL_CLOCK)
28$(eval $(call add_define,SYSCNT_FREQ))
29endif
30
Sheetal Tigadoliad0943e2019-12-18 19:44:43 +053031# By default, Trusted Watchdog is always enabled unless SPIN_ON_BL1_EXIT is set
32ifeq (${BRCM_DISABLE_TRUSTED_WDOG},)
33BRCM_DISABLE_TRUSTED_WDOG := 0
34endif
35ifeq (${SPIN_ON_BL1_EXIT}, 1)
36BRCM_DISABLE_TRUSTED_WDOG := 1
37endif
38
39$(eval $(call assert_boolean,BRCM_DISABLE_TRUSTED_WDOG))
40$(eval $(call add_define,BRCM_DISABLE_TRUSTED_WDOG))
41
Sheetal Tigadoli2a96dc22019-12-18 12:01:01 +053042# Process ARM_BL31_IN_DRAM flag
43ifeq (${ARM_BL31_IN_DRAM},)
44ARM_BL31_IN_DRAM := 0
45endif
46$(eval $(call assert_boolean,ARM_BL31_IN_DRAM))
47$(eval $(call add_define,ARM_BL31_IN_DRAM))
48
Sheetal Tigadoli13680c92019-12-13 10:39:06 +053049ifeq (${STANDALONE_BL2},yes)
Sheetal Tigadoliad0943e2019-12-18 19:44:43 +053050BL2_LOG_LEVEL := 40
Sheetal Tigadoli13680c92019-12-13 10:39:06 +053051$(eval $(call add_define,MMU_DISABLED))
52endif
53
54# BL2 XIP from QSPI
55RUN_BL2_FROM_QSPI := 0
56ifeq (${RUN_BL2_FROM_QSPI},1)
57$(eval $(call add_define,RUN_BL2_FROM_QSPI))
58endif
59
Sheetal Tigadoliad0943e2019-12-18 19:44:43 +053060# BL2 XIP from NAND
61RUN_BL2_FROM_NAND := 0
62ifeq (${RUN_BL2_FROM_NAND},1)
63$(eval $(call add_define,RUN_BL2_FROM_NAND))
64endif
65
66ifneq (${ELOG_AP_UART_LOG_BASE},)
67$(eval $(call add_define,ELOG_AP_UART_LOG_BASE))
68endif
69
70ifeq (${ELOG_SUPPORT},1)
71ifeq (${ELOG_STORE_MEDIA},DDR)
72$(eval $(call add_define,ELOG_STORE_MEDIA_DDR))
73ifneq (${ELOG_STORE_OFFSET},)
74$(eval $(call add_define,ELOG_STORE_OFFSET))
75endif
76endif
77endif
78
79ifneq (${BL2_LOG_LEVEL},)
80$(eval $(call add_define,BL2_LOG_LEVEL))
81endif
82
Sheetal Tigadoli58a9eca2019-12-18 20:05:09 +053083ifneq (${BL31_LOG_LEVEL},)
84$(eval $(call add_define,BL31_LOG_LEVEL))
85endif
86
Sheetal Tigadoli13680c92019-12-13 10:39:06 +053087# Use CRMU SRAM from iHOST
88ifneq (${USE_CRMU_SRAM},)
89$(eval $(call add_define,USE_CRMU_SRAM))
90endif
91
92# On BRCM platforms, separate the code and read-only data sections to allow
93# mapping the former as executable and the latter as execute-never.
94SEPARATE_CODE_AND_RODATA := 1
95
96# Use generic OID definition (tbbr_oid.h)
97USE_TBBR_DEFS := 1
98
Sheetal Tigadoli2a96dc22019-12-18 12:01:01 +053099PLAT_INCLUDES += -Iplat/brcm/board/common \
100 -Iinclude/drivers/brcm
Sheetal Tigadoli13680c92019-12-13 10:39:06 +0530101
102PLAT_BL_COMMON_SOURCES += plat/brcm/common/brcm_common.c \
103 plat/brcm/board/common/cmn_sec.c \
104 plat/brcm/board/common/bcm_console.c \
Sheetal Tigadoliad0943e2019-12-18 19:44:43 +0530105 plat/brcm/board/common/brcm_mbedtls.c \
Sheetal Tigadoli13680c92019-12-13 10:39:06 +0530106 plat/brcm/board/common/plat_setup.c \
107 plat/brcm/board/common/platform_common.c \
108 drivers/arm/sp804/sp804_delay_timer.c \
Sheetal Tigadoliad0943e2019-12-18 19:44:43 +0530109 drivers/brcm/sotp.c \
Sheetal Tigadoli13680c92019-12-13 10:39:06 +0530110 drivers/delay_timer/delay_timer.c \
111 drivers/io/io_fip.c \
112 drivers/io/io_memmap.c \
113 drivers/io/io_storage.c \
114 plat/brcm/common/brcm_io_storage.c \
115 plat/brcm/board/common/err.c \
Sheetal Tigadoliad0943e2019-12-18 19:44:43 +0530116 plat/brcm/board/common/sbl_util.c \
Sheetal Tigadoli13680c92019-12-13 10:39:06 +0530117 drivers/arm/sp805/sp805.c
118
119BL2_SOURCES += plat/brcm/common/brcm_bl2_mem_params_desc.c \
120 plat/brcm/common/brcm_image_load.c \
121 common/desc_image_load.c
122
123BL2_SOURCES += plat/brcm/common/brcm_bl2_setup.c
124
Sheetal Tigadoli2a96dc22019-12-18 12:01:01 +0530125BL31_SOURCES += plat/brcm/common/brcm_bl31_setup.c
126
Sheetal Tigadoliad0943e2019-12-18 19:44:43 +0530127ifeq (${BCM_ELOG},yes)
128ELOG_SOURCES += plat/brcm/board/common/bcm_elog.c
129BL2_SOURCES += ${ELOG_SOURCES}
Sheetal Tigadoli58a9eca2019-12-18 20:05:09 +0530130BL31_SOURCES += ${ELOG_SOURCES}
Sheetal Tigadoliad0943e2019-12-18 19:44:43 +0530131endif
132
133ifeq (${DRIVER_OCOTP_ENABLE},1)
134$(eval $(call add_define,DRIVER_OCOTP_ENABLE))
135BL2_SOURCES += drivers/brcm/ocotp.c
136endif
137
138# Enable FRU table support
139ifeq (${USE_FRU},yes)
140$(eval $(call add_define,USE_FRU))
141BL2_SOURCES += drivers/brcm/fru.c
142endif
143
144# Enable GPIO support
145ifeq (${USE_GPIO},yes)
146$(eval $(call add_define,USE_GPIO))
147BL2_SOURCES += drivers/gpio/gpio.c
148BL2_SOURCES += drivers/brcm/iproc_gpio.c
149ifeq (${GPIO_SUPPORT_FLOAT_DETECTION},yes)
150$(eval $(call add_define,GPIO_SUPPORT_FLOAT_DETECTION))
151endif
152endif
153
154# Include mbedtls if it can be located
155MBEDTLS_DIR := mbedtls
156MBEDTLS_CHECK := $(shell find ${MBEDTLS_DIR}/include -name '${MBEDTLS_DIR}')
157
158ifneq (${MBEDTLS_CHECK},)
159$(info Found mbedTLS at ${MBEDTLS_DIR})
160PLAT_INCLUDES += -I${MBEDTLS_DIR}/include/mbedtls
161# Specify mbedTLS configuration file
162MBEDTLS_CONFIG_FILE := "<brcm_mbedtls_config.h>"
163
164# By default, use RSA keys
165KEY_ALG := rsa_1_5
166
167# Include common TBB sources
168AUTH_SOURCES += drivers/auth/auth_mod.c \
169 drivers/auth/crypto_mod.c \
170 drivers/auth/img_parser_mod.c \
171 drivers/auth/tbbr/tbbr_cot.c
172
173BL2_SOURCES += ${AUTH_SOURCES}
174
175# Use ATF framework for MBEDTLS
176TRUSTED_BOARD_BOOT := 1
177CRYPTO_LIB_MK := drivers/auth/mbedtls/mbedtls_crypto.mk
178IMG_PARSER_LIB_MK := drivers/auth/mbedtls/mbedtls_x509.mk
179$(info Including ${CRYPTO_LIB_MK})
180include ${CRYPTO_LIB_MK}
181$(info Including ${IMG_PARSER_LIB_MK})
182include ${IMG_PARSER_LIB_MK}
183
184# Use ATF secure boot functions
185# Use Hardcoded hash for devel
186
187ARM_ROTPK_LOCATION=arm_rsa
188ifeq (${ARM_ROTPK_LOCATION}, arm_rsa)
189ARM_ROTPK_LOCATION_ID=ARM_ROTPK_DEVEL_RSA_ID
190ROT_KEY=plat/arm/board/common/rotpk/arm_rotprivk_rsa.pem
191else ifeq (${ARM_ROTPK_LOCATION}, brcm_rsa)
192ARM_ROTPK_LOCATION_ID=BRCM_ROTPK_SOTP_RSA_ID
193ifeq (${ROT_KEY},)
194ROT_KEY=plat/brcm/board/common/rotpk/rsa_dauth2048_key.pem
195endif
196KEY_FIND := $(shell m="${ROT_KEY}"; [ -f "$$m" ] && echo "$$m")
197ifeq (${KEY_FIND},)
198$(error Error: No ${ROT_KEY} located)
199else
200$(info Using ROT_KEY: ${ROT_KEY})
201endif
202else
203$(error "Unsupported ARM_ROTPK_LOCATION value")
204endif
205
206$(eval $(call add_define,ARM_ROTPK_LOCATION_ID))
207PLAT_BL_COMMON_SOURCES+=plat/brcm/board/common/board_arm_trusted_boot.c
208endif
209
Sheetal Tigadoli2a96dc22019-12-18 12:01:01 +0530210#M0 runtime firmware
211ifdef SCP_BL2
212$(eval $(call add_define,NEED_SCP_BL2))
213SCP_CFG_DIR=$(dir ${SCP_BL2})
214PLAT_INCLUDES += -I${SCP_CFG_DIR}
215endif
216
217ifneq (${NEED_BL33},yes)
218# If there is no BL33, BL31 will jump to this address.
219ifeq (${USE_DDR},yes)
220PRELOADED_BL33_BASE := 0x80000000
221else
222PRELOADED_BL33_BASE := 0x74000000
223endif
224endif
225
Sheetal Tigadoli13680c92019-12-13 10:39:06 +0530226# Use translation tables library v1 by default
227ARM_XLAT_TABLES_LIB_V1 := 1
228ifeq (${ARM_XLAT_TABLES_LIB_V1}, 1)
229$(eval $(call assert_boolean,ARM_XLAT_TABLES_LIB_V1))
230$(eval $(call add_define,ARM_XLAT_TABLES_LIB_V1))
231PLAT_BL_COMMON_SOURCES += lib/xlat_tables/aarch64/xlat_tables.c \
232 lib/xlat_tables/xlat_tables_common.c
233endif