Commit 9b4c611c authored by Nariman Poushin's avatar Nariman Poushin
Browse files

plat/arm: css: Convert CSS_SYSTEM_PWR_STATE from macro to inline function

This is to fix a number of Coverity Scan DEADCODE defects, CID numbers
listed below, as reported from
https://scan.coverity.com/projects/arm-software-arm-trusted-firmware



CID 267023
CID 267022
CID 267020

Change-Id: I2963a799b210149e84ccab5c5b9082267ddfe337
Signed-off-by: default avatarNariman Poushin <nariman.poushin@linaro.org>
parent b70dcbc1
...@@ -17,9 +17,15 @@ ...@@ -17,9 +17,15 @@
/* Macros to read the CSS power domain state */ /* Macros to read the CSS power domain state */
#define CSS_CORE_PWR_STATE(state) (state)->pwr_domain_state[ARM_PWR_LVL0] #define CSS_CORE_PWR_STATE(state) (state)->pwr_domain_state[ARM_PWR_LVL0]
#define CSS_CLUSTER_PWR_STATE(state) (state)->pwr_domain_state[ARM_PWR_LVL1] #define CSS_CLUSTER_PWR_STATE(state) (state)->pwr_domain_state[ARM_PWR_LVL1]
#define CSS_SYSTEM_PWR_STATE(state) \
((PLAT_MAX_PWR_LVL == CSS_SYSTEM_PWR_DMN_LVL) ?\ static inline unsigned int css_system_pwr_state(const psci_power_state_t *state)
(state)->pwr_domain_state[CSS_SYSTEM_PWR_DMN_LVL] : 0) {
#if (PLAT_MAX_PWR_LVL == CSS_SYSTEM_PWR_DMN_LVL)
return state->pwr_domain_state[CSS_SYSTEM_PWR_DMN_LVL];
#else
return 0;
#endif
}
int css_pwr_domain_on(u_register_t mpidr); int css_pwr_domain_on(u_register_t mpidr);
void css_pwr_domain_on_finish(const psci_power_state_t *target_state); void css_pwr_domain_on_finish(const psci_power_state_t *target_state);
......
...@@ -96,7 +96,7 @@ static void css_pwr_domain_on_finisher_common( ...@@ -96,7 +96,7 @@ static void css_pwr_domain_on_finisher_common(
void css_pwr_domain_on_finish(const psci_power_state_t *target_state) void css_pwr_domain_on_finish(const psci_power_state_t *target_state)
{ {
/* Assert that the system power domain need not be initialized */ /* Assert that the system power domain need not be initialized */
assert(CSS_SYSTEM_PWR_STATE(target_state) == ARM_LOCAL_STATE_RUN); assert(css_system_pwr_state(target_state) == ARM_LOCAL_STATE_RUN);
/* Program the gic per-cpu distributor or re-distributor interface */ /* Program the gic per-cpu distributor or re-distributor interface */
plat_arm_gic_pcpu_init(); plat_arm_gic_pcpu_init();
...@@ -149,7 +149,7 @@ void css_pwr_domain_suspend(const psci_power_state_t *target_state) ...@@ -149,7 +149,7 @@ void css_pwr_domain_suspend(const psci_power_state_t *target_state)
css_power_down_common(target_state); css_power_down_common(target_state);
/* Perform system domain state saving if issuing system suspend */ /* Perform system domain state saving if issuing system suspend */
if (CSS_SYSTEM_PWR_STATE(target_state) == ARM_LOCAL_STATE_OFF) { if (css_system_pwr_state(target_state) == ARM_LOCAL_STATE_OFF) {
arm_system_pwr_domain_save(); arm_system_pwr_domain_save();
/* Power off the Redistributor after having saved its context */ /* Power off the Redistributor after having saved its context */
...@@ -174,7 +174,7 @@ void css_pwr_domain_suspend_finish( ...@@ -174,7 +174,7 @@ void css_pwr_domain_suspend_finish(
return; return;
/* Perform system domain restore if woken up from system suspend */ /* Perform system domain restore if woken up from system suspend */
if (CSS_SYSTEM_PWR_STATE(target_state) == ARM_LOCAL_STATE_OFF) if (css_system_pwr_state(target_state) == ARM_LOCAL_STATE_OFF)
/* /*
* At this point, the Distributor must be powered on to be ready * At this point, the Distributor must be powered on to be ready
* to have its state restored. The Redistributor will be powered * to have its state restored. The Redistributor will be powered
......
...@@ -87,7 +87,7 @@ void css_scp_suspend(const struct psci_power_state *target_state) ...@@ -87,7 +87,7 @@ void css_scp_suspend(const struct psci_power_state *target_state)
ARM_LOCAL_STATE_OFF); ARM_LOCAL_STATE_OFF);
/* Check if power down at system power domain level is requested */ /* Check if power down at system power domain level is requested */
if (CSS_SYSTEM_PWR_STATE(target_state) == ARM_LOCAL_STATE_OFF) { if (css_system_pwr_state(target_state) == ARM_LOCAL_STATE_OFF) {
/* Issue SCMI command for SYSTEM_SUSPEND */ /* Issue SCMI command for SYSTEM_SUSPEND */
ret = scmi_sys_pwr_state_set(scmi_handle, ret = scmi_sys_pwr_state_set(scmi_handle,
SCMI_SYS_PWR_FORCEFUL_REQ, SCMI_SYS_PWR_FORCEFUL_REQ,
......
...@@ -25,7 +25,7 @@ void css_scp_suspend(const struct psci_power_state *target_state) ...@@ -25,7 +25,7 @@ void css_scp_suspend(const struct psci_power_state *target_state)
uint32_t system_state = scpi_power_on; uint32_t system_state = scpi_power_on;
/* Check if power down at system power domain level is requested */ /* Check if power down at system power domain level is requested */
if (CSS_SYSTEM_PWR_STATE(target_state) == ARM_LOCAL_STATE_OFF) if (css_system_pwr_state(target_state) == ARM_LOCAL_STATE_OFF)
system_state = scpi_power_retention; system_state = scpi_power_retention;
/* Cluster is to be turned off, so disable coherency */ /* Cluster is to be turned off, so disable coherency */
......
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