blob: b3d503e60ba132c9e39fab0505b44db74fd2db9e [file] [log] [blame]
Achin Gupta4f6ad662013-10-25 09:08:21 +01001/*
Jayanth Dodderi Chidanand18d93792023-07-18 14:48:09 +01002 * Copyright (c) 2013-2024, Arm Limited and Contributors. All rights reserved.
Achin Gupta4f6ad662013-10-25 09:08:21 +01003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Achin Gupta4f6ad662013-10-25 09:08:21 +01005 */
6
Dan Handley2bd4ef22014-04-09 13:14:54 +01007#include <assert.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00008
9#include <arch_helpers.h>
10#include <common/debug.h>
11#include <drivers/arm/gicv3.h>
Antonio Nino Diazf13d09a2019-01-23 21:50:09 +000012#include <drivers/arm/fvp/fvp_pwrc.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000013#include <lib/mmio.h>
14#include <lib/psci/psci.h>
Antonio Nino Diazbd7b7402019-01-25 14:30:04 +000015#include <plat/arm/common/arm_config.h>
16#include <plat/arm/common/plat_arm.h>
Antonio Nino Diaza320ecd2019-01-15 14:19:50 +000017#include <platform_def.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000018
Dan Handleyed6ff952014-05-14 17:44:19 +010019#include "fvp_private.h"
Ambroise Vincentb237bca2019-02-13 15:58:00 +000020#include "../drivers/arm/gic/v3/gicv3_private.h"
Achin Gupta4f6ad662013-10-25 09:08:21 +010021
Dan Handley2b6b5742015-03-19 19:17:53 +000022
Soby Mathew7799cf72015-04-16 14:49:09 +010023#if ARM_RECOM_STATE_ID_ENC
24/*
25 * The table storing the valid idle power states. Ensure that the
26 * array entries are populated in ascending order of state-id to
27 * enable us to use binary search during power state validation.
28 * The table must be terminated by a NULL entry.
29 */
30const unsigned int arm_pm_idle_states[] = {
31 /* State-id - 0x01 */
32 arm_make_pwrstate_lvl1(ARM_LOCAL_STATE_RUN, ARM_LOCAL_STATE_RET,
33 ARM_PWR_LVL0, PSTATE_TYPE_STANDBY),
34 /* State-id - 0x02 */
35 arm_make_pwrstate_lvl1(ARM_LOCAL_STATE_RUN, ARM_LOCAL_STATE_OFF,
36 ARM_PWR_LVL0, PSTATE_TYPE_POWERDOWN),
37 /* State-id - 0x22 */
38 arm_make_pwrstate_lvl1(ARM_LOCAL_STATE_OFF, ARM_LOCAL_STATE_OFF,
39 ARM_PWR_LVL1, PSTATE_TYPE_POWERDOWN),
Soby Mathew9ca28062017-10-11 16:08:58 +010040 /* State-id - 0x222 */
41 arm_make_pwrstate_lvl2(ARM_LOCAL_STATE_OFF, ARM_LOCAL_STATE_OFF,
42 ARM_LOCAL_STATE_OFF, ARM_PWR_LVL2, PSTATE_TYPE_POWERDOWN),
Soby Mathew7799cf72015-04-16 14:49:09 +010043 0,
44};
45#endif
46
Achin Gupta4f6ad662013-10-25 09:08:21 +010047/*******************************************************************************
Achin Gupta85876392014-07-31 17:45:51 +010048 * Function which implements the common FVP specific operations to power down a
Achin Gupta85876392014-07-31 17:45:51 +010049 * cluster in response to a CPU_OFF or CPU_SUSPEND request.
50 ******************************************************************************/
Sandrine Bailleuxa64a8542015-03-05 10:54:34 +000051static void fvp_cluster_pwrdwn_common(void)
Achin Gupta85876392014-07-31 17:45:51 +010052{
53 uint64_t mpidr = read_mpidr_el1();
54
55 /* Disable coherency if this cluster is to be turned off */
Vikram Kanigirifbb13012016-02-15 11:54:14 +000056 fvp_interconnect_disable();
Achin Gupta85876392014-07-31 17:45:51 +010057
58 /* Program the power controller to turn the cluster off */
59 fvp_pwrc_write_pcoffr(mpidr);
60}
61
Soby Mathew9ca28062017-10-11 16:08:58 +010062/*
63 * Empty implementation of these hooks avoid setting the GICR_WAKER.Sleep bit
64 * on ARM GICv3 implementations on FVP. This is required, because FVP does not
65 * support SYSTEM_SUSPEND and it is `faked` in firmware. Hence, for wake up
66 * from `fake` system suspend the GIC must not be powered off.
67 */
Roberto Vargas1a6eed32018-02-12 12:36:17 +000068void arm_gicv3_distif_pre_save(unsigned int rdist_proc_num)
Soby Mathew9ca28062017-10-11 16:08:58 +010069{}
70
Roberto Vargas1a6eed32018-02-12 12:36:17 +000071void arm_gicv3_distif_post_restore(unsigned int rdist_proc_num)
Soby Mathew9ca28062017-10-11 16:08:58 +010072{}
73
Soby Mathew12012dd2015-10-26 14:01:53 +000074static void fvp_power_domain_on_finish_common(const psci_power_state_t *target_state)
75{
76 unsigned long mpidr;
77
78 assert(target_state->pwr_domain_state[ARM_PWR_LVL0] ==
79 ARM_LOCAL_STATE_OFF);
80
81 /* Get the mpidr for this cpu */
82 mpidr = read_mpidr_el1();
83
84 /* Perform the common cluster specific operations */
85 if (target_state->pwr_domain_state[ARM_PWR_LVL1] ==
86 ARM_LOCAL_STATE_OFF) {
87 /*
88 * This CPU might have woken up whilst the cluster was
89 * attempting to power down. In this case the FVP power
90 * controller will have a pending cluster power off request
91 * which needs to be cleared by writing to the PPONR register.
92 * This prevents the power controller from interpreting a
93 * subsequent entry of this cpu into a simple wfi as a power
94 * down request.
95 */
96 fvp_pwrc_write_pponr(mpidr);
97
98 /* Enable coherency if this cluster was off */
Vikram Kanigirifbb13012016-02-15 11:54:14 +000099 fvp_interconnect_enable();
Soby Mathew12012dd2015-10-26 14:01:53 +0000100 }
Soby Mathew9ca28062017-10-11 16:08:58 +0100101 /* Perform the common system specific operations */
102 if (target_state->pwr_domain_state[ARM_PWR_LVL2] ==
103 ARM_LOCAL_STATE_OFF)
104 arm_system_pwr_domain_resume();
Soby Mathew12012dd2015-10-26 14:01:53 +0000105
106 /*
107 * Clear PWKUPR.WEN bit to ensure interrupts do not interfere
108 * with a cpu power down unless the bit is set again
109 */
110 fvp_pwrc_clr_wen(mpidr);
111}
112
Achin Gupta85876392014-07-31 17:45:51 +0100113/*******************************************************************************
Soby Mathewfec4eb72015-07-01 16:16:20 +0100114 * FVP handler called when a CPU is about to enter standby.
Vikram Kanigiri3b7c59b2014-03-21 11:57:10 +0000115 ******************************************************************************/
Roberto Vargas2ca18d92018-02-12 12:36:17 +0000116static void fvp_cpu_standby(plat_local_state_t cpu_state)
Vikram Kanigiri3b7c59b2014-03-21 11:57:10 +0000117{
Alexei Fedorovd27febf2021-09-01 15:41:14 +0100118 u_register_t scr = read_scr_el3();
Soby Mathewfec4eb72015-07-01 16:16:20 +0100119
120 assert(cpu_state == ARM_LOCAL_STATE_RET);
121
Andrew Thoelke42e75a72014-04-28 12:28:39 +0100122 /*
Alexei Fedorovd27febf2021-09-01 15:41:14 +0100123 * Enable the Non-secure interrupt to wake the CPU.
124 * In GICv3 affinity routing mode, the Non-secure Group 1 interrupts
125 * use Physical FIQ at EL3 whereas in GICv2, Physical IRQ is used.
126 * Enabling both the bits works for both GICv2 mode and GICv3 affinity
127 * routing mode.
128 */
129 write_scr_el3(scr | SCR_IRQ_BIT | SCR_FIQ_BIT);
130 isb();
131
132 /*
133 * Enter standby state.
134 * dsb is good practice before using wfi to enter low power states.
Andrew Thoelke42e75a72014-04-28 12:28:39 +0100135 */
136 dsb();
Vikram Kanigiri3b7c59b2014-03-21 11:57:10 +0000137 wfi();
Alexei Fedorovd27febf2021-09-01 15:41:14 +0100138
139 /*
140 * Restore SCR_EL3 to the original value, synchronisation of SCR_EL3
141 * is done by eret in el3_exit() to save some execution cycles.
142 */
143 write_scr_el3(scr);
Vikram Kanigiri3b7c59b2014-03-21 11:57:10 +0000144}
145
146/*******************************************************************************
Soby Mathewfec4eb72015-07-01 16:16:20 +0100147 * FVP handler called when a power domain is about to be turned on. The
148 * mpidr determines the CPU to be turned on.
Achin Gupta4f6ad662013-10-25 09:08:21 +0100149 ******************************************************************************/
Roberto Vargas2ca18d92018-02-12 12:36:17 +0000150static int fvp_pwr_domain_on(u_register_t mpidr)
Achin Gupta4f6ad662013-10-25 09:08:21 +0100151{
152 int rc = PSCI_E_SUCCESS;
Achin Gupta4f6ad662013-10-25 09:08:21 +0100153 unsigned int psysr;
154
Achin Gupta4f6ad662013-10-25 09:08:21 +0100155 /*
Sandrine Bailleux7175bde2015-12-08 14:18:24 +0000156 * Ensure that we do not cancel an inflight power off request for the
157 * target cpu. That would leave it in a zombie wfi. Wait for it to power
158 * off and then program the power controller to turn that CPU on.
Achin Gupta4f6ad662013-10-25 09:08:21 +0100159 */
160 do {
161 psysr = fvp_pwrc_read_psysr(mpidr);
Sathees Balya50905c72018-10-05 13:30:59 +0100162 } while ((psysr & PSYSR_AFF_L0) != 0U);
Achin Gupta4f6ad662013-10-25 09:08:21 +0100163
Achin Gupta4f6ad662013-10-25 09:08:21 +0100164 fvp_pwrc_write_pponr(mpidr);
Achin Gupta4f6ad662013-10-25 09:08:21 +0100165 return rc;
166}
167
168/*******************************************************************************
Soby Mathewfec4eb72015-07-01 16:16:20 +0100169 * FVP handler called when a power domain is about to be turned off. The
170 * target_state encodes the power state that each level should transition to.
Achin Gupta4f6ad662013-10-25 09:08:21 +0100171 ******************************************************************************/
Roberto Vargas2ca18d92018-02-12 12:36:17 +0000172static void fvp_pwr_domain_off(const psci_power_state_t *target_state)
Achin Gupta4f6ad662013-10-25 09:08:21 +0100173{
Soby Mathewfec4eb72015-07-01 16:16:20 +0100174 assert(target_state->pwr_domain_state[ARM_PWR_LVL0] ==
175 ARM_LOCAL_STATE_OFF);
Achin Gupta4f6ad662013-10-25 09:08:21 +0100176
Achin Gupta85876392014-07-31 17:45:51 +0100177 /*
Soby Mathewfec4eb72015-07-01 16:16:20 +0100178 * If execution reaches this stage then this power domain will be
179 * suspended. Perform at least the cpu specific actions followed
180 * by the cluster specific operations if applicable.
Achin Gupta85876392014-07-31 17:45:51 +0100181 */
Jeenu Viswambharan6ad35482016-12-09 11:14:34 +0000182
183 /* Prevent interrupts from spuriously waking up this cpu */
184 plat_arm_gic_cpuif_disable();
185
186 /* Turn redistributor off */
187 plat_arm_gic_redistif_off();
188
189 /* Program the power controller to power off this cpu. */
190 fvp_pwrc_write_ppoffr(read_mpidr_el1());
Achin Gupta4f6ad662013-10-25 09:08:21 +0100191
Soby Mathewfec4eb72015-07-01 16:16:20 +0100192 if (target_state->pwr_domain_state[ARM_PWR_LVL1] ==
193 ARM_LOCAL_STATE_OFF)
Achin Gupta85876392014-07-31 17:45:51 +0100194 fvp_cluster_pwrdwn_common();
Achin Gupta4f6ad662013-10-25 09:08:21 +0100195
Achin Gupta4f6ad662013-10-25 09:08:21 +0100196}
197
198/*******************************************************************************
Soby Mathewfec4eb72015-07-01 16:16:20 +0100199 * FVP handler called when a power domain is about to be suspended. The
200 * target_state encodes the power state that each level should transition to.
Achin Gupta4f6ad662013-10-25 09:08:21 +0100201 ******************************************************************************/
Roberto Vargas2ca18d92018-02-12 12:36:17 +0000202static void fvp_pwr_domain_suspend(const psci_power_state_t *target_state)
Achin Gupta4f6ad662013-10-25 09:08:21 +0100203{
Soby Mathewffb4ab12014-09-26 15:08:52 +0100204 unsigned long mpidr;
205
Soby Mathewfec4eb72015-07-01 16:16:20 +0100206 /*
207 * FVP has retention only at cpu level. Just return
208 * as nothing is to be done for retention.
209 */
210 if (target_state->pwr_domain_state[ARM_PWR_LVL0] ==
211 ARM_LOCAL_STATE_RET)
Soby Mathew74e52a72014-10-02 16:56:51 +0100212 return;
Achin Gupta4f6ad662013-10-25 09:08:21 +0100213
Soby Mathewfec4eb72015-07-01 16:16:20 +0100214 assert(target_state->pwr_domain_state[ARM_PWR_LVL0] ==
215 ARM_LOCAL_STATE_OFF);
216
Soby Mathewffb4ab12014-09-26 15:08:52 +0100217 /* Get the mpidr for this cpu */
218 mpidr = read_mpidr_el1();
219
Achin Gupta85876392014-07-31 17:45:51 +0100220 /* Program the power controller to enable wakeup interrupts. */
221 fvp_pwrc_set_wen(mpidr);
Achin Gupta4f6ad662013-10-25 09:08:21 +0100222
Jeenu Viswambharan6ad35482016-12-09 11:14:34 +0000223 /* Prevent interrupts from spuriously waking up this cpu */
224 plat_arm_gic_cpuif_disable();
225
226 /*
227 * The Redistributor is not powered off as it can potentially prevent
228 * wake up events reaching the CPUIF and/or might lead to losing
229 * register context.
230 */
231
Achin Gupta85876392014-07-31 17:45:51 +0100232 /* Perform the common cluster specific operations */
Soby Mathewfec4eb72015-07-01 16:16:20 +0100233 if (target_state->pwr_domain_state[ARM_PWR_LVL1] ==
234 ARM_LOCAL_STATE_OFF)
Achin Gupta85876392014-07-31 17:45:51 +0100235 fvp_cluster_pwrdwn_common();
Soby Mathew9ca28062017-10-11 16:08:58 +0100236
237 /* Perform the common system specific operations */
238 if (target_state->pwr_domain_state[ARM_PWR_LVL2] ==
239 ARM_LOCAL_STATE_OFF)
240 arm_system_pwr_domain_save();
241
242 /* Program the power controller to power off this cpu. */
243 fvp_pwrc_write_ppoffr(read_mpidr_el1());
Wing Li05364b92023-01-26 18:33:43 -0800244
Wing Li05364b92023-01-26 18:33:43 -0800245 return;
Achin Gupta4f6ad662013-10-25 09:08:21 +0100246}
247
248/*******************************************************************************
Soby Mathewfec4eb72015-07-01 16:16:20 +0100249 * FVP handler called when a power domain has just been powered on after
250 * being turned off earlier. The target_state encodes the low power state that
251 * each level has woken up from.
Achin Gupta4f6ad662013-10-25 09:08:21 +0100252 ******************************************************************************/
Roberto Vargas2ca18d92018-02-12 12:36:17 +0000253static void fvp_pwr_domain_on_finish(const psci_power_state_t *target_state)
Achin Gupta4f6ad662013-10-25 09:08:21 +0100254{
Soby Mathew12012dd2015-10-26 14:01:53 +0000255 fvp_power_domain_on_finish_common(target_state);
Achin Gupta4f6ad662013-10-25 09:08:21 +0100256
Madhukar Pappireddy2859b7d2019-06-10 16:54:36 -0500257}
258
259/*******************************************************************************
260 * FVP handler called when a power domain has just been powered on and the cpu
261 * and its cluster are fully participating in coherent transaction on the
262 * interconnect. Data cache must be enabled for CPU at this point.
263 ******************************************************************************/
264static void fvp_pwr_domain_on_finish_late(const psci_power_state_t *target_state)
265{
266 /* Program GIC per-cpu distributor or re-distributor interface */
Achin Gupta1fa7eb62015-11-03 14:18:34 +0000267 plat_arm_gic_pcpu_init();
268
Madhukar Pappireddy2859b7d2019-06-10 16:54:36 -0500269 /* Enable GIC CPU interface */
Achin Gupta1fa7eb62015-11-03 14:18:34 +0000270 plat_arm_gic_cpuif_enable();
Achin Gupta4f6ad662013-10-25 09:08:21 +0100271}
272
273/*******************************************************************************
Soby Mathewfec4eb72015-07-01 16:16:20 +0100274 * FVP handler called when a power domain has just been powered on after
275 * having been suspended earlier. The target_state encodes the low power state
276 * that each level has woken up from.
Achin Gupta4f6ad662013-10-25 09:08:21 +0100277 * TODO: At the moment we reuse the on finisher and reinitialize the secure
278 * context. Need to implement a separate suspend finisher.
279 ******************************************************************************/
Roberto Vargas2ca18d92018-02-12 12:36:17 +0000280static void fvp_pwr_domain_suspend_finish(const psci_power_state_t *target_state)
Achin Gupta4f6ad662013-10-25 09:08:21 +0100281{
Soby Mathewfec4eb72015-07-01 16:16:20 +0100282 /*
283 * Nothing to be done on waking up from retention from CPU level.
284 */
285 if (target_state->pwr_domain_state[ARM_PWR_LVL0] ==
286 ARM_LOCAL_STATE_RET)
287 return;
288
Soby Mathew12012dd2015-10-26 14:01:53 +0000289 fvp_power_domain_on_finish_common(target_state);
290
Madhukar Pappireddy2859b7d2019-06-10 16:54:36 -0500291 /* Enable GIC CPU interface */
Achin Gupta1fa7eb62015-11-03 14:18:34 +0000292 plat_arm_gic_cpuif_enable();
Achin Gupta4f6ad662013-10-25 09:08:21 +0100293}
294
Juan Castillo4dc4a472014-08-12 11:17:06 +0100295/*******************************************************************************
296 * FVP handlers to shutdown/reboot the system
297 ******************************************************************************/
298static void __dead2 fvp_system_off(void)
299{
300 /* Write the System Configuration Control Register */
Dan Handley2b6b5742015-03-19 19:17:53 +0000301 mmio_write_32(V2M_SYSREGS_BASE + V2M_SYS_CFGCTRL,
302 V2M_CFGCTRL_START |
303 V2M_CFGCTRL_RW |
304 V2M_CFGCTRL_FUNC(V2M_FUNC_SHUTDOWN));
Juan Castillo4dc4a472014-08-12 11:17:06 +0100305 wfi();
306 ERROR("FVP System Off: operation not handled.\n");
307 panic();
308}
309
310static void __dead2 fvp_system_reset(void)
311{
312 /* Write the System Configuration Control Register */
Dan Handley2b6b5742015-03-19 19:17:53 +0000313 mmio_write_32(V2M_SYSREGS_BASE + V2M_SYS_CFGCTRL,
314 V2M_CFGCTRL_START |
315 V2M_CFGCTRL_RW |
316 V2M_CFGCTRL_FUNC(V2M_FUNC_REBOOT));
Juan Castillo4dc4a472014-08-12 11:17:06 +0100317 wfi();
318 ERROR("FVP System Reset: operation not handled.\n");
319 panic();
320}
Achin Gupta4f6ad662013-10-25 09:08:21 +0100321
Jeenu Viswambharan095529a2016-08-04 09:43:15 +0100322static int fvp_node_hw_state(u_register_t target_cpu,
323 unsigned int power_level)
324{
325 unsigned int psysr;
326 int ret;
327
328 /*
329 * The format of 'power_level' is implementation-defined, but 0 must
330 * mean a CPU. We also allow 1 to denote the cluster
331 */
Sathees Balya50905c72018-10-05 13:30:59 +0100332 if ((power_level != ARM_PWR_LVL0) && (power_level != ARM_PWR_LVL1))
Jeenu Viswambharan095529a2016-08-04 09:43:15 +0100333 return PSCI_E_INVALID_PARAMS;
334
335 /*
336 * Read the status of the given MPDIR from FVP power controller. The
337 * power controller only gives us on/off status, so map that to expected
338 * return values of the PSCI call
339 */
340 psysr = fvp_pwrc_read_psysr(target_cpu);
341 if (psysr == PSYSR_INVALID)
342 return PSCI_E_INVALID_PARAMS;
343
Jonathan Wrightff957ed2018-03-14 15:24:00 +0000344 if (power_level == ARM_PWR_LVL0) {
Sathees Balya50905c72018-10-05 13:30:59 +0100345 ret = ((psysr & PSYSR_AFF_L0) != 0U) ? HW_ON : HW_OFF;
Jonathan Wrightff957ed2018-03-14 15:24:00 +0000346 } else {
347 /* power_level == ARM_PWR_LVL1 */
Sathees Balya50905c72018-10-05 13:30:59 +0100348 ret = ((psysr & PSYSR_AFF_L1) != 0U) ? HW_ON : HW_OFF;
Jeenu Viswambharan095529a2016-08-04 09:43:15 +0100349 }
350
351 return ret;
352}
353
Soby Mathew9ca28062017-10-11 16:08:58 +0100354/*
355 * The FVP doesn't truly support power management at SYSTEM power domain. The
356 * SYSTEM_SUSPEND will be down-graded to the cluster level within the platform
357 * layer. The `fake` SYSTEM_SUSPEND allows us to validate some of the driver
358 * save and restore sequences on FVP.
359 */
Roberto Vargas2ca18d92018-02-12 12:36:17 +0000360#if !ARM_BL31_IN_DRAM
361static void fvp_get_sys_suspend_power_state(psci_power_state_t *req_state)
Soby Mathew9ca28062017-10-11 16:08:58 +0100362{
363 unsigned int i;
364
365 for (i = ARM_PWR_LVL0; i <= PLAT_MAX_PWR_LVL; i++)
366 req_state->pwr_domain_state[i] = ARM_LOCAL_STATE_OFF;
Wing Libcff3652023-06-28 14:03:21 -0700367
368#if PSCI_OS_INIT_MODE
369 req_state->last_at_pwrlvl = PLAT_MAX_PWR_LVL;
370#endif
Soby Mathew9ca28062017-10-11 16:08:58 +0100371}
Roberto Vargas2ca18d92018-02-12 12:36:17 +0000372#endif
Soby Mathew9ca28062017-10-11 16:08:58 +0100373
Achin Gupta4f6ad662013-10-25 09:08:21 +0100374/*******************************************************************************
Soby Mathew9ca28062017-10-11 16:08:58 +0100375 * Handler to filter PSCI requests.
376 ******************************************************************************/
377/*
378 * The system power domain suspend is only supported only via
379 * PSCI SYSTEM_SUSPEND API. PSCI CPU_SUSPEND request to system power domain
380 * will be downgraded to the lower level.
381 */
382static int fvp_validate_power_state(unsigned int power_state,
383 psci_power_state_t *req_state)
384{
385 int rc;
386 rc = arm_validate_power_state(power_state, req_state);
387
388 /*
389 * Ensure that the system power domain level is never suspended
390 * via PSCI CPU SUSPEND API. Currently system suspend is only
391 * supported via PSCI SYSTEM SUSPEND API.
392 */
393 req_state->pwr_domain_state[ARM_PWR_LVL2] = ARM_LOCAL_STATE_RUN;
394 return rc;
395}
396
397/*
398 * Custom `translate_power_state_by_mpidr` handler for FVP. Unlike in the
399 * `fvp_validate_power_state`, we do not downgrade the system power
400 * domain level request in `power_state` as it will be used to query the
401 * PSCI_STAT_COUNT/RESIDENCY at the system power domain level.
402 */
403static int fvp_translate_power_state_by_mpidr(u_register_t mpidr,
404 unsigned int power_state,
405 psci_power_state_t *output_state)
406{
407 return arm_validate_power_state(power_state, output_state);
408}
409
410/*******************************************************************************
Soby Mathewfeac8fc2015-09-29 15:47:16 +0100411 * Export the platform handlers via plat_arm_psci_pm_ops. The ARM Standard
412 * platform layer will take care of registering the handlers with PSCI.
Achin Gupta4f6ad662013-10-25 09:08:21 +0100413 ******************************************************************************/
Soby Mathew0b4c5a32016-10-21 17:51:22 +0100414plat_psci_ops_t plat_arm_psci_pm_ops = {
Soby Mathewfec4eb72015-07-01 16:16:20 +0100415 .cpu_standby = fvp_cpu_standby,
416 .pwr_domain_on = fvp_pwr_domain_on,
417 .pwr_domain_off = fvp_pwr_domain_off,
418 .pwr_domain_suspend = fvp_pwr_domain_suspend,
419 .pwr_domain_on_finish = fvp_pwr_domain_on_finish,
Madhukar Pappireddy2859b7d2019-06-10 16:54:36 -0500420 .pwr_domain_on_finish_late = fvp_pwr_domain_on_finish_late,
Soby Mathewfec4eb72015-07-01 16:16:20 +0100421 .pwr_domain_suspend_finish = fvp_pwr_domain_suspend_finish,
Juan Castillo4dc4a472014-08-12 11:17:06 +0100422 .system_off = fvp_system_off,
Soby Mathew74e52a72014-10-02 16:56:51 +0100423 .system_reset = fvp_system_reset,
Soby Mathew9ca28062017-10-11 16:08:58 +0100424 .validate_power_state = fvp_validate_power_state,
Jeenu Viswambharan59424d82017-09-19 09:27:18 +0100425 .validate_ns_entrypoint = arm_validate_psci_entrypoint,
Soby Mathew9ca28062017-10-11 16:08:58 +0100426 .translate_power_state_by_mpidr = fvp_translate_power_state_by_mpidr,
Roberto Vargasa1c16b62017-08-03 09:16:43 +0100427 .get_node_hw_state = fvp_node_hw_state,
Antonio Nino Diaz0b6af832017-11-22 12:00:44 +0000428#if !ARM_BL31_IN_DRAM
429 /*
430 * The TrustZone Controller is set up during the warmboot sequence after
431 * resuming the CPU from a SYSTEM_SUSPEND. If BL31 is located in SRAM
432 * this is not a problem but, if it is in TZC-secured DRAM, it tries to
433 * reconfigure the same memory it is running on, causing an exception.
434 */
Soby Mathew9ca28062017-10-11 16:08:58 +0100435 .get_sys_suspend_power_state = fvp_get_sys_suspend_power_state,
Antonio Nino Diaz0b6af832017-11-22 12:00:44 +0000436#endif
Roberto Vargasa1c16b62017-08-03 09:16:43 +0100437 .mem_protect_chk = arm_psci_mem_protect_chk,
438 .read_mem_protect = arm_psci_read_mem_protect,
439 .write_mem_protect = arm_nor_psci_write_mem_protect,
Achin Gupta4f6ad662013-10-25 09:08:21 +0100440};
Chandni Cherukurie4bf6a02018-11-14 13:43:59 +0530441
442const plat_psci_ops_t *plat_arm_psci_override_pm_ops(plat_psci_ops_t *ops)
443{
444 return ops;
445}