aboutsummaryrefslogtreecommitdiff
path: root/plat
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2021-07-20 20:05:38 +0100
committerAndre Przywara <andre.przywara@arm.com>2021-11-04 15:58:34 +0000
commitd7e39c43f2f58aabb085ed7b8f461f9ece6002d0 (patch)
treee66cd1918e11c8d12212ef15b6ccdceec39d90f5 /plat
parent93b785f5ae66a6418581c304c83a346e8baa5aa3 (diff)
downloadarm-trusted-firmware-d7e39c43f2f58aabb085ed7b8f461f9ece6002d0.tar.gz
feat(arm_fpga): add ITS autodetection
Some FPGAs come with a GIC that has an ITS block configured. Since the ITS sits between the distributor and redistributors, we can autodetect that, and already adjust the GICR base address. To also make this ITS usable, add an ITS node to our base DTB, and remove that should we not find an ITS during the scan for the redistributor. This allows to use the same TF-A binary for FPGA images with or without an ITS. Change-Id: I4c0417dec7bccdbad8cbca26fa2634950fc50a66 Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Diffstat (limited to 'plat')
-rw-r--r--plat/arm/board/arm_fpga/fpga_bl31_setup.c10
-rw-r--r--plat/arm/board/arm_fpga/fpga_gicv3.c5
-rw-r--r--plat/arm/board/arm_fpga/fpga_private.h1
3 files changed, 16 insertions, 0 deletions
diff --git a/plat/arm/board/arm_fpga/fpga_bl31_setup.c b/plat/arm/board/arm_fpga/fpga_bl31_setup.c
index abe68ad2d..31c36151d 100644
--- a/plat/arm/board/arm_fpga/fpga_bl31_setup.c
+++ b/plat/arm/board/arm_fpga/fpga_bl31_setup.c
@@ -242,6 +242,16 @@ static void fpga_prepare_dtb(void)
}
}
+ /* Check whether we have an ITS. Remove the DT node if not. */
+ if (!fpga_has_its()) {
+ int node = fdt_node_offset_by_compatible(fdt, 0,
+ "arm,gic-v3-its");
+
+ if (node >= 0) {
+ fdt_del_node(fdt, node);
+ }
+ }
+
err = fdt_pack(fdt);
if (err < 0) {
ERROR("Failed to pack Device Tree at %p: error %d\n", fdt, err);
diff --git a/plat/arm/board/arm_fpga/fpga_gicv3.c b/plat/arm/board/arm_fpga/fpga_gicv3.c
index c379e7d03..e06a9da56 100644
--- a/plat/arm/board/arm_fpga/fpga_gicv3.c
+++ b/plat/arm/board/arm_fpga/fpga_gicv3.c
@@ -155,3 +155,8 @@ uintptr_t fpga_get_redist_base(void)
{
return fpga_gicv3_driver_data.gicr_base;
}
+
+bool fpga_has_its(void)
+{
+ return nr_itses > 0;
+}
diff --git a/plat/arm/board/arm_fpga/fpga_private.h b/plat/arm/board/arm_fpga/fpga_private.h
index 61c8992cd..84d651cea 100644
--- a/plat/arm/board/arm_fpga/fpga_private.h
+++ b/plat/arm/board/arm_fpga/fpga_private.h
@@ -27,6 +27,7 @@ unsigned int plat_fpga_calc_core_pos(uint32_t mpid);
unsigned int fpga_get_nr_gic_cores(void);
uintptr_t fpga_get_redist_size(void);
uintptr_t fpga_get_redist_base(void);
+bool fpga_has_its(void);
#endif /* __ASSEMBLER__ */