Sheetal Tigadoli | 13680c9 | 2019-12-13 10:39:06 +0530 | [diff] [blame] | 1 | # |
Bharat Gooty | 66b0bb4 | 2020-09-24 12:29:00 +0530 | [diff] [blame] | 2 | # Copyright (c) 2015 - 2021, Broadcom |
Sheetal Tigadoli | 13680c9 | 2019-12-13 10:39:06 +0530 | [diff] [blame] | 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 | |
Bharat Gooty | 66b0bb4 | 2020-09-24 12:29:00 +0530 | [diff] [blame] | 39 | ifeq (${DRIVER_I2C_ENABLE},) |
| 40 | DRIVER_I2C_ENABLE := 0 |
| 41 | endif |
| 42 | |
Sheetal Tigadoli | ad0943e | 2019-12-18 19:44:43 +0530 | [diff] [blame] | 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 | |
Sheetal Tigadoli | 2a96dc2 | 2019-12-18 12:01:01 +0530 | [diff] [blame] | 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 | |
Sheetal Tigadoli | 13680c9 | 2019-12-13 10:39:06 +0530 | [diff] [blame] | 61 | ifeq (${STANDALONE_BL2},yes) |
Sheetal Tigadoli | ad0943e | 2019-12-18 19:44:43 +0530 | [diff] [blame] | 62 | BL2_LOG_LEVEL := 40 |
Sheetal Tigadoli | 13680c9 | 2019-12-13 10:39:06 +0530 | [diff] [blame] | 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 | |
Sheetal Tigadoli | ad0943e | 2019-12-18 19:44:43 +0530 | [diff] [blame] | 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 | |
Sheetal Tigadoli | 58a9eca | 2019-12-18 20:05:09 +0530 | [diff] [blame] | 95 | ifneq (${BL31_LOG_LEVEL},) |
| 96 | $(eval $(call add_define,BL31_LOG_LEVEL)) |
| 97 | endif |
| 98 | |
Sheetal Tigadoli | 13680c9 | 2019-12-13 10:39:06 +0530 | [diff] [blame] | 99 | # Use CRMU SRAM from iHOST |
| 100 | ifneq (${USE_CRMU_SRAM},) |
| 101 | $(eval $(call add_define,USE_CRMU_SRAM)) |
| 102 | endif |
| 103 | |
Sheetal Tigadoli | b015670 | 2020-01-05 14:59:04 +0530 | [diff] [blame] | 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 | |
Sheetal Tigadoli | 13680c9 | 2019-12-13 10:39:06 +0530 | [diff] [blame] | 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 | |
Sheetal Tigadoli | 2a96dc2 | 2019-12-18 12:01:01 +0530 | [diff] [blame] | 119 | PLAT_INCLUDES += -Iplat/brcm/board/common \ |
Sheetal Tigadoli | b015670 | 2020-01-05 14:59:04 +0530 | [diff] [blame] | 120 | -Iinclude/drivers/brcm \ |
Bharat Gooty | d9ff1ca | 2020-09-24 13:02:39 +0530 | [diff] [blame] | 121 | -Iinclude/drivers/brcm/emmc \ |
| 122 | -Iinclude/drivers/brcm/mdio |
Sheetal Tigadoli | 13680c9 | 2019-12-13 10:39:06 +0530 | [diff] [blame] | 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 \ |
Sheetal Tigadoli | ad0943e | 2019-12-18 19:44:43 +0530 | [diff] [blame] | 127 | plat/brcm/board/common/brcm_mbedtls.c \ |
Sheetal Tigadoli | 13680c9 | 2019-12-13 10:39:06 +0530 | [diff] [blame] | 128 | plat/brcm/board/common/plat_setup.c \ |
| 129 | plat/brcm/board/common/platform_common.c \ |
| 130 | drivers/arm/sp804/sp804_delay_timer.c \ |
Sheetal Tigadoli | ad0943e | 2019-12-18 19:44:43 +0530 | [diff] [blame] | 131 | drivers/brcm/sotp.c \ |
Sheetal Tigadoli | 13680c9 | 2019-12-13 10:39:06 +0530 | [diff] [blame] | 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 \ |
Sheetal Tigadoli | ad0943e | 2019-12-18 19:44:43 +0530 | [diff] [blame] | 138 | plat/brcm/board/common/sbl_util.c \ |
Sheetal Tigadoli | 13680c9 | 2019-12-13 10:39:06 +0530 | [diff] [blame] | 139 | drivers/arm/sp805/sp805.c |
| 140 | |
Bharat Gooty | 23763b5 | 2020-07-13 17:58:29 +0530 | [diff] [blame] | 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 | |
Sheetal Tigadoli | b015670 | 2020-01-05 14:59:04 +0530 | [diff] [blame] | 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 | |
Sheetal Tigadoli | 13680c9 | 2019-12-13 10:39:06 +0530 | [diff] [blame] | 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 | |
Sheetal Tigadoli | 2a96dc2 | 2019-12-18 12:01:01 +0530 | [diff] [blame] | 169 | BL31_SOURCES += plat/brcm/common/brcm_bl31_setup.c |
| 170 | |
Sheetal Tigadoli | ad0943e | 2019-12-18 19:44:43 +0530 | [diff] [blame] | 171 | ifeq (${BCM_ELOG},yes) |
| 172 | ELOG_SOURCES += plat/brcm/board/common/bcm_elog.c |
| 173 | BL2_SOURCES += ${ELOG_SOURCES} |
Sheetal Tigadoli | 58a9eca | 2019-12-18 20:05:09 +0530 | [diff] [blame] | 174 | BL31_SOURCES += ${ELOG_SOURCES} |
Sheetal Tigadoli | ad0943e | 2019-12-18 19:44:43 +0530 | [diff] [blame] | 175 | endif |
| 176 | |
Sheetal Tigadoli | 3bb1b4c | 2020-01-05 21:19:02 +0530 | [diff] [blame] | 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 | |
Sheetal Tigadoli | 6c4db5d | 2020-01-06 00:08:24 +0530 | [diff] [blame] | 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 | |
Bharat Gooty | 66b0bb4 | 2020-09-24 12:29:00 +0530 | [diff] [blame] | 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 | |
Sheetal Tigadoli | ad0943e | 2019-12-18 19:44:43 +0530 | [diff] [blame] | 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 |
Manish V Badarkhe | 1728204 | 2022-03-09 21:49:59 +0000 | [diff] [blame] | 217 | MBEDTLS_DIR ?= mbedtls |
| 218 | MBEDTLS_CHECK := $(shell find ${MBEDTLS_DIR}/include -name '$(notdir ${MBEDTLS_DIR})') |
Sheetal Tigadoli | ad0943e | 2019-12-18 19:44:43 +0530 | [diff] [blame] | 219 | |
| 220 | ifneq (${MBEDTLS_CHECK},) |
| 221 | $(info Found mbedTLS at ${MBEDTLS_DIR}) |
| 222 | PLAT_INCLUDES += -I${MBEDTLS_DIR}/include/mbedtls |
Sheetal Tigadoli | ad0943e | 2019-12-18 19:44:43 +0530 | [diff] [blame] | 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 \ |
Manish V Badarkhe | 043fd62 | 2020-05-16 16:36:39 +0100 | [diff] [blame] | 231 | drivers/auth/tbbr/tbbr_cot_common.c \ |
| 232 | drivers/auth/tbbr/tbbr_cot_bl2.c |
Sheetal Tigadoli | ad0943e | 2019-12-18 19:44:43 +0530 | [diff] [blame] | 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 | |
Sheetal Tigadoli | 2a96dc2 | 2019-12-18 12:01:01 +0530 | [diff] [blame] | 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 | |
Sheetal Tigadoli | 13680c9 | 2019-12-13 10:39:06 +0530 | [diff] [blame] | 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 |