PSCI: Fix MISRA defects in ON/OFF/SUSPEND/SYSTEM_OFF

Fix violations of MISRA C-2012 Rules 8.13, 10.1, 10.3, 17.7 and 20.7.

Change-Id: I6f45a1069b742aebf9e1d6a403717b1522083f51
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
This commit is contained in:
Antonio Nino Diaz 2018-07-16 23:19:25 +01:00
parent 2bc3dba924
commit 621d64f89b
5 changed files with 76 additions and 73 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2017, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -40,14 +40,15 @@ static void psci_set_power_off_state(psci_power_state_t *state_info)
******************************************************************************/ ******************************************************************************/
int psci_do_cpu_off(unsigned int end_pwrlvl) int psci_do_cpu_off(unsigned int end_pwrlvl)
{ {
int rc = PSCI_E_SUCCESS, idx = plat_my_core_pos(); int rc = PSCI_E_SUCCESS;
int idx = (int) plat_my_core_pos();
psci_power_state_t state_info; psci_power_state_t state_info;
/* /*
* This function must only be called on platforms where the * This function must only be called on platforms where the
* CPU_OFF platform hooks have been implemented. * CPU_OFF platform hooks have been implemented.
*/ */
assert(psci_plat_pm_ops->pwr_domain_off); assert(psci_plat_pm_ops->pwr_domain_off != NULL);
/* Construct the psci_power_state for CPU_OFF */ /* Construct the psci_power_state for CPU_OFF */
psci_set_power_off_state(&state_info); psci_set_power_off_state(&state_info);
@ -57,17 +58,16 @@ int psci_do_cpu_off(unsigned int end_pwrlvl)
* level so that by the time all locks are taken, the system topology * level so that by the time all locks are taken, the system topology
* is snapshot and state management can be done safely. * is snapshot and state management can be done safely.
*/ */
psci_acquire_pwr_domain_locks(end_pwrlvl, psci_acquire_pwr_domain_locks(end_pwrlvl, idx);
idx);
/* /*
* Call the cpu off handler registered by the Secure Payload Dispatcher * Call the cpu off handler registered by the Secure Payload Dispatcher
* to let it do any bookkeeping. Assume that the SPD always reports an * to let it do any bookkeeping. Assume that the SPD always reports an
* E_DENIED error if SP refuse to power down * E_DENIED error if SP refuse to power down
*/ */
if (psci_spd_pm && psci_spd_pm->svc_off) { if ((psci_spd_pm != NULL) && (psci_spd_pm->svc_off != NULL)) {
rc = psci_spd_pm->svc_off(0); rc = psci_spd_pm->svc_off(0);
if (rc) if (rc != 0)
goto exit; goto exit;
} }
@ -120,8 +120,7 @@ exit:
* Release the locks corresponding to each power level in the * Release the locks corresponding to each power level in the
* reverse order to which they were acquired. * reverse order to which they were acquired.
*/ */
psci_release_pwr_domain_locks(end_pwrlvl, psci_release_pwr_domain_locks(end_pwrlvl, idx);
idx);
/* /*
* Check if all actions needed to safely power down this cpu have * Check if all actions needed to safely power down this cpu have
@ -154,7 +153,7 @@ exit:
PMF_NO_CACHE_MAINT); PMF_NO_CACHE_MAINT);
#endif #endif
if (psci_plat_pm_ops->pwr_domain_pwr_down_wfi) { if (psci_plat_pm_ops->pwr_domain_pwr_down_wfi != NULL) {
/* This function must not return */ /* This function must not return */
psci_plat_pm_ops->pwr_domain_pwr_down_wfi(&state_info); psci_plat_pm_ops->pwr_domain_pwr_down_wfi(&state_info);
} else { } else {

View File

@ -55,22 +55,22 @@ static int cpu_on_validate_state(aff_info_state_t aff_state)
* platform handler as it can return error. * platform handler as it can return error.
******************************************************************************/ ******************************************************************************/
int psci_cpu_on_start(u_register_t target_cpu, int psci_cpu_on_start(u_register_t target_cpu,
entry_point_info_t *ep) const entry_point_info_t *ep)
{ {
int rc; int rc;
unsigned int target_idx = plat_core_pos_by_mpidr(target_cpu);
aff_info_state_t target_aff_state; aff_info_state_t target_aff_state;
int target_idx = plat_core_pos_by_mpidr(target_cpu);
/* Calling function must supply valid input arguments */ /* Calling function must supply valid input arguments */
assert((int) target_idx >= 0); assert(target_idx >= 0);
assert(ep != NULL); assert(ep != NULL);
/* /*
* This function must only be called on platforms where the * This function must only be called on platforms where the
* CPU_ON platform hooks have been implemented. * CPU_ON platform hooks have been implemented.
*/ */
assert(psci_plat_pm_ops->pwr_domain_on && assert((psci_plat_pm_ops->pwr_domain_on != NULL) &&
psci_plat_pm_ops->pwr_domain_on_finish); (psci_plat_pm_ops->pwr_domain_on_finish != NULL));
/* Protect against multiple CPUs trying to turn ON the same target CPU */ /* Protect against multiple CPUs trying to turn ON the same target CPU */
psci_spin_lock_cpu(target_idx); psci_spin_lock_cpu(target_idx);
@ -91,7 +91,8 @@ int psci_cpu_on_start(u_register_t target_cpu,
* target CPUs shutdown was not seen by the current CPU's cluster. And * target CPUs shutdown was not seen by the current CPU's cluster. And
* so the cache may contain stale data for the target CPU. * so the cache may contain stale data for the target CPU.
*/ */
flush_cpu_data_by_index(target_idx, psci_svc_cpu_data.aff_info_state); flush_cpu_data_by_index((unsigned int)target_idx,
psci_svc_cpu_data.aff_info_state);
rc = cpu_on_validate_state(psci_get_aff_info_state_by_idx(target_idx)); rc = cpu_on_validate_state(psci_get_aff_info_state_by_idx(target_idx));
if (rc != PSCI_E_SUCCESS) if (rc != PSCI_E_SUCCESS)
goto exit; goto exit;
@ -101,7 +102,7 @@ int psci_cpu_on_start(u_register_t target_cpu,
* to let it do any bookeeping. If the handler encounters an error, it's * to let it do any bookeeping. If the handler encounters an error, it's
* expected to assert within * expected to assert within
*/ */
if (psci_spd_pm && psci_spd_pm->svc_on) if ((psci_spd_pm != NULL) && (psci_spd_pm->svc_on != NULL))
psci_spd_pm->svc_on(target_cpu); psci_spd_pm->svc_on(target_cpu);
/* /*
@ -110,7 +111,8 @@ int psci_cpu_on_start(u_register_t target_cpu,
* turned OFF. * turned OFF.
*/ */
psci_set_aff_info_state_by_idx(target_idx, AFF_STATE_ON_PENDING); psci_set_aff_info_state_by_idx(target_idx, AFF_STATE_ON_PENDING);
flush_cpu_data_by_index(target_idx, psci_svc_cpu_data.aff_info_state); flush_cpu_data_by_index((unsigned int)target_idx,
psci_svc_cpu_data.aff_info_state);
/* /*
* The cache line invalidation by the target CPU after setting the * The cache line invalidation by the target CPU after setting the
@ -122,9 +124,11 @@ int psci_cpu_on_start(u_register_t target_cpu,
if (target_aff_state != AFF_STATE_ON_PENDING) { if (target_aff_state != AFF_STATE_ON_PENDING) {
assert(target_aff_state == AFF_STATE_OFF); assert(target_aff_state == AFF_STATE_OFF);
psci_set_aff_info_state_by_idx(target_idx, AFF_STATE_ON_PENDING); psci_set_aff_info_state_by_idx(target_idx, AFF_STATE_ON_PENDING);
flush_cpu_data_by_index(target_idx, psci_svc_cpu_data.aff_info_state); flush_cpu_data_by_index((unsigned int)target_idx,
psci_svc_cpu_data.aff_info_state);
assert(psci_get_aff_info_state_by_idx(target_idx) == AFF_STATE_ON_PENDING); assert(psci_get_aff_info_state_by_idx(target_idx) ==
AFF_STATE_ON_PENDING);
} }
/* /*
@ -136,15 +140,16 @@ int psci_cpu_on_start(u_register_t target_cpu,
* steps to power on. * steps to power on.
*/ */
rc = psci_plat_pm_ops->pwr_domain_on(target_cpu); rc = psci_plat_pm_ops->pwr_domain_on(target_cpu);
assert(rc == PSCI_E_SUCCESS || rc == PSCI_E_INTERN_FAIL); assert((rc == PSCI_E_SUCCESS) || (rc == PSCI_E_INTERN_FAIL));
if (rc == PSCI_E_SUCCESS) if (rc == PSCI_E_SUCCESS)
/* Store the re-entry information for the non-secure world. */ /* Store the re-entry information for the non-secure world. */
cm_init_context_by_index(target_idx, ep); cm_init_context_by_index((unsigned int)target_idx, ep);
else { else {
/* Restore the state on error. */ /* Restore the state on error. */
psci_set_aff_info_state_by_idx(target_idx, AFF_STATE_OFF); psci_set_aff_info_state_by_idx(target_idx, AFF_STATE_OFF);
flush_cpu_data_by_index(target_idx, psci_svc_cpu_data.aff_info_state); flush_cpu_data_by_index((unsigned int)target_idx,
psci_svc_cpu_data.aff_info_state);
} }
exit: exit:
@ -157,8 +162,7 @@ exit:
* are called by the common finisher routine in psci_common.c. The `state_info` * are called by the common finisher routine in psci_common.c. The `state_info`
* is the psci_power_state from which this CPU has woken up from. * is the psci_power_state from which this CPU has woken up from.
******************************************************************************/ ******************************************************************************/
void psci_cpu_on_finish(unsigned int cpu_idx, void psci_cpu_on_finish(int cpu_idx, const psci_power_state_t *state_info)
psci_power_state_t *state_info)
{ {
/* /*
* Plat. management: Perform the platform specific actions * Plat. management: Perform the platform specific actions
@ -199,7 +203,7 @@ void psci_cpu_on_finish(unsigned int cpu_idx,
* Dispatcher to let it do any bookeeping. If the handler encounters an * Dispatcher to let it do any bookeeping. If the handler encounters an
* error, it's expected to assert within * error, it's expected to assert within
*/ */
if (psci_spd_pm && psci_spd_pm->svc_on_finish) if ((psci_spd_pm != NULL) && (psci_spd_pm->svc_on_finish != NULL))
psci_spd_pm->svc_on_finish(0); psci_spd_pm->svc_on_finish(0);
PUBLISH_EVENT(psci_cpu_on_finish); PUBLISH_EVENT(psci_cpu_on_finish);

View File

@ -295,22 +295,20 @@ void prepare_cpu_pwr_dwn(unsigned int power_level);
/* Private exported functions from psci_on.c */ /* Private exported functions from psci_on.c */
int psci_cpu_on_start(u_register_t target_cpu, int psci_cpu_on_start(u_register_t target_cpu,
entry_point_info_t *ep); const entry_point_info_t *ep);
void psci_cpu_on_finish(unsigned int cpu_idx, void psci_cpu_on_finish(int cpu_idx, const psci_power_state_t *state_info);
psci_power_state_t *state_info);
/* Private exported functions from psci_off.c */ /* Private exported functions from psci_off.c */
int psci_do_cpu_off(unsigned int end_pwrlvl); int psci_do_cpu_off(unsigned int end_pwrlvl);
/* Private exported functions from psci_suspend.c */ /* Private exported functions from psci_suspend.c */
void psci_cpu_suspend_start(entry_point_info_t *ep, void psci_cpu_suspend_start(const entry_point_info_t *ep,
unsigned int end_pwrlvl, unsigned int end_pwrlvl,
psci_power_state_t *state_info, psci_power_state_t *state_info,
unsigned int is_power_down_state); unsigned int is_power_down_state);
void psci_cpu_suspend_finish(unsigned int cpu_idx, void psci_cpu_suspend_finish(int cpu_idx, const psci_power_state_t *state_info);
psci_power_state_t *state_info);
/* Private exported functions from psci_helpers.S */ /* Private exported functions from psci_helpers.S */
void psci_do_pwrdown_cache_maintenance(unsigned int pwr_level); void psci_do_pwrdown_cache_maintenance(unsigned int pwr_level);
@ -319,7 +317,7 @@ void psci_do_pwrup_cache_maintenance(void);
/* Private exported functions from psci_system_off.c */ /* Private exported functions from psci_system_off.c */
void __dead2 psci_system_off(void); void __dead2 psci_system_off(void);
void __dead2 psci_system_reset(void); void __dead2 psci_system_reset(void);
int psci_system_reset2(uint32_t reset_type, u_register_t cookie); u_register_t psci_system_reset2(uint32_t reset_type, u_register_t cookie);
/* Private exported functions from psci_stat.c */ /* Private exported functions from psci_stat.c */
void psci_stats_update_pwr_down(unsigned int end_pwrlvl, void psci_stats_update_pwr_down(unsigned int end_pwrlvl,

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2017, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -23,7 +23,7 @@
* This function does generic and platform specific operations after a wake-up * This function does generic and platform specific operations after a wake-up
* from standby/retention states at multiple power levels. * from standby/retention states at multiple power levels.
******************************************************************************/ ******************************************************************************/
static void psci_suspend_to_standby_finisher(unsigned int cpu_idx, static void psci_suspend_to_standby_finisher(int cpu_idx,
unsigned int end_pwrlvl) unsigned int end_pwrlvl)
{ {
psci_power_state_t state_info; psci_power_state_t state_info;
@ -64,8 +64,8 @@ static void psci_suspend_to_standby_finisher(unsigned int cpu_idx,
* operations. * operations.
******************************************************************************/ ******************************************************************************/
static void psci_suspend_to_pwrdown_start(unsigned int end_pwrlvl, static void psci_suspend_to_pwrdown_start(unsigned int end_pwrlvl,
entry_point_info_t *ep, const entry_point_info_t *ep,
psci_power_state_t *state_info) const psci_power_state_t *state_info)
{ {
unsigned int max_off_lvl = psci_find_max_off_lvl(state_info); unsigned int max_off_lvl = psci_find_max_off_lvl(state_info);
@ -85,7 +85,7 @@ static void psci_suspend_to_pwrdown_start(unsigned int end_pwrlvl,
* Dispatcher to let it do any book-keeping. If the handler encounters an * Dispatcher to let it do any book-keeping. If the handler encounters an
* error, it's expected to assert within * error, it's expected to assert within
*/ */
if (psci_spd_pm && psci_spd_pm->svc_suspend) if ((psci_spd_pm != NULL) && (psci_spd_pm->svc_suspend != NULL))
psci_spd_pm->svc_suspend(max_off_lvl); psci_spd_pm->svc_suspend(max_off_lvl);
#if !HW_ASSISTED_COHERENCY #if !HW_ASSISTED_COHERENCY
@ -95,7 +95,7 @@ static void psci_suspend_to_pwrdown_start(unsigned int end_pwrlvl,
* HW_ASSISTED_COHERENCY = 0 platforms that can safely perform these * HW_ASSISTED_COHERENCY = 0 platforms that can safely perform these
* actions with data caches enabled. * actions with data caches enabled.
*/ */
if (psci_plat_pm_ops->pwr_domain_suspend_pwrdown_early) if (psci_plat_pm_ops->pwr_domain_suspend_pwrdown_early != NULL)
psci_plat_pm_ops->pwr_domain_suspend_pwrdown_early(state_info); psci_plat_pm_ops->pwr_domain_suspend_pwrdown_early(state_info);
#endif #endif
@ -147,20 +147,20 @@ static void psci_suspend_to_pwrdown_start(unsigned int end_pwrlvl,
* the state transition has been done, no further error is expected and it is * the state transition has been done, no further error is expected and it is
* not possible to undo any of the actions taken beyond that point. * not possible to undo any of the actions taken beyond that point.
******************************************************************************/ ******************************************************************************/
void psci_cpu_suspend_start(entry_point_info_t *ep, void psci_cpu_suspend_start(const entry_point_info_t *ep,
unsigned int end_pwrlvl, unsigned int end_pwrlvl,
psci_power_state_t *state_info, psci_power_state_t *state_info,
unsigned int is_power_down_state) unsigned int is_power_down_state)
{ {
int skip_wfi = 0; int skip_wfi = 0;
unsigned int idx = plat_my_core_pos(); int idx = (int) plat_my_core_pos();
/* /*
* This function must only be called on platforms where the * This function must only be called on platforms where the
* CPU_SUSPEND platform hooks have been implemented. * CPU_SUSPEND platform hooks have been implemented.
*/ */
assert(psci_plat_pm_ops->pwr_domain_suspend && assert((psci_plat_pm_ops->pwr_domain_suspend != NULL) &&
psci_plat_pm_ops->pwr_domain_suspend_finish); (psci_plat_pm_ops->pwr_domain_suspend_finish != NULL));
/* /*
* This function acquires the lock corresponding to each power * This function acquires the lock corresponding to each power
@ -175,7 +175,7 @@ void psci_cpu_suspend_start(entry_point_info_t *ep,
* introduced by lock contention to increase the chances of early * introduced by lock contention to increase the chances of early
* detection that a wake-up interrupt has fired. * detection that a wake-up interrupt has fired.
*/ */
if (read_isr_el1()) { if (read_isr_el1() != 0U) {
skip_wfi = 1; skip_wfi = 1;
goto exit; goto exit;
} }
@ -192,7 +192,7 @@ void psci_cpu_suspend_start(entry_point_info_t *ep,
psci_stats_update_pwr_down(end_pwrlvl, state_info); psci_stats_update_pwr_down(end_pwrlvl, state_info);
#endif #endif
if (is_power_down_state) if (is_power_down_state != 0U)
psci_suspend_to_pwrdown_start(end_pwrlvl, ep, state_info); psci_suspend_to_pwrdown_start(end_pwrlvl, ep, state_info);
/* /*
@ -214,10 +214,10 @@ exit:
*/ */
psci_release_pwr_domain_locks(end_pwrlvl, psci_release_pwr_domain_locks(end_pwrlvl,
idx); idx);
if (skip_wfi) if (skip_wfi == 1)
return; return;
if (is_power_down_state) { if (is_power_down_state != 0U) {
#if ENABLE_RUNTIME_INSTRUMENTATION #if ENABLE_RUNTIME_INSTRUMENTATION
/* /*
@ -232,7 +232,7 @@ exit:
#endif #endif
/* The function calls below must not return */ /* The function calls below must not return */
if (psci_plat_pm_ops->pwr_domain_pwr_down_wfi) if (psci_plat_pm_ops->pwr_domain_pwr_down_wfi != NULL)
psci_plat_pm_ops->pwr_domain_pwr_down_wfi(state_info); psci_plat_pm_ops->pwr_domain_pwr_down_wfi(state_info);
else else
psci_power_down_wfi(); psci_power_down_wfi();
@ -269,15 +269,15 @@ exit:
* are called by the common finisher routine in psci_common.c. The `state_info` * are called by the common finisher routine in psci_common.c. The `state_info`
* is the psci_power_state from which this CPU has woken up from. * is the psci_power_state from which this CPU has woken up from.
******************************************************************************/ ******************************************************************************/
void psci_cpu_suspend_finish(unsigned int cpu_idx, void psci_cpu_suspend_finish(int cpu_idx, const psci_power_state_t *state_info)
psci_power_state_t *state_info)
{ {
unsigned int counter_freq; unsigned int counter_freq;
unsigned int max_off_lvl; unsigned int max_off_lvl;
/* Ensure we have been woken up from a suspended state */ /* Ensure we have been woken up from a suspended state */
assert(psci_get_aff_info_state() == AFF_STATE_ON && is_local_state_off(\ assert((psci_get_aff_info_state() == AFF_STATE_ON) &&
state_info->pwr_domain_state[PSCI_CPU_PWR_LVL])); (is_local_state_off(
state_info->pwr_domain_state[PSCI_CPU_PWR_LVL]) != 0));
/* /*
* Plat. management: Perform the platform specific actions * Plat. management: Perform the platform specific actions
@ -302,9 +302,9 @@ void psci_cpu_suspend_finish(unsigned int cpu_idx,
* Dispatcher to let it do any bookeeping. If the handler encounters an * Dispatcher to let it do any bookeeping. If the handler encounters an
* error, it's expected to assert within * error, it's expected to assert within
*/ */
if (psci_spd_pm && psci_spd_pm->svc_suspend_finish) { if ((psci_spd_pm != NULL) && (psci_spd_pm->svc_suspend_finish != NULL)) {
max_off_lvl = psci_find_max_off_lvl(state_info); max_off_lvl = psci_find_max_off_lvl(state_info);
assert (max_off_lvl != PSCI_INVALID_PWR_LVL); assert(max_off_lvl != PSCI_INVALID_PWR_LVL);
psci_spd_pm->svc_suspend_finish(max_off_lvl); psci_spd_pm->svc_suspend_finish(max_off_lvl);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014-2017, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2014-2018, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -16,14 +16,14 @@ void __dead2 psci_system_off(void)
{ {
psci_print_power_domain_map(); psci_print_power_domain_map();
assert(psci_plat_pm_ops->system_off); assert(psci_plat_pm_ops->system_off != NULL);
/* Notify the Secure Payload Dispatcher */ /* Notify the Secure Payload Dispatcher */
if (psci_spd_pm && psci_spd_pm->svc_system_off) { if ((psci_spd_pm != NULL) && (psci_spd_pm->svc_system_off != NULL)) {
psci_spd_pm->svc_system_off(); psci_spd_pm->svc_system_off();
} }
console_flush(); (void) console_flush();
/* Call the platform specific hook */ /* Call the platform specific hook */
psci_plat_pm_ops->system_off(); psci_plat_pm_ops->system_off();
@ -35,14 +35,14 @@ void __dead2 psci_system_reset(void)
{ {
psci_print_power_domain_map(); psci_print_power_domain_map();
assert(psci_plat_pm_ops->system_reset); assert(psci_plat_pm_ops->system_reset != NULL);
/* Notify the Secure Payload Dispatcher */ /* Notify the Secure Payload Dispatcher */
if (psci_spd_pm && psci_spd_pm->svc_system_reset) { if ((psci_spd_pm != NULL) && (psci_spd_pm->svc_system_reset != NULL)) {
psci_spd_pm->svc_system_reset(); psci_spd_pm->svc_system_reset();
} }
console_flush(); (void) console_flush();
/* Call the platform specific hook */ /* Call the platform specific hook */
psci_plat_pm_ops->system_reset(); psci_plat_pm_ops->system_reset();
@ -50,32 +50,34 @@ void __dead2 psci_system_reset(void)
/* This function does not return. We should never get here */ /* This function does not return. We should never get here */
} }
int psci_system_reset2(uint32_t reset_type, u_register_t cookie) u_register_t psci_system_reset2(uint32_t reset_type, u_register_t cookie)
{ {
int is_vendor; unsigned int is_vendor;
psci_print_power_domain_map(); psci_print_power_domain_map();
assert(psci_plat_pm_ops->system_reset2); assert(psci_plat_pm_ops->system_reset2 != NULL);
is_vendor = (reset_type >> PSCI_RESET2_TYPE_VENDOR_SHIFT) & 1; is_vendor = (reset_type >> PSCI_RESET2_TYPE_VENDOR_SHIFT) & 1U;
if (!is_vendor) { if (is_vendor == 0U) {
/* /*
* Only WARM_RESET is allowed for architectural type resets. * Only WARM_RESET is allowed for architectural type resets.
*/ */
if (reset_type != PSCI_RESET2_SYSTEM_WARM_RESET) if (reset_type != PSCI_RESET2_SYSTEM_WARM_RESET)
return PSCI_E_INVALID_PARAMS; return (u_register_t) PSCI_E_INVALID_PARAMS;
if (psci_plat_pm_ops->write_mem_protect && if ((psci_plat_pm_ops->write_mem_protect != NULL) &&
psci_plat_pm_ops->write_mem_protect(0) < 0) { (psci_plat_pm_ops->write_mem_protect(0) < 0)) {
return PSCI_E_NOT_SUPPORTED; return (u_register_t) PSCI_E_NOT_SUPPORTED;
} }
} }
/* Notify the Secure Payload Dispatcher */ /* Notify the Secure Payload Dispatcher */
if (psci_spd_pm && psci_spd_pm->svc_system_reset) { if ((psci_spd_pm != NULL) && (psci_spd_pm->svc_system_reset != NULL)) {
psci_spd_pm->svc_system_reset(); psci_spd_pm->svc_system_reset();
} }
console_flush(); (void) console_flush();
return psci_plat_pm_ops->system_reset2(is_vendor, reset_type, cookie); return (u_register_t)
psci_plat_pm_ops->system_reset2((int) is_vendor, reset_type,
cookie);
} }