xref: /rk3399_ARM-atf/lib/psci/psci_private.h (revision b88a4416b5e5f2bda2240c632ba79e15a9a75c45)
1532ed618SSoby Mathew /*
2aea4ccf8SHarrison Mutai  * Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved.
3532ed618SSoby Mathew  *
482cb2c1aSdp-arm  * SPDX-License-Identifier: BSD-3-Clause
5532ed618SSoby Mathew  */
6532ed618SSoby Mathew 
797373c33SAntonio Nino Diaz #ifndef PSCI_PRIVATE_H
897373c33SAntonio Nino Diaz #define PSCI_PRIVATE_H
9532ed618SSoby Mathew 
1009d40e0eSAntonio Nino Diaz #include <stdbool.h>
1109d40e0eSAntonio Nino Diaz 
12532ed618SSoby Mathew #include <arch.h>
134829df83SAntonio Nino Diaz #include <arch_helpers.h>
1409d40e0eSAntonio Nino Diaz #include <common/bl_common.h>
1509d40e0eSAntonio Nino Diaz #include <lib/bakery_lock.h>
1609d40e0eSAntonio Nino Diaz #include <lib/el3_runtime/cpu_data.h>
1709d40e0eSAntonio Nino Diaz #include <lib/psci/psci.h>
1809d40e0eSAntonio Nino Diaz #include <lib/spinlock.h>
19532ed618SSoby Mathew 
20532ed618SSoby Mathew /*
21532ed618SSoby Mathew  * The PSCI capability which are provided by the generic code but does not
22532ed618SSoby Mathew  * depend on the platform or spd capabilities.
23532ed618SSoby Mathew  */
24532ed618SSoby Mathew #define PSCI_GENERIC_CAP	\
25532ed618SSoby Mathew 			(define_psci_cap(PSCI_VERSION) |		\
26532ed618SSoby Mathew 			define_psci_cap(PSCI_AFFINITY_INFO_AARCH64) |	\
27532ed618SSoby Mathew 			define_psci_cap(PSCI_FEATURES))
28532ed618SSoby Mathew 
29532ed618SSoby Mathew /*
30532ed618SSoby Mathew  * The PSCI capabilities mask for 64 bit functions.
31532ed618SSoby Mathew  */
32532ed618SSoby Mathew #define PSCI_CAP_64BIT_MASK	\
33532ed618SSoby Mathew 			(define_psci_cap(PSCI_CPU_SUSPEND_AARCH64) |	\
34532ed618SSoby Mathew 			define_psci_cap(PSCI_CPU_ON_AARCH64) |		\
35532ed618SSoby Mathew 			define_psci_cap(PSCI_AFFINITY_INFO_AARCH64) |	\
36532ed618SSoby Mathew 			define_psci_cap(PSCI_MIG_AARCH64) |		\
37532ed618SSoby Mathew 			define_psci_cap(PSCI_MIG_INFO_UP_CPU_AARCH64) |	\
3828d3d614SJeenu Viswambharan 			define_psci_cap(PSCI_NODE_HW_STATE_AARCH64) |	\
39532ed618SSoby Mathew 			define_psci_cap(PSCI_SYSTEM_SUSPEND_AARCH64) |	\
40532ed618SSoby Mathew 			define_psci_cap(PSCI_STAT_RESIDENCY_AARCH64) |	\
4136a8f8fdSRoberto Vargas 			define_psci_cap(PSCI_STAT_COUNT_AARCH64) |	\
424ce9b8eaSRoberto Vargas 			define_psci_cap(PSCI_SYSTEM_RESET2_AARCH64) |	\
434ce9b8eaSRoberto Vargas 			define_psci_cap(PSCI_MEM_CHK_RANGE_AARCH64))
44532ed618SSoby Mathew 
45a86865acSGraeme Gregory /* Internally PSCI uses a uint16_t for various cpu indexes so
46a86865acSGraeme Gregory  * define a limit to number of CPUs that can be initialised.
47a86865acSGraeme Gregory  */
48a86865acSGraeme Gregory #define PSCI_MAX_CPUS_INDEX	0xFFFFU
49a86865acSGraeme Gregory 
50ce14a12fSLucian Paul-Trifu /* Invalid parent */
51ce14a12fSLucian Paul-Trifu #define PSCI_PARENT_NODE_INVALID	0xFFFFFFFFU
52ce14a12fSLucian Paul-Trifu 
53532ed618SSoby Mathew /*
5497373c33SAntonio Nino Diaz  * Helper functions to get/set the fields of PSCI per-cpu data.
55532ed618SSoby Mathew  */
5697373c33SAntonio Nino Diaz static inline void psci_set_aff_info_state(aff_info_state_t aff_state)
5797373c33SAntonio Nino Diaz {
5897373c33SAntonio Nino Diaz 	set_cpu_data(psci_svc_cpu_data.aff_info_state, aff_state);
5997373c33SAntonio Nino Diaz }
60532ed618SSoby Mathew 
6197373c33SAntonio Nino Diaz static inline aff_info_state_t psci_get_aff_info_state(void)
6297373c33SAntonio Nino Diaz {
6397373c33SAntonio Nino Diaz 	return get_cpu_data(psci_svc_cpu_data.aff_info_state);
6497373c33SAntonio Nino Diaz }
65532ed618SSoby Mathew 
66fc81021aSDeepika Bhavnani static inline aff_info_state_t psci_get_aff_info_state_by_idx(unsigned int idx)
6797373c33SAntonio Nino Diaz {
68fc81021aSDeepika Bhavnani 	return get_cpu_data_by_index(idx,
6997373c33SAntonio Nino Diaz 				     psci_svc_cpu_data.aff_info_state);
7097373c33SAntonio Nino Diaz }
7197373c33SAntonio Nino Diaz 
72fc81021aSDeepika Bhavnani static inline void psci_set_aff_info_state_by_idx(unsigned int idx,
7397373c33SAntonio Nino Diaz 						  aff_info_state_t aff_state)
7497373c33SAntonio Nino Diaz {
75fc81021aSDeepika Bhavnani 	set_cpu_data_by_index(idx,
7697373c33SAntonio Nino Diaz 			      psci_svc_cpu_data.aff_info_state, aff_state);
7797373c33SAntonio Nino Diaz }
7897373c33SAntonio Nino Diaz 
7997373c33SAntonio Nino Diaz static inline unsigned int psci_get_suspend_pwrlvl(void)
8097373c33SAntonio Nino Diaz {
8197373c33SAntonio Nino Diaz 	return get_cpu_data(psci_svc_cpu_data.target_pwrlvl);
8297373c33SAntonio Nino Diaz }
8397373c33SAntonio Nino Diaz 
8497373c33SAntonio Nino Diaz static inline void psci_set_suspend_pwrlvl(unsigned int target_lvl)
8597373c33SAntonio Nino Diaz {
8697373c33SAntonio Nino Diaz 	set_cpu_data(psci_svc_cpu_data.target_pwrlvl, target_lvl);
8797373c33SAntonio Nino Diaz }
8897373c33SAntonio Nino Diaz 
8997373c33SAntonio Nino Diaz static inline void psci_set_cpu_local_state(plat_local_state_t state)
9097373c33SAntonio Nino Diaz {
9197373c33SAntonio Nino Diaz 	set_cpu_data(psci_svc_cpu_data.local_state, state);
9297373c33SAntonio Nino Diaz }
9397373c33SAntonio Nino Diaz 
9497373c33SAntonio Nino Diaz static inline plat_local_state_t psci_get_cpu_local_state(void)
9597373c33SAntonio Nino Diaz {
9697373c33SAntonio Nino Diaz 	return get_cpu_data(psci_svc_cpu_data.local_state);
9797373c33SAntonio Nino Diaz }
9897373c33SAntonio Nino Diaz 
99fc81021aSDeepika Bhavnani static inline plat_local_state_t psci_get_cpu_local_state_by_idx(
100fc81021aSDeepika Bhavnani 		unsigned int idx)
10197373c33SAntonio Nino Diaz {
102fc81021aSDeepika Bhavnani 	return get_cpu_data_by_index(idx,
10397373c33SAntonio Nino Diaz 				     psci_svc_cpu_data.local_state);
10497373c33SAntonio Nino Diaz }
10597373c33SAntonio Nino Diaz 
10697373c33SAntonio Nino Diaz /* Helper function to identify a CPU standby request in PSCI Suspend call */
107362030bfSAntonio Nino Diaz static inline bool is_cpu_standby_req(unsigned int is_power_down_state,
10897373c33SAntonio Nino Diaz 				      unsigned int retn_lvl)
10997373c33SAntonio Nino Diaz {
110362030bfSAntonio Nino Diaz 	return (is_power_down_state == 0U) && (retn_lvl == 0U);
11197373c33SAntonio Nino Diaz }
112532ed618SSoby Mathew 
113532ed618SSoby Mathew /*******************************************************************************
114532ed618SSoby Mathew  * The following two data structures implement the power domain tree. The tree
115532ed618SSoby Mathew  * is used to track the state of all the nodes i.e. power domain instances
116532ed618SSoby Mathew  * described by the platform. The tree consists of nodes that describe CPU power
117532ed618SSoby Mathew  * domains i.e. leaf nodes and all other power domains which are parents of a
118532ed618SSoby Mathew  * CPU power domain i.e. non-leaf nodes.
119532ed618SSoby Mathew  ******************************************************************************/
120532ed618SSoby Mathew typedef struct non_cpu_pwr_domain_node {
121532ed618SSoby Mathew 	/*
122532ed618SSoby Mathew 	 * Index of the first CPU power domain node level 0 which has this node
123532ed618SSoby Mathew 	 * as its parent.
124532ed618SSoby Mathew 	 */
125fc81021aSDeepika Bhavnani 	unsigned int cpu_start_idx;
126532ed618SSoby Mathew 
127532ed618SSoby Mathew 	/*
128532ed618SSoby Mathew 	 * Number of CPU power domains which are siblings of the domain indexed
129532ed618SSoby Mathew 	 * by 'cpu_start_idx' i.e. all the domains in the range 'cpu_start_idx
130532ed618SSoby Mathew 	 * -> cpu_start_idx + ncpus' have this node as their parent.
131532ed618SSoby Mathew 	 */
132532ed618SSoby Mathew 	unsigned int ncpus;
133532ed618SSoby Mathew 
134532ed618SSoby Mathew 	/*
135532ed618SSoby Mathew 	 * Index of the parent power domain node.
136532ed618SSoby Mathew 	 * TODO: Figure out whether to whether using pointer is more efficient.
137532ed618SSoby Mathew 	 */
138532ed618SSoby Mathew 	unsigned int parent_node;
139532ed618SSoby Mathew 
140532ed618SSoby Mathew 	plat_local_state_t local_state;
141532ed618SSoby Mathew 
142532ed618SSoby Mathew 	unsigned char level;
143532ed618SSoby Mathew 
144532ed618SSoby Mathew 	/* For indexing the psci_lock array*/
145a86865acSGraeme Gregory 	uint16_t lock_index;
146532ed618SSoby Mathew } non_cpu_pd_node_t;
147532ed618SSoby Mathew 
148532ed618SSoby Mathew typedef struct cpu_pwr_domain_node {
149532ed618SSoby Mathew 	u_register_t mpidr;
150532ed618SSoby Mathew 
151532ed618SSoby Mathew 	/*
152532ed618SSoby Mathew 	 * Index of the parent power domain node.
153532ed618SSoby Mathew 	 * TODO: Figure out whether to whether using pointer is more efficient.
154532ed618SSoby Mathew 	 */
155532ed618SSoby Mathew 	unsigned int parent_node;
156532ed618SSoby Mathew 
157532ed618SSoby Mathew 	/*
158532ed618SSoby Mathew 	 * A CPU power domain does not require state coordination like its
159532ed618SSoby Mathew 	 * parent power domains. Hence this node does not include a bakery
160532ed618SSoby Mathew 	 * lock. A spinlock is required by the CPU_ON handler to prevent a race
161532ed618SSoby Mathew 	 * when multiple CPUs try to turn ON the same target CPU.
162532ed618SSoby Mathew 	 */
163532ed618SSoby Mathew 	spinlock_t cpu_lock;
164532ed618SSoby Mathew } cpu_pd_node_t;
165532ed618SSoby Mathew 
166*b88a4416SWing Li #if PSCI_OS_INIT_MODE
167*b88a4416SWing Li /*******************************************************************************
168*b88a4416SWing Li  * The supported power state coordination modes that can be used in CPU_SUSPEND.
169*b88a4416SWing Li  ******************************************************************************/
170*b88a4416SWing Li typedef enum suspend_mode {
171*b88a4416SWing Li 	PLAT_COORD = 0,
172*b88a4416SWing Li 	OS_INIT = 1
173*b88a4416SWing Li } suspend_mode_t;
174*b88a4416SWing Li #endif
175*b88a4416SWing Li 
176532ed618SSoby Mathew /*******************************************************************************
1774829df83SAntonio Nino Diaz  * The following are helpers and declarations of locks.
1784829df83SAntonio Nino Diaz  ******************************************************************************/
1794829df83SAntonio Nino Diaz #if HW_ASSISTED_COHERENCY
1804829df83SAntonio Nino Diaz /*
1814829df83SAntonio Nino Diaz  * On systems where participant CPUs are cache-coherent, we can use spinlocks
1824829df83SAntonio Nino Diaz  * instead of bakery locks.
1834829df83SAntonio Nino Diaz  */
1844829df83SAntonio Nino Diaz #define DEFINE_PSCI_LOCK(_name)		spinlock_t _name
1854829df83SAntonio Nino Diaz #define DECLARE_PSCI_LOCK(_name)	extern DEFINE_PSCI_LOCK(_name)
1864829df83SAntonio Nino Diaz 
1874829df83SAntonio Nino Diaz /* One lock is required per non-CPU power domain node */
1884829df83SAntonio Nino Diaz DECLARE_PSCI_LOCK(psci_locks[PSCI_NUM_NON_CPU_PWR_DOMAINS]);
1894829df83SAntonio Nino Diaz 
1904829df83SAntonio Nino Diaz /*
1914829df83SAntonio Nino Diaz  * On systems with hardware-assisted coherency, make PSCI cache operations NOP,
1924829df83SAntonio Nino Diaz  * as PSCI participants are cache-coherent, and there's no need for explicit
1934829df83SAntonio Nino Diaz  * cache maintenance operations or barriers to coordinate their state.
1944829df83SAntonio Nino Diaz  */
1954829df83SAntonio Nino Diaz static inline void psci_flush_dcache_range(uintptr_t __unused addr,
1964829df83SAntonio Nino Diaz 					   size_t __unused size)
1974829df83SAntonio Nino Diaz {
1984829df83SAntonio Nino Diaz 	/* Empty */
1994829df83SAntonio Nino Diaz }
2004829df83SAntonio Nino Diaz 
2014829df83SAntonio Nino Diaz #define psci_flush_cpu_data(member)
2024829df83SAntonio Nino Diaz #define psci_inv_cpu_data(member)
2034829df83SAntonio Nino Diaz 
2044829df83SAntonio Nino Diaz static inline void psci_dsbish(void)
2054829df83SAntonio Nino Diaz {
2064829df83SAntonio Nino Diaz 	/* Empty */
2074829df83SAntonio Nino Diaz }
2084829df83SAntonio Nino Diaz 
2094829df83SAntonio Nino Diaz static inline void psci_lock_get(non_cpu_pd_node_t *non_cpu_pd_node)
2104829df83SAntonio Nino Diaz {
2114829df83SAntonio Nino Diaz 	spin_lock(&psci_locks[non_cpu_pd_node->lock_index]);
2124829df83SAntonio Nino Diaz }
2134829df83SAntonio Nino Diaz 
2144829df83SAntonio Nino Diaz static inline void psci_lock_release(non_cpu_pd_node_t *non_cpu_pd_node)
2154829df83SAntonio Nino Diaz {
2164829df83SAntonio Nino Diaz 	spin_unlock(&psci_locks[non_cpu_pd_node->lock_index]);
2174829df83SAntonio Nino Diaz }
2184829df83SAntonio Nino Diaz 
2194829df83SAntonio Nino Diaz #else /* if HW_ASSISTED_COHERENCY == 0 */
2204829df83SAntonio Nino Diaz /*
2214829df83SAntonio Nino Diaz  * Use bakery locks for state coordination as not all PSCI participants are
2224829df83SAntonio Nino Diaz  * cache coherent.
2234829df83SAntonio Nino Diaz  */
2244829df83SAntonio Nino Diaz #define DEFINE_PSCI_LOCK(_name)		DEFINE_BAKERY_LOCK(_name)
2254829df83SAntonio Nino Diaz #define DECLARE_PSCI_LOCK(_name)	DECLARE_BAKERY_LOCK(_name)
2264829df83SAntonio Nino Diaz 
2274829df83SAntonio Nino Diaz /* One lock is required per non-CPU power domain node */
2284829df83SAntonio Nino Diaz DECLARE_PSCI_LOCK(psci_locks[PSCI_NUM_NON_CPU_PWR_DOMAINS]);
2294829df83SAntonio Nino Diaz 
2304829df83SAntonio Nino Diaz /*
2314829df83SAntonio Nino Diaz  * If not all PSCI participants are cache-coherent, perform cache maintenance
2324829df83SAntonio Nino Diaz  * and issue barriers wherever required to coordinate state.
2334829df83SAntonio Nino Diaz  */
2344829df83SAntonio Nino Diaz static inline void psci_flush_dcache_range(uintptr_t addr, size_t size)
2354829df83SAntonio Nino Diaz {
2364829df83SAntonio Nino Diaz 	flush_dcache_range(addr, size);
2374829df83SAntonio Nino Diaz }
2384829df83SAntonio Nino Diaz 
2394829df83SAntonio Nino Diaz #define psci_flush_cpu_data(member)		flush_cpu_data(member)
2404829df83SAntonio Nino Diaz #define psci_inv_cpu_data(member)		inv_cpu_data(member)
2414829df83SAntonio Nino Diaz 
2424829df83SAntonio Nino Diaz static inline void psci_dsbish(void)
2434829df83SAntonio Nino Diaz {
2444829df83SAntonio Nino Diaz 	dsbish();
2454829df83SAntonio Nino Diaz }
2464829df83SAntonio Nino Diaz 
2474829df83SAntonio Nino Diaz static inline void psci_lock_get(non_cpu_pd_node_t *non_cpu_pd_node)
2484829df83SAntonio Nino Diaz {
2494829df83SAntonio Nino Diaz 	bakery_lock_get(&psci_locks[non_cpu_pd_node->lock_index]);
2504829df83SAntonio Nino Diaz }
2514829df83SAntonio Nino Diaz 
2524829df83SAntonio Nino Diaz static inline void psci_lock_release(non_cpu_pd_node_t *non_cpu_pd_node)
2534829df83SAntonio Nino Diaz {
2544829df83SAntonio Nino Diaz 	bakery_lock_release(&psci_locks[non_cpu_pd_node->lock_index]);
2554829df83SAntonio Nino Diaz }
2564829df83SAntonio Nino Diaz 
2574829df83SAntonio Nino Diaz #endif /* HW_ASSISTED_COHERENCY */
2584829df83SAntonio Nino Diaz 
2594829df83SAntonio Nino Diaz static inline void psci_lock_init(non_cpu_pd_node_t *non_cpu_pd_node,
260a86865acSGraeme Gregory 				  uint16_t idx)
2614829df83SAntonio Nino Diaz {
2624829df83SAntonio Nino Diaz 	non_cpu_pd_node[idx].lock_index = idx;
2634829df83SAntonio Nino Diaz }
2644829df83SAntonio Nino Diaz 
2654829df83SAntonio Nino Diaz /*******************************************************************************
266532ed618SSoby Mathew  * Data prototypes
267532ed618SSoby Mathew  ******************************************************************************/
268532ed618SSoby Mathew extern const plat_psci_ops_t *psci_plat_pm_ops;
269532ed618SSoby Mathew extern non_cpu_pd_node_t psci_non_cpu_pd_nodes[PSCI_NUM_NON_CPU_PWR_DOMAINS];
270532ed618SSoby Mathew extern cpu_pd_node_t psci_cpu_pd_nodes[PLATFORM_CORE_COUNT];
271532ed618SSoby Mathew extern unsigned int psci_caps;
272ab4df50cSPankaj Gupta extern unsigned int psci_plat_core_count;
273*b88a4416SWing Li #if PSCI_OS_INIT_MODE
274*b88a4416SWing Li extern suspend_mode_t psci_suspend_mode;
275*b88a4416SWing Li #endif
276532ed618SSoby Mathew 
277532ed618SSoby Mathew /*******************************************************************************
278532ed618SSoby Mathew  * SPD's power management hooks registered with PSCI
279532ed618SSoby Mathew  ******************************************************************************/
280532ed618SSoby Mathew extern const spd_pm_ops_t *psci_spd_pm;
281532ed618SSoby Mathew 
282532ed618SSoby Mathew /*******************************************************************************
283532ed618SSoby Mathew  * Function prototypes
284532ed618SSoby Mathew  ******************************************************************************/
285532ed618SSoby Mathew /* Private exported functions from psci_common.c */
286532ed618SSoby Mathew int psci_validate_power_state(unsigned int power_state,
287532ed618SSoby Mathew 			      psci_power_state_t *state_info);
288532ed618SSoby Mathew void psci_query_sys_suspend_pwrstate(psci_power_state_t *state_info);
289532ed618SSoby Mathew int psci_validate_mpidr(u_register_t mpidr);
290532ed618SSoby Mathew void psci_init_req_local_pwr_states(void);
29161eae524SAchin Gupta void psci_get_target_local_pwr_states(unsigned int end_pwrlvl,
29261eae524SAchin Gupta 				      psci_power_state_t *target_state);
293532ed618SSoby Mathew int psci_validate_entry_point(entry_point_info_t *ep,
294532ed618SSoby Mathew 			uintptr_t entrypoint, u_register_t context_id);
295fc81021aSDeepika Bhavnani void psci_get_parent_pwr_domain_nodes(unsigned int cpu_idx,
296532ed618SSoby Mathew 				      unsigned int end_lvl,
2976b7b0f36SAntonio Nino Diaz 				      unsigned int *node_index);
298532ed618SSoby Mathew void psci_do_state_coordination(unsigned int end_pwrlvl,
299532ed618SSoby Mathew 				psci_power_state_t *state_info);
30074d27d00SAndrew F. Davis void psci_acquire_pwr_domain_locks(unsigned int end_pwrlvl,
30174d27d00SAndrew F. Davis 				   const unsigned int *parent_nodes);
30274d27d00SAndrew F. Davis void psci_release_pwr_domain_locks(unsigned int end_pwrlvl,
30374d27d00SAndrew F. Davis 				   const unsigned int *parent_nodes);
304532ed618SSoby Mathew int psci_validate_suspend_req(const psci_power_state_t *state_info,
3059fb8af33SRoberto Vargas 			      unsigned int is_power_down_state);
306532ed618SSoby Mathew unsigned int psci_find_max_off_lvl(const psci_power_state_t *state_info);
307532ed618SSoby Mathew unsigned int psci_find_target_suspend_lvl(const psci_power_state_t *state_info);
308532ed618SSoby Mathew void psci_set_pwr_domains_to_run(unsigned int end_pwrlvl);
309532ed618SSoby Mathew void psci_print_power_domain_map(void);
310b41b0824SJayanth Dodderi Chidanand bool psci_is_last_on_cpu(void);
311532ed618SSoby Mathew int psci_spd_migrate_info(u_register_t *mpidr);
312b0408e87SJeenu Viswambharan 
313b0408e87SJeenu Viswambharan /*
314b0408e87SJeenu Viswambharan  * CPU power down is directly called only when HW_ASSISTED_COHERENCY is
315b0408e87SJeenu Viswambharan  * available. Otherwise, this needs post-call stack maintenance, which is
316b0408e87SJeenu Viswambharan  * handled in assembly.
317b0408e87SJeenu Viswambharan  */
318b0408e87SJeenu Viswambharan void prepare_cpu_pwr_dwn(unsigned int power_level);
319532ed618SSoby Mathew 
320aea4ccf8SHarrison Mutai /* This function applies various CPU errata during power down. */
321aea4ccf8SHarrison Mutai void apply_cpu_pwr_dwn_errata(void);
322aea4ccf8SHarrison Mutai 
323532ed618SSoby Mathew /* Private exported functions from psci_on.c */
324532ed618SSoby Mathew int psci_cpu_on_start(u_register_t target_cpu,
325621d64f8SAntonio Nino Diaz 		      const entry_point_info_t *ep);
326532ed618SSoby Mathew 
3275b33ad17SDeepika Bhavnani void psci_cpu_on_finish(unsigned int cpu_idx, const psci_power_state_t *state_info);
328532ed618SSoby Mathew 
329532ed618SSoby Mathew /* Private exported functions from psci_off.c */
330532ed618SSoby Mathew int psci_do_cpu_off(unsigned int end_pwrlvl);
331532ed618SSoby Mathew 
332532ed618SSoby Mathew /* Private exported functions from psci_suspend.c */
333621d64f8SAntonio Nino Diaz void psci_cpu_suspend_start(const entry_point_info_t *ep,
334532ed618SSoby Mathew 			unsigned int end_pwrlvl,
335532ed618SSoby Mathew 			psci_power_state_t *state_info,
3369fb8af33SRoberto Vargas 			unsigned int is_power_down_state);
337532ed618SSoby Mathew 
3385b33ad17SDeepika Bhavnani void psci_cpu_suspend_finish(unsigned int cpu_idx, const psci_power_state_t *state_info);
339532ed618SSoby Mathew 
340532ed618SSoby Mathew /* Private exported functions from psci_helpers.S */
341532ed618SSoby Mathew void psci_do_pwrdown_cache_maintenance(unsigned int pwr_level);
342532ed618SSoby Mathew void psci_do_pwrup_cache_maintenance(void);
343532ed618SSoby Mathew 
344532ed618SSoby Mathew /* Private exported functions from psci_system_off.c */
345532ed618SSoby Mathew void __dead2 psci_system_off(void);
346532ed618SSoby Mathew void __dead2 psci_system_reset(void);
347621d64f8SAntonio Nino Diaz u_register_t psci_system_reset2(uint32_t reset_type, u_register_t cookie);
348532ed618SSoby Mathew 
349532ed618SSoby Mathew /* Private exported functions from psci_stat.c */
350532ed618SSoby Mathew void psci_stats_update_pwr_down(unsigned int end_pwrlvl,
351532ed618SSoby Mathew 			const psci_power_state_t *state_info);
352532ed618SSoby Mathew void psci_stats_update_pwr_up(unsigned int end_pwrlvl,
35304c1db1eSdp-arm 			const psci_power_state_t *state_info);
354532ed618SSoby Mathew u_register_t psci_stat_residency(u_register_t target_cpu,
355532ed618SSoby Mathew 			unsigned int power_state);
356532ed618SSoby Mathew u_register_t psci_stat_count(u_register_t target_cpu,
357532ed618SSoby Mathew 			unsigned int power_state);
358532ed618SSoby Mathew 
359d4c596beSRoberto Vargas /* Private exported functions from psci_mem_protect.c */
3608c20c3c9SAntonio Nino Diaz u_register_t psci_mem_protect(unsigned int enable);
3618c20c3c9SAntonio Nino Diaz u_register_t psci_mem_chk_range(uintptr_t base, u_register_t length);
362d4c596beSRoberto Vargas 
36397373c33SAntonio Nino Diaz #endif /* PSCI_PRIVATE_H */
364