psci.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. #ifndef __LINUX_PSCI_H
  14. #define __LINUX_PSCI_H
  15. #include <linux/init.h>
  16. #include <linux/types.h>
  17. #define PSCI_POWER_STATE_TYPE_STANDBY 0
  18. #define PSCI_POWER_STATE_TYPE_POWER_DOWN 1
  19. bool psci_tos_resident_on(int cpu);
  20. int psci_cpu_init_idle(unsigned int cpu);
  21. int psci_cpu_suspend_enter(unsigned long index);
  22. enum psci_conduit {
  23. PSCI_CONDUIT_NONE,
  24. PSCI_CONDUIT_SMC,
  25. PSCI_CONDUIT_HVC,
  26. };
  27. enum smccc_version {
  28. SMCCC_VERSION_1_0,
  29. SMCCC_VERSION_1_1,
  30. };
  31. struct psci_operations {
  32. u32 (*get_version)(void);
  33. int (*cpu_suspend)(u32 state, unsigned long entry_point);
  34. int (*cpu_off)(u32 state);
  35. int (*cpu_on)(unsigned long cpuid, unsigned long entry_point);
  36. int (*migrate)(unsigned long cpuid);
  37. int (*affinity_info)(unsigned long target_affinity,
  38. unsigned long lowest_affinity_level);
  39. int (*migrate_info_type)(void);
  40. enum psci_conduit conduit;
  41. enum smccc_version smccc_version;
  42. };
  43. extern struct psci_operations psci_ops;
  44. #if defined(CONFIG_ARM_PSCI_FW)
  45. int __init psci_dt_init(void);
  46. #else
  47. static inline int psci_dt_init(void) { return 0; }
  48. #endif
  49. #if defined(CONFIG_ARM_PSCI_FW) && defined(CONFIG_ACPI)
  50. int __init psci_acpi_init(void);
  51. bool __init acpi_psci_present(void);
  52. bool acpi_psci_use_hvc(void);
  53. #else
  54. static inline int psci_acpi_init(void) { return 0; }
  55. static inline bool acpi_psci_present(void) { return false; }
  56. static inline bool acpi_psci_use_hvc(void) {return false; }
  57. #endif
  58. #endif /* __LINUX_PSCI_H */