blob: ebe0a881d13d7b40db2ab231b7c72e3f6655e5c1 [file] [log] [blame]
Thomas Gleixner1802d0b2019-05-27 08:55:21 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Mark Rutlandbff607922015-07-31 15:46:16 +01002/*
Mark Rutlandbff607922015-07-31 15:46:16 +01003 *
4 * Copyright (C) 2015 ARM Limited
5 */
6
7#ifndef __LINUX_PSCI_H
8#define __LINUX_PSCI_H
9
Mark Rutlanda5520ea2019-08-09 14:22:43 +010010#include <linux/arm-smccc.h>
Mark Rutlandbff607922015-07-31 15:46:16 +010011#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
17bool psci_tos_resident_on(int cpu);
Mark Rutlandbff607922015-07-31 15:46:16 +010018
Lorenzo Pieralisi9ffeb6d2019-08-09 12:03:12 +010019int psci_cpu_suspend_enter(u32 state);
20bool psci_power_state_is_valid(u32 state);
Lorenzo Pieralisi8b6f2492016-02-01 18:01:30 +010021
Marc Zyngiere78eef52018-02-06 17:56:17 +000022enum smccc_version {
23 SMCCC_VERSION_1_0,
24 SMCCC_VERSION_1_1,
25};
26
Mark Rutlandbff607922015-07-31 15:46:16 +010027struct psci_operations {
Will Deacond68e3ba2018-01-02 21:45:41 +000028 u32 (*get_version)(void);
Mark Rutlandbff607922015-07-31 15:46:16 +010029 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 Rutlanda5520ea2019-08-09 14:22:43 +010036 enum arm_smccc_conduit conduit;
Marc Zyngiere78eef52018-02-06 17:56:17 +000037 enum smccc_version smccc_version;
Mark Rutlandbff607922015-07-31 15:46:16 +010038};
39
40extern struct psci_operations psci_ops;
41
42#if defined(CONFIG_ARM_PSCI_FW)
43int __init psci_dt_init(void);
44#else
45static inline int psci_dt_init(void) { return 0; }
46#endif
47
48#if defined(CONFIG_ARM_PSCI_FW) && defined(CONFIG_ACPI)
49int __init psci_acpi_init(void);
50bool __init acpi_psci_present(void);
James Morsefa31ab72018-01-08 15:38:15 +000051bool acpi_psci_use_hvc(void);
Mark Rutlandbff607922015-07-31 15:46:16 +010052#else
53static inline int psci_acpi_init(void) { return 0; }
54static inline bool acpi_psci_present(void) { return false; }
James Morsefa31ab72018-01-08 15:38:15 +000055static inline bool acpi_psci_use_hvc(void) {return false; }
Mark Rutlandbff607922015-07-31 15:46:16 +010056#endif
57
58#endif /* __LINUX_PSCI_H */