xref: /rk3399_ARM-atf/plat/rpi/rpi4/platform.mk (revision 97ef53052b1a45ae82de696b8f56ae76afd9ba9e)
1#
2# Copyright (c) 2013-2024, Arm Limited and Contributors. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
7include lib/libfdt/libfdt.mk
8include lib/xlat_tables_v2/xlat_tables.mk
9
10include drivers/arm/gic/v2/gicv2.mk
11
12PLAT_INCLUDES		:=	-Iplat/rpi/common/include		\
13				-Iplat/rpi/rpi4/include
14
15PLAT_BL_COMMON_SOURCES	:=	drivers/ti/uart/aarch64/16550_console.S	\
16				drivers/arm/pl011/aarch64/pl011_console.S \
17				plat/rpi/common/rpi3_common.c		\
18				${XLAT_TABLES_LIB_SRCS}
19
20BL31_SOURCES		+=	lib/cpus/aarch64/cortex_a72.S		\
21				plat/rpi/common/aarch64/plat_helpers.S	\
22				plat/rpi/common/aarch64/armstub8_header.S \
23				drivers/delay_timer/delay_timer.c	\
24				drivers/gpio/gpio.c			\
25				drivers/rpi3/gpio/rpi3_gpio.c		\
26				plat/common/plat_gicv2.c                \
27				plat/rpi/common/rpi4_bl31_setup.c	\
28				plat/rpi/rpi4/rpi4_setup.c		\
29				plat/rpi/common/rpi3_pm.c		\
30				plat/common/plat_psci_common.c		\
31				plat/rpi/common/rpi3_topology.c		\
32				common/fdt_fixup.c			\
33				${LIBFDT_SRCS}				\
34				${GICV2_SOURCES}
35
36# For now we only support BL31, using the kernel loaded by the GPU firmware.
37RESET_TO_BL31		:=	1
38
39# All CPUs enter armstub8.bin.
40COLD_BOOT_SINGLE_CPU	:=	0
41
42# Tune compiler for Cortex-A72
43ifeq ($($(ARCH)-cc-id),arm-clang)
44    TF_CFLAGS_aarch64	+=	-mcpu=cortex-a72
45else ifneq ($(filter %-clang,$($(ARCH)-cc-id)),)
46    TF_CFLAGS_aarch64	+=	-mcpu=cortex-a72
47else
48    TF_CFLAGS_aarch64	+=	-mtune=cortex-a72
49endif
50
51# Add support for platform supplied linker script for BL31 build
52$(eval $(call add_define,PLAT_EXTRA_LD_SCRIPT))
53
54# Enable all errata workarounds for Cortex-A72
55ERRATA_A72_859971		:= 1
56
57WORKAROUND_CVE_2017_5715	:= 1
58
59# Add new default target when compiling this platform
60all: bl31
61
62# Build config flags
63# ------------------
64
65# Disable stack protector by default
66ENABLE_STACK_PROTECTOR	 	:= 0
67
68# Have different sections for code and rodata
69SEPARATE_CODE_AND_RODATA	:= 1
70
71# Use Coherent memory
72USE_COHERENT_MEM		:= 1
73
74# Platform build flags
75# --------------------
76
77# There is not much else than a Linux kernel to load at the moment.
78RPI3_DIRECT_LINUX_BOOT		:= 1
79
80# BL33 images are in AArch64 by default
81RPI3_BL33_IN_AARCH32		:= 0
82
83# UART to use at runtime. -1 means the runtime UART is disabled.
84# Any other value means the default UART will be used.
85RPI3_RUNTIME_UART		:= 0
86
87# Use normal memory mapping for ROM, FIP, SRAM and DRAM
88RPI3_USE_UEFI_MAP		:= 0
89
90# SMCCC PCI support (should be enabled for ACPI builds)
91SMC_PCI_SUPPORT            	:= 0
92
93# Process platform flags
94# ----------------------
95
96$(eval $(call add_define,RPI3_BL33_IN_AARCH32))
97$(eval $(call add_define,RPI3_DIRECT_LINUX_BOOT))
98ifdef RPI3_PRELOADED_DTB_BASE
99$(eval $(call add_define,RPI3_PRELOADED_DTB_BASE))
100endif
101$(eval $(call add_define,RPI3_RUNTIME_UART))
102$(eval $(call add_define,RPI3_USE_UEFI_MAP))
103$(eval $(call add_define,SMC_PCI_SUPPORT))
104
105ifeq (${ARCH},aarch32)
106  $(error Error: AArch32 not supported on rpi4)
107endif
108
109ifneq ($(ENABLE_STACK_PROTECTOR), 0)
110PLAT_BL_COMMON_SOURCES	+=	drivers/rpi3/rng/rpi3_rng.c		\
111				plat/rpi/common/rpi3_stack_protector.c
112endif
113
114ifeq ($(SMC_PCI_SUPPORT), 1)
115BL31_SOURCES            +=      plat/rpi/rpi4/rpi4_pci_svc.c
116endif
117