blob: a8a15613c157ef48bfbc87810d9a04c8edba3e1b [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
10#include <linux/init.h>
11#include <linux/types.h>
12
13#define PSCI_POWER_STATE_TYPE_STANDBY 0
14#define PSCI_POWER_STATE_TYPE_POWER_DOWN 1
15
16bool psci_tos_resident_on(int cpu);
Mark Rutlandbff607922015-07-31 15:46:16 +010017
Lorenzo Pieralisi8b6f2492016-02-01 18:01:30 +010018int psci_cpu_init_idle(unsigned int cpu);
19int psci_cpu_suspend_enter(unsigned long index);
20
Marc Zyngier09a8d6d2018-02-06 17:56:16 +000021enum psci_conduit {
22 PSCI_CONDUIT_NONE,
23 PSCI_CONDUIT_SMC,
24 PSCI_CONDUIT_HVC,
25};
26
Marc Zyngiere78eef52018-02-06 17:56:17 +000027enum smccc_version {
28 SMCCC_VERSION_1_0,
29 SMCCC_VERSION_1_1,
30};
31
Mark Rutlandbff607922015-07-31 15:46:16 +010032struct psci_operations {
Will Deacond68e3ba2018-01-02 21:45:41 +000033 u32 (*get_version)(void);
Mark Rutlandbff607922015-07-31 15:46:16 +010034 int (*cpu_suspend)(u32 state, unsigned long entry_point);
35 int (*cpu_off)(u32 state);
36 int (*cpu_on)(unsigned long cpuid, unsigned long entry_point);
37 int (*migrate)(unsigned long cpuid);
38 int (*affinity_info)(unsigned long target_affinity,
39 unsigned long lowest_affinity_level);
40 int (*migrate_info_type)(void);
Marc Zyngier09a8d6d2018-02-06 17:56:16 +000041 enum psci_conduit conduit;
Marc Zyngiere78eef52018-02-06 17:56:17 +000042 enum smccc_version smccc_version;
Mark Rutlandbff607922015-07-31 15:46:16 +010043};
44
45extern struct psci_operations psci_ops;
46
47#if defined(CONFIG_ARM_PSCI_FW)
48int __init psci_dt_init(void);
49#else
50static inline int psci_dt_init(void) { return 0; }
51#endif
52
53#if defined(CONFIG_ARM_PSCI_FW) && defined(CONFIG_ACPI)
54int __init psci_acpi_init(void);
55bool __init acpi_psci_present(void);
James Morsefa31ab72018-01-08 15:38:15 +000056bool acpi_psci_use_hvc(void);
Mark Rutlandbff607922015-07-31 15:46:16 +010057#else
58static inline int psci_acpi_init(void) { return 0; }
59static inline bool acpi_psci_present(void) { return false; }
James Morsefa31ab72018-01-08 15:38:15 +000060static inline bool acpi_psci_use_hvc(void) {return false; }
Mark Rutlandbff607922015-07-31 15:46:16 +010061#endif
62
63#endif /* __LINUX_PSCI_H */