feat(rmm-eac4): Add support for new RMI_VERSION cmd

This patch adds the necessary support for the new RMI_VERSION
command as mentioned EAC4 specification.

Signed-off-by: Soby Mathew <soby.mathew@arm.com>
Change-Id: I4629357b42d05d291fd81aaea97edf0a0c4518f5
diff --git a/runtime/core/handler.c b/runtime/core/handler.c
index 3dbff55..29c73fc 100644
--- a/runtime/core/handler.c
+++ b/runtime/core/handler.c
@@ -126,7 +126,7 @@
  * The 4th value enables the error log.
  */
 static const struct smc_handler smc_handlers[] = {
-	HANDLER(VERSION,		0, 0, smc_version,		 true,  true),
+	HANDLER(VERSION,		1, 1, smc_version,		 true,  true),
 	HANDLER(FEATURES,		1, 1, smc_read_feature_register, true,  true),
 	HANDLER(GRANULE_DELEGATE,	1, 0, smc_granule_delegate,	 false, true),
 	HANDLER(GRANULE_UNDELEGATE,	1, 0, smc_granule_undelegate,	 false, true),
@@ -181,15 +181,6 @@
 		return;
 	}
 
-	if (function_id == SMC_RMM_VERSION) {
-		/*
-		 * RMM_VERSION is special because it returns the
-		 * version number, not the error code.
-		 */
-		INFO("SMC_RMM_%-21s > %lx\n", handler->fn_name, res->x[0]);
-		return;
-	}
-
 	rc = unpack_return_code(res->x[0]);
 
 	if ((handler->log_exec) ||
diff --git a/runtime/include/smc-handler.h b/runtime/include/smc-handler.h
index 685f3c5..5965078 100644
--- a/runtime/include/smc-handler.h
+++ b/runtime/include/smc-handler.h
@@ -8,7 +8,8 @@
 
 #include <smc.h>
 
-unsigned long smc_version(void);
+void smc_version(unsigned long rmi_version,
+				struct smc_result *res);
 
 void smc_read_feature_register(unsigned long index,
 				struct smc_result *res);
diff --git a/runtime/rmi/system.c b/runtime/rmi/system.c
index 024d419..5847350 100644
--- a/runtime/rmi/system.c
+++ b/runtime/rmi/system.c
@@ -9,7 +9,13 @@
 COMPILER_ASSERT(RMI_ABI_VERSION_MAJOR <= 0x7FFF);
 COMPILER_ASSERT(RMI_ABI_VERSION_MINOR <= 0xFFFF);
 
-unsigned long smc_version(void)
+void smc_version(unsigned long rmi_version, struct smc_result *res)
 {
-	return RMI_ABI_VERSION;
+	if (rmi_version != RMI_ABI_VERSION) {
+		res->x[0] = RMI_ERROR_INPUT;
+	} else {
+		res->x[0] = RMI_SUCCESS;
+	}
+
+	res->x[1] = RMI_ABI_VERSION;
 }