int psci_cpu_suspend(unsigned int power_state, unsigned long entrypoint, unsigned long context_id) { int rc; unsigned long mpidr; unsigned int target_afflvl, pstate_type; /* TODO: Standby states are not supported at the moment */ pstate_type = psci_get_pstate_type(power_state); if (pstate_type == 0) { rc = PSCI_E_INVALID_PARAMS; goto exit; } /* Sanity check the requested state */ target_afflvl = psci_get_pstate_afflvl(power_state); if (target_afflvl > MPIDR_MAX_AFFLVL) { rc = PSCI_E_INVALID_PARAMS; goto exit; } mpidr = read_mpidr(); rc = psci_afflvl_suspend(mpidr, entrypoint, context_id, power_state, MPIDR_AFFLVL0, target_afflvl); exit: if (rc != PSCI_E_SUCCESS) assert(rc == PSCI_E_INVALID_PARAMS); return rc; }
int psci_cpu_suspend(unsigned int power_state, unsigned long entrypoint, unsigned long context_id) { int rc; unsigned long mpidr; unsigned int target_afflvl, pstate_type; /* Sanity check the requested state */ target_afflvl = psci_get_pstate_afflvl(power_state); if (target_afflvl > MPIDR_MAX_AFFLVL) return PSCI_E_INVALID_PARAMS; pstate_type = psci_get_pstate_type(power_state); if (pstate_type == PSTATE_TYPE_STANDBY) { if (psci_plat_pm_ops->affinst_standby) rc = psci_plat_pm_ops->affinst_standby(power_state); else return PSCI_E_INVALID_PARAMS; } else { mpidr = read_mpidr(); rc = psci_afflvl_suspend(mpidr, entrypoint, context_id, power_state, MPIDR_AFFLVL0, target_afflvl); } assert(rc == PSCI_E_INVALID_PARAMS || rc == PSCI_E_SUCCESS); return rc; }
static int32_t poplar_validate_power_state(unsigned int power_state, psci_power_state_t *req_state) { VERBOSE("%s: power_state: 0x%x\n", __func__, power_state); int pstate = psci_get_pstate_type(power_state); assert(req_state); /* Sanity check the requested state */ if (pstate == PSTATE_TYPE_STANDBY) req_state->pwr_domain_state[MPIDR_AFFLVL0] = PLAT_MAX_RET_STATE; else req_state->pwr_domain_state[MPIDR_AFFLVL0] = PLAT_MAX_OFF_STATE; /* We expect the 'state id' to be zero */ if (psci_get_pstate_id(power_state)) return PSCI_E_INVALID_PARAMS; return PSCI_E_SUCCESS; }
/******************************************************************************* * Rockchip standard platform handler called to check the validity of the power * state parameter. ******************************************************************************/ int rockchip_validate_power_state(unsigned int power_state, psci_power_state_t *req_state) { int pstate = psci_get_pstate_type(power_state); int pwr_lvl = psci_get_pstate_pwrlvl(power_state); int i; assert(req_state); if (pwr_lvl > PLAT_MAX_PWR_LVL) return PSCI_E_INVALID_PARAMS; /* Sanity check the requested state */ if (pstate == PSTATE_TYPE_STANDBY) { /* * It's probably to enter standby only on power level 0 * ignore any other power level. */ if (pwr_lvl != MPIDR_AFFLVL0) return PSCI_E_INVALID_PARAMS; req_state->pwr_domain_state[MPIDR_AFFLVL0] = PLAT_MAX_RET_STATE; } else { for (i = MPIDR_AFFLVL0; i <= pwr_lvl; i++) req_state->pwr_domain_state[i] = PLAT_MAX_OFF_STATE; for (i = (pwr_lvl + 1); i <= PLAT_MAX_PWR_LVL; i++) req_state->pwr_domain_state[i] = PLAT_MAX_RET_STATE; } /* We expect the 'state id' to be zero */ if (psci_get_pstate_id(power_state)) return PSCI_E_INVALID_PARAMS; return PSCI_E_SUCCESS; }
static int stm32_validate_power_state(unsigned int power_state, psci_power_state_t *req_state) { int pstate = psci_get_pstate_type(power_state); if (pstate != 0) { return PSCI_E_INVALID_PARAMS; } if (psci_get_pstate_pwrlvl(power_state)) { return PSCI_E_INVALID_PARAMS; } if (psci_get_pstate_id(power_state)) { return PSCI_E_INVALID_PARAMS; } req_state->pwr_domain_state[0] = ARM_LOCAL_STATE_RET; req_state->pwr_domain_state[1] = ARM_LOCAL_STATE_RUN; return PSCI_E_SUCCESS; }