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