2019-11-11 11:11:06 +00:00
|
|
|
#
|
2020-10-15 19:40:04 +01:00
|
|
|
# Copyright (c) 2021, Arm Limited. All rights reserved.
|
2019-11-11 11:11:06 +00:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
#
|
|
|
|
|
2021-09-28 15:52:14 +01:00
|
|
|
include common/fdt_wrappers.mk
|
2020-01-24 15:02:27 +00:00
|
|
|
include lib/libfdt/libfdt.mk
|
|
|
|
|
2019-11-11 11:11:06 +00:00
|
|
|
RESET_TO_BL31 := 1
|
|
|
|
ifeq (${RESET_TO_BL31}, 0)
|
|
|
|
$(error "This is a BL31-only port; RESET_TO_BL31 must be enabled")
|
|
|
|
endif
|
|
|
|
|
2019-12-16 14:08:27 +00:00
|
|
|
ifeq (${ENABLE_PIE}, 1)
|
|
|
|
override SEPARATE_CODE_AND_RODATA := 1
|
|
|
|
endif
|
|
|
|
|
2019-11-11 11:11:06 +00:00
|
|
|
CTX_INCLUDE_AARCH32_REGS := 0
|
|
|
|
ifeq (${CTX_INCLUDE_AARCH32_REGS}, 1)
|
|
|
|
$(error "This is an AArch64-only port; CTX_INCLUDE_AARCH32_REGS must be disabled")
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq (${TRUSTED_BOARD_BOOT}, 1)
|
|
|
|
$(error "TRUSTED_BOARD_BOOT must be disabled")
|
|
|
|
endif
|
|
|
|
|
2020-07-08 13:01:00 +01:00
|
|
|
PRELOADED_BL33_BASE := 0x80080000
|
2019-11-11 11:11:06 +00:00
|
|
|
|
2020-07-08 13:01:00 +01:00
|
|
|
FPGA_PRELOADED_DTB_BASE := 0x80070000
|
2019-11-11 11:11:06 +00:00
|
|
|
$(eval $(call add_define,FPGA_PRELOADED_DTB_BASE))
|
|
|
|
|
2020-07-07 10:40:46 +01:00
|
|
|
FPGA_PRELOADED_CMD_LINE := 0x1000
|
|
|
|
$(eval $(call add_define,FPGA_PRELOADED_CMD_LINE))
|
|
|
|
|
2021-08-17 08:50:53 +01:00
|
|
|
ENABLE_AMU := 1
|
|
|
|
|
2019-11-11 11:11:06 +00:00
|
|
|
# Treating this as a memory-constrained port for now
|
|
|
|
USE_COHERENT_MEM := 0
|
|
|
|
|
2020-01-15 10:20:09 +00:00
|
|
|
# This can be overridden depending on CPU(s) used in the FPGA image
|
2019-11-11 11:11:06 +00:00
|
|
|
HW_ASSISTED_COHERENCY := 1
|
|
|
|
|
2020-04-09 10:10:09 +01:00
|
|
|
PL011_GENERIC_UART := 1
|
|
|
|
|
2020-08-20 18:48:09 +01:00
|
|
|
SUPPORT_UNKNOWN_MPID ?= 1
|
|
|
|
|
2020-01-15 10:20:09 +00:00
|
|
|
FPGA_CPU_LIBS := lib/cpus/${ARCH}/aem_generic.S
|
|
|
|
|
|
|
|
# select a different set of CPU files, depending on whether we compile for
|
|
|
|
# hardware assisted coherency cores or not
|
|
|
|
ifeq (${HW_ASSISTED_COHERENCY}, 0)
|
|
|
|
# Cores used without DSU
|
|
|
|
FPGA_CPU_LIBS += lib/cpus/aarch64/cortex_a35.S \
|
|
|
|
lib/cpus/aarch64/cortex_a53.S \
|
|
|
|
lib/cpus/aarch64/cortex_a57.S \
|
|
|
|
lib/cpus/aarch64/cortex_a72.S \
|
|
|
|
lib/cpus/aarch64/cortex_a73.S
|
|
|
|
else
|
|
|
|
# AArch64-only cores
|
|
|
|
FPGA_CPU_LIBS += lib/cpus/aarch64/cortex_a76.S \
|
|
|
|
lib/cpus/aarch64/cortex_a76ae.S \
|
|
|
|
lib/cpus/aarch64/cortex_a77.S \
|
2020-06-01 22:49:34 +01:00
|
|
|
lib/cpus/aarch64/cortex_a78.S \
|
2020-10-23 13:22:07 +01:00
|
|
|
lib/cpus/aarch64/neoverse_n_common.S \
|
2020-01-15 10:20:09 +00:00
|
|
|
lib/cpus/aarch64/neoverse_n1.S \
|
2020-10-23 13:22:07 +01:00
|
|
|
lib/cpus/aarch64/neoverse_n2.S \
|
2020-01-15 10:20:09 +00:00
|
|
|
lib/cpus/aarch64/neoverse_e1.S \
|
2020-09-30 21:28:03 +01:00
|
|
|
lib/cpus/aarch64/neoverse_v1.S \
|
2020-09-30 21:34:51 +01:00
|
|
|
lib/cpus/aarch64/cortex_a78_ae.S \
|
2020-01-15 10:20:09 +00:00
|
|
|
lib/cpus/aarch64/cortex_a65.S \
|
2020-06-25 13:10:38 +01:00
|
|
|
lib/cpus/aarch64/cortex_a65ae.S \
|
2021-05-18 21:23:31 +01:00
|
|
|
lib/cpus/aarch64/cortex_a510.S \
|
|
|
|
lib/cpus/aarch64/cortex_a710.S \
|
2021-03-15 20:07:21 +00:00
|
|
|
lib/cpus/aarch64/cortex_makalu.S \
|
2021-04-20 23:05:04 +01:00
|
|
|
lib/cpus/aarch64/cortex_makalu_elp_arm.S \
|
2021-03-16 20:20:58 +00:00
|
|
|
lib/cpus/aarch64/cortex_a78c.S
|
2020-06-25 13:10:38 +01:00
|
|
|
|
2020-01-15 10:20:09 +00:00
|
|
|
# AArch64/AArch32 cores
|
|
|
|
FPGA_CPU_LIBS += lib/cpus/aarch64/cortex_a55.S \
|
|
|
|
lib/cpus/aarch64/cortex_a75.S
|
|
|
|
endif
|
2019-11-11 11:11:06 +00:00
|
|
|
|
2020-08-20 18:48:09 +01:00
|
|
|
ifeq (${SUPPORT_UNKNOWN_MPID}, 1)
|
|
|
|
# Add support for unknown/invalid MPIDs (aarch64 only)
|
|
|
|
$(eval $(call add_define,SUPPORT_UNKNOWN_MPID))
|
|
|
|
FPGA_CPU_LIBS += lib/cpus/aarch64/generic.S
|
|
|
|
endif
|
|
|
|
|
2020-03-25 15:50:38 +00:00
|
|
|
# Allow detection of GIC-600
|
|
|
|
GICV3_SUPPORT_GIC600 := 1
|
2020-04-03 18:59:20 +01:00
|
|
|
|
2021-05-18 15:53:05 +01:00
|
|
|
GIC_ENABLE_V4_EXTN := 1
|
|
|
|
|
2020-04-03 18:59:20 +01:00
|
|
|
# Include GICv3 driver files
|
|
|
|
include drivers/arm/gic/v3/gicv3.mk
|
|
|
|
|
|
|
|
FPGA_GIC_SOURCES := ${GICV3_SOURCES} \
|
2019-12-03 14:08:21 +00:00
|
|
|
plat/common/plat_gicv3.c \
|
|
|
|
plat/arm/board/arm_fpga/fpga_gicv3.c
|
2019-11-11 11:11:06 +00:00
|
|
|
|
arm_fpga: Add devicetree file
The FPGA images used in Arm Ltd. focus on CPU cores, so they share a
common platform, with a minimal set of peripherals (interconnect, GIC,
UART).
This allows to support most platforms with a single devicetree file.
The topology and number of CPU cores differ, but those will added at
runtime, in BL31. Other adjustments (GICR size, SPE node, command line)
are also done at this point.
Add the common devicetree file to TF-A's build system, so it can be
build together with BL31. At runtime, the resulting .dtb file should be
uploaded to the address given with FPGA_PRELOADED_DTB_BASE at build time.
Change-Id: I3206d6131059502ec96896e95329865452c9d83e
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2020-08-03 12:54:58 +01:00
|
|
|
FDT_SOURCES := fdts/arm_fpga.dts
|
|
|
|
|
2019-11-11 11:11:06 +00:00
|
|
|
PLAT_INCLUDES := -Iplat/arm/board/arm_fpga/include
|
|
|
|
|
|
|
|
PLAT_BL_COMMON_SOURCES := plat/arm/board/arm_fpga/${ARCH}/fpga_helpers.S
|
|
|
|
|
2021-09-28 15:52:14 +01:00
|
|
|
BL31_SOURCES += common/fdt_fixup.c \
|
2020-01-24 15:02:27 +00:00
|
|
|
drivers/delay_timer/delay_timer.c \
|
2019-11-11 11:11:06 +00:00
|
|
|
drivers/delay_timer/generic_delay_timer.c \
|
|
|
|
drivers/arm/pl011/${ARCH}/pl011_console.S \
|
|
|
|
plat/common/plat_psci_common.c \
|
|
|
|
plat/arm/board/arm_fpga/fpga_pm.c \
|
|
|
|
plat/arm/board/arm_fpga/fpga_topology.c \
|
|
|
|
plat/arm/board/arm_fpga/fpga_console.c \
|
|
|
|
plat/arm/board/arm_fpga/fpga_bl31_setup.c \
|
|
|
|
${FPGA_CPU_LIBS} \
|
|
|
|
${FPGA_GIC_SOURCES}
|
|
|
|
|
2021-09-28 15:52:14 +01:00
|
|
|
BL31_SOURCES += ${FDT_WRAPPERS_SOURCES}
|
|
|
|
|
2021-10-07 14:19:12 +01:00
|
|
|
$(eval $(call MAKE_S,$(BUILD_PLAT),plat/arm/board/arm_fpga/rom_trampoline.S,bl31))
|
|
|
|
$(eval $(call MAKE_S,$(BUILD_PLAT),plat/arm/board/arm_fpga/kernel_trampoline.S,bl31))
|
|
|
|
$(eval $(call MAKE_LD,$(BUILD_PLAT)/build_axf.ld,plat/arm/board/arm_fpga/build_axf.ld.S,bl31))
|
2020-08-03 13:06:38 +01:00
|
|
|
|
feat(arm_fpga): add kernel trampoline
The arm64 Linux kernel needed to be loaded at a certain offset within any
2MB aligned region; this value was configured at compile time and stored
in the Linux kernel image header. The default value was always 512KiB,
so this is the value we use in the TF-A build system for the kernel
load address.
However the whole scheme around the TEXT_OFFSET changed in Linux v5.8:
Linux kernels became fully relocatable, so this value is largely ignored
now, and its default value changed to 0. The only remainder is a warning
message at boot time in case there is a mismatch:
[Firmware Bug]: Kernel image misaligned at boot, please fix your bootloader!
To avoid this warning, and to make TF-A Linux kernel boot protocol
compliant, we should load newer kernels to offset 0 of a 2 MB
region. This can be done by the user at FPGA boot time, but BL31 needs
to know about this address. As we can't change the build default to 0
without breaking older kernels, we should try to make a build dealing
with both versions:
This patch introduces a small trampoline code, which gets loaded at
512KB of DRAM, and branches up to 2MB. If users load their newer
kernels at 2MB, this trampoline will cover them. In case an older kernel
is loaded at 512KB, it will overwrite this trampoline code, so it would
still work.
Change-Id: If49ca86f5dca380036caf2555349748722901277
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2021-05-14 16:13:28 +01:00
|
|
|
bl31.axf: bl31 dtbs ${BUILD_PLAT}/rom_trampoline.o ${BUILD_PLAT}/kernel_trampoline.o ${BUILD_PLAT}/build_axf.ld
|
arm_fpga: Add post-build linker script
For the Arm Ltd. FPGAs to run, we need to load several payloads into the
FPGA's memory:
- Some trampoline code at address 0x0, to jump to BL31's entry point.
- The actual BL31 binary at the beginning of DRAM.
- The (generic) DTB image to describe the hardware.
- The actual non-secure payloads (kernel, ramdisks, ...)
The latter is application specific, but the first three blobs are rather
generic.
Since the uploader tool supports ELF binaries, it seems helpful to
combine these three images into one .axf file, as this also simplifies
the command line.
Add a post-build linker script, that combines those three bits into one
ELF file, together with their specific load addresses.
Include a call to "ld" with this linker script in the platform Makefile,
so it will be build automatically. The result will be called "bl31.axf".
Change-Id: I4a90da16fa1e0e83b51d19e5b1daf61f5a0bbfca
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2020-09-16 17:13:33 +01:00
|
|
|
$(ECHO) " LD $@"
|
2021-08-20 16:23:23 +01:00
|
|
|
$(Q)$(LD) -T ${BUILD_PLAT}/build_axf.ld -L ${BUILD_PLAT} --strip-debug -s -n -o ${BUILD_PLAT}/bl31.axf
|
arm_fpga: Add post-build linker script
For the Arm Ltd. FPGAs to run, we need to load several payloads into the
FPGA's memory:
- Some trampoline code at address 0x0, to jump to BL31's entry point.
- The actual BL31 binary at the beginning of DRAM.
- The (generic) DTB image to describe the hardware.
- The actual non-secure payloads (kernel, ramdisks, ...)
The latter is application specific, but the first three blobs are rather
generic.
Since the uploader tool supports ELF binaries, it seems helpful to
combine these three images into one .axf file, as this also simplifies
the command line.
Add a post-build linker script, that combines those three bits into one
ELF file, together with their specific load addresses.
Include a call to "ld" with this linker script in the platform Makefile,
so it will be build automatically. The result will be called "bl31.axf".
Change-Id: I4a90da16fa1e0e83b51d19e5b1daf61f5a0bbfca
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2020-09-16 17:13:33 +01:00
|
|
|
|
|
|
|
all: bl31.axf
|