Commit 3140a9e5 authored by Achin Gupta's avatar Achin Gupta Committed by Dan Handley
Browse files

psci: rework cpu_off assertion and minor cleanups

This patch:

1. removes a duplicate assertion to check that the only error
   condition that can be returned while turning a cpu off is
   PSCI_E_DENIED. Having this assertion after calling
   psci_afflvl_off() is sufficient.

2. corrects some incorrect usage of 'its' vs 'it is'

3. removes some unwanted white spaces

Change-Id: Icf014e269b54f5be5ce0b9fbe6b41258e4ebf403
parent 2d94d4a0
...@@ -91,13 +91,6 @@ static int psci_afflvl0_off(unsigned long mpidr, aff_map_node *cpu_node) ...@@ -91,13 +91,6 @@ static int psci_afflvl0_off(unsigned long mpidr, aff_map_node *cpu_node)
plat_state); plat_state);
} }
/*
* The only error cpu_off can return is E_DENIED. So check if that's
* indeed the case. The caller will simply 'eret' in case of an error.
*/
if (rc != PSCI_E_SUCCESS)
assert(rc == PSCI_E_DENIED);
return rc; return rc;
} }
...@@ -123,7 +116,7 @@ static int psci_afflvl1_off(unsigned long mpidr, aff_map_node *cluster_node) ...@@ -123,7 +116,7 @@ static int psci_afflvl1_off(unsigned long mpidr, aff_map_node *cluster_node)
dcsw_op_all(DCCISW); dcsw_op_all(DCCISW);
/* /*
* Plat. Management. Allow the platform to do it's cluster * Plat. Management. Allow the platform to do its cluster
* specific bookeeping e.g. turn off interconnect coherency, * specific bookeeping e.g. turn off interconnect coherency,
* program the power controller etc. * program the power controller etc.
*/ */
...@@ -152,7 +145,7 @@ static int psci_afflvl2_off(unsigned long mpidr, aff_map_node *system_node) ...@@ -152,7 +145,7 @@ static int psci_afflvl2_off(unsigned long mpidr, aff_map_node *system_node)
/* No arch. and generic bookeeping to do here currently */ /* No arch. and generic bookeeping to do here currently */
/* /*
* Plat. Management : Allow the platform to do it's bookeeping * Plat. Management : Allow the platform to do its bookeeping
* at this affinity level * at this affinity level
*/ */
if (psci_plat_pm_ops->affinst_off) if (psci_plat_pm_ops->affinst_off)
......
...@@ -333,7 +333,7 @@ static unsigned int psci_afflvl0_on_finish(unsigned long mpidr, ...@@ -333,7 +333,7 @@ static unsigned int psci_afflvl0_on_finish(unsigned long mpidr,
/* /*
* Generic management: Now we just need to retrieve the * Generic management: Now we just need to retrieve the
* information that we had stashed away during the cpu_on * information that we had stashed away during the cpu_on
* call to set this cpu on it's way. First get the index * call to set this cpu on its way. First get the index
* for restoring the re-entry info * for restoring the re-entry info
*/ */
index = cpu_node->data; index = cpu_node->data;
......
...@@ -153,7 +153,7 @@ static int psci_afflvl1_suspend(unsigned long mpidr, ...@@ -153,7 +153,7 @@ static int psci_afflvl1_suspend(unsigned long mpidr,
dcsw_op_all(DCCISW); dcsw_op_all(DCCISW);
/* /*
* Plat. Management. Allow the platform to do it's cluster * Plat. Management. Allow the platform to do its cluster
* specific bookeeping e.g. turn off interconnect coherency, * specific bookeeping e.g. turn off interconnect coherency,
* program the power controller etc. * program the power controller etc.
*/ */
...@@ -166,7 +166,6 @@ static int psci_afflvl1_suspend(unsigned long mpidr, ...@@ -166,7 +166,6 @@ static int psci_afflvl1_suspend(unsigned long mpidr,
* platform handler prototype the same. * platform handler prototype the same.
*/ */
psci_entrypoint = (unsigned long) psci_aff_suspend_finish_entry; psci_entrypoint = (unsigned long) psci_aff_suspend_finish_entry;
rc = psci_plat_pm_ops->affinst_suspend(mpidr, rc = psci_plat_pm_ops->affinst_suspend(mpidr,
psci_entrypoint, psci_entrypoint,
ns_entrypoint, ns_entrypoint,
...@@ -198,7 +197,7 @@ static int psci_afflvl2_suspend(unsigned long mpidr, ...@@ -198,7 +197,7 @@ static int psci_afflvl2_suspend(unsigned long mpidr,
plat_state = psci_get_aff_phys_state(system_node); plat_state = psci_get_aff_phys_state(system_node);
/* /*
* Plat. Management : Allow the platform to do it's bookeeping * Plat. Management : Allow the platform to do its bookeeping
* at this affinity level * at this affinity level
*/ */
if (psci_plat_pm_ops->affinst_suspend) { if (psci_plat_pm_ops->affinst_suspend) {
...@@ -210,7 +209,6 @@ static int psci_afflvl2_suspend(unsigned long mpidr, ...@@ -210,7 +209,6 @@ static int psci_afflvl2_suspend(unsigned long mpidr,
* platform handler prototype the same. * platform handler prototype the same.
*/ */
psci_entrypoint = (unsigned long) psci_aff_suspend_finish_entry; psci_entrypoint = (unsigned long) psci_aff_suspend_finish_entry;
rc = psci_plat_pm_ops->affinst_suspend(mpidr, rc = psci_plat_pm_ops->affinst_suspend(mpidr,
psci_entrypoint, psci_entrypoint,
ns_entrypoint, ns_entrypoint,
...@@ -387,7 +385,7 @@ static unsigned int psci_afflvl0_suspend_finish(unsigned long mpidr, ...@@ -387,7 +385,7 @@ static unsigned int psci_afflvl0_suspend_finish(unsigned long mpidr,
/* /*
* Generic management: Now we just need to retrieve the * Generic management: Now we just need to retrieve the
* information that we had stashed away during the suspend * information that we had stashed away during the suspend
* call to set this cpu on it's way. * call to set this cpu on its way.
*/ */
psci_get_ns_entry_info(index); psci_get_ns_entry_info(index);
......
...@@ -196,7 +196,7 @@ int psci_change_state(unsigned long mpidr, ...@@ -196,7 +196,7 @@ int psci_change_state(unsigned long mpidr,
/******************************************************************************* /*******************************************************************************
* This routine does the heavy lifting for psci_change_state(). It examines the * This routine does the heavy lifting for psci_change_state(). It examines the
* state of each affinity instance at the next lower affinity level and decides * state of each affinity instance at the next lower affinity level and decides
* it's final state accordingly. If a lower affinity instance is ON then the * its final state accordingly. If a lower affinity instance is ON then the
* higher affinity instance is ON. If all the lower affinity instances are OFF * higher affinity instance is ON. If all the lower affinity instances are OFF
* then the higher affinity instance is OFF. If atleast one lower affinity * then the higher affinity instance is OFF. If atleast one lower affinity
* instance is SUSPENDED then the higher affinity instance is SUSPENDED. If only * instance is SUSPENDED then the higher affinity instance is SUSPENDED. If only
...@@ -210,7 +210,7 @@ unsigned int psci_calculate_affinity_state(aff_map_node *aff_node) ...@@ -210,7 +210,7 @@ unsigned int psci_calculate_affinity_state(aff_map_node *aff_node)
unsigned long tempidr; unsigned long tempidr;
aff_map_node *lo_aff_node; aff_map_node *lo_aff_node;
/* Cannot calculate lowest affinity state. It's simply assigned */ /* Cannot calculate lowest affinity state. It is simply assigned */
assert(aff_node->level > MPIDR_AFFLVL0); assert(aff_node->level > MPIDR_AFFLVL0);
/* /*
...@@ -248,7 +248,7 @@ unsigned int psci_calculate_affinity_state(aff_map_node *aff_node) ...@@ -248,7 +248,7 @@ unsigned int psci_calculate_affinity_state(aff_map_node *aff_node)
/* /*
* At least one X-1 needs to be suspended for X to be suspended * At least one X-1 needs to be suspended for X to be suspended
* but it's effectively on for the affinity_info call. * but it is effectively on for the affinity_info call.
* SUSPEND > ON_PENDING > OFF. * SUSPEND > ON_PENDING > OFF.
*/ */
case PSCI_STATE_SUSPEND: case PSCI_STATE_SUSPEND:
...@@ -424,8 +424,8 @@ int psci_set_ns_entry_info(unsigned int index, ...@@ -424,8 +424,8 @@ int psci_set_ns_entry_info(unsigned int index,
/******************************************************************************* /*******************************************************************************
* An affinity level could be on, on_pending, suspended or off. These are the * An affinity level could be on, on_pending, suspended or off. These are the
* logical states it can be in. Physically either it's off or on. When it's in * logical states it can be in. Physically either it is off or on. When it is in
* the state on_pending then it's about to be turned on. It's not possible to * the state on_pending then it is about to be turned on. It is not possible to
* tell whether that's actually happenned or not. So we err on the side of * tell whether that's actually happenned or not. So we err on the side of
* caution & treat the affinity level as being turned off. * caution & treat the affinity level as being turned off.
******************************************************************************/ ******************************************************************************/
......
...@@ -122,9 +122,11 @@ int psci_cpu_off(void) ...@@ -122,9 +122,11 @@ int psci_cpu_off(void)
*/ */
rc = psci_afflvl_off(mpidr, target_afflvl, MPIDR_AFFLVL0); rc = psci_afflvl_off(mpidr, target_afflvl, MPIDR_AFFLVL0);
if (rc != PSCI_E_SUCCESS) { /*
assert(rc == PSCI_E_DENIED); * The only error cpu_off can return is E_DENIED. So check if that's
} * indeed the case.
*/
assert (rc == PSCI_E_SUCCESS || rc == PSCI_E_DENIED);
return rc; return rc;
} }
......
...@@ -171,6 +171,4 @@ CASSERT(GPREGS_FP_OFF == __builtin_offsetof(gp_regs, fp), \ ...@@ -171,6 +171,4 @@ CASSERT(GPREGS_FP_OFF == __builtin_offsetof(gp_regs, fp), \
extern void runtime_svc_init(unsigned long mpidr); extern void runtime_svc_init(unsigned long mpidr);
#endif /*__ASSEMBLY__*/ #endif /*__ASSEMBLY__*/
#endif /* __RUNTIME_SVC_H__ */ #endif /* __RUNTIME_SVC_H__ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment