| 1 |
# |
| 2 |
# Copyright (c) 2015 - 2021, Broadcom |
| 3 |
# |
| 4 |
# SPDX-License-Identifier: BSD-3-Clause |
| 5 |
# |
| 6 |
|
| 7 |
PLAT_BL_COMMON_SOURCES += plat/brcm/board/common/board_common.c |
| 8 |
|
| 9 |
# If no board config makefile, do not include it |
| 10 |
ifneq (${BOARD_CFG},) |
| 11 |
BOARD_CFG_MAKE := $(shell find plat/brcm/board/${PLAT} -name '${BOARD_CFG}.mk') |
| 12 |
$(eval $(call add_define,BOARD_CFG)) |
| 13 |
ifneq (${BOARD_CFG_MAKE},) |
| 14 |
$(info Including ${BOARD_CFG_MAKE}) |
| 15 |
include ${BOARD_CFG_MAKE} |
| 16 |
else |
| 17 |
$(error Error: File ${BOARD_CFG}.mk not found in plat/brcm/board/${PLAT}) |
| 18 |
endif |
| 19 |
endif |
| 20 |
|
| 21 |
# To compile with highest log level (VERBOSE) set value to 50 |
| 22 |
LOG_LEVEL := 40 |
| 23 |
|
| 24 |
# Use custom generic timer clock |
| 25 |
ifneq (${GENTIMER_ACTUAL_CLOCK},) |
| 26 |
$(info Using GENTIMER_ACTUAL_CLOCK=$(GENTIMER_ACTUAL_CLOCK)) |
| 27 |
SYSCNT_FREQ := $(GENTIMER_ACTUAL_CLOCK) |
| 28 |
$(eval $(call add_define,SYSCNT_FREQ)) |
| 29 |
endif |
| 30 |
|
| 31 |
ifeq (${DRIVER_EMMC_ENABLE},) |
| 32 |
DRIVER_EMMC_ENABLE :=1 |
| 33 |
endif |
| 34 |
|
| 35 |
ifeq (${DRIVER_SPI_ENABLE},) |
| 36 |
DRIVER_SPI_ENABLE := 0 |
| 37 |
endif |
| 38 |
|
| 39 |
ifeq (${DRIVER_I2C_ENABLE},) |
| 40 |
DRIVER_I2C_ENABLE := 0 |
| 41 |
endif |
| 42 |
|
| 43 |
# By default, Trusted Watchdog is always enabled unless SPIN_ON_BL1_EXIT is set |
| 44 |
ifeq (${BRCM_DISABLE_TRUSTED_WDOG},) |
| 45 |
BRCM_DISABLE_TRUSTED_WDOG := 0 |
| 46 |
endif |
| 47 |
ifeq (${SPIN_ON_BL1_EXIT}, 1) |
| 48 |
BRCM_DISABLE_TRUSTED_WDOG := 1 |
| 49 |
endif |
| 50 |
|
| 51 |
$(eval $(call assert_boolean,BRCM_DISABLE_TRUSTED_WDOG)) |
| 52 |
$(eval $(call add_define,BRCM_DISABLE_TRUSTED_WDOG)) |
| 53 |
|
| 54 |
# Process ARM_BL31_IN_DRAM flag |
| 55 |
ifeq (${ARM_BL31_IN_DRAM},) |
| 56 |
ARM_BL31_IN_DRAM := 0 |
| 57 |
endif |
| 58 |
$(eval $(call assert_boolean,ARM_BL31_IN_DRAM)) |
| 59 |
$(eval $(call add_define,ARM_BL31_IN_DRAM)) |
| 60 |
|
| 61 |
ifeq (${STANDALONE_BL2},yes) |
| 62 |
BL2_LOG_LEVEL := 40 |
| 63 |
$(eval $(call add_define,MMU_DISABLED)) |
| 64 |
endif |
| 65 |
|
| 66 |
# BL2 XIP from QSPI |
| 67 |
RUN_BL2_FROM_QSPI := 0 |
| 68 |
ifeq (${RUN_BL2_FROM_QSPI},1) |
| 69 |
$(eval $(call add_define,RUN_BL2_FROM_QSPI)) |
| 70 |
endif |
| 71 |
|
| 72 |
# BL2 XIP from NAND |
| 73 |
RUN_BL2_FROM_NAND := 0 |
| 74 |
ifeq (${RUN_BL2_FROM_NAND},1) |
| 75 |
$(eval $(call add_define,RUN_BL2_FROM_NAND)) |
| 76 |
endif |
| 77 |
|
| 78 |
ifneq (${ELOG_AP_UART_LOG_BASE},) |
| 79 |
$(eval $(call add_define,ELOG_AP_UART_LOG_BASE)) |
| 80 |
endif |
| 81 |
|
| 82 |
ifeq (${ELOG_SUPPORT},1) |
| 83 |
ifeq (${ELOG_STORE_MEDIA},DDR) |
| 84 |
$(eval $(call add_define,ELOG_STORE_MEDIA_DDR)) |
| 85 |
ifneq (${ELOG_STORE_OFFSET},) |
| 86 |
$(eval $(call add_define,ELOG_STORE_OFFSET)) |
| 87 |
endif |
| 88 |
endif |
| 89 |
endif |
| 90 |
|
| 91 |
ifneq (${BL2_LOG_LEVEL},) |
| 92 |
$(eval $(call add_define,BL2_LOG_LEVEL)) |
| 93 |
endif |
| 94 |
|
| 95 |
ifneq (${BL31_LOG_LEVEL},) |
| 96 |
$(eval $(call add_define,BL31_LOG_LEVEL)) |
| 97 |
endif |
| 98 |
|
| 99 |
# Use CRMU SRAM from iHOST |
| 100 |
ifneq (${USE_CRMU_SRAM},) |
| 101 |
$(eval $(call add_define,USE_CRMU_SRAM)) |
| 102 |
endif |
| 103 |
|
| 104 |
# Use PIO mode if DDR is not used |
| 105 |
ifeq (${USE_DDR},yes) |
| 106 |
EMMC_USE_DMA := 1 |
| 107 |
else |
| 108 |
EMMC_USE_DMA := 0 |
| 109 |
endif |
| 110 |
$(eval $(call add_define,EMMC_USE_DMA)) |
| 111 |
|
| 112 |
# On BRCM platforms, separate the code and read-only data sections to allow |
| 113 |
# mapping the former as executable and the latter as execute-never. |
| 114 |
SEPARATE_CODE_AND_RODATA := 1 |
| 115 |
|
| 116 |
# Use generic OID definition (tbbr_oid.h) |
| 117 |
USE_TBBR_DEFS := 1 |
| 118 |
|
| 119 |
PLAT_INCLUDES += -Iplat/brcm/board/common \ |
| 120 |
-Iinclude/drivers/brcm \ |
| 121 |
-Iinclude/drivers/brcm/emmc \ |
| 122 |
-Iinclude/drivers/brcm/mdio |
| 123 |
|
| 124 |
PLAT_BL_COMMON_SOURCES += plat/brcm/common/brcm_common.c \ |
| 125 |
plat/brcm/board/common/cmn_sec.c \ |
| 126 |
plat/brcm/board/common/bcm_console.c \ |
| 127 |
plat/brcm/board/common/brcm_mbedtls.c \ |
| 128 |
plat/brcm/board/common/plat_setup.c \ |
| 129 |
plat/brcm/board/common/platform_common.c \ |
| 130 |
drivers/arm/sp804/sp804_delay_timer.c \ |
| 131 |
drivers/brcm/sotp.c \ |
| 132 |
drivers/delay_timer/delay_timer.c \ |
| 133 |
drivers/io/io_fip.c \ |
| 134 |
drivers/io/io_memmap.c \ |
| 135 |
drivers/io/io_storage.c \ |
| 136 |
plat/brcm/common/brcm_io_storage.c \ |
| 137 |
plat/brcm/board/common/err.c \ |
| 138 |
plat/brcm/board/common/sbl_util.c \ |
| 139 |
drivers/arm/sp805/sp805.c |
| 140 |
|
| 141 |
# Add RNG driver |
| 142 |
DRIVER_RNG_ENABLE := 1 |
| 143 |
ifeq (${DRIVER_RNG_ENABLE},1) |
| 144 |
PLAT_BL_COMMON_SOURCES += drivers/brcm/rng.c |
| 145 |
endif |
| 146 |
|
| 147 |
# Add eMMC driver |
| 148 |
ifeq (${DRIVER_EMMC_ENABLE},1) |
| 149 |
$(eval $(call add_define,DRIVER_EMMC_ENABLE)) |
| 150 |
|
| 151 |
EMMC_SOURCES += drivers/brcm/emmc/emmc_chal_sd.c \ |
| 152 |
drivers/brcm/emmc/emmc_csl_sdcard.c \ |
| 153 |
drivers/brcm/emmc/emmc_csl_sdcmd.c \ |
| 154 |
drivers/brcm/emmc/emmc_pboot_hal_memory_drv.c |
| 155 |
|
| 156 |
PLAT_BL_COMMON_SOURCES += ${EMMC_SOURCES} |
| 157 |
|
| 158 |
ifeq (${DRIVER_EMMC_ENABLE_DATA_WIDTH_8BIT},) |
| 159 |
$(eval $(call add_define,DRIVER_EMMC_ENABLE_DATA_WIDTH_8BIT)) |
| 160 |
endif |
| 161 |
endif |
| 162 |
|
| 163 |
BL2_SOURCES += plat/brcm/common/brcm_bl2_mem_params_desc.c \ |
| 164 |
plat/brcm/common/brcm_image_load.c \ |
| 165 |
common/desc_image_load.c |
| 166 |
|
| 167 |
BL2_SOURCES += plat/brcm/common/brcm_bl2_setup.c |
| 168 |
|
| 169 |
BL31_SOURCES += plat/brcm/common/brcm_bl31_setup.c |
| 170 |
|
| 171 |
ifeq (${BCM_ELOG},yes) |
| 172 |
ELOG_SOURCES += plat/brcm/board/common/bcm_elog.c |
| 173 |
BL2_SOURCES += ${ELOG_SOURCES} |
| 174 |
BL31_SOURCES += ${ELOG_SOURCES} |
| 175 |
endif |
| 176 |
|
| 177 |
# Add spi driver |
| 178 |
ifeq (${DRIVER_SPI_ENABLE},1) |
| 179 |
PLAT_BL_COMMON_SOURCES += drivers/brcm/spi/iproc_spi.c \ |
| 180 |
drivers/brcm/spi/iproc_qspi.c |
| 181 |
endif |
| 182 |
|
| 183 |
# Add spi nor/flash driver |
| 184 |
ifeq (${DRIVER_SPI_NOR_ENABLE},1) |
| 185 |
PLAT_BL_COMMON_SOURCES += drivers/brcm/spi_sf.c \ |
| 186 |
drivers/brcm/spi_flash.c |
| 187 |
endif |
| 188 |
|
| 189 |
ifeq (${DRIVER_I2C_ENABLE},1) |
| 190 |
$(eval $(call add_define,DRIVER_I2C_ENABLE)) |
| 191 |
BL2_SOURCES += drivers/brcm/i2c/i2c.c |
| 192 |
PLAT_INCLUDES += -Iinclude/drivers/brcm/i2c |
| 193 |
endif |
| 194 |
|
| 195 |
ifeq (${DRIVER_OCOTP_ENABLE},1) |
| 196 |
$(eval $(call add_define,DRIVER_OCOTP_ENABLE)) |
| 197 |
BL2_SOURCES += drivers/brcm/ocotp.c |
| 198 |
endif |
| 199 |
|
| 200 |
# Enable FRU table support |
| 201 |
ifeq (${USE_FRU},yes) |
| 202 |
$(eval $(call add_define,USE_FRU)) |
| 203 |
BL2_SOURCES += drivers/brcm/fru.c |
| 204 |
endif |
| 205 |
|
| 206 |
# Enable GPIO support |
| 207 |
ifeq (${USE_GPIO},yes) |
| 208 |
$(eval $(call add_define,USE_GPIO)) |
| 209 |
BL2_SOURCES += drivers/gpio/gpio.c |
| 210 |
BL2_SOURCES += drivers/brcm/iproc_gpio.c |
| 211 |
ifeq (${GPIO_SUPPORT_FLOAT_DETECTION},yes) |
| 212 |
$(eval $(call add_define,GPIO_SUPPORT_FLOAT_DETECTION)) |
| 213 |
endif |
| 214 |
endif |
| 215 |
|
| 216 |
# Include mbedtls if it can be located |
| 217 |
MBEDTLS_DIR ?= mbedtls |
| 218 |
MBEDTLS_CHECK := $(shell find ${MBEDTLS_DIR}/include -name '$(notdir ${MBEDTLS_DIR})') |
| 219 |
|
| 220 |
ifneq (${MBEDTLS_CHECK},) |
| 221 |
$(info Found mbedTLS at ${MBEDTLS_DIR}) |
| 222 |
PLAT_INCLUDES += -I${MBEDTLS_DIR}/include/mbedtls |
| 223 |
|
| 224 |
# By default, use RSA keys |
| 225 |
KEY_ALG := rsa_1_5 |
| 226 |
|
| 227 |
# Include common TBB sources |
| 228 |
AUTH_SOURCES += drivers/auth/auth_mod.c \ |
| 229 |
drivers/auth/crypto_mod.c \ |
| 230 |
drivers/auth/img_parser_mod.c \ |
| 231 |
drivers/auth/tbbr/tbbr_cot_common.c \ |
| 232 |
drivers/auth/tbbr/tbbr_cot_bl2.c |
| 233 |
|
| 234 |
BL2_SOURCES += ${AUTH_SOURCES} |
| 235 |
|
| 236 |
# Use ATF framework for MBEDTLS |
| 237 |
TRUSTED_BOARD_BOOT := 1 |
| 238 |
CRYPTO_LIB_MK := drivers/auth/mbedtls/mbedtls_crypto.mk |
| 239 |
IMG_PARSER_LIB_MK := drivers/auth/mbedtls/mbedtls_x509.mk |
| 240 |
$(info Including ${CRYPTO_LIB_MK}) |
| 241 |
include ${CRYPTO_LIB_MK} |
| 242 |
$(info Including ${IMG_PARSER_LIB_MK}) |
| 243 |
include ${IMG_PARSER_LIB_MK} |
| 244 |
|
| 245 |
# Use ATF secure boot functions |
| 246 |
# Use Hardcoded hash for devel |
| 247 |
|
| 248 |
ARM_ROTPK_LOCATION=arm_rsa |
| 249 |
ifeq (${ARM_ROTPK_LOCATION}, arm_rsa) |
| 250 |
ARM_ROTPK_LOCATION_ID=ARM_ROTPK_DEVEL_RSA_ID |
| 251 |
ROT_KEY=plat/arm/board/common/rotpk/arm_rotprivk_rsa.pem |
| 252 |
else ifeq (${ARM_ROTPK_LOCATION}, brcm_rsa) |
| 253 |
ARM_ROTPK_LOCATION_ID=BRCM_ROTPK_SOTP_RSA_ID |
| 254 |
ifeq (${ROT_KEY},) |
| 255 |
ROT_KEY=plat/brcm/board/common/rotpk/rsa_dauth2048_key.pem |
| 256 |
endif |
| 257 |
KEY_FIND := $(shell m="${ROT_KEY}"; [ -f "$$m" ] && echo "$$m") |
| 258 |
ifeq (${KEY_FIND},) |
| 259 |
$(error Error: No ${ROT_KEY} located) |
| 260 |
else |
| 261 |
$(info Using ROT_KEY: ${ROT_KEY}) |
| 262 |
endif |
| 263 |
else |
| 264 |
$(error "Unsupported ARM_ROTPK_LOCATION value") |
| 265 |
endif |
| 266 |
|
| 267 |
$(eval $(call add_define,ARM_ROTPK_LOCATION_ID)) |
| 268 |
PLAT_BL_COMMON_SOURCES+=plat/brcm/board/common/board_arm_trusted_boot.c |
| 269 |
endif |
| 270 |
|
| 271 |
#M0 runtime firmware |
| 272 |
ifdef SCP_BL2 |
| 273 |
$(eval $(call add_define,NEED_SCP_BL2)) |
| 274 |
SCP_CFG_DIR=$(dir ${SCP_BL2}) |
| 275 |
PLAT_INCLUDES += -I${SCP_CFG_DIR} |
| 276 |
endif |
| 277 |
|
| 278 |
ifneq (${NEED_BL33},yes) |
| 279 |
# If there is no BL33, BL31 will jump to this address. |
| 280 |
ifeq (${USE_DDR},yes) |
| 281 |
PRELOADED_BL33_BASE := 0x80000000 |
| 282 |
else |
| 283 |
PRELOADED_BL33_BASE := 0x74000000 |
| 284 |
endif |
| 285 |
endif |
| 286 |
|
| 287 |
# Use translation tables library v1 by default |
| 288 |
ARM_XLAT_TABLES_LIB_V1 := 1 |
| 289 |
ifeq (${ARM_XLAT_TABLES_LIB_V1}, 1) |
| 290 |
$(eval $(call assert_boolean,ARM_XLAT_TABLES_LIB_V1)) |
| 291 |
$(eval $(call add_define,ARM_XLAT_TABLES_LIB_V1)) |
| 292 |
PLAT_BL_COMMON_SOURCES += lib/xlat_tables/aarch64/xlat_tables.c \ |
| 293 |
lib/xlat_tables/xlat_tables_common.c |
| 294 |
endif |