FF-A: Booting SPs according to 'boot-order'

Secure Hafnium boots partitions according to boot-order in the manifest.
In this patch:
- Added manifest parsing of "boot-order", and populated VM structure
with it;
- Added the field "next_boot" to the VM structure, in order to create a
boot list that is sorted by the "boot-order";
- The root of the list points to the highest priority VM;
- Booting consists on traversing the list upon use of MSG_WAIT
interface from the highest priority VMs;
- After traversing the whole boot list, returns execution to SPMD;
- "manifest_Test.cc" updated to include "boot-order" field in
tests to the partition manifest;
- "vm_test.cc" updated to include unit test for the main logic of this
patch.

Change-Id: I43adf90447eed3bc24c8eb2ccb8eb979b471f3c3
Signed-off-by: J-Alves <Joao.Alves@arm.com>
diff --git a/src/manifest.c b/src/manifest.c
index 60b0fa3..ab61b12 100644
--- a/src/manifest.c
+++ b/src/manifest.c
@@ -195,6 +195,21 @@
 	return MANIFEST_SUCCESS;
 }
 
+static enum manifest_return_code read_optional_uint16(
+	const struct fdt_node *node, const char *property,
+	uint16_t default_value, uint16_t *out)
+{
+	enum manifest_return_code ret;
+
+	ret = read_uint16(node, property, out);
+	if (ret == MANIFEST_ERROR_PROPERTY_NOT_FOUND) {
+		*out = default_value;
+		return MANIFEST_SUCCESS;
+	}
+
+	return MANIFEST_SUCCESS;
+}
+
 static enum manifest_return_code read_uint8(const struct fdt_node *node,
 					    const char *property, uint8_t *out)
 {
@@ -530,6 +545,10 @@
 	TRY(read_uint64(&root, "entrypoint-offset", &vm->sp.ep_offset));
 	dlog_verbose("  SP entry point offset %#x\n", vm->sp.ep_offset);
 
+	TRY(read_optional_uint16(&root, "boot-order", DEFAULT_BOOT_ORDER,
+				 &vm->sp.boot_order));
+	dlog_verbose(" SP boot order %#u\n", vm->sp.boot_order);
+
 	TRY(read_uint8(&root, "xlat-granule", (uint8_t *)&vm->sp.xlat_granule));
 	dlog_verbose("  SP translation granule %d\n", vm->sp.xlat_granule);