Add type check when getting message by ID

When the kernel driver handles incoming rpmsg messages, it uses the ID
in the message header to find the corresponding mailbox message. The
mailbox messages are stored as a generic message struct that is later
cast to the specific message type.

There is currently no type information stored in the generic message
struct so only the ID is used to distinguish between the mailbox
messages. This means if an incorrect ID is received that matches a
mailbox message with a different type, the kernel driver will cast the
message struct to the wrong type.

Type information has now been added to the generic message struct and
will be checked when trying to find the corresponding mailbox message so
both the ID and type must be correct to find a matching message.

Change-Id: Ifdbceea6ec4ae7078f424a32ce1ff5474bd22fef
diff --git a/kernel/ethosu_mailbox.h b/kernel/ethosu_mailbox.h
index edf922b..c192b54 100644
--- a/kernel/ethosu_mailbox.h
+++ b/kernel/ethosu_mailbox.h
@@ -51,8 +51,9 @@
 };
 
 struct ethosu_mailbox_msg {
-	int  id;
-	void (*fail)(struct ethosu_mailbox_msg *msg);
+	int      id;
+	uint32_t type;
+	void     (*fail)(struct ethosu_mailbox_msg *msg);
 };
 
 /****************************************************************************
@@ -93,7 +94,8 @@
  * Return: a valid pointer on success, otherwise an error ptr.
  */
 struct ethosu_mailbox_msg *ethosu_mailbox_find(struct ethosu_mailbox *mbox,
-					       int msg_id);
+					       int msg_id,
+					       uint32_t msg_type);
 
 /**
  * ethosu_mailbox_fail() - Fail mailbox messages