Sheetal Tigadoli | 13680c9 | 2019-12-13 10:39:06 +0530 | [diff] [blame] | 1 | # |
| 2 | # Copyright (c) 2015 - 2020, 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 | |
Sheetal Tigadoli | ad0943e | 2019-12-18 19:44:43 +0530 | [diff] [blame] | 31 | # By default, Trusted Watchdog is always enabled unless SPIN_ON_BL1_EXIT is set |
| 32 | ifeq (${BRCM_DISABLE_TRUSTED_WDOG},) |
| 33 | BRCM_DISABLE_TRUSTED_WDOG := 0 |
| 34 | endif |
| 35 | ifeq (${SPIN_ON_BL1_EXIT}, 1) |
| 36 | BRCM_DISABLE_TRUSTED_WDOG := 1 |
| 37 | endif |
| 38 | |
| 39 | $(eval $(call assert_boolean,BRCM_DISABLE_TRUSTED_WDOG)) |
| 40 | $(eval $(call add_define,BRCM_DISABLE_TRUSTED_WDOG)) |
| 41 | |
Sheetal Tigadoli | 2a96dc2 | 2019-12-18 12:01:01 +0530 | [diff] [blame] | 42 | # Process ARM_BL31_IN_DRAM flag |
| 43 | ifeq (${ARM_BL31_IN_DRAM},) |
| 44 | ARM_BL31_IN_DRAM := 0 |
| 45 | endif |
| 46 | $(eval $(call assert_boolean,ARM_BL31_IN_DRAM)) |
| 47 | $(eval $(call add_define,ARM_BL31_IN_DRAM)) |
| 48 | |
Sheetal Tigadoli | 13680c9 | 2019-12-13 10:39:06 +0530 | [diff] [blame] | 49 | ifeq (${STANDALONE_BL2},yes) |
Sheetal Tigadoli | ad0943e | 2019-12-18 19:44:43 +0530 | [diff] [blame] | 50 | BL2_LOG_LEVEL := 40 |
Sheetal Tigadoli | 13680c9 | 2019-12-13 10:39:06 +0530 | [diff] [blame] | 51 | $(eval $(call add_define,MMU_DISABLED)) |
| 52 | endif |
| 53 | |
| 54 | # BL2 XIP from QSPI |
| 55 | RUN_BL2_FROM_QSPI := 0 |
| 56 | ifeq (${RUN_BL2_FROM_QSPI},1) |
| 57 | $(eval $(call add_define,RUN_BL2_FROM_QSPI)) |
| 58 | endif |
| 59 | |
Sheetal Tigadoli | ad0943e | 2019-12-18 19:44:43 +0530 | [diff] [blame] | 60 | # BL2 XIP from NAND |
| 61 | RUN_BL2_FROM_NAND := 0 |
| 62 | ifeq (${RUN_BL2_FROM_NAND},1) |
| 63 | $(eval $(call add_define,RUN_BL2_FROM_NAND)) |
| 64 | endif |
| 65 | |
| 66 | ifneq (${ELOG_AP_UART_LOG_BASE},) |
| 67 | $(eval $(call add_define,ELOG_AP_UART_LOG_BASE)) |
| 68 | endif |
| 69 | |
| 70 | ifeq (${ELOG_SUPPORT},1) |
| 71 | ifeq (${ELOG_STORE_MEDIA},DDR) |
| 72 | $(eval $(call add_define,ELOG_STORE_MEDIA_DDR)) |
| 73 | ifneq (${ELOG_STORE_OFFSET},) |
| 74 | $(eval $(call add_define,ELOG_STORE_OFFSET)) |
| 75 | endif |
| 76 | endif |
| 77 | endif |
| 78 | |
| 79 | ifneq (${BL2_LOG_LEVEL},) |
| 80 | $(eval $(call add_define,BL2_LOG_LEVEL)) |
| 81 | endif |
| 82 | |
Sheetal Tigadoli | 58a9eca | 2019-12-18 20:05:09 +0530 | [diff] [blame^] | 83 | ifneq (${BL31_LOG_LEVEL},) |
| 84 | $(eval $(call add_define,BL31_LOG_LEVEL)) |
| 85 | endif |
| 86 | |
Sheetal Tigadoli | 13680c9 | 2019-12-13 10:39:06 +0530 | [diff] [blame] | 87 | # Use CRMU SRAM from iHOST |
| 88 | ifneq (${USE_CRMU_SRAM},) |
| 89 | $(eval $(call add_define,USE_CRMU_SRAM)) |
| 90 | endif |
| 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. |
| 94 | SEPARATE_CODE_AND_RODATA := 1 |
| 95 | |
| 96 | # Use generic OID definition (tbbr_oid.h) |
| 97 | USE_TBBR_DEFS := 1 |
| 98 | |
Sheetal Tigadoli | 2a96dc2 | 2019-12-18 12:01:01 +0530 | [diff] [blame] | 99 | PLAT_INCLUDES += -Iplat/brcm/board/common \ |
| 100 | -Iinclude/drivers/brcm |
Sheetal Tigadoli | 13680c9 | 2019-12-13 10:39:06 +0530 | [diff] [blame] | 101 | |
| 102 | PLAT_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 Tigadoli | ad0943e | 2019-12-18 19:44:43 +0530 | [diff] [blame] | 105 | plat/brcm/board/common/brcm_mbedtls.c \ |
Sheetal Tigadoli | 13680c9 | 2019-12-13 10:39:06 +0530 | [diff] [blame] | 106 | plat/brcm/board/common/plat_setup.c \ |
| 107 | plat/brcm/board/common/platform_common.c \ |
| 108 | drivers/arm/sp804/sp804_delay_timer.c \ |
Sheetal Tigadoli | ad0943e | 2019-12-18 19:44:43 +0530 | [diff] [blame] | 109 | drivers/brcm/sotp.c \ |
Sheetal Tigadoli | 13680c9 | 2019-12-13 10:39:06 +0530 | [diff] [blame] | 110 | 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 Tigadoli | ad0943e | 2019-12-18 19:44:43 +0530 | [diff] [blame] | 116 | plat/brcm/board/common/sbl_util.c \ |
Sheetal Tigadoli | 13680c9 | 2019-12-13 10:39:06 +0530 | [diff] [blame] | 117 | drivers/arm/sp805/sp805.c |
| 118 | |
| 119 | BL2_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 | |
| 123 | BL2_SOURCES += plat/brcm/common/brcm_bl2_setup.c |
| 124 | |
Sheetal Tigadoli | 2a96dc2 | 2019-12-18 12:01:01 +0530 | [diff] [blame] | 125 | BL31_SOURCES += plat/brcm/common/brcm_bl31_setup.c |
| 126 | |
Sheetal Tigadoli | ad0943e | 2019-12-18 19:44:43 +0530 | [diff] [blame] | 127 | ifeq (${BCM_ELOG},yes) |
| 128 | ELOG_SOURCES += plat/brcm/board/common/bcm_elog.c |
| 129 | BL2_SOURCES += ${ELOG_SOURCES} |
Sheetal Tigadoli | 58a9eca | 2019-12-18 20:05:09 +0530 | [diff] [blame^] | 130 | BL31_SOURCES += ${ELOG_SOURCES} |
Sheetal Tigadoli | ad0943e | 2019-12-18 19:44:43 +0530 | [diff] [blame] | 131 | endif |
| 132 | |
| 133 | ifeq (${DRIVER_OCOTP_ENABLE},1) |
| 134 | $(eval $(call add_define,DRIVER_OCOTP_ENABLE)) |
| 135 | BL2_SOURCES += drivers/brcm/ocotp.c |
| 136 | endif |
| 137 | |
| 138 | # Enable FRU table support |
| 139 | ifeq (${USE_FRU},yes) |
| 140 | $(eval $(call add_define,USE_FRU)) |
| 141 | BL2_SOURCES += drivers/brcm/fru.c |
| 142 | endif |
| 143 | |
| 144 | # Enable GPIO support |
| 145 | ifeq (${USE_GPIO},yes) |
| 146 | $(eval $(call add_define,USE_GPIO)) |
| 147 | BL2_SOURCES += drivers/gpio/gpio.c |
| 148 | BL2_SOURCES += drivers/brcm/iproc_gpio.c |
| 149 | ifeq (${GPIO_SUPPORT_FLOAT_DETECTION},yes) |
| 150 | $(eval $(call add_define,GPIO_SUPPORT_FLOAT_DETECTION)) |
| 151 | endif |
| 152 | endif |
| 153 | |
| 154 | # Include mbedtls if it can be located |
| 155 | MBEDTLS_DIR := mbedtls |
| 156 | MBEDTLS_CHECK := $(shell find ${MBEDTLS_DIR}/include -name '${MBEDTLS_DIR}') |
| 157 | |
| 158 | ifneq (${MBEDTLS_CHECK},) |
| 159 | $(info Found mbedTLS at ${MBEDTLS_DIR}) |
| 160 | PLAT_INCLUDES += -I${MBEDTLS_DIR}/include/mbedtls |
| 161 | # Specify mbedTLS configuration file |
| 162 | MBEDTLS_CONFIG_FILE := "<brcm_mbedtls_config.h>" |
| 163 | |
| 164 | # By default, use RSA keys |
| 165 | KEY_ALG := rsa_1_5 |
| 166 | |
| 167 | # Include common TBB sources |
| 168 | AUTH_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 | |
| 173 | BL2_SOURCES += ${AUTH_SOURCES} |
| 174 | |
| 175 | # Use ATF framework for MBEDTLS |
| 176 | TRUSTED_BOARD_BOOT := 1 |
| 177 | CRYPTO_LIB_MK := drivers/auth/mbedtls/mbedtls_crypto.mk |
| 178 | IMG_PARSER_LIB_MK := drivers/auth/mbedtls/mbedtls_x509.mk |
| 179 | $(info Including ${CRYPTO_LIB_MK}) |
| 180 | include ${CRYPTO_LIB_MK} |
| 181 | $(info Including ${IMG_PARSER_LIB_MK}) |
| 182 | include ${IMG_PARSER_LIB_MK} |
| 183 | |
| 184 | # Use ATF secure boot functions |
| 185 | # Use Hardcoded hash for devel |
| 186 | |
| 187 | ARM_ROTPK_LOCATION=arm_rsa |
| 188 | ifeq (${ARM_ROTPK_LOCATION}, arm_rsa) |
| 189 | ARM_ROTPK_LOCATION_ID=ARM_ROTPK_DEVEL_RSA_ID |
| 190 | ROT_KEY=plat/arm/board/common/rotpk/arm_rotprivk_rsa.pem |
| 191 | else ifeq (${ARM_ROTPK_LOCATION}, brcm_rsa) |
| 192 | ARM_ROTPK_LOCATION_ID=BRCM_ROTPK_SOTP_RSA_ID |
| 193 | ifeq (${ROT_KEY},) |
| 194 | ROT_KEY=plat/brcm/board/common/rotpk/rsa_dauth2048_key.pem |
| 195 | endif |
| 196 | KEY_FIND := $(shell m="${ROT_KEY}"; [ -f "$$m" ] && echo "$$m") |
| 197 | ifeq (${KEY_FIND},) |
| 198 | $(error Error: No ${ROT_KEY} located) |
| 199 | else |
| 200 | $(info Using ROT_KEY: ${ROT_KEY}) |
| 201 | endif |
| 202 | else |
| 203 | $(error "Unsupported ARM_ROTPK_LOCATION value") |
| 204 | endif |
| 205 | |
| 206 | $(eval $(call add_define,ARM_ROTPK_LOCATION_ID)) |
| 207 | PLAT_BL_COMMON_SOURCES+=plat/brcm/board/common/board_arm_trusted_boot.c |
| 208 | endif |
| 209 | |
Sheetal Tigadoli | 2a96dc2 | 2019-12-18 12:01:01 +0530 | [diff] [blame] | 210 | #M0 runtime firmware |
| 211 | ifdef SCP_BL2 |
| 212 | $(eval $(call add_define,NEED_SCP_BL2)) |
| 213 | SCP_CFG_DIR=$(dir ${SCP_BL2}) |
| 214 | PLAT_INCLUDES += -I${SCP_CFG_DIR} |
| 215 | endif |
| 216 | |
| 217 | ifneq (${NEED_BL33},yes) |
| 218 | # If there is no BL33, BL31 will jump to this address. |
| 219 | ifeq (${USE_DDR},yes) |
| 220 | PRELOADED_BL33_BASE := 0x80000000 |
| 221 | else |
| 222 | PRELOADED_BL33_BASE := 0x74000000 |
| 223 | endif |
| 224 | endif |
| 225 | |
Sheetal Tigadoli | 13680c9 | 2019-12-13 10:39:06 +0530 | [diff] [blame] | 226 | # Use translation tables library v1 by default |
| 227 | ARM_XLAT_TABLES_LIB_V1 := 1 |
| 228 | ifeq (${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)) |
| 231 | PLAT_BL_COMMON_SOURCES += lib/xlat_tables/aarch64/xlat_tables.c \ |
| 232 | lib/xlat_tables/xlat_tables_common.c |
| 233 | endif |