plat(n1sdp): initial commit of N1SDP platform port

This patch allows TFTF to run on N1SDP in a limited manner and is still in
development, some tests are disabled using the file
plat/arm/n1sdp/tests_to_skip.txt.

The major known issue now is with PSCI commands waking up and powering
down cores, and SGIs do not wake up powered off cores.

Build command: "make CROSS_COMPILE=aarch64-none-elf- PLAT=n1sdp tftf"

To run TFTF on N1SDP, copy tftf.bin to the /SOFTWARE directory on the SD
card and edit the images.txt file to load tftf.bin instead of uefi.bin.

Signed-off-by: John Powell <john.powell@arm.com>
Change-Id: I897ba665306413c594544d6a231555475e7c8111
diff --git a/plat/arm/n1sdp/n1sdp_pwr_state.c b/plat/arm/n1sdp/n1sdp_pwr_state.c
new file mode 100644
index 0000000..fcee7c4
--- /dev/null
+++ b/plat/arm/n1sdp/n1sdp_pwr_state.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2022, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <platform.h>
+#include <psci.h>
+
+/* State IDs for local power states on SGI platforms. */
+#define N1SDP_PS_RUN_STATE_ID		0 /* Valid for CPUs and Clusters */
+#define N1SDP_PS_RETENTION_STATE_ID	1 /* Valid for only CPUs */
+#define N1SDP_PS_OFF_STATE_ID		2 /* Valid for CPUs and Clusters */
+
+/* Suspend depth definitions for each power state */
+#define N1SDP_PS_RUN_DEPTH		0
+#define N1SDP_PS_RETENTION_DEPTH		1
+#define N1SDP_PS_OFF_DEPTH		2
+
+/* The state property array with details of idle state possible for the core */
+static const plat_state_prop_t core_state_prop[] = {
+	{N1SDP_PS_RETENTION_DEPTH, N1SDP_PS_RETENTION_STATE_ID, PSTATE_TYPE_STANDBY},
+	{N1SDP_PS_OFF_DEPTH, N1SDP_PS_OFF_STATE_ID, PSTATE_TYPE_POWERDOWN},
+	{0}
+};
+
+/* The state property array with details of idle state possible for the cluster */
+static const plat_state_prop_t cluster_state_prop[] = {
+	{N1SDP_PS_OFF_DEPTH, N1SDP_PS_OFF_STATE_ID, PSTATE_TYPE_POWERDOWN},
+	{0}
+};
+
+const plat_state_prop_t *plat_get_state_prop(unsigned int level)
+{
+	switch (level) {
+	case MPIDR_AFFLVL0:
+		return core_state_prop;
+	case MPIDR_AFFLVL1:
+		return cluster_state_prop;
+	default:
+		return NULL;
+	}
+}