Add runtime services framework

This patch introduces the framework to enable registration and
initialisation of runtime services. PSCI is registered and initialised
as a runtime service. Handling of runtime service requests will be
implemented in subsequent patches.

Change-Id: Id21e7ddc5a33d42b7d6e455b41155fc5441a9547
diff --git a/common/psci/psci_setup.c b/common/psci/psci_setup.c
index 91de1ab..c471d1f 100644
--- a/common/psci/psci_setup.c
+++ b/common/psci/psci_setup.c
@@ -36,6 +36,7 @@
 #include <platform.h>
 #include <psci_private.h>
 #include <context_mgmt.h>
+#include <runtime_svc.h>
 
 /*******************************************************************************
  * Per cpu non-secure contexts used to program the architectural state prior
@@ -275,8 +276,9 @@
  * level within the 'psci_aff_map' array. This allows restricting search of a
  * node at an affinity level between the indices in the limits array.
  ******************************************************************************/
-void psci_setup(unsigned long mpidr)
+int32_t psci_setup(void)
 {
+	unsigned long mpidr = read_mpidr();
 	int afflvl, affmap_idx, max_afflvl;
 	aff_map_node *node;
 
@@ -335,5 +337,16 @@
 	platform_setup_pm(&psci_plat_pm_ops);
 	assert(psci_plat_pm_ops);
 
-	return;
+	return 0;
 }
+
+/* Register PSCI as a run time service */
+DECLARE_RT_SVC(
+		psci,
+
+		OEN_STD_START,
+		OEN_STD_END,
+		SMC_TYPE_FAST,
+		psci_setup,
+		NULL
+);