feat(rdv1): add support for tftf
Add tftf support for Neoverse Reference Design RD-V1 platform. The RD-V1
platform includes 16 Neoverse V1 CPUs, CMN-650 interconnect, GIC-700 and
SMMU-600.
Signed-off-by: Shriram K <shriram.k@arm.com>
Change-Id: I2ae41cb99cf1ed5560eafb8c6c7876f0adec2146
diff --git a/plat/arm/rdinfra/rdv1/include/platform_def.h b/plat/arm/rdinfra/rdv1/include/platform_def.h
new file mode 100644
index 0000000..7869551
--- /dev/null
+++ b/plat/arm/rdinfra/rdv1/include/platform_def.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2022, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef PLATFORM_DEF_H
+#define PLATFORM_DEF_H
+
+#include <sgi_soc_platform_def.h>
+
+#define PLAT_ARM_CLUSTER_COUNT U(16)
+#define CSS_SGI_MAX_CPUS_PER_CLUSTER U(1)
+#define CSS_SGI_MAX_PE_PER_CPU U(1)
+
+/* GIC related constants */
+#define PLAT_ARM_GICD_BASE UL(0x30000000)
+#define PLAT_ARM_GICR_BASE UL(0x30140000)
+#define PLAT_ARM_GICC_BASE UL(0x2C000000)
+
+/* Platform specific page table and MMU setup constants */
+#define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 42)
+#define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 42)
+
+#endif /* PLATFORM_DEF_H */
diff --git a/plat/arm/rdinfra/rdv1/platform.mk b/plat/arm/rdinfra/rdv1/platform.mk
new file mode 100644
index 0000000..8001ec5
--- /dev/null
+++ b/plat/arm/rdinfra/rdv1/platform.mk
@@ -0,0 +1,18 @@
+#
+# Copyright (c) 2022, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+include plat/arm/sgi/common/sgi_common.mk
+
+PLAT_INCLUDES += -Iplat/arm/rdinfra/rdv1/include/
+
+PLAT_SOURCES += plat/arm/rdinfra/rdv1/topology.c
+
+PLAT_TESTS_SKIP_LIST := plat/arm/rdinfra/rdv1/tests_to_skip.txt
+
+ifdef CSS_SGI_PLATFORM_VARIANT
+$(error "CSS_SGI_PLATFORM_VARIANT should not be set for RD-V1, \
+ currently set to ${CSS_SGI_PLATFORM_VARIANT}.")
+endif
diff --git a/plat/arm/rdinfra/rdv1/tests_to_skip.txt b/plat/arm/rdinfra/rdv1/tests_to_skip.txt
new file mode 100644
index 0000000..25e3414
--- /dev/null
+++ b/plat/arm/rdinfra/rdv1/tests_to_skip.txt
@@ -0,0 +1,19 @@
+#
+# Copyright (c) 2022, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+# System suspend is not supported as there are no wakeup sources in RD-V1 FVP
+PSCI STAT/Stats test cases after system suspend
+PSCI System Suspend Validation
+
+# The following tests hang during the test execution
+Timer framework Validation/Stress test the timer framework
+PSCI Affinity Info/Affinity info level0 powerdown
+PSCI CPU Suspend/CPU suspend to powerdown at level 0
+PSCI CPU Suspend/CPU suspend to powerdown at level 1
+
+# The following tests are not supported on RD-V1
+CPU extensions/Use trace buffer control Registers
+CPU extensions/Use trace filter control Registers
diff --git a/plat/arm/rdinfra/rdv1/topology.c b/plat/arm/rdinfra/rdv1/topology.c
new file mode 100644
index 0000000..ad13285
--- /dev/null
+++ b/plat/arm/rdinfra/rdv1/topology.c
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2022, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <assert.h>
+#include <plat_topology.h>
+#include <tftf_lib.h>
+
+static const struct {
+ unsigned int cluster_id;
+ unsigned int cpu_id;
+} plat_cores[] = {
+ /* Cluster0: 1 core */
+ { 0, 0 },
+ /* Cluster1: 1 core */
+ { 1, 0 },
+ /* Cluster2: 1 core */
+ { 2, 0 },
+ /* Cluster3: 1 core */
+ { 3, 0 },
+ /* Cluster4: 1 core */
+ { 4, 0 },
+ /* Cluster5: 1 core */
+ { 5, 0 },
+ /* Cluster6: 1 core */
+ { 6, 0 },
+ /* Cluster7: 1 core */
+ { 7, 0 },
+ /* Cluster8: 1 core */
+ { 8, 0 },
+ /* Cluster9: 1 core */
+ { 9, 0 },
+ /* Cluster10: 1 core */
+ { 10, 0 },
+ /* Cluster11: 1 core */
+ { 11, 0 },
+ /* Cluster12: 1 core */
+ { 12, 0 },
+ /* Cluster13: 1 core */
+ { 13, 0 },
+ /* Cluster14: 1 core */
+ { 14, 0 },
+ /* Cluster15: 1 core */
+ { 15, 0 },
+};
+
+/*
+ * The power domain tree descriptor. The cluster power domains are
+ * arranged so that when the PSCI generic code creates the power domain tree,
+ * the indices of the CPU power domain nodes it allocates match the linear
+ * indices returned by plat_core_pos_by_mpidr().
+ */
+const unsigned char plat_pd_tree_desc[] = {
+ /* Number of root nodes */
+ PLAT_ARM_CLUSTER_COUNT,
+ /* Number of children for the 1st node */
+ CSS_SGI_MAX_CPUS_PER_CLUSTER,
+ /* Number of children for the 2nd node */
+ CSS_SGI_MAX_CPUS_PER_CLUSTER,
+ /* Number of children for the 3rd node */
+ CSS_SGI_MAX_CPUS_PER_CLUSTER,
+ /* Number of children for the 4th node */
+ CSS_SGI_MAX_CPUS_PER_CLUSTER,
+ /* Number of children for the 5th node */
+ CSS_SGI_MAX_CPUS_PER_CLUSTER,
+ /* Number of children for the 6th node */
+ CSS_SGI_MAX_CPUS_PER_CLUSTER,
+ /* Number of children for the 7th node */
+ CSS_SGI_MAX_CPUS_PER_CLUSTER,
+ /* Number of children for the 8th node */
+ CSS_SGI_MAX_CPUS_PER_CLUSTER,
+ /* Number of children for the 9th node */
+ CSS_SGI_MAX_CPUS_PER_CLUSTER,
+ /* Number of children for the 10th node */
+ CSS_SGI_MAX_CPUS_PER_CLUSTER,
+ /* Number of children for the 11th node */
+ CSS_SGI_MAX_CPUS_PER_CLUSTER,
+ /* Number of children for the 12th node */
+ CSS_SGI_MAX_CPUS_PER_CLUSTER,
+ /* Number of children for the 13th node */
+ CSS_SGI_MAX_CPUS_PER_CLUSTER,
+ /* Number of children for the 14th node */
+ CSS_SGI_MAX_CPUS_PER_CLUSTER,
+ /* Number of children for the 15th node */
+ CSS_SGI_MAX_CPUS_PER_CLUSTER,
+ /* Number of children for the 16th node */
+ CSS_SGI_MAX_CPUS_PER_CLUSTER
+};
+
+const unsigned char *tftf_plat_get_pwr_domain_tree_desc(void)
+{
+ return plat_pd_tree_desc;
+}
+
+uint64_t tftf_plat_get_mpidr(unsigned int core_pos)
+{
+ unsigned int mpid;
+
+ assert(core_pos < PLATFORM_CORE_COUNT);
+
+ mpid = make_mpid(plat_cores[core_pos].cluster_id,
+ plat_cores[core_pos].cpu_id);
+
+ return (uint64_t)mpid;
+}