diff options
author | danh-arm <dan.handley@arm.com> | 2014-05-06 17:54:03 +0100 |
---|---|---|
committer | danh-arm <dan.handley@arm.com> | 2014-05-06 17:54:03 +0100 |
commit | 408c37682a0233c8c4fa88700b603f0b09d6361f (patch) | |
tree | 18133148dea88d9a2313113111b24b56e8130505 /services/std_svc/psci | |
parent | b495bdef190acf166c713e138b61c5bb25402fc0 (diff) | |
parent | 97043ac98e13a726dbf8b3b41654dca759e3da2c (diff) |
Merge pull request #48 from danh-arm/dh/major-refactoring
dh/major refactoring
Diffstat (limited to 'services/std_svc/psci')
-rw-r--r-- | services/std_svc/psci/psci_afflvl_off.c | 28 | ||||
-rw-r--r-- | services/std_svc/psci/psci_afflvl_on.c | 43 | ||||
-rw-r--r-- | services/std_svc/psci/psci_afflvl_suspend.c | 51 | ||||
-rw-r--r-- | services/std_svc/psci/psci_common.c | 59 | ||||
-rw-r--r-- | services/std_svc/psci/psci_entry.S | 5 | ||||
-rw-r--r-- | services/std_svc/psci/psci_main.c | 12 | ||||
-rw-r--r-- | services/std_svc/psci/psci_private.h | 82 | ||||
-rw-r--r-- | services/std_svc/psci/psci_setup.c | 24 |
8 files changed, 137 insertions, 167 deletions
diff --git a/services/std_svc/psci/psci_afflvl_off.c b/services/std_svc/psci/psci_afflvl_off.c index f6bd40c8..e007bc30 100644 --- a/services/std_svc/psci/psci_afflvl_off.c +++ b/services/std_svc/psci/psci_afflvl_off.c @@ -28,23 +28,19 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <stdio.h> -#include <string.h> -#include <assert.h> -#include <debug.h> +#include <arch.h> #include <arch_helpers.h> -#include <console.h> -#include <platform.h> -#include <psci.h> -#include <psci_private.h> +#include <assert.h> +#include <string.h> +#include "psci_private.h" -typedef int (*afflvl_off_handler)(unsigned long, aff_map_node *); +typedef int (*afflvl_off_handler_t)(unsigned long, aff_map_node_t *); /******************************************************************************* * The next three functions implement a handler for each supported affinity * level which is called when that affinity level is turned off. ******************************************************************************/ -static int psci_afflvl0_off(unsigned long mpidr, aff_map_node *cpu_node) +static int psci_afflvl0_off(unsigned long mpidr, aff_map_node_t *cpu_node) { unsigned int index, plat_state; int rc = PSCI_E_SUCCESS; @@ -111,7 +107,7 @@ static int psci_afflvl0_off(unsigned long mpidr, aff_map_node *cpu_node) return rc; } -static int psci_afflvl1_off(unsigned long mpidr, aff_map_node *cluster_node) +static int psci_afflvl1_off(unsigned long mpidr, aff_map_node_t *cluster_node) { int rc = PSCI_E_SUCCESS; unsigned int plat_state; @@ -148,7 +144,7 @@ static int psci_afflvl1_off(unsigned long mpidr, aff_map_node *cluster_node) return rc; } -static int psci_afflvl2_off(unsigned long mpidr, aff_map_node *system_node) +static int psci_afflvl2_off(unsigned long mpidr, aff_map_node_t *system_node) { int rc = PSCI_E_SUCCESS; unsigned int plat_state; @@ -178,7 +174,7 @@ static int psci_afflvl2_off(unsigned long mpidr, aff_map_node *system_node) return rc; } -static const afflvl_off_handler psci_afflvl_off_handlers[] = { +static const afflvl_off_handler_t psci_afflvl_off_handlers[] = { psci_afflvl0_off, psci_afflvl1_off, psci_afflvl2_off, @@ -189,13 +185,13 @@ static const afflvl_off_handler psci_afflvl_off_handlers[] = { * topology tree and calls the off handler for the corresponding affinity * levels ******************************************************************************/ -static int psci_call_off_handlers(mpidr_aff_map_nodes mpidr_nodes, +static int psci_call_off_handlers(mpidr_aff_map_nodes_t mpidr_nodes, int start_afflvl, int end_afflvl, unsigned long mpidr) { int rc = PSCI_E_INVALID_PARAMS, level; - aff_map_node *node; + aff_map_node_t *node; for (level = start_afflvl; level <= end_afflvl; level++) { node = mpidr_nodes[level]; @@ -242,7 +238,7 @@ int psci_afflvl_off(unsigned long mpidr, int end_afflvl) { int rc = PSCI_E_SUCCESS; - mpidr_aff_map_nodes mpidr_nodes; + mpidr_aff_map_nodes_t mpidr_nodes; mpidr &= MPIDR_AFFINITY_MASK;; diff --git a/services/std_svc/psci/psci_afflvl_on.c b/services/std_svc/psci/psci_afflvl_on.c index 0878f219..8f9bb4de 100644 --- a/services/std_svc/psci/psci_afflvl_on.c +++ b/services/std_svc/psci/psci_afflvl_on.c @@ -28,19 +28,18 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <stdio.h> -#include <string.h> -#include <assert.h> -#include <debug.h> +#include <arch.h> #include <arch_helpers.h> -#include <console.h> -#include <platform.h> -#include <psci.h> -#include <psci_private.h> +#include <assert.h> +#include <bl_common.h> +#include <bl31.h> #include <context_mgmt.h> +#include <runtime_svc.h> +#include <stddef.h> +#include "psci_private.h" -typedef int (*afflvl_on_handler)(unsigned long, - aff_map_node *, +typedef int (*afflvl_on_handler_t)(unsigned long, + aff_map_node_t *, unsigned long, unsigned long); @@ -48,7 +47,7 @@ typedef int (*afflvl_on_handler)(unsigned long, * This function checks whether a cpu which has been requested to be turned on * is OFF to begin with. ******************************************************************************/ -static int cpu_on_validate_state(aff_map_node *node) +static int cpu_on_validate_state(aff_map_node_t *node) { unsigned int psci_state; @@ -71,7 +70,7 @@ static int cpu_on_validate_state(aff_map_node *node) * TODO: Split this code across separate handlers for each type of setup? ******************************************************************************/ static int psci_afflvl0_on(unsigned long target_cpu, - aff_map_node *cpu_node, + aff_map_node_t *cpu_node, unsigned long ns_entrypoint, unsigned long context_id) { @@ -139,7 +138,7 @@ static int psci_afflvl0_on(unsigned long target_cpu, * TODO: Split this code across separate handlers for each type of setup? ******************************************************************************/ static int psci_afflvl1_on(unsigned long target_cpu, - aff_map_node *cluster_node, + aff_map_node_t *cluster_node, unsigned long ns_entrypoint, unsigned long context_id) { @@ -180,7 +179,7 @@ static int psci_afflvl1_on(unsigned long target_cpu, * TODO: Split this code across separate handlers for each type of setup? ******************************************************************************/ static int psci_afflvl2_on(unsigned long target_cpu, - aff_map_node *system_node, + aff_map_node_t *system_node, unsigned long ns_entrypoint, unsigned long context_id) { @@ -217,7 +216,7 @@ static int psci_afflvl2_on(unsigned long target_cpu, } /* Private data structure to make this handlers accessible through indexing */ -static const afflvl_on_handler psci_afflvl_on_handlers[] = { +static const afflvl_on_handler_t psci_afflvl_on_handlers[] = { psci_afflvl0_on, psci_afflvl1_on, psci_afflvl2_on, @@ -228,7 +227,7 @@ static const afflvl_on_handler psci_afflvl_on_handlers[] = { * topology tree and calls the on handler for the corresponding affinity * levels ******************************************************************************/ -static int psci_call_on_handlers(mpidr_aff_map_nodes target_cpu_nodes, +static int psci_call_on_handlers(mpidr_aff_map_nodes_t target_cpu_nodes, int start_afflvl, int end_afflvl, unsigned long target_cpu, @@ -236,7 +235,7 @@ static int psci_call_on_handlers(mpidr_aff_map_nodes target_cpu_nodes, unsigned long context_id) { int rc = PSCI_E_INVALID_PARAMS, level; - aff_map_node *node; + aff_map_node_t *node; for (level = end_afflvl; level >= start_afflvl; level--) { node = target_cpu_nodes[level]; @@ -282,7 +281,7 @@ int psci_afflvl_on(unsigned long target_cpu, int end_afflvl) { int rc = PSCI_E_SUCCESS; - mpidr_aff_map_nodes target_cpu_nodes; + mpidr_aff_map_nodes_t target_cpu_nodes; unsigned long mpidr = read_mpidr() & MPIDR_AFFINITY_MASK; /* @@ -334,7 +333,7 @@ int psci_afflvl_on(unsigned long target_cpu, * are called by the common finisher routine in psci_common.c. ******************************************************************************/ static unsigned int psci_afflvl0_on_finish(unsigned long mpidr, - aff_map_node *cpu_node) + aff_map_node_t *cpu_node) { unsigned int index, plat_state, state, rc = PSCI_E_SUCCESS; @@ -409,7 +408,7 @@ static unsigned int psci_afflvl0_on_finish(unsigned long mpidr, } static unsigned int psci_afflvl1_on_finish(unsigned long mpidr, - aff_map_node *cluster_node) + aff_map_node_t *cluster_node) { unsigned int plat_state, rc = PSCI_E_SUCCESS; @@ -441,7 +440,7 @@ static unsigned int psci_afflvl1_on_finish(unsigned long mpidr, static unsigned int psci_afflvl2_on_finish(unsigned long mpidr, - aff_map_node *system_node) + aff_map_node_t *system_node) { unsigned int plat_state, rc = PSCI_E_SUCCESS; @@ -477,7 +476,7 @@ static unsigned int psci_afflvl2_on_finish(unsigned long mpidr, return rc; } -const afflvl_power_on_finisher psci_afflvl_on_finishers[] = { +const afflvl_power_on_finisher_t psci_afflvl_on_finishers[] = { psci_afflvl0_on_finish, psci_afflvl1_on_finish, psci_afflvl2_on_finish, diff --git a/services/std_svc/psci/psci_afflvl_suspend.c b/services/std_svc/psci/psci_afflvl_suspend.c index fc6fe1f4..dc12f7a3 100644 --- a/services/std_svc/psci/psci_afflvl_suspend.c +++ b/services/std_svc/psci/psci_afflvl_suspend.c @@ -28,19 +28,18 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <stdio.h> -#include <string.h> #include <assert.h> -#include <debug.h> +#include <bl_common.h> +#include <arch.h> #include <arch_helpers.h> -#include <console.h> -#include <platform.h> -#include <psci.h> -#include <psci_private.h> +#include <context.h> #include <context_mgmt.h> +#include <runtime_svc.h> +#include <stddef.h> +#include "psci_private.h" -typedef int (*afflvl_suspend_handler)(unsigned long, - aff_map_node *, +typedef int (*afflvl_suspend_handler_t)(unsigned long, + aff_map_node_t *, unsigned long, unsigned long, unsigned int); @@ -49,7 +48,7 @@ typedef int (*afflvl_suspend_handler)(unsigned long, * This function sets the power state of the current cpu while * powering down during a cpu_suspend call ******************************************************************************/ -void psci_set_suspend_power_state(aff_map_node *node, unsigned int power_state) +void psci_set_suspend_power_state(aff_map_node_t *node, unsigned int power_state) { /* * Check that nobody else is calling this function on our behalf & @@ -67,7 +66,7 @@ void psci_set_suspend_power_state(aff_map_node *node, unsigned int power_state) */ flush_dcache_range( (unsigned long)&psci_suspend_context[node->data], - sizeof(suspend_context)); + sizeof(suspend_context_t)); } /******************************************************************************* @@ -77,7 +76,7 @@ void psci_set_suspend_power_state(aff_map_node *node, unsigned int power_state) ******************************************************************************/ int psci_get_suspend_afflvl(unsigned long mpidr) { - aff_map_node *node; + aff_map_node_t *node; node = psci_get_aff_map_node(mpidr & MPIDR_AFFINITY_MASK, MPIDR_AFFLVL0); @@ -92,7 +91,7 @@ int psci_get_suspend_afflvl(unsigned long mpidr) * down during a cpu_suspend call. Returns PSCI_INVALID_DATA if the * power state saved for the node is invalid ******************************************************************************/ -int psci_get_aff_map_node_suspend_afflvl(aff_map_node *node) +int psci_get_aff_map_node_suspend_afflvl(aff_map_node_t *node) { unsigned int power_state; @@ -110,7 +109,7 @@ int psci_get_aff_map_node_suspend_afflvl(aff_map_node *node) ******************************************************************************/ int psci_get_suspend_stateid(unsigned long mpidr) { - aff_map_node *node; + aff_map_node_t *node; unsigned int power_state; node = psci_get_aff_map_node(mpidr & MPIDR_AFFINITY_MASK, @@ -128,14 +127,14 @@ int psci_get_suspend_stateid(unsigned long mpidr) * level which is called when that affinity level is about to be suspended. ******************************************************************************/ static int psci_afflvl0_suspend(unsigned long mpidr, - aff_map_node *cpu_node, + aff_map_node_t *cpu_node, unsigned long ns_entrypoint, unsigned long context_id, unsigned int power_state) { unsigned int index, plat_state; unsigned long psci_entrypoint, sctlr; - el3_state *saved_el3_state; + el3_state_t *saved_el3_state; int rc = PSCI_E_SUCCESS; /* Sanity check to safeguard against data corruption */ @@ -227,7 +226,7 @@ static int psci_afflvl0_suspend(unsigned long mpidr, } static int psci_afflvl1_suspend(unsigned long mpidr, - aff_map_node *cluster_node, + aff_map_node_t *cluster_node, unsigned long ns_entrypoint, unsigned long context_id, unsigned int power_state) @@ -281,7 +280,7 @@ static int psci_afflvl1_suspend(unsigned long mpidr, static int psci_afflvl2_suspend(unsigned long mpidr, - aff_map_node *system_node, + aff_map_node_t *system_node, unsigned long ns_entrypoint, unsigned long context_id, unsigned int power_state) @@ -325,7 +324,7 @@ static int psci_afflvl2_suspend(unsigned long mpidr, return rc; } -static const afflvl_suspend_handler psci_afflvl_suspend_handlers[] = { +static const afflvl_suspend_handler_t psci_afflvl_suspend_handlers[] = { psci_afflvl0_suspend, psci_afflvl1_suspend, psci_afflvl2_suspend, @@ -336,7 +335,7 @@ static const afflvl_suspend_handler psci_afflvl_suspend_handlers[] = { * topology tree and calls the suspend handler for the corresponding affinity * levels ******************************************************************************/ -static int psci_call_suspend_handlers(mpidr_aff_map_nodes mpidr_nodes, +static int psci_call_suspend_handlers(mpidr_aff_map_nodes_t mpidr_nodes, int start_afflvl, int end_afflvl, unsigned long mpidr, @@ -345,7 +344,7 @@ static int psci_call_suspend_handlers(mpidr_aff_map_nodes mpidr_nodes, unsigned int power_state) { int rc = PSCI_E_INVALID_PARAMS, level; - aff_map_node *node; + aff_map_node_t *node; for (level = start_afflvl; level <= end_afflvl; level++) { node = mpidr_nodes[level]; @@ -399,7 +398,7 @@ int psci_afflvl_suspend(unsigned long mpidr, int end_afflvl) { int rc = PSCI_E_SUCCESS; - mpidr_aff_map_nodes mpidr_nodes; + mpidr_aff_map_nodes_t mpidr_nodes; mpidr &= MPIDR_AFFINITY_MASK; @@ -452,7 +451,7 @@ int psci_afflvl_suspend(unsigned long mpidr, * are called by the common finisher routine in psci_common.c. ******************************************************************************/ static unsigned int psci_afflvl0_suspend_finish(unsigned long mpidr, - aff_map_node *cpu_node) + aff_map_node_t *cpu_node) { unsigned int index, plat_state, state, rc = PSCI_E_SUCCESS; int32_t suspend_level; @@ -532,7 +531,7 @@ static unsigned int psci_afflvl0_suspend_finish(unsigned long mpidr, } static unsigned int psci_afflvl1_suspend_finish(unsigned long mpidr, - aff_map_node *cluster_node) + aff_map_node_t *cluster_node) { unsigned int plat_state, rc = PSCI_E_SUCCESS; @@ -564,7 +563,7 @@ static unsigned int psci_afflvl1_suspend_finish(unsigned long mpidr, static unsigned int psci_afflvl2_suspend_finish(unsigned long mpidr, - aff_map_node *system_node) + aff_map_node_t *system_node) { unsigned int plat_state, rc = PSCI_E_SUCCESS;; @@ -600,7 +599,7 @@ static unsigned int psci_afflvl2_suspend_finish(unsigned long mpidr, return rc; } -const afflvl_power_on_finisher psci_afflvl_suspend_finishers[] = { +const afflvl_power_on_finisher_t psci_afflvl_suspend_finishers[] = { psci_afflvl0_suspend_finish, psci_afflvl1_suspend_finish, psci_afflvl2_suspend_finish, diff --git a/services/std_svc/psci/psci_common.c b/services/std_svc/psci/psci_common.c index 8b49b778..1d5c3621 100644 --- a/services/std_svc/psci/psci_common.c +++ b/services/std_svc/psci/psci_common.c @@ -28,23 +28,20 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <stdio.h> -#include <string.h> -#include <assert.h> +#include <arch.h> #include <arch_helpers.h> -#include <console.h> -#include <platform.h> -#include <psci.h> -#include <psci_private.h> +#include <assert.h> +#include <bl_common.h> +#include <context.h> #include <context_mgmt.h> -#include <runtime_svc.h> -#include "debug.h" +#include <debug.h> +#include "psci_private.h" /* * SPD power management operations, expected to be supplied by the registered * SPD on successful SP initialization */ -const spd_pm_ops *psci_spd_pm; +const spd_pm_ops_t *psci_spd_pm; /******************************************************************************* * Arrays that contains information needs to resume a cpu's execution when woken @@ -52,8 +49,8 @@ const spd_pm_ops *psci_spd_pm; * free index in the 'psci_ns_entry_info' & 'psci_suspend_context' arrays. Each * cpu is allocated a single entry in each array during startup. ******************************************************************************/ -suspend_context psci_suspend_context[PSCI_NUM_AFFS]; -ns_entry_info psci_ns_entry_info[PSCI_NUM_AFFS]; +suspend_context_t psci_suspend_context[PSCI_NUM_AFFS]; +ns_entry_info_t psci_ns_entry_info[PSCI_NUM_AFFS]; unsigned int psci_ns_einfo_idx; /******************************************************************************* @@ -61,7 +58,7 @@ unsigned int psci_ns_einfo_idx; * management of affinity instances. Each node (aff_map_node) in the array * corresponds to an affinity instance e.g. cluster, cpu within an mpidr ******************************************************************************/ -aff_map_node psci_aff_map[PSCI_NUM_AFFS] +aff_map_node_t psci_aff_map[PSCI_NUM_AFFS] __attribute__ ((section("tzfw_coherent_mem"))); /******************************************************************************* @@ -72,12 +69,12 @@ __attribute__ ((section("tzfw_coherent_mem"))); * level i.e. start index and end index needs to be present. 'psci_aff_limits' * stores this information. ******************************************************************************/ -aff_limits_node psci_aff_limits[MPIDR_MAX_AFFLVL + 1]; +aff_limits_node_t psci_aff_limits[MPIDR_MAX_AFFLVL + 1]; /******************************************************************************* * Pointer to functions exported by the platform to complete power mgmt. ops ******************************************************************************/ -plat_pm_ops *psci_plat_pm_ops; +plat_pm_ops_t *psci_plat_pm_ops; /******************************************************************************* * Routine to return the maximum affinity level to traverse to after a cpu has @@ -89,7 +86,7 @@ plat_pm_ops *psci_plat_pm_ops; ******************************************************************************/ int get_power_on_target_afflvl(unsigned long mpidr) { - aff_map_node *node; + aff_map_node_t *node; unsigned int state; int afflvl; @@ -180,7 +177,7 @@ int psci_check_afflvl_range(int start_afflvl, int end_afflvl) void psci_acquire_afflvl_locks(unsigned long mpidr, int start_afflvl, int end_afflvl, - mpidr_aff_map_nodes mpidr_nodes) + mpidr_aff_map_nodes_t mpidr_nodes) { int level; @@ -199,7 +196,7 @@ void psci_acquire_afflvl_locks(unsigned long mpidr, void psci_release_afflvl_locks(unsigned long mpidr, int start_afflvl, int end_afflvl, - mpidr_aff_map_nodes mpidr_nodes) + mpidr_aff_map_nodes_t mpidr_nodes) { int level; @@ -216,7 +213,7 @@ void psci_release_afflvl_locks(unsigned long mpidr, ******************************************************************************/ int psci_validate_mpidr(unsigned long mpidr, int level) { - aff_map_node *node; + aff_map_node_t *node; node = psci_get_aff_map_node(mpidr, level); if (node && (node->state & PSCI_AFF_PRESENT)) @@ -234,8 +231,8 @@ void psci_get_ns_entry_info(unsigned int index) { unsigned long sctlr = 0, scr, el_status, id_aa64pfr0; uint64_t mpidr = read_mpidr(); - cpu_context *ns_entry_context; - gp_regs *ns_entry_gpregs; + cpu_context_t *ns_entry_context; + gp_regs_t *ns_entry_gpregs; scr = read_scr(); @@ -267,7 +264,7 @@ void psci_get_ns_entry_info(unsigned int index) write_sctlr_el1(sctlr); /* Fulfill the cpu_on entry reqs. as per the psci spec */ - ns_entry_context = (cpu_context *) cm_get_context(mpidr, NON_SECURE); + ns_entry_context = (cpu_context_t *) cm_get_context(mpidr, NON_SECURE); assert(ns_entry_context); /* @@ -380,7 +377,7 @@ int psci_set_ns_entry_info(unsigned int index, * This function takes a pointer to an affinity node in the topology tree and * returns its state. State of a non-leaf node needs to be calculated. ******************************************************************************/ -unsigned short psci_get_state(aff_map_node *node) +unsigned short psci_get_state(aff_map_node_t *node) { assert(node->level >= MPIDR_AFFLVL0 && node->level <= MPIDR_MAX_AFFLVL); @@ -407,7 +404,7 @@ unsigned short psci_get_state(aff_map_node *node) * a target state. State of a non-leaf node needs to be converted to a reference * count. State of a leaf node can be set directly. ******************************************************************************/ -void psci_set_state(aff_map_node *node, unsigned short state) +void psci_set_state(aff_map_node_t *node, unsigned short state) { assert(node->level >= MPIDR_AFFLVL0 && node->level <= MPIDR_MAX_AFFLVL); @@ -448,7 +445,7 @@ void psci_set_state(aff_map_node *node, unsigned short state) * tell whether that's actually happenned or not. So we err on the side of * caution & treat the affinity level as being turned off. ******************************************************************************/ -unsigned short psci_get_phys_state(aff_map_node *node) +unsigned short psci_get_phys_state(aff_map_node_t *node) { unsigned int state; @@ -461,14 +458,14 @@ unsigned short psci_get_phys_state(aff_map_node *node) * topology tree and calls the physical power on handler for the corresponding * affinity levels ******************************************************************************/ -static int psci_call_power_on_handlers(mpidr_aff_map_nodes mpidr_nodes, +static int psci_call_power_on_handlers(mpidr_aff_map_nodes_t mpidr_nodes, int start_afflvl, int end_afflvl, - afflvl_power_on_finisher *pon_handlers, + afflvl_power_on_finisher_t *pon_handlers, unsigned long mpidr) { int rc = PSCI_E_INVALID_PARAMS, level; - aff_map_node *node; + aff_map_node_t *node; for (level = end_afflvl; level >= start_afflvl; level--) { node = mpidr_nodes[level]; @@ -511,9 +508,9 @@ static int psci_call_power_on_handlers(mpidr_aff_map_nodes mpidr_nodes, void psci_afflvl_power_on_finish(unsigned long mpidr, int start_afflvl, int end_afflvl, - afflvl_power_on_finisher *pon_handlers) + afflvl_power_on_finisher_t *pon_handlers) { - mpidr_aff_map_nodes mpidr_nodes; + mpidr_aff_map_nodes_t mpidr_nodes; int rc; mpidr &= MPIDR_AFFINITY_MASK; @@ -565,7 +562,7 @@ void psci_afflvl_power_on_finish(unsigned long mpidr, * management operation. The power management hooks are expected to be provided * by the SPD, after it finishes all its initialization ******************************************************************************/ -void psci_register_spd_pm_hook(const spd_pm_ops *pm) +void psci_register_spd_pm_hook(const spd_pm_ops_t *pm) { psci_spd_pm = pm; } diff --git a/services/std_svc/psci/psci_entry.S b/services/std_svc/psci/psci_entry.S index bdd571e7..e2c690db 100644 --- a/services/std_svc/psci/psci_entry.S +++ b/services/std_svc/psci/psci_entry.S @@ -29,12 +29,9 @@ */ #include <arch.h> -#include <platform.h> -#include <psci.h> -#include <psci_private.h> -#include <runtime_svc.h> #include <asm_macros.S> #include <cm_macros.S> +#include <psci.h> .globl psci_aff_on_finish_entry .globl psci_aff_suspend_finish_entry diff --git a/services/std_svc/psci/psci_main.c b/services/std_svc/psci/psci_main.c index c90929dd..1bcf2166 100644 --- a/services/std_svc/psci/psci_main.c +++ b/services/std_svc/psci/psci_main.c @@ -28,16 +28,12 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <stdio.h> -#include <string.h> -#include <assert.h> +#include <arch.h> #include <arch_helpers.h> -#include <console.h> -#include <platform.h> -#include <psci_private.h> +#include <assert.h> #include <runtime_svc.h> #include <debug.h> -#include <context_mgmt.h> +#include "psci_private.h" /******************************************************************************* * PSCI frontend api for servicing SMCs. Described in the PSCI spec. @@ -144,7 +140,7 @@ int psci_affinity_info(unsigned long target_affinity, { int rc = PSCI_E_INVALID_PARAMS; unsigned int aff_state; - aff_map_node *node; + aff_map_node_t *node; if (lowest_affinity_level > get_max_afflvl()) return rc; diff --git a/services/std_svc/psci/psci_private.h b/services/std_svc/psci/psci_private.h index 8cb3aab8..b0b5cc9f 100644 --- a/services/std_svc/psci/psci_private.h +++ b/services/std_svc/psci/psci_private.h @@ -33,79 +33,79 @@ #include <arch.h> #include <bakery_lock.h> +#include <psci.h> -#ifndef __ASSEMBLY__ /******************************************************************************* * The following two data structures hold the generic information to bringup * a suspended/hotplugged out cpu ******************************************************************************/ -typedef struct { +typedef struct eret_params { unsigned long entrypoint; unsigned long spsr; -} eret_params; +} eret_params_t; -typedef struct { - eret_params eret_info; +typedef struct ns_entry_info { + eret_params_t eret_info; unsigned long context_id; unsigned int scr; unsigned int sctlr; -} ns_entry_info; +} ns_entry_info_t; /******************************************************************************* * The following two data structures hold the topology tree which in turn tracks * the state of the all the affinity instances supported by the platform. ******************************************************************************/ -typedef struct { +typedef struct aff_map_node { unsigned long mpidr; unsigned short ref_count; unsigned char state; unsigned char level; unsigned int data; - bakery_lock lock; -} aff_map_node; + bakery_lock_t lock; +} aff_map_node_t; -typedef struct { +typedef struct aff_limits_node { int min; int max; -} aff_limits_node; +} aff_limits_node_t; /******************************************************************************* * This data structure holds secure world context that needs to be preserved * across cpu_suspend calls which enter the power down state. ******************************************************************************/ -typedef struct { +typedef struct suspend_context { unsigned int power_state; -} __aligned(CACHE_WRITEBACK_GRANULE) suspend_context; +} __aligned(CACHE_WRITEBACK_GRANULE) suspend_context_t; -typedef aff_map_node (*mpidr_aff_map_nodes[MPIDR_MAX_AFFLVL]); -typedef unsigned int (*afflvl_power_on_finisher)(unsigned long, - aff_map_node *); +typedef aff_map_node_t (*mpidr_aff_map_nodes_t[MPIDR_MAX_AFFLVL]); +typedef unsigned int (*afflvl_power_on_finisher_t)(unsigned long, + aff_map_node_t *); /******************************************************************************* * Data prototypes ******************************************************************************/ -extern suspend_context psci_suspend_context[PSCI_NUM_AFFS]; -extern ns_entry_info psci_ns_entry_info[PSCI_NUM_AFFS]; +extern suspend_context_t psci_suspend_context[PSCI_NUM_AFFS]; +extern ns_entry_info_t psci_ns_entry_info[PSCI_NUM_AFFS]; extern unsigned int psci_ns_einfo_idx; -extern aff_limits_node psci_aff_limits[MPIDR_MAX_AFFLVL + 1]; -extern plat_pm_ops *psci_plat_pm_ops; -extern aff_map_node psci_aff_map[PSCI_NUM_AFFS]; -extern afflvl_power_on_finisher psci_afflvl_off_finish_handlers[]; -extern afflvl_power_on_finisher psci_afflvl_sus_finish_handlers[]; +extern aff_limits_node_t psci_aff_limits[MPIDR_MAX_AFFLVL + 1]; +extern plat_pm_ops_t *psci_plat_pm_ops; +extern aff_map_node_t psci_aff_map[PSCI_NUM_AFFS]; +extern afflvl_power_on_finisher_t psci_afflvl_off_finish_handlers[]; +extern afflvl_power_on_finisher_t psci_afflvl_sus_finish_handlers[]; /******************************************************************************* * SPD's power management hooks registered with PSCI ******************************************************************************/ -extern const spd_pm_ops *psci_spd_pm; +extern const spd_pm_ops_t *psci_spd_pm; /******************************************************************************* * Function prototypes ******************************************************************************/ /* Private exported functions from psci_common.c */ extern int get_max_afflvl(void); -extern unsigned short psci_get_state(aff_map_node *node); -extern unsigned short psci_get_phys_state(aff_map_node *node); -extern void psci_set_state(aff_map_node *node, unsigned short state); +extern unsigned short psci_get_state(aff_map_node_t *node); +extern unsigned short psci_get_phys_state(aff_map_node_t *node); +extern void psci_set_state(aff_map_node_t *node, unsigned short state); extern void psci_get_ns_entry_info(unsigned int index); extern unsigned long mpidr_set_aff_inst(unsigned long, unsigned char, int); extern int psci_validate_mpidr(unsigned long, int); @@ -113,7 +113,7 @@ extern int get_power_on_target_afflvl(unsigned long mpidr); extern void psci_afflvl_power_on_finish(unsigned long, int, int, - afflvl_power_on_finisher *); + afflvl_power_on_finisher_t *); extern int psci_set_ns_entry_info(unsigned int index, unsigned long entrypoint, unsigned long context_id); @@ -121,18 +121,18 @@ extern int psci_check_afflvl_range(int start_afflvl, int end_afflvl); extern void psci_acquire_afflvl_locks(unsigned long mpidr, int start_afflvl, int end_afflvl, - mpidr_aff_map_nodes mpidr_nodes); + mpidr_aff_map_nodes_t mpidr_nodes); extern void psci_release_afflvl_locks(unsigned long mpidr, int start_afflvl, int end_afflvl, - mpidr_aff_map_nodes mpidr_nodes); + mpidr_aff_map_nodes_t mpidr_nodes); /* Private exported functions from psci_setup.c */ extern int psci_get_aff_map_nodes(unsigned long mpidr, int start_afflvl, int end_afflvl, - mpidr_aff_map_nodes mpidr_nodes); -extern aff_map_node *psci_get_aff_map_node(unsigned long, int); + mpidr_aff_map_nodes_t mpidr_nodes); +extern aff_map_node_t *psci_get_aff_map_node(unsigned long, int); /* Private exported functions from psci_affinity_on.c */ extern int psci_afflvl_on(unsigned long, @@ -145,9 +145,9 @@ extern int psci_afflvl_on(unsigned long, extern int psci_afflvl_off(unsigned long, int, int); /* Private exported functions from psci_affinity_suspend.c */ -extern void psci_set_suspend_power_state(aff_map_node *node, +extern void psci_set_suspend_power_state(aff_map_node_t *node, unsigned int power_state); -extern int psci_get_aff_map_node_suspend_afflvl(aff_map_node *node); +extern int psci_get_aff_map_node_suspend_afflvl(aff_map_node_t *node); extern int psci_afflvl_suspend(unsigned long, unsigned long, unsigned long, @@ -156,19 +156,5 @@ extern int psci_afflvl_suspend(unsigned long, int); extern unsigned int psci_afflvl_suspend_finish(unsigned long, int, int); -/* Private exported functions from psci_main.c */ -extern uint64_t psci_smc_handler(uint32_t smc_fid, - uint64_t x1, - uint64_t x2, - uint64_t x3, - uint64_t x4, - void *cookie, - void *handle, - uint64_t flags); - -/* PSCI setup function */ -extern int32_t psci_setup(void); - -#endif /*__ASSEMBLY__*/ #endif /* __PSCI_PRIVATE_H__ */ diff --git a/services/std_svc/psci/psci_setup.c b/services/std_svc/psci/psci_setup.c index 4525d78d..71d3f1e7 100644 --- a/services/std_svc/psci/psci_setup.c +++ b/services/std_svc/psci/psci_setup.c @@ -28,15 +28,15 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <stdio.h> -#include <string.h> -#include <assert.h> +#include <arch.h> #include <arch_helpers.h> -#include <console.h> -#include <platform.h> -#include <psci_private.h> +#include <assert.h> +#include <bl_common.h> +#include <context.h> #include <context_mgmt.h> -#include <runtime_svc.h> +#include <platform.h> +#include <stddef.h> +#include "psci_private.h" /******************************************************************************* * Per cpu non-secure contexts used to program the architectural state prior @@ -45,7 +45,7 @@ * of relying on platform defined constants. Using PSCI_NUM_AFFS will be an * overkill. ******************************************************************************/ -static cpu_context psci_ns_context[PLATFORM_CORE_COUNT]; +static cpu_context_t psci_ns_context[PLATFORM_CORE_COUNT]; /******************************************************************************* * Routines for retrieving the node corresponding to an affinity level instance @@ -81,7 +81,7 @@ static int psci_aff_map_get_idx(unsigned long key, return mid; } -aff_map_node *psci_get_aff_map_node(unsigned long mpidr, int aff_lvl) +aff_map_node_t *psci_get_aff_map_node(unsigned long mpidr, int aff_lvl) { int rc; @@ -106,10 +106,10 @@ aff_map_node *psci_get_aff_map_node(unsigned long mpidr, int aff_lvl) int psci_get_aff_map_nodes(unsigned long mpidr, int start_afflvl, int end_afflvl, - mpidr_aff_map_nodes mpidr_nodes) + mpidr_aff_map_nodes_t mpidr_nodes) { int rc = PSCI_E_INVALID_PARAMS, level; - aff_map_node *node; + aff_map_node_t *node; rc = psci_check_afflvl_range(start_afflvl, end_afflvl); if (rc != PSCI_E_SUCCESS) @@ -285,7 +285,7 @@ int32_t psci_setup(void) { unsigned long mpidr = read_mpidr(); int afflvl, affmap_idx, max_afflvl; - aff_map_node *node; + aff_map_node_t *node; psci_ns_einfo_idx = 0; psci_plat_pm_ops = NULL; |