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