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