PSA FF-A: add memory-region parsing support

This patch implements support for parsing memory regions described in
Section 3.1, Table 10 of PSA FF-A EAC specification.
A maximum of 8 memory-regions can be defined for a given partition.

Change-Id: I348be5aa3510ef02b4b990dbbba07d443750eae7
Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
diff --git a/inc/hf/manifest.h b/inc/hf/manifest.h
index 88f3b6e..fc3307b 100644
--- a/inc/hf/manifest.h
+++ b/inc/hf/manifest.h
@@ -21,6 +21,11 @@
 
 #define SP_RTX_BUF_NAME_SIZE 10
 
+#define SP_MAX_MEMORY_REGIONS 8
+
+/** Mask for getting read/write/execute permission */
+#define MM_PERM_MASK 0x7
+
 enum run_time_el {
 	EL1 = 0,
 	S_EL0,
@@ -41,6 +46,23 @@
 };
 
 /**
+ * Partition Memory region as described in PSA FFA v1.0 spec, Table 10
+ */
+struct memory_region {
+	/**
+	 * Specify PA, VA for S-EL0 partitions or IPA
+	 * for S-EL1 partitions - optional.
+	 */
+	uintptr_t base_address;
+	/** Page count - mandatory */
+	uint32_t page_count;
+	/** Memory attributes - mandatory */
+	uint32_t attributes;
+	/** Name of memory region - optional */
+	struct string name;
+};
+
+/**
  * Partition manifest as described in PSA FF-A v1.0 spec section 3.1
  */
 struct sp_manifest {
@@ -93,6 +115,9 @@
 	bool time_slice_mem;
 	/** optional - tuples SEPID/SMMUID/streamId */
 	uint32_t stream_ep_ids[1];
+
+	/** Memory regions */
+	struct memory_region mem_regions[SP_MAX_MEMORY_REGIONS];
 };
 
 /**
@@ -165,6 +190,7 @@
 	MANIFEST_ERROR_INTEGER_OVERFLOW,
 	MANIFEST_ERROR_MALFORMED_INTEGER_LIST,
 	MANIFEST_ERROR_MALFORMED_BOOLEAN,
+	MANIFEST_ERROR_MEMORY_REGION_NODE_EMPTY,
 };
 
 enum manifest_return_code manifest_init(struct mm_stage1_locked stage1_locked,