Mark Rutland | bff6079 | 2015-07-31 15:46:16 +0100 | [diff] [blame] | 1 | /* |
| 2 | * This program is free software; you can redistribute it and/or modify |
| 3 | * it under the terms of the GNU General Public License version 2 as |
| 4 | * published by the Free Software Foundation. |
| 5 | * |
| 6 | * This program is distributed in the hope that it will be useful, |
| 7 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 8 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 9 | * GNU General Public License for more details. |
| 10 | * |
| 11 | * Copyright (C) 2015 ARM Limited |
| 12 | */ |
| 13 | |
| 14 | #ifndef __LINUX_PSCI_H |
| 15 | #define __LINUX_PSCI_H |
| 16 | |
| 17 | #include <linux/init.h> |
| 18 | #include <linux/types.h> |
| 19 | |
| 20 | #define PSCI_POWER_STATE_TYPE_STANDBY 0 |
| 21 | #define PSCI_POWER_STATE_TYPE_POWER_DOWN 1 |
| 22 | |
| 23 | bool psci_tos_resident_on(int cpu); |
Mark Rutland | bff6079 | 2015-07-31 15:46:16 +0100 | [diff] [blame] | 24 | |
Lorenzo Pieralisi | 8b6f249 | 2016-02-01 18:01:30 +0100 | [diff] [blame] | 25 | int psci_cpu_init_idle(unsigned int cpu); |
| 26 | int psci_cpu_suspend_enter(unsigned long index); |
| 27 | |
Marc Zyngier | 09a8d6d | 2018-02-06 17:56:16 +0000 | [diff] [blame] | 28 | enum psci_conduit { |
| 29 | PSCI_CONDUIT_NONE, |
| 30 | PSCI_CONDUIT_SMC, |
| 31 | PSCI_CONDUIT_HVC, |
| 32 | }; |
| 33 | |
Marc Zyngier | e78eef5 | 2018-02-06 17:56:17 +0000 | [diff] [blame] | 34 | enum smccc_version { |
| 35 | SMCCC_VERSION_1_0, |
| 36 | SMCCC_VERSION_1_1, |
| 37 | }; |
| 38 | |
Mark Rutland | bff6079 | 2015-07-31 15:46:16 +0100 | [diff] [blame] | 39 | struct psci_operations { |
Will Deacon | d68e3ba | 2018-01-02 21:45:41 +0000 | [diff] [blame] | 40 | u32 (*get_version)(void); |
Mark Rutland | bff6079 | 2015-07-31 15:46:16 +0100 | [diff] [blame] | 41 | int (*cpu_suspend)(u32 state, unsigned long entry_point); |
| 42 | int (*cpu_off)(u32 state); |
| 43 | int (*cpu_on)(unsigned long cpuid, unsigned long entry_point); |
| 44 | int (*migrate)(unsigned long cpuid); |
| 45 | int (*affinity_info)(unsigned long target_affinity, |
| 46 | unsigned long lowest_affinity_level); |
| 47 | int (*migrate_info_type)(void); |
Marc Zyngier | 09a8d6d | 2018-02-06 17:56:16 +0000 | [diff] [blame] | 48 | enum psci_conduit conduit; |
Marc Zyngier | e78eef5 | 2018-02-06 17:56:17 +0000 | [diff] [blame] | 49 | enum smccc_version smccc_version; |
Mark Rutland | bff6079 | 2015-07-31 15:46:16 +0100 | [diff] [blame] | 50 | }; |
| 51 | |
| 52 | extern struct psci_operations psci_ops; |
| 53 | |
| 54 | #if defined(CONFIG_ARM_PSCI_FW) |
| 55 | int __init psci_dt_init(void); |
| 56 | #else |
| 57 | static inline int psci_dt_init(void) { return 0; } |
| 58 | #endif |
| 59 | |
| 60 | #if defined(CONFIG_ARM_PSCI_FW) && defined(CONFIG_ACPI) |
| 61 | int __init psci_acpi_init(void); |
| 62 | bool __init acpi_psci_present(void); |
James Morse | fa31ab7 | 2018-01-08 15:38:15 +0000 | [diff] [blame] | 63 | bool acpi_psci_use_hvc(void); |
Mark Rutland | bff6079 | 2015-07-31 15:46:16 +0100 | [diff] [blame] | 64 | #else |
| 65 | static inline int psci_acpi_init(void) { return 0; } |
| 66 | static inline bool acpi_psci_present(void) { return false; } |
James Morse | fa31ab7 | 2018-01-08 15:38:15 +0000 | [diff] [blame] | 67 | static inline bool acpi_psci_use_hvc(void) {return false; } |
Mark Rutland | bff6079 | 2015-07-31 15:46:16 +0100 | [diff] [blame] | 68 | #endif |
| 69 | |
| 70 | #endif /* __LINUX_PSCI_H */ |