xref: /linux/include/linux/psci.h (revision a5520eac)
11802d0beSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2bff60792SMark Rutland /*
3bff60792SMark Rutland  *
4bff60792SMark Rutland  * Copyright (C) 2015 ARM Limited
5bff60792SMark Rutland  */
6bff60792SMark Rutland 
7bff60792SMark Rutland #ifndef __LINUX_PSCI_H
8bff60792SMark Rutland #define __LINUX_PSCI_H
9bff60792SMark Rutland 
10*a5520eacSMark Rutland #include <linux/arm-smccc.h>
11bff60792SMark Rutland #include <linux/init.h>
12bff60792SMark Rutland #include <linux/types.h>
13bff60792SMark Rutland 
14bff60792SMark Rutland #define PSCI_POWER_STATE_TYPE_STANDBY		0
15bff60792SMark Rutland #define PSCI_POWER_STATE_TYPE_POWER_DOWN	1
16bff60792SMark Rutland 
17bff60792SMark Rutland bool psci_tos_resident_on(int cpu);
18bff60792SMark Rutland 
199ffeb6d0SLorenzo Pieralisi int psci_cpu_suspend_enter(u32 state);
209ffeb6d0SLorenzo Pieralisi bool psci_power_state_is_valid(u32 state);
218b6f2499SLorenzo Pieralisi 
22e78eef55SMarc Zyngier enum smccc_version {
23e78eef55SMarc Zyngier 	SMCCC_VERSION_1_0,
24e78eef55SMarc Zyngier 	SMCCC_VERSION_1_1,
25e78eef55SMarc Zyngier };
26e78eef55SMarc Zyngier 
27bff60792SMark Rutland struct psci_operations {
28d68e3ba5SWill Deacon 	u32 (*get_version)(void);
29bff60792SMark Rutland 	int (*cpu_suspend)(u32 state, unsigned long entry_point);
30bff60792SMark Rutland 	int (*cpu_off)(u32 state);
31bff60792SMark Rutland 	int (*cpu_on)(unsigned long cpuid, unsigned long entry_point);
32bff60792SMark Rutland 	int (*migrate)(unsigned long cpuid);
33bff60792SMark Rutland 	int (*affinity_info)(unsigned long target_affinity,
34bff60792SMark Rutland 			unsigned long lowest_affinity_level);
35bff60792SMark Rutland 	int (*migrate_info_type)(void);
36*a5520eacSMark Rutland 	enum arm_smccc_conduit conduit;
37e78eef55SMarc Zyngier 	enum smccc_version smccc_version;
38bff60792SMark Rutland };
39bff60792SMark Rutland 
40bff60792SMark Rutland extern struct psci_operations psci_ops;
41bff60792SMark Rutland 
42bff60792SMark Rutland #if defined(CONFIG_ARM_PSCI_FW)
43bff60792SMark Rutland int __init psci_dt_init(void);
44bff60792SMark Rutland #else
45bff60792SMark Rutland static inline int psci_dt_init(void) { return 0; }
46bff60792SMark Rutland #endif
47bff60792SMark Rutland 
48bff60792SMark Rutland #if defined(CONFIG_ARM_PSCI_FW) && defined(CONFIG_ACPI)
49bff60792SMark Rutland int __init psci_acpi_init(void);
50bff60792SMark Rutland bool __init acpi_psci_present(void);
51fa31ab77SJames Morse bool acpi_psci_use_hvc(void);
52bff60792SMark Rutland #else
53bff60792SMark Rutland static inline int psci_acpi_init(void) { return 0; }
54bff60792SMark Rutland static inline bool acpi_psci_present(void) { return false; }
55fa31ab77SJames Morse static inline bool acpi_psci_use_hvc(void) {return false; }
56bff60792SMark Rutland #endif
57bff60792SMark Rutland 
58bff60792SMark Rutland #endif /* __LINUX_PSCI_H */
59