xref: /rk3399_ARM-atf/include/lib/psci/psci.h (revision 2bd3b39767019a2c49f4d6b0d8d316dfe8e1e6b7)
1532ed618SSoby Mathew /*
2*2bd3b397SBoyan Karatotev  * Copyright (c) 2013-2024, Arm Limited and Contributors. All rights reserved.
36cf4ae97SVarun Wadekar  * Copyright (c) 2023, NVIDIA Corporation. All rights reserved.
4532ed618SSoby Mathew  *
582cb2c1aSdp-arm  * SPDX-License-Identifier: BSD-3-Clause
6532ed618SSoby Mathew  */
7532ed618SSoby Mathew 
897373c33SAntonio Nino Diaz #ifndef PSCI_H
997373c33SAntonio Nino Diaz #define PSCI_H
10532ed618SSoby Mathew 
11532ed618SSoby Mathew #include <platform_def.h>	/* for PLAT_NUM_PWR_DOMAINS */
1209d40e0eSAntonio Nino Diaz 
1309d40e0eSAntonio Nino Diaz #include <common/bl_common.h>
1409d40e0eSAntonio Nino Diaz #include <lib/bakery_lock.h>
1509d40e0eSAntonio Nino Diaz #include <lib/psci/psci_lib.h>	/* To maintain compatibility for SPDs */
1609d40e0eSAntonio Nino Diaz #include <lib/utils_def.h>
17532ed618SSoby Mathew 
18532ed618SSoby Mathew /*******************************************************************************
19532ed618SSoby Mathew  * Number of power domains whose state this PSCI implementation can track
20532ed618SSoby Mathew  ******************************************************************************/
21532ed618SSoby Mathew #ifdef PLAT_NUM_PWR_DOMAINS
22532ed618SSoby Mathew #define PSCI_NUM_PWR_DOMAINS	PLAT_NUM_PWR_DOMAINS
23532ed618SSoby Mathew #else
245b33ad17SDeepika Bhavnani #define PSCI_NUM_PWR_DOMAINS	(U(2) * PLATFORM_CORE_COUNT)
25532ed618SSoby Mathew #endif
26532ed618SSoby Mathew 
27532ed618SSoby Mathew #define PSCI_NUM_NON_CPU_PWR_DOMAINS	(PSCI_NUM_PWR_DOMAINS - \
28532ed618SSoby Mathew 					 PLATFORM_CORE_COUNT)
29532ed618SSoby Mathew 
30532ed618SSoby Mathew /* This is the power level corresponding to a CPU */
311083b2b3SAntonio Nino Diaz #define PSCI_CPU_PWR_LVL	U(0)
32532ed618SSoby Mathew 
33532ed618SSoby Mathew /*
34532ed618SSoby Mathew  * The maximum power level supported by PSCI. Since PSCI CPU_SUSPEND
35532ed618SSoby Mathew  * uses the old power_state parameter format which has 2 bits to specify the
36532ed618SSoby Mathew  * power level, this constant is defined to be 3.
37532ed618SSoby Mathew  */
38030567e6SVarun Wadekar #define PSCI_MAX_PWR_LVL	U(3)
39532ed618SSoby Mathew 
40532ed618SSoby Mathew /*******************************************************************************
41532ed618SSoby Mathew  * Defines for runtime services function ids
42532ed618SSoby Mathew  ******************************************************************************/
43030567e6SVarun Wadekar #define PSCI_VERSION			U(0x84000000)
44030567e6SVarun Wadekar #define PSCI_CPU_SUSPEND_AARCH32	U(0x84000001)
45030567e6SVarun Wadekar #define PSCI_CPU_SUSPEND_AARCH64	U(0xc4000001)
46030567e6SVarun Wadekar #define PSCI_CPU_OFF			U(0x84000002)
47030567e6SVarun Wadekar #define PSCI_CPU_ON_AARCH32		U(0x84000003)
48030567e6SVarun Wadekar #define PSCI_CPU_ON_AARCH64		U(0xc4000003)
49030567e6SVarun Wadekar #define PSCI_AFFINITY_INFO_AARCH32	U(0x84000004)
50030567e6SVarun Wadekar #define PSCI_AFFINITY_INFO_AARCH64	U(0xc4000004)
51030567e6SVarun Wadekar #define PSCI_MIG_AARCH32		U(0x84000005)
52030567e6SVarun Wadekar #define PSCI_MIG_AARCH64		U(0xc4000005)
53030567e6SVarun Wadekar #define PSCI_MIG_INFO_TYPE		U(0x84000006)
54030567e6SVarun Wadekar #define PSCI_MIG_INFO_UP_CPU_AARCH32	U(0x84000007)
55030567e6SVarun Wadekar #define PSCI_MIG_INFO_UP_CPU_AARCH64	U(0xc4000007)
56030567e6SVarun Wadekar #define PSCI_SYSTEM_OFF			U(0x84000008)
57030567e6SVarun Wadekar #define PSCI_SYSTEM_RESET		U(0x84000009)
58030567e6SVarun Wadekar #define PSCI_FEATURES			U(0x8400000A)
59030567e6SVarun Wadekar #define PSCI_NODE_HW_STATE_AARCH32	U(0x8400000d)
60030567e6SVarun Wadekar #define PSCI_NODE_HW_STATE_AARCH64	U(0xc400000d)
61030567e6SVarun Wadekar #define PSCI_SYSTEM_SUSPEND_AARCH32	U(0x8400000E)
62030567e6SVarun Wadekar #define PSCI_SYSTEM_SUSPEND_AARCH64	U(0xc400000E)
63b88a4416SWing Li #define PSCI_SET_SUSPEND_MODE		U(0x8400000F)
64030567e6SVarun Wadekar #define PSCI_STAT_RESIDENCY_AARCH32	U(0x84000010)
65030567e6SVarun Wadekar #define PSCI_STAT_RESIDENCY_AARCH64	U(0xc4000010)
66030567e6SVarun Wadekar #define PSCI_STAT_COUNT_AARCH32		U(0x84000011)
67030567e6SVarun Wadekar #define PSCI_STAT_COUNT_AARCH64		U(0xc4000011)
6836a8f8fdSRoberto Vargas #define PSCI_SYSTEM_RESET2_AARCH32	U(0x84000012)
6936a8f8fdSRoberto Vargas #define PSCI_SYSTEM_RESET2_AARCH64	U(0xc4000012)
70d4c596beSRoberto Vargas #define PSCI_MEM_PROTECT		U(0x84000013)
71d4c596beSRoberto Vargas #define PSCI_MEM_CHK_RANGE_AARCH32	U(0x84000014)
72d4c596beSRoberto Vargas #define PSCI_MEM_CHK_RANGE_AARCH64	U(0xc4000014)
73532ed618SSoby Mathew 
74532ed618SSoby Mathew /*
75532ed618SSoby Mathew  * Number of PSCI calls (above) implemented
76532ed618SSoby Mathew  */
77532ed618SSoby Mathew #if ENABLE_PSCI_STAT
78b88a4416SWing Li #if PSCI_OS_INIT_MODE
79b88a4416SWing Li #define PSCI_NUM_CALLS			U(30)
80532ed618SSoby Mathew #else
81b88a4416SWing Li #define PSCI_NUM_CALLS			U(29)
82b88a4416SWing Li #endif
83b88a4416SWing Li #else
84b88a4416SWing Li #if PSCI_OS_INIT_MODE
85b88a4416SWing Li #define PSCI_NUM_CALLS			U(26)
86b88a4416SWing Li #else
87b88a4416SWing Li #define PSCI_NUM_CALLS			U(25)
88b88a4416SWing Li #endif
89532ed618SSoby Mathew #endif
90532ed618SSoby Mathew 
91cf0b1492SSoby Mathew /* The macros below are used to identify PSCI calls from the SMC function ID */
92030567e6SVarun Wadekar #define PSCI_FID_MASK			U(0xffe0)
93030567e6SVarun Wadekar #define PSCI_FID_VALUE			U(0)
94cf0b1492SSoby Mathew #define is_psci_fid(_fid) \
95cf0b1492SSoby Mathew 	(((_fid) & PSCI_FID_MASK) == PSCI_FID_VALUE)
96cf0b1492SSoby Mathew 
97532ed618SSoby Mathew /*******************************************************************************
98532ed618SSoby Mathew  * PSCI Migrate and friends
99532ed618SSoby Mathew  ******************************************************************************/
1001083b2b3SAntonio Nino Diaz #define PSCI_TOS_UP_MIG_CAP	0
1011083b2b3SAntonio Nino Diaz #define PSCI_TOS_NOT_UP_MIG_CAP	1
1021083b2b3SAntonio Nino Diaz #define PSCI_TOS_NOT_PRESENT_MP	2
103532ed618SSoby Mathew 
104532ed618SSoby Mathew /*******************************************************************************
105532ed618SSoby Mathew  * PSCI CPU_SUSPEND 'power_state' parameter specific defines
106532ed618SSoby Mathew  ******************************************************************************/
107030567e6SVarun Wadekar #define PSTATE_ID_SHIFT		U(0)
108532ed618SSoby Mathew 
109532ed618SSoby Mathew #if PSCI_EXTENDED_STATE_ID
110030567e6SVarun Wadekar #define PSTATE_VALID_MASK	U(0xB0000000)
111030567e6SVarun Wadekar #define PSTATE_TYPE_SHIFT	U(30)
112030567e6SVarun Wadekar #define PSTATE_ID_MASK		U(0xfffffff)
113532ed618SSoby Mathew #else
114030567e6SVarun Wadekar #define PSTATE_VALID_MASK	U(0xFCFE0000)
115030567e6SVarun Wadekar #define PSTATE_TYPE_SHIFT	U(16)
116030567e6SVarun Wadekar #define PSTATE_PWR_LVL_SHIFT	U(24)
117030567e6SVarun Wadekar #define PSTATE_ID_MASK		U(0xffff)
118030567e6SVarun Wadekar #define PSTATE_PWR_LVL_MASK	U(0x3)
119532ed618SSoby Mathew 
120532ed618SSoby Mathew #define psci_get_pstate_pwrlvl(pstate)	(((pstate) >> PSTATE_PWR_LVL_SHIFT) & \
121532ed618SSoby Mathew 					PSTATE_PWR_LVL_MASK)
122532ed618SSoby Mathew #define psci_make_powerstate(state_id, type, pwrlvl) \
123532ed618SSoby Mathew 			(((state_id) & PSTATE_ID_MASK) << PSTATE_ID_SHIFT) |\
124532ed618SSoby Mathew 			(((type) & PSTATE_TYPE_MASK) << PSTATE_TYPE_SHIFT) |\
125532ed618SSoby Mathew 			(((pwrlvl) & PSTATE_PWR_LVL_MASK) << PSTATE_PWR_LVL_SHIFT)
126532ed618SSoby Mathew #endif /* __PSCI_EXTENDED_STATE_ID__ */
127532ed618SSoby Mathew 
128030567e6SVarun Wadekar #define PSTATE_TYPE_STANDBY	U(0x0)
129030567e6SVarun Wadekar #define PSTATE_TYPE_POWERDOWN	U(0x1)
130030567e6SVarun Wadekar #define PSTATE_TYPE_MASK	U(0x1)
131532ed618SSoby Mathew 
132532ed618SSoby Mathew /*******************************************************************************
133532ed618SSoby Mathew  * PSCI CPU_FEATURES feature flag specific defines
134532ed618SSoby Mathew  ******************************************************************************/
135532ed618SSoby Mathew /* Features flags for CPU SUSPEND power state parameter format. Bits [1:1] */
136030567e6SVarun Wadekar #define FF_PSTATE_SHIFT		U(1)
137030567e6SVarun Wadekar #define FF_PSTATE_ORIG		U(0)
138030567e6SVarun Wadekar #define FF_PSTATE_EXTENDED	U(1)
139532ed618SSoby Mathew #if PSCI_EXTENDED_STATE_ID
140532ed618SSoby Mathew #define FF_PSTATE		FF_PSTATE_EXTENDED
141532ed618SSoby Mathew #else
142532ed618SSoby Mathew #define FF_PSTATE		FF_PSTATE_ORIG
143532ed618SSoby Mathew #endif
144532ed618SSoby Mathew 
145532ed618SSoby Mathew /* Features flags for CPU SUSPEND OS Initiated mode support. Bits [0:0] */
146030567e6SVarun Wadekar #define FF_MODE_SUPPORT_SHIFT		U(0)
1479a70e69eSWing Li #if PSCI_OS_INIT_MODE
148030567e6SVarun Wadekar #define FF_SUPPORTS_OS_INIT_MODE	U(1)
1499a70e69eSWing Li #else
1509a70e69eSWing Li #define FF_SUPPORTS_OS_INIT_MODE	U(0)
1519a70e69eSWing Li #endif
152532ed618SSoby Mathew 
153532ed618SSoby Mathew /*******************************************************************************
154532ed618SSoby Mathew  * PSCI version
155532ed618SSoby Mathew  ******************************************************************************/
156030567e6SVarun Wadekar #define PSCI_MAJOR_VER		(U(1) << 16)
157829e97d7SRoberto Vargas #define PSCI_MINOR_VER		U(0x1)
158532ed618SSoby Mathew 
159532ed618SSoby Mathew /*******************************************************************************
160532ed618SSoby Mathew  * PSCI error codes
161532ed618SSoby Mathew  ******************************************************************************/
162532ed618SSoby Mathew #define PSCI_E_SUCCESS		0
163532ed618SSoby Mathew #define PSCI_E_NOT_SUPPORTED	-1
164532ed618SSoby Mathew #define PSCI_E_INVALID_PARAMS	-2
165532ed618SSoby Mathew #define PSCI_E_DENIED		-3
166532ed618SSoby Mathew #define PSCI_E_ALREADY_ON	-4
167532ed618SSoby Mathew #define PSCI_E_ON_PENDING	-5
168532ed618SSoby Mathew #define PSCI_E_INTERN_FAIL	-6
169532ed618SSoby Mathew #define PSCI_E_NOT_PRESENT	-7
170532ed618SSoby Mathew #define PSCI_E_DISABLED		-8
171532ed618SSoby Mathew #define PSCI_E_INVALID_ADDRESS	-9
172532ed618SSoby Mathew 
173532ed618SSoby Mathew #define PSCI_INVALID_MPIDR	~((u_register_t)0)
174532ed618SSoby Mathew 
17536a8f8fdSRoberto Vargas /*
17636a8f8fdSRoberto Vargas  * SYSTEM_RESET2 macros
17736a8f8fdSRoberto Vargas  */
1781083b2b3SAntonio Nino Diaz #define PSCI_RESET2_TYPE_VENDOR_SHIFT	U(31)
1791083b2b3SAntonio Nino Diaz #define PSCI_RESET2_TYPE_VENDOR		(U(1) << PSCI_RESET2_TYPE_VENDOR_SHIFT)
1801083b2b3SAntonio Nino Diaz #define PSCI_RESET2_TYPE_ARCH		(U(0) << PSCI_RESET2_TYPE_VENDOR_SHIFT)
1811083b2b3SAntonio Nino Diaz #define PSCI_RESET2_SYSTEM_WARM_RESET	(PSCI_RESET2_TYPE_ARCH | U(0))
18236a8f8fdSRoberto Vargas 
183d5dfdeb6SJulius Werner #ifndef __ASSEMBLER__
184532ed618SSoby Mathew 
185532ed618SSoby Mathew #include <stdint.h>
186532ed618SSoby Mathew 
18797373c33SAntonio Nino Diaz /* Function to help build the psci capabilities bitfield */
18897373c33SAntonio Nino Diaz 
18997373c33SAntonio Nino Diaz static inline unsigned int define_psci_cap(unsigned int x)
19097373c33SAntonio Nino Diaz {
19197373c33SAntonio Nino Diaz 	return U(1) << (x & U(0x1f));
19297373c33SAntonio Nino Diaz }
19397373c33SAntonio Nino Diaz 
19497373c33SAntonio Nino Diaz 
19597373c33SAntonio Nino Diaz /* Power state helper functions */
19697373c33SAntonio Nino Diaz 
19797373c33SAntonio Nino Diaz static inline unsigned int psci_get_pstate_id(unsigned int power_state)
19897373c33SAntonio Nino Diaz {
19997373c33SAntonio Nino Diaz 	return ((power_state) >> PSTATE_ID_SHIFT) & PSTATE_ID_MASK;
20097373c33SAntonio Nino Diaz }
20197373c33SAntonio Nino Diaz 
20297373c33SAntonio Nino Diaz static inline unsigned int psci_get_pstate_type(unsigned int power_state)
20397373c33SAntonio Nino Diaz {
20497373c33SAntonio Nino Diaz 	return ((power_state) >> PSTATE_TYPE_SHIFT) & PSTATE_TYPE_MASK;
20597373c33SAntonio Nino Diaz }
20697373c33SAntonio Nino Diaz 
20797373c33SAntonio Nino Diaz static inline unsigned int psci_check_power_state(unsigned int power_state)
20897373c33SAntonio Nino Diaz {
20997373c33SAntonio Nino Diaz 	return ((power_state) & PSTATE_VALID_MASK);
21097373c33SAntonio Nino Diaz }
21197373c33SAntonio Nino Diaz 
212532ed618SSoby Mathew /*
213532ed618SSoby Mathew  * These are the states reported by the PSCI_AFFINITY_INFO API for the specified
214532ed618SSoby Mathew  * CPU. The definitions of these states can be found in Section 5.7.1 in the
215532ed618SSoby Mathew  * PSCI specification (ARM DEN 0022C).
216532ed618SSoby Mathew  */
217532ed618SSoby Mathew typedef enum {
218030567e6SVarun Wadekar 	AFF_STATE_ON = U(0),
219030567e6SVarun Wadekar 	AFF_STATE_OFF = U(1),
220030567e6SVarun Wadekar 	AFF_STATE_ON_PENDING = U(2)
221532ed618SSoby Mathew } aff_info_state_t;
222532ed618SSoby Mathew 
223532ed618SSoby Mathew /*
22428d3d614SJeenu Viswambharan  * These are the power states reported by PSCI_NODE_HW_STATE API for the
22528d3d614SJeenu Viswambharan  * specified CPU. The definitions of these states can be found in Section 5.15.3
22628d3d614SJeenu Viswambharan  * of PSCI specification (ARM DEN 0022C).
22728d3d614SJeenu Viswambharan  */
2281083b2b3SAntonio Nino Diaz #define HW_ON		0
2291083b2b3SAntonio Nino Diaz #define HW_OFF		1
2301083b2b3SAntonio Nino Diaz #define HW_STANDBY	2
23128d3d614SJeenu Viswambharan 
23228d3d614SJeenu Viswambharan /*
233532ed618SSoby Mathew  * Macro to represent invalid affinity level within PSCI.
234532ed618SSoby Mathew  */
235030567e6SVarun Wadekar #define PSCI_INVALID_PWR_LVL	(PLAT_MAX_PWR_LVL + U(1))
236532ed618SSoby Mathew 
237532ed618SSoby Mathew /*
238532ed618SSoby Mathew  * Type for representing the local power state at a particular level.
239532ed618SSoby Mathew  */
240532ed618SSoby Mathew typedef uint8_t plat_local_state_t;
241532ed618SSoby Mathew 
242532ed618SSoby Mathew /* The local state macro used to represent RUN state. */
243030567e6SVarun Wadekar #define PSCI_LOCAL_STATE_RUN	U(0)
244532ed618SSoby Mathew 
245532ed618SSoby Mathew /*
24697373c33SAntonio Nino Diaz  * Function to test whether the plat_local_state is RUN state
247532ed618SSoby Mathew  */
24897373c33SAntonio Nino Diaz static inline int is_local_state_run(unsigned int plat_local_state)
24997373c33SAntonio Nino Diaz {
25097373c33SAntonio Nino Diaz 	return (plat_local_state == PSCI_LOCAL_STATE_RUN) ? 1 : 0;
25197373c33SAntonio Nino Diaz }
252532ed618SSoby Mathew 
253532ed618SSoby Mathew /*
25497373c33SAntonio Nino Diaz  * Function to test whether the plat_local_state is RETENTION state
255532ed618SSoby Mathew  */
25697373c33SAntonio Nino Diaz static inline int is_local_state_retn(unsigned int plat_local_state)
25797373c33SAntonio Nino Diaz {
25897373c33SAntonio Nino Diaz 	return ((plat_local_state > PSCI_LOCAL_STATE_RUN) &&
25997373c33SAntonio Nino Diaz 		(plat_local_state <= PLAT_MAX_RET_STATE)) ? 1 : 0;
26097373c33SAntonio Nino Diaz }
261532ed618SSoby Mathew 
262532ed618SSoby Mathew /*
26397373c33SAntonio Nino Diaz  * Function to test whether the plat_local_state is OFF state
264532ed618SSoby Mathew  */
26597373c33SAntonio Nino Diaz static inline int is_local_state_off(unsigned int plat_local_state)
26697373c33SAntonio Nino Diaz {
26797373c33SAntonio Nino Diaz 	return ((plat_local_state > PLAT_MAX_RET_STATE) &&
26897373c33SAntonio Nino Diaz 		(plat_local_state <= PLAT_MAX_OFF_STATE)) ? 1 : 0;
26997373c33SAntonio Nino Diaz }
270532ed618SSoby Mathew 
271532ed618SSoby Mathew /*****************************************************************************
272532ed618SSoby Mathew  * This data structure defines the representation of the power state parameter
273532ed618SSoby Mathew  * for its exchange between the generic PSCI code and the platform port. For
274532ed618SSoby Mathew  * example, it is used by the platform port to specify the requested power
275532ed618SSoby Mathew  * states during a power management operation. It is used by the generic code to
276532ed618SSoby Mathew  * inform the platform about the target power states that each level should
277532ed618SSoby Mathew  * enter.
278532ed618SSoby Mathew  ****************************************************************************/
279532ed618SSoby Mathew typedef struct psci_power_state {
280532ed618SSoby Mathew 	/*
281532ed618SSoby Mathew 	 * The pwr_domain_state[] stores the local power state at each level
282532ed618SSoby Mathew 	 * for the CPU.
283532ed618SSoby Mathew 	 */
284030567e6SVarun Wadekar 	plat_local_state_t pwr_domain_state[PLAT_MAX_PWR_LVL + U(1)];
285606b7430SWing Li #if PSCI_OS_INIT_MODE
286606b7430SWing Li 	/*
287606b7430SWing Li 	 * The highest power level at which the current CPU is the last running
288606b7430SWing Li 	 * CPU.
289606b7430SWing Li 	 */
290606b7430SWing Li 	unsigned int last_at_pwrlvl;
291606b7430SWing Li #endif
292532ed618SSoby Mathew } psci_power_state_t;
293532ed618SSoby Mathew 
294532ed618SSoby Mathew /*******************************************************************************
295532ed618SSoby Mathew  * Structure used to store per-cpu information relevant to the PSCI service.
296532ed618SSoby Mathew  * It is populated in the per-cpu data array. In return we get a guarantee that
297532ed618SSoby Mathew  * this information will not reside on a cache line shared with another cpu.
298532ed618SSoby Mathew  ******************************************************************************/
299532ed618SSoby Mathew typedef struct psci_cpu_data {
300532ed618SSoby Mathew 	/* State as seen by PSCI Affinity Info API */
301532ed618SSoby Mathew 	aff_info_state_t aff_info_state;
302532ed618SSoby Mathew 
303532ed618SSoby Mathew 	/*
304532ed618SSoby Mathew 	 * Highest power level which takes part in a power management
3050c836554SBoyan Karatotev 	 * operation. May be lower while the core is in suspend state.
306532ed618SSoby Mathew 	 */
3071083b2b3SAntonio Nino Diaz 	unsigned int target_pwrlvl;
308532ed618SSoby Mathew 
309532ed618SSoby Mathew 	/* The local power state of this CPU */
310532ed618SSoby Mathew 	plat_local_state_t local_state;
311532ed618SSoby Mathew } psci_cpu_data_t;
312532ed618SSoby Mathew 
313532ed618SSoby Mathew /*******************************************************************************
314532ed618SSoby Mathew  * Structure populated by platform specific code to export routines which
315532ed618SSoby Mathew  * perform common low level power management functions
316532ed618SSoby Mathew  ******************************************************************************/
317532ed618SSoby Mathew typedef struct plat_psci_ops {
318532ed618SSoby Mathew 	void (*cpu_standby)(plat_local_state_t cpu_state);
319532ed618SSoby Mathew 	int (*pwr_domain_on)(u_register_t mpidr);
320532ed618SSoby Mathew 	void (*pwr_domain_off)(const psci_power_state_t *target_state);
3216cf4ae97SVarun Wadekar 	int (*pwr_domain_off_early)(const psci_power_state_t *target_state);
322d3488614SWing Li #if PSCI_OS_INIT_MODE
323d3488614SWing Li 	int (*pwr_domain_validate_suspend)(
324d3488614SWing Li 				const psci_power_state_t *target_state);
325d3488614SWing Li #endif
3261862d620SVarun Wadekar 	void (*pwr_domain_suspend_pwrdown_early)(
3271862d620SVarun Wadekar 				const psci_power_state_t *target_state);
328532ed618SSoby Mathew 	void (*pwr_domain_suspend)(const psci_power_state_t *target_state);
329532ed618SSoby Mathew 	void (*pwr_domain_on_finish)(const psci_power_state_t *target_state);
33010107707SMadhukar Pappireddy 	void (*pwr_domain_on_finish_late)(
33110107707SMadhukar Pappireddy 				const psci_power_state_t *target_state);
332532ed618SSoby Mathew 	void (*pwr_domain_suspend_finish)(
333532ed618SSoby Mathew 				const psci_power_state_t *target_state);
3343c471c35SYann Gautier 	void __dead2 (*pwr_domain_pwr_down_wfi)(
3353c471c35SYann Gautier 				const psci_power_state_t *target_state);
3363c471c35SYann Gautier 	void __dead2 (*system_off)(void);
3373c471c35SYann Gautier 	void __dead2 (*system_reset)(void);
338532ed618SSoby Mathew 	int (*validate_power_state)(unsigned int power_state,
339532ed618SSoby Mathew 				    psci_power_state_t *req_state);
340532ed618SSoby Mathew 	int (*validate_ns_entrypoint)(uintptr_t ns_entrypoint);
341532ed618SSoby Mathew 	void (*get_sys_suspend_power_state)(
342532ed618SSoby Mathew 				    psci_power_state_t *req_state);
343532ed618SSoby Mathew 	int (*get_pwr_lvl_state_idx)(plat_local_state_t pwr_domain_state,
344532ed618SSoby Mathew 				    int pwrlvl);
345532ed618SSoby Mathew 	int (*translate_power_state_by_mpidr)(u_register_t mpidr,
346532ed618SSoby Mathew 				    unsigned int power_state,
347532ed618SSoby Mathew 				    psci_power_state_t *output_state);
34828d3d614SJeenu Viswambharan 	int (*get_node_hw_state)(u_register_t mpidr, unsigned int power_level);
349d4c596beSRoberto Vargas 	int (*mem_protect_chk)(uintptr_t base, u_register_t length);
350d4c596beSRoberto Vargas 	int (*read_mem_protect)(int *val);
351d4c596beSRoberto Vargas 	int (*write_mem_protect)(int val);
35236a8f8fdSRoberto Vargas 	int (*system_reset2)(int is_vendor,
35336a8f8fdSRoberto Vargas 				int reset_type, u_register_t cookie);
354532ed618SSoby Mathew } plat_psci_ops_t;
355532ed618SSoby Mathew 
356532ed618SSoby Mathew /*******************************************************************************
357532ed618SSoby Mathew  * Function & Data prototypes
358532ed618SSoby Mathew  ******************************************************************************/
359532ed618SSoby Mathew unsigned int psci_version(void);
360532ed618SSoby Mathew int psci_cpu_on(u_register_t target_cpu,
361532ed618SSoby Mathew 		uintptr_t entrypoint,
362532ed618SSoby Mathew 		u_register_t context_id);
363532ed618SSoby Mathew int psci_cpu_suspend(unsigned int power_state,
364532ed618SSoby Mathew 		     uintptr_t entrypoint,
365532ed618SSoby Mathew 		     u_register_t context_id);
366532ed618SSoby Mathew int psci_system_suspend(uintptr_t entrypoint, u_register_t context_id);
367532ed618SSoby Mathew int psci_cpu_off(void);
368532ed618SSoby Mathew int psci_affinity_info(u_register_t target_affinity,
369532ed618SSoby Mathew 		       unsigned int lowest_affinity_level);
370532ed618SSoby Mathew int psci_migrate(u_register_t target_cpu);
371532ed618SSoby Mathew int psci_migrate_info_type(void);
3726b7b0f36SAntonio Nino Diaz u_register_t psci_migrate_info_up_cpu(void);
37328d3d614SJeenu Viswambharan int psci_node_hw_state(u_register_t target_cpu,
37428d3d614SJeenu Viswambharan 		       unsigned int power_level);
375532ed618SSoby Mathew int psci_features(unsigned int psci_fid);
376b88a4416SWing Li #if PSCI_OS_INIT_MODE
377b88a4416SWing Li int psci_set_suspend_mode(unsigned int mode);
378b88a4416SWing Li #endif
379*2bd3b397SBoyan Karatotev void psci_power_down_wfi(void);
380cf0b1492SSoby Mathew void psci_arch_setup(void);
381cf0b1492SSoby Mathew 
382d5dfdeb6SJulius Werner #endif /*__ASSEMBLER__*/
383532ed618SSoby Mathew 
38497373c33SAntonio Nino Diaz #endif /* PSCI_H */
385