Thomas Gleixner | 1802d0b | 2019-05-27 08:55:21 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Mark Rutland | bff60792 | 2015-07-31 15:46:16 +0100 | [diff] [blame] | 2 | /* |
Mark Rutland | bff60792 | 2015-07-31 15:46:16 +0100 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2015 ARM Limited |
| 5 | */ |
| 6 | |
| 7 | #ifndef __LINUX_PSCI_H |
| 8 | #define __LINUX_PSCI_H |
| 9 | |
Mark Rutland | a5520ea | 2019-08-09 14:22:43 +0100 | [diff] [blame] | 10 | #include <linux/arm-smccc.h> |
Mark Rutland | bff60792 | 2015-07-31 15:46:16 +0100 | [diff] [blame] | 11 | #include <linux/init.h> |
| 12 | #include <linux/types.h> |
| 13 | |
| 14 | #define PSCI_POWER_STATE_TYPE_STANDBY 0 |
| 15 | #define PSCI_POWER_STATE_TYPE_POWER_DOWN 1 |
| 16 | |
| 17 | bool psci_tos_resident_on(int cpu); |
Mark Rutland | bff60792 | 2015-07-31 15:46:16 +0100 | [diff] [blame] | 18 | |
Lorenzo Pieralisi | 9ffeb6d | 2019-08-09 12:03:12 +0100 | [diff] [blame] | 19 | int psci_cpu_suspend_enter(u32 state); |
| 20 | bool psci_power_state_is_valid(u32 state); |
Lorenzo Pieralisi | 8b6f249 | 2016-02-01 18:01:30 +0100 | [diff] [blame] | 21 | |
Marc Zyngier | e78eef5 | 2018-02-06 17:56:17 +0000 | [diff] [blame] | 22 | enum smccc_version { |
| 23 | SMCCC_VERSION_1_0, |
| 24 | SMCCC_VERSION_1_1, |
| 25 | }; |
| 26 | |
Mark Rutland | bff60792 | 2015-07-31 15:46:16 +0100 | [diff] [blame] | 27 | struct psci_operations { |
Will Deacon | d68e3ba | 2018-01-02 21:45:41 +0000 | [diff] [blame] | 28 | u32 (*get_version)(void); |
Mark Rutland | bff60792 | 2015-07-31 15:46:16 +0100 | [diff] [blame] | 29 | int (*cpu_suspend)(u32 state, unsigned long entry_point); |
| 30 | int (*cpu_off)(u32 state); |
| 31 | int (*cpu_on)(unsigned long cpuid, unsigned long entry_point); |
| 32 | int (*migrate)(unsigned long cpuid); |
| 33 | int (*affinity_info)(unsigned long target_affinity, |
| 34 | unsigned long lowest_affinity_level); |
| 35 | int (*migrate_info_type)(void); |
Mark Rutland | a5520ea | 2019-08-09 14:22:43 +0100 | [diff] [blame] | 36 | enum arm_smccc_conduit conduit; |
Marc Zyngier | e78eef5 | 2018-02-06 17:56:17 +0000 | [diff] [blame] | 37 | enum smccc_version smccc_version; |
Mark Rutland | bff60792 | 2015-07-31 15:46:16 +0100 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | extern struct psci_operations psci_ops; |
| 41 | |
| 42 | #if defined(CONFIG_ARM_PSCI_FW) |
| 43 | int __init psci_dt_init(void); |
| 44 | #else |
| 45 | static inline int psci_dt_init(void) { return 0; } |
| 46 | #endif |
| 47 | |
| 48 | #if defined(CONFIG_ARM_PSCI_FW) && defined(CONFIG_ACPI) |
| 49 | int __init psci_acpi_init(void); |
| 50 | bool __init acpi_psci_present(void); |
James Morse | fa31ab7 | 2018-01-08 15:38:15 +0000 | [diff] [blame] | 51 | bool acpi_psci_use_hvc(void); |
Mark Rutland | bff60792 | 2015-07-31 15:46:16 +0100 | [diff] [blame] | 52 | #else |
| 53 | static inline int psci_acpi_init(void) { return 0; } |
| 54 | static inline bool acpi_psci_present(void) { return false; } |
James Morse | fa31ab7 | 2018-01-08 15:38:15 +0000 | [diff] [blame] | 55 | static inline bool acpi_psci_use_hvc(void) {return false; } |
Mark Rutland | bff60792 | 2015-07-31 15:46:16 +0100 | [diff] [blame] | 56 | #endif |
| 57 | |
| 58 | #endif /* __LINUX_PSCI_H */ |