David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 2 | /* |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2015 ARM Limited |
| 5 | */ |
| 6 | |
| 7 | #ifndef __LINUX_PSCI_H |
| 8 | #define __LINUX_PSCI_H |
| 9 | |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame] | 10 | #include <linux/arm-smccc.h> |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [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); |
| 18 | |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 19 | int psci_cpu_suspend_enter(u32 state); |
| 20 | bool psci_power_state_is_valid(u32 state); |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame] | 21 | int psci_set_osi_mode(bool enable); |
| 22 | bool psci_has_osi_support(void); |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 23 | |
| 24 | struct psci_operations { |
| 25 | u32 (*get_version)(void); |
| 26 | int (*cpu_suspend)(u32 state, unsigned long entry_point); |
| 27 | int (*cpu_off)(u32 state); |
| 28 | int (*cpu_on)(unsigned long cpuid, unsigned long entry_point); |
| 29 | int (*migrate)(unsigned long cpuid); |
| 30 | int (*affinity_info)(unsigned long target_affinity, |
| 31 | unsigned long lowest_affinity_level); |
| 32 | int (*migrate_info_type)(void); |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 33 | }; |
| 34 | |
| 35 | extern struct psci_operations psci_ops; |
| 36 | |
| 37 | #if defined(CONFIG_ARM_PSCI_FW) |
| 38 | int __init psci_dt_init(void); |
| 39 | #else |
| 40 | static inline int psci_dt_init(void) { return 0; } |
| 41 | #endif |
| 42 | |
| 43 | #if defined(CONFIG_ARM_PSCI_FW) && defined(CONFIG_ACPI) |
| 44 | int __init psci_acpi_init(void); |
| 45 | bool __init acpi_psci_present(void); |
| 46 | bool acpi_psci_use_hvc(void); |
| 47 | #else |
| 48 | static inline int psci_acpi_init(void) { return 0; } |
| 49 | static inline bool acpi_psci_present(void) { return false; } |
| 50 | static inline bool acpi_psci_use_hvc(void) {return false; } |
| 51 | #endif |
| 52 | |
| 53 | #endif /* __LINUX_PSCI_H */ |