feat(memory share): validate sp device mem ranges

Validate the device memory specified in a partitions manifest
belongs to the ranges given in the SPMC manifest. This patch
also introduces the ability to define ns device memory ranges
in the SPMC which are needed for later enablement of NWd to SWd
device memory sharing.

Tests made to fail in manifest_test.cc are fixed in this patch
and an additional test is added to check the validation works
as expected. In addition the test checking that normal memory
regions and device memory regions cannot overlap has been removed
as these memory regions need to be allocated in the regions defined
in the SPMC so this would fail with MANIFEST_ERROR_MEM_REGION_INVALID
and is checked by the test added in this patch.

Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
Change-Id: If93418614f9b58e61e625839ed689048e3c75a03
Signed-off-by: J-Alves <joao.alves@arm.com>
diff --git a/src/boot_flow/common.c b/src/boot_flow/common.c
index 3e93c33..0e8d5cd 100644
--- a/src/boot_flow/common.c
+++ b/src/boot_flow/common.c
@@ -19,6 +19,7 @@
 	struct string memory = STRING_INIT("memory");
 	struct string ns_memory = STRING_INIT("ns-memory");
 	struct string device_memory = STRING_INIT("device-memory");
+	struct string ns_device_memory = STRING_INIT("ns-device-memory");
 
 	p->mem_ranges_count = 0;
 	p->kernel_arg = plat_boot_flow_get_kernel_arg();
@@ -28,11 +29,15 @@
 	       fdt_find_cpus(fdt, p->cpu_ids, &p->cpu_count) &&
 	       fdt_find_memory_ranges(fdt, &memory, p->mem_ranges,
 				      &p->mem_ranges_count, MAX_MEM_RANGES) &&
+	       fdt_find_memory_ranges(fdt, &ns_memory, p->ns_mem_ranges,
+				      &p->ns_mem_ranges_count,
+				      MAX_MEM_RANGES) &&
 	       fdt_find_memory_ranges(fdt, &device_memory, p->device_mem_ranges,
 				      &p->device_mem_ranges_count,
 				      MAX_DEVICE_MEM_RANGES) &&
-	       fdt_find_memory_ranges(fdt, &ns_memory, p->ns_mem_ranges,
-				      &p->ns_mem_ranges_count, MAX_MEM_RANGES);
+	       fdt_find_memory_ranges(
+		       fdt, &ns_device_memory, p->ns_device_mem_ranges,
+		       &p->ns_device_mem_ranges_count, MAX_DEVICE_MEM_RANGES);
 }
 
 /**