feat(manifest): support FF-A v1.2 direct messages

Add additional messaging method parsing to indicate whether a partition
can send/receive messages via FFA_MSG_SEND_DIRECT_REQ2.

Also enforce that a manifest declaring an FF-A version < FF-A v1.2
cannot declare usage of FFA_MSG_SEND_DIRECT_REQ2.

Signed-off-by: Kathleen Capella <kathleen.capella@arm.com>
Change-Id: I56f8e15dd00f16932ab7059dc585e12a9ca28f09
diff --git a/src/manifest.c b/src/manifest.c
index 3065c72..6be414a 100644
--- a/src/manifest.c
+++ b/src/manifest.c
@@ -895,6 +895,9 @@
 	enum manifest_return_code ret_code = MANIFEST_SUCCESS;
 	const char *error_string = "specified in manifest is unsupported";
 	uint32_t k = 0;
+	bool using_req2 = (vm->partition.messaging_method &
+			   (FFA_PARTITION_DIRECT_REQ2_RECV |
+			    FFA_PARTITION_DIRECT_REQ2_SEND)) != 0;
 
 	/* ensure that the SPM version is compatible */
 	ffa_version_major = (vm->partition.ffa_version & 0xffff0000) >>
@@ -929,9 +932,16 @@
 		ret_code = MANIFEST_ERROR_NOT_COMPATIBLE;
 	}
 
+	if (vm->partition.ffa_version < MAKE_FFA_VERSION(1, 2) && using_req2) {
+		dlog_error("Messaging method %s: %x\n", error_string,
+			   vm->partition.messaging_method);
+		ret_code = MANIFEST_ERROR_NOT_COMPATIBLE;
+	}
+
 	if ((vm->partition.messaging_method &
 	     ~(FFA_PARTITION_DIRECT_REQ_RECV | FFA_PARTITION_DIRECT_REQ_SEND |
-	       FFA_PARTITION_INDIRECT_MSG)) != 0U) {
+	       FFA_PARTITION_INDIRECT_MSG | FFA_PARTITION_DIRECT_REQ2_RECV |
+	       FFA_PARTITION_DIRECT_REQ2_SEND)) != 0U) {
 		dlog_error("Messaging method %s: %x\n", error_string,
 			   vm->partition.messaging_method);
 		ret_code = MANIFEST_ERROR_NOT_COMPATIBLE;
@@ -1089,8 +1099,8 @@
 		vm->partition.rxtx.available = true;
 	}
 
-	TRY(read_uint8(&root, "messaging-method",
-		       (uint8_t *)&vm->partition.messaging_method));
+	TRY(read_uint16(&root, "messaging-method",
+			(uint16_t *)&vm->partition.messaging_method));
 	dlog_verbose("  Messaging method %u\n", vm->partition.messaging_method);
 
 	TRY(read_bool(&root, "managed-exit", &managed_exit_field_present));