1# 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 31# 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 42# 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 49ifeq (${STANDALONE_BL2},yes) 50BL2_LOG_LEVEL := 40 51$(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 60# 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 83# Use CRMU SRAM from iHOST 84ifneq (${USE_CRMU_SRAM},) 85$(eval $(call add_define,USE_CRMU_SRAM)) 86endif 87 88# On BRCM platforms, separate the code and read-only data sections to allow 89# mapping the former as executable and the latter as execute-never. 90SEPARATE_CODE_AND_RODATA := 1 91 92# Use generic OID definition (tbbr_oid.h) 93USE_TBBR_DEFS := 1 94 95PLAT_INCLUDES += -Iplat/brcm/board/common \ 96 -Iinclude/drivers/brcm 97 98PLAT_BL_COMMON_SOURCES += plat/brcm/common/brcm_common.c \ 99 plat/brcm/board/common/cmn_sec.c \ 100 plat/brcm/board/common/bcm_console.c \ 101 plat/brcm/board/common/brcm_mbedtls.c \ 102 plat/brcm/board/common/plat_setup.c \ 103 plat/brcm/board/common/platform_common.c \ 104 drivers/arm/sp804/sp804_delay_timer.c \ 105 drivers/brcm/sotp.c \ 106 drivers/delay_timer/delay_timer.c \ 107 drivers/io/io_fip.c \ 108 drivers/io/io_memmap.c \ 109 drivers/io/io_storage.c \ 110 plat/brcm/common/brcm_io_storage.c \ 111 plat/brcm/board/common/err.c \ 112 plat/brcm/board/common/sbl_util.c \ 113 drivers/arm/sp805/sp805.c 114 115BL2_SOURCES += plat/brcm/common/brcm_bl2_mem_params_desc.c \ 116 plat/brcm/common/brcm_image_load.c \ 117 common/desc_image_load.c 118 119BL2_SOURCES += plat/brcm/common/brcm_bl2_setup.c 120 121BL31_SOURCES += plat/brcm/common/brcm_bl31_setup.c 122 123ifeq (${BCM_ELOG},yes) 124ELOG_SOURCES += plat/brcm/board/common/bcm_elog.c 125BL2_SOURCES += ${ELOG_SOURCES} 126endif 127 128ifeq (${DRIVER_OCOTP_ENABLE},1) 129$(eval $(call add_define,DRIVER_OCOTP_ENABLE)) 130BL2_SOURCES += drivers/brcm/ocotp.c 131endif 132 133# Enable FRU table support 134ifeq (${USE_FRU},yes) 135$(eval $(call add_define,USE_FRU)) 136BL2_SOURCES += drivers/brcm/fru.c 137endif 138 139# Enable GPIO support 140ifeq (${USE_GPIO},yes) 141$(eval $(call add_define,USE_GPIO)) 142BL2_SOURCES += drivers/gpio/gpio.c 143BL2_SOURCES += drivers/brcm/iproc_gpio.c 144ifeq (${GPIO_SUPPORT_FLOAT_DETECTION},yes) 145$(eval $(call add_define,GPIO_SUPPORT_FLOAT_DETECTION)) 146endif 147endif 148 149# Include mbedtls if it can be located 150MBEDTLS_DIR := mbedtls 151MBEDTLS_CHECK := $(shell find ${MBEDTLS_DIR}/include -name '${MBEDTLS_DIR}') 152 153ifneq (${MBEDTLS_CHECK},) 154$(info Found mbedTLS at ${MBEDTLS_DIR}) 155PLAT_INCLUDES += -I${MBEDTLS_DIR}/include/mbedtls 156# Specify mbedTLS configuration file 157MBEDTLS_CONFIG_FILE := "<brcm_mbedtls_config.h>" 158 159# By default, use RSA keys 160KEY_ALG := rsa_1_5 161 162# Include common TBB sources 163AUTH_SOURCES += drivers/auth/auth_mod.c \ 164 drivers/auth/crypto_mod.c \ 165 drivers/auth/img_parser_mod.c \ 166 drivers/auth/tbbr/tbbr_cot.c 167 168BL2_SOURCES += ${AUTH_SOURCES} 169 170# Use ATF framework for MBEDTLS 171TRUSTED_BOARD_BOOT := 1 172CRYPTO_LIB_MK := drivers/auth/mbedtls/mbedtls_crypto.mk 173IMG_PARSER_LIB_MK := drivers/auth/mbedtls/mbedtls_x509.mk 174$(info Including ${CRYPTO_LIB_MK}) 175include ${CRYPTO_LIB_MK} 176$(info Including ${IMG_PARSER_LIB_MK}) 177include ${IMG_PARSER_LIB_MK} 178 179# Use ATF secure boot functions 180# Use Hardcoded hash for devel 181 182ARM_ROTPK_LOCATION=arm_rsa 183ifeq (${ARM_ROTPK_LOCATION}, arm_rsa) 184ARM_ROTPK_LOCATION_ID=ARM_ROTPK_DEVEL_RSA_ID 185ROT_KEY=plat/arm/board/common/rotpk/arm_rotprivk_rsa.pem 186else ifeq (${ARM_ROTPK_LOCATION}, brcm_rsa) 187ARM_ROTPK_LOCATION_ID=BRCM_ROTPK_SOTP_RSA_ID 188ifeq (${ROT_KEY},) 189ROT_KEY=plat/brcm/board/common/rotpk/rsa_dauth2048_key.pem 190endif 191KEY_FIND := $(shell m="${ROT_KEY}"; [ -f "$$m" ] && echo "$$m") 192ifeq (${KEY_FIND},) 193$(error Error: No ${ROT_KEY} located) 194else 195$(info Using ROT_KEY: ${ROT_KEY}) 196endif 197else 198$(error "Unsupported ARM_ROTPK_LOCATION value") 199endif 200 201$(eval $(call add_define,ARM_ROTPK_LOCATION_ID)) 202PLAT_BL_COMMON_SOURCES+=plat/brcm/board/common/board_arm_trusted_boot.c 203endif 204 205#M0 runtime firmware 206ifdef SCP_BL2 207$(eval $(call add_define,NEED_SCP_BL2)) 208SCP_CFG_DIR=$(dir ${SCP_BL2}) 209PLAT_INCLUDES += -I${SCP_CFG_DIR} 210endif 211 212ifneq (${NEED_BL33},yes) 213# If there is no BL33, BL31 will jump to this address. 214ifeq (${USE_DDR},yes) 215PRELOADED_BL33_BASE := 0x80000000 216else 217PRELOADED_BL33_BASE := 0x74000000 218endif 219endif 220 221# Use translation tables library v1 by default 222ARM_XLAT_TABLES_LIB_V1 := 1 223ifeq (${ARM_XLAT_TABLES_LIB_V1}, 1) 224$(eval $(call assert_boolean,ARM_XLAT_TABLES_LIB_V1)) 225$(eval $(call add_define,ARM_XLAT_TABLES_LIB_V1)) 226PLAT_BL_COMMON_SOURCES += lib/xlat_tables/aarch64/xlat_tables.c \ 227 lib/xlat_tables/xlat_tables_common.c 228endif 229