Cactus: Create tertiary partition

In order to test the RXTX_MAP API a tertiary cactus partition without a
RX_TX region specified in its manifest is required. This patch adds this
SP which is loaded at 0x730000. The primary and secondary SP's
RX_TX regions are moved to allow for this.

Signed-off-by: Ruari Phipps <ruari.phipps@arm.com>
Change-Id: Idefe4bd7b589e974a0f011ba702763cadfec5df9
diff --git a/spm/cactus/cactus-secondary.dts b/spm/cactus/cactus-secondary.dts
index 8a140a9..71a56f4 100644
--- a/spm/cactus/cactus-secondary.dts
+++ b/spm/cactus/cactus-secondary.dts
@@ -45,14 +45,14 @@
 		rxbuffer: rx-buffer {
 			description = "rx-buffer";
 			pages-count = <1>;
-			base-address = <0x00000000 0x7202000>;
+			base-address = <0x00000000 0x7302000>;
 			attributes = <0x1>; /* read-only */
 		};
 
 		txbuffer: tx-buffer {
 			description = "tx-buffer";
 			pages-count = <1>;
-			base-address = <0x00000000 0x7203000>;
+			base-address = <0x00000000 0x7303000>;
 			attributes = <0x3>; /* read-write */
 		};
 
diff --git a/spm/cactus/cactus-tertiary.dts b/spm/cactus/cactus-tertiary.dts
new file mode 100644
index 0000000..d823ef3
--- /dev/null
+++ b/spm/cactus/cactus-tertiary.dts
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2020, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * This file is a Partition Manifest (PM) for a minimal Secure Partition (SP)
+ * that has additional optional properties defined.
+ *
+ */
+
+/dts-v1/;
+
+/ {
+	compatible = "arm,ffa-manifest-1.0";
+
+	/* Properties */
+	description = "Base-1";
+	ffa-version = <0x00010000>; /* 31:16 - Major, 15:0 - Minor */
+	uuid = <0x79b55c73 0x1d8c44b9 0x859361e1 0x770ad8d2>;
+	id = <3>;
+	auxiliary-id = <0xae>;
+	stream-endpoint-ids = <0 1 2 3>;
+	execution-ctx-count = <1>;
+	exception-level = <2>; /* S-EL1 */
+	execution-state = <0>; /* AARCH64 */
+	load-address = <0x7200000>;
+	entrypoint-offset = <0x00001000>;
+	xlat-granule = <0>; /* 4KiB */
+	boot-order = <0>;
+	messaging-method = <0>; /* Direct messaging only */
+	run-time-model = <0>; /* Run to completion */
+
+	/* Boot protocol */
+	gp-register-num = <0x0>;
+
+	memory-regions {
+		compatible = "arm,ffa-manifest-memory-regions";
+
+		/* Without optional base-address */
+		test-memory {
+			description = "test-memory";
+			pages-count = <4>;
+			attributes = <0x7>; /* read-write-execute */
+		};
+	};
+
+	device-regions {
+		compatible = "arm,ffa-manifest-device-regions";
+
+		test-reg {
+			/* Dummy values */
+			base-address = <0x00000000 0x25000000>;
+			pages-count = <16>;
+			attributes = <0x3>; /* read-write */
+			reg = <0x10000008 0x00000001 1>;
+			smmu-id = <1>;
+			stream-ids = <0x0 0x1>;
+			interrupts = <0x2 0x3>,
+					<0x4 0x5>;
+		};
+	};
+
+};
diff --git a/spm/cactus/cactus.dts b/spm/cactus/cactus.dts
index 2e30db4..919a5d5 100644
--- a/spm/cactus/cactus.dts
+++ b/spm/cactus/cactus.dts
@@ -45,14 +45,14 @@
 		rxbuffer: rx-buffer {
 			description = "rx-buffer";
 			pages-count = <1>;
-			base-address = <0x00000000 0x7200000>;
+			base-address = <0x00000000 0x7300000>;
 			attributes = <0x1>; /* read-only */
 		};
 
 		txbuffer: tx-buffer {
 			description = "tx-buffer";
 			pages-count = <1>;
-			base-address = <0x00000000 0x7201000>;
+			base-address = <0x00000000 0x7301000>;
 			attributes = <0x3>; /* read-write */
 		};
 
diff --git a/tools/generate_json/generate_json.sh b/tools/generate_json/generate_json.sh
index 7405378..449733c 100755
--- a/tools/generate_json/generate_json.sh
+++ b/tools/generate_json/generate_json.sh
@@ -17,8 +17,9 @@
 GENERATED_JSON=build/$2/$3/sp_layout.json
 
 # To demonstrate communication between SP's, two cactus S-EL1 instances used.
-# cactus-primary and cactus-secondary has same binary but different
-# partition manifest.
+# To also test mapping of the RXTX region a third cactus S-EL1 instance is used.
+# cactus-primary, cactus-secondary and cactus-tertiary have same binary but
+# different partition manifests.
 if [ "$1" == "cactus" ]; then
 	echo -e "{\n\t\"$1-primary\" : {\n \
 	\t\"image\": \"$1.bin\",\n \
@@ -26,7 +27,9 @@
 	\t\"owner\": \"SiP\"\n\t},\n\n\t\"$1-secondary\" : {\n \
 	\t\"image\": \"$1.bin\",\n \
 	\t\"pm\": \"../../../spm/$1/$1-secondary.dts\",\n \
-	\t\"owner\": \"Plat\"\n \
+	\t\"owner\": \"Plat\"\n\t},\n\n\t\"$1-tertiary\" : {\n \
+	\t\"image\": \"$1.bin\",\n \
+	\t\"pm\": \"../../../spm/$1/$1-tertiary.dts\" \n \
 	}\n}" \
 	> "$GENERATED_JSON"
 else