diff options
Diffstat (limited to 'services/std_svc/psci/psci_afflvl_on.c')
-rw-r--r-- | services/std_svc/psci/psci_afflvl_on.c | 107 |
1 files changed, 43 insertions, 64 deletions
diff --git a/services/std_svc/psci/psci_afflvl_on.c b/services/std_svc/psci/psci_afflvl_on.c index 10bc586..f1d30c9 100644 --- a/services/std_svc/psci/psci_afflvl_on.c +++ b/services/std_svc/psci/psci_afflvl_on.c @@ -75,7 +75,6 @@ static int psci_afflvl0_on(unsigned long target_cpu, unsigned long ns_entrypoint, unsigned long context_id) { - unsigned int plat_state; unsigned long psci_entrypoint; uint32_t ns_scr_el3 = read_scr_el3(); uint32_t ns_sctlr_el1 = read_sctlr_el1(); @@ -113,23 +112,19 @@ static int psci_afflvl0_on(unsigned long target_cpu, /* Set the secure world (EL3) re-entry point after BL1 */ psci_entrypoint = (unsigned long) psci_aff_on_finish_entry; + if (!psci_plat_pm_ops->affinst_on) + return PSCI_E_SUCCESS; + /* * Plat. management: Give the platform the current state * of the target cpu to allow it to perform the necessary * steps to power on. */ - if (psci_plat_pm_ops->affinst_on) { - - /* Get the current physical state of this cpu */ - plat_state = psci_get_phys_state(cpu_node); - rc = psci_plat_pm_ops->affinst_on(target_cpu, - psci_entrypoint, - ns_entrypoint, - cpu_node->level, - plat_state); - } - - return rc; + return psci_plat_pm_ops->affinst_on(target_cpu, + psci_entrypoint, + ns_entrypoint, + cpu_node->level, + psci_get_phys_state(cpu_node)); } /******************************************************************************* @@ -142,8 +137,6 @@ static int psci_afflvl1_on(unsigned long target_cpu, unsigned long ns_entrypoint, unsigned long context_id) { - int rc = PSCI_E_SUCCESS; - unsigned int plat_state; unsigned long psci_entrypoint; assert(cluster_node->level == MPIDR_AFFLVL1); @@ -155,22 +148,20 @@ static int psci_afflvl1_on(unsigned long target_cpu, /* State management: Is not required while turning a cluster on */ + if (!psci_plat_pm_ops->affinst_on) + return PSCI_E_SUCCESS; + /* * Plat. management: Give the platform the current state * of the target cpu to allow it to perform the necessary * steps to power on. */ - if (psci_plat_pm_ops->affinst_on) { - plat_state = psci_get_phys_state(cluster_node); - psci_entrypoint = (unsigned long) psci_aff_on_finish_entry; - rc = psci_plat_pm_ops->affinst_on(target_cpu, - psci_entrypoint, - ns_entrypoint, - cluster_node->level, - plat_state); - } - - return rc; + psci_entrypoint = (unsigned long) psci_aff_on_finish_entry; + return psci_plat_pm_ops->affinst_on(target_cpu, + psci_entrypoint, + ns_entrypoint, + cluster_node->level, + psci_get_phys_state(cluster_node)); } /******************************************************************************* @@ -183,8 +174,6 @@ static int psci_afflvl2_on(unsigned long target_cpu, unsigned long ns_entrypoint, unsigned long context_id) { - int rc = PSCI_E_SUCCESS; - unsigned int plat_state; unsigned long psci_entrypoint; /* Cannot go beyond affinity level 2 in this psci imp. */ @@ -197,22 +186,20 @@ static int psci_afflvl2_on(unsigned long target_cpu, /* State management: Is not required while turning a system on */ + if (!psci_plat_pm_ops->affinst_on) + return PSCI_E_SUCCESS; + /* * Plat. management: Give the platform the current state * of the target cpu to allow it to perform the necessary * steps to power on. */ - if (psci_plat_pm_ops->affinst_on) { - plat_state = psci_get_phys_state(system_node); - psci_entrypoint = (unsigned long) psci_aff_on_finish_entry; - rc = psci_plat_pm_ops->affinst_on(target_cpu, - psci_entrypoint, - ns_entrypoint, - system_node->level, - plat_state); - } - - return rc; + psci_entrypoint = (unsigned long) psci_aff_on_finish_entry; + return psci_plat_pm_ops->affinst_on(target_cpu, + psci_entrypoint, + ns_entrypoint, + system_node->level, + psci_get_phys_state(system_node)); } /* Private data structure to make this handlers accessible through indexing */ @@ -227,7 +214,7 @@ static const afflvl_on_handler_t 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_t target_cpu_nodes, +static int psci_call_on_handlers(aff_map_node_t *target_cpu_nodes[], int start_afflvl, int end_afflvl, unsigned long target_cpu, @@ -402,10 +389,13 @@ static unsigned int psci_afflvl0_on_finish(aff_map_node_t *cpu_node) static unsigned int psci_afflvl1_on_finish(aff_map_node_t *cluster_node) { - unsigned int plat_state, rc = PSCI_E_SUCCESS; + unsigned int plat_state; assert(cluster_node->level == MPIDR_AFFLVL1); + if (!psci_plat_pm_ops->affinst_on_finish) + return PSCI_E_SUCCESS; + /* * Plat. management: Perform the platform specific actions * as per the old state of the cluster e.g. enabling @@ -414,27 +404,23 @@ static unsigned int psci_afflvl1_on_finish(aff_map_node_t *cluster_node) * then assert as there is no way to recover from this * situation. */ - if (psci_plat_pm_ops->affinst_on_finish) { - - /* Get the physical state of this cluster */ - plat_state = psci_get_phys_state(cluster_node); - rc = psci_plat_pm_ops->affinst_on_finish(read_mpidr_el1(), - cluster_node->level, - plat_state); - assert(rc == PSCI_E_SUCCESS); - } - - return rc; + plat_state = psci_get_phys_state(cluster_node); + return psci_plat_pm_ops->affinst_on_finish(read_mpidr_el1(), + cluster_node->level, + plat_state); } static unsigned int psci_afflvl2_on_finish(aff_map_node_t *system_node) { - unsigned int plat_state, rc = PSCI_E_SUCCESS; + unsigned int plat_state; /* Cannot go beyond this affinity level */ assert(system_node->level == MPIDR_AFFLVL2); + if (!psci_plat_pm_ops->affinst_on_finish) + return PSCI_E_SUCCESS; + /* * Currently, there are no architectural actions to perform * at the system level. @@ -448,17 +434,10 @@ static unsigned int psci_afflvl2_on_finish(aff_map_node_t *system_node) * then assert as there is no way to recover from this * situation. */ - if (psci_plat_pm_ops->affinst_on_finish) { - - /* Get the physical state of the system */ - plat_state = psci_get_phys_state(system_node); - rc = psci_plat_pm_ops->affinst_on_finish(read_mpidr_el1(), - system_node->level, - plat_state); - assert(rc == PSCI_E_SUCCESS); - } - - return rc; + plat_state = psci_get_phys_state(system_node); + return psci_plat_pm_ops->affinst_on_finish(read_mpidr_el1(), + system_node->level, + plat_state); } const afflvl_power_on_finisher_t psci_afflvl_on_finishers[] = { |