1*f834b64fSMario Bălănică# 2*f834b64fSMario Bălănică# Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved. 3*f834b64fSMario Bălănică# Copyright (c) 2024, Mario Bălănică <mariobalanica02@gmail.com> 4*f834b64fSMario Bălănică# 5*f834b64fSMario Bălănică# SPDX-License-Identifier: BSD-3-Clause 6*f834b64fSMario Bălănică# 7*f834b64fSMario Bălănică 8*f834b64fSMario Bălănicăinclude lib/xlat_tables_v2/xlat_tables.mk 9*f834b64fSMario Bălănică 10*f834b64fSMario Bălănicăinclude drivers/arm/gic/v2/gicv2.mk 11*f834b64fSMario Bălănică 12*f834b64fSMario BălănicăPLAT_INCLUDES := -Iplat/rpi/common/include \ 13*f834b64fSMario Bălănică -Iplat/rpi/rpi5/include 14*f834b64fSMario Bălănică 15*f834b64fSMario BălănicăPLAT_BL_COMMON_SOURCES := drivers/arm/pl011/aarch64/pl011_console.S \ 16*f834b64fSMario Bălănică plat/rpi/common/rpi3_common.c \ 17*f834b64fSMario Bălănică plat/rpi/common/rpi3_console_pl011.c \ 18*f834b64fSMario Bălănică ${XLAT_TABLES_LIB_SRCS} 19*f834b64fSMario Bălănică 20*f834b64fSMario BălănicăBL31_SOURCES += lib/cpus/aarch64/cortex_a76.S \ 21*f834b64fSMario Bălănică plat/rpi/common/aarch64/plat_helpers.S \ 22*f834b64fSMario Bălănică plat/rpi/common/aarch64/armstub8_header.S \ 23*f834b64fSMario Bălănică drivers/delay_timer/delay_timer.c \ 24*f834b64fSMario Bălănică plat/common/plat_gicv2.c \ 25*f834b64fSMario Bălănică plat/rpi/common/rpi4_bl31_setup.c \ 26*f834b64fSMario Bălănică plat/rpi/rpi5/rpi5_setup.c \ 27*f834b64fSMario Bălănică plat/rpi/common/rpi3_pm.c \ 28*f834b64fSMario Bălănică plat/common/plat_psci_common.c \ 29*f834b64fSMario Bălănică plat/rpi/common/rpi3_topology.c \ 30*f834b64fSMario Bălănică ${GICV2_SOURCES} 31*f834b64fSMario Bălănică 32*f834b64fSMario Bălănică# For now we only support BL31, using the kernel loaded by the GPU firmware. 33*f834b64fSMario BălănicăRESET_TO_BL31 := 1 34*f834b64fSMario Bălănică 35*f834b64fSMario Bălănică# All CPUs enter armstub8.bin. 36*f834b64fSMario BălănicăCOLD_BOOT_SINGLE_CPU := 0 37*f834b64fSMario Bălănică 38*f834b64fSMario Bălănică# Tune compiler for Cortex-A76 39*f834b64fSMario Bălănicăifeq ($(notdir $(CC)),armclang) 40*f834b64fSMario Bălănică TF_CFLAGS_aarch64 += -mcpu=cortex-a76 41*f834b64fSMario Bălănicăelse ifneq ($(findstring clang,$(notdir $(CC))),) 42*f834b64fSMario Bălănică TF_CFLAGS_aarch64 += -mcpu=cortex-a76 43*f834b64fSMario Bălănicăelse 44*f834b64fSMario Bălănică TF_CFLAGS_aarch64 += -mtune=cortex-a76 45*f834b64fSMario Bălănicăendif 46*f834b64fSMario Bălănică 47*f834b64fSMario Bălănică# Add support for platform supplied linker script for BL31 build 48*f834b64fSMario Bălănică$(eval $(call add_define,PLAT_EXTRA_LD_SCRIPT)) 49*f834b64fSMario Bălănică 50*f834b64fSMario Bălănică# Enable all errata workarounds for Cortex-A76 r4p1 51*f834b64fSMario BălănicăERRATA_A76_1946160 := 1 52*f834b64fSMario BălănicăERRATA_A76_2743102 := 1 53*f834b64fSMario Bălănică 54*f834b64fSMario Bălănică# Add new default target when compiling this platform 55*f834b64fSMario Bălănicăall: bl31 56*f834b64fSMario Bălănică 57*f834b64fSMario Bălănică# Build config flags 58*f834b64fSMario Bălănică# ------------------ 59*f834b64fSMario Bălănică 60*f834b64fSMario Bălănică# Disable stack protector by default 61*f834b64fSMario BălănicăENABLE_STACK_PROTECTOR := 0 62*f834b64fSMario Bălănică 63*f834b64fSMario Bălănică# Have different sections for code and rodata 64*f834b64fSMario BălănicăSEPARATE_CODE_AND_RODATA := 1 65*f834b64fSMario Bălănică 66*f834b64fSMario Bălănică# Hardware-managed coherency 67*f834b64fSMario BălănicăHW_ASSISTED_COHERENCY := 1 68*f834b64fSMario BălănicăUSE_COHERENT_MEM := 0 69*f834b64fSMario Bălănică 70*f834b64fSMario Bălănică# Cortex-A76 is 64-bit only 71*f834b64fSMario BălănicăCTX_INCLUDE_AARCH32_REGS := 0 72*f834b64fSMario Bălănică 73*f834b64fSMario Bălănică# Platform build flags 74*f834b64fSMario Bălănică# -------------------- 75*f834b64fSMario Bălănică 76*f834b64fSMario Bălănică# There is not much else than a Linux kernel to load at the moment. 77*f834b64fSMario BălănicăRPI3_DIRECT_LINUX_BOOT := 1 78*f834b64fSMario Bălănică 79*f834b64fSMario Bălănică# BL33 images can only be AArch64 on this platform. 80*f834b64fSMario BălănicăRPI3_BL33_IN_AARCH32 := 0 81*f834b64fSMario Bălănică 82*f834b64fSMario Bălănică# UART to use at runtime. -1 means the runtime UART is disabled. 83*f834b64fSMario Bălănică# Any other value means the default UART will be used. 84*f834b64fSMario BălănicăRPI3_RUNTIME_UART := 0 85*f834b64fSMario Bălănică 86*f834b64fSMario Bălănică# Use normal memory mapping for ROM, FIP, SRAM and DRAM 87*f834b64fSMario BălănicăRPI3_USE_UEFI_MAP := 0 88*f834b64fSMario Bălănică 89*f834b64fSMario Bălănică# Process platform flags 90*f834b64fSMario Bălănică# ---------------------- 91*f834b64fSMario Bălănică 92*f834b64fSMario Bălănică$(eval $(call add_define,RPI3_BL33_IN_AARCH32)) 93*f834b64fSMario Bălănică$(eval $(call add_define,RPI3_DIRECT_LINUX_BOOT)) 94*f834b64fSMario Bălănicăifdef RPI3_PRELOADED_DTB_BASE 95*f834b64fSMario Bălănică$(eval $(call add_define,RPI3_PRELOADED_DTB_BASE)) 96*f834b64fSMario Bălănicăendif 97*f834b64fSMario Bălănică$(eval $(call add_define,RPI3_RUNTIME_UART)) 98*f834b64fSMario Bălănică$(eval $(call add_define,RPI3_USE_UEFI_MAP)) 99*f834b64fSMario Bălănică 100*f834b64fSMario Bălănicăifeq (${ARCH},aarch32) 101*f834b64fSMario Bălănică $(error Error: AArch32 not supported on rpi5) 102*f834b64fSMario Bălănicăendif 103*f834b64fSMario Bălănică 104*f834b64fSMario Bălănicăifneq ($(ENABLE_STACK_PROTECTOR), 0) 105*f834b64fSMario BălănicăPLAT_BL_COMMON_SOURCES += drivers/rpi3/rng/rpi3_rng.c \ 106*f834b64fSMario Bălănică plat/rpi/common/rpi3_stack_protector.c 107*f834b64fSMario Bălănicăendif 108