1 #ifndef __ASM_PSCI_H__ 2 #define __ASM_PSCI_H__ 3 4 #include <asm/smccc.h> 5 6 /* PSCI return values (inclusive of all PSCI versions) */ 7 #define PSCI_SUCCESS 0 8 #define PSCI_NOT_SUPPORTED -1 9 #define PSCI_INVALID_PARAMETERS -2 10 #define PSCI_DENIED -3 11 #define PSCI_ALREADY_ON -4 12 #define PSCI_ON_PENDING -5 13 #define PSCI_INTERNAL_FAILURE -6 14 #define PSCI_NOT_PRESENT -7 15 #define PSCI_DISABLED -8 16 17 /* availability of PSCI on the host for SMP bringup */ 18 extern uint32_t psci_ver; 19 20 int psci_init(void); 21 int call_psci_cpu_on(int cpu); 22 void call_psci_system_off(void); 23 void call_psci_system_reset(void); 24 25 /* functions to handle guest PSCI requests */ 26 int32_t do_psci_cpu_on(uint32_t vcpuid, register_t entry_point); 27 int32_t do_psci_cpu_off(uint32_t power_state); 28 int32_t do_psci_cpu_suspend(uint32_t power_state, register_t entry_point); 29 int32_t do_psci_migrate(uint32_t vcpuid); 30 31 /* PSCI 0.2 functions to handle guest PSCI requests */ 32 uint32_t do_psci_0_2_version(void); 33 register_t do_psci_0_2_cpu_suspend(uint32_t power_state, register_t entry_point, 34 register_t context_id); 35 int32_t do_psci_0_2_cpu_off(void); 36 int32_t do_psci_0_2_cpu_on(register_t target_cpu, register_t entry_point, 37 register_t context_id); 38 int32_t do_psci_0_2_affinity_info(register_t target_affinity, 39 uint32_t lowest_affinity_level); 40 int32_t do_psci_0_2_migrate(uint32_t target_cpu); 41 uint32_t do_psci_0_2_migrate_info_type(void); 42 register_t do_psci_0_2_migrate_info_up_cpu(void); 43 void do_psci_0_2_system_off(void); 44 void do_psci_0_2_system_reset(void); 45 46 /* PSCI v0.2 interface */ 47 #define PSCI_0_2_FN32(name) ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \ 48 ARM_SMCCC_CONV_32, \ 49 ARM_SMCCC_OWNER_STANDARD, \ 50 PSCI_0_2_FN_##name) 51 #define PSCI_0_2_FN64(name) ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \ 52 ARM_SMCCC_CONV_64, \ 53 ARM_SMCCC_OWNER_STANDARD, \ 54 PSCI_0_2_FN_##name) 55 #define PSCI_0_2_FN_PSCI_VERSION 0 56 #define PSCI_0_2_FN_CPU_SUSPEND 1 57 #define PSCI_0_2_FN_CPU_OFF 2 58 #define PSCI_0_2_FN_CPU_ON 3 59 #define PSCI_0_2_FN_AFFINITY_INFO 4 60 #define PSCI_0_2_FN_MIGRATE 5 61 #define PSCI_0_2_FN_MIGRATE_INFO_TYPE 6 62 #define PSCI_0_2_FN_MIGRATE_INFO_UP_CPU 7 63 #define PSCI_0_2_FN_SYSTEM_OFF 8 64 #define PSCI_0_2_FN_SYSTEM_RESET 9 65 66 /* PSCI v0.2 affinity level state returned by AFFINITY_INFO */ 67 #define PSCI_0_2_AFFINITY_LEVEL_ON 0 68 #define PSCI_0_2_AFFINITY_LEVEL_OFF 1 69 #define PSCI_0_2_AFFINITY_LEVEL_ON_PENDING 2 70 71 /* PSCI v0.2 multicore support in Trusted OS returned by MIGRATE_INFO_TYPE */ 72 #define PSCI_0_2_TOS_UP_MIGRATE_CAPABLE 0 73 #define PSCI_0_2_TOS_UP_NOT_MIGRATE_CAPABLE 1 74 #define PSCI_0_2_TOS_MP_OR_NOT_PRESENT 2 75 76 /* PSCI v0.2 power state encoding for CPU_SUSPEND function */ 77 #define PSCI_0_2_POWER_STATE_ID_MASK 0xffff 78 #define PSCI_0_2_POWER_STATE_ID_SHIFT 0 79 #define PSCI_0_2_POWER_STATE_TYPE_SHIFT 16 80 #define PSCI_0_2_POWER_STATE_TYPE_MASK \ 81 (0x1 << PSCI_0_2_POWER_STATE_TYPE_SHIFT) 82 83 /* PSCI version decoding (independent of PSCI version) */ 84 #define PSCI_VERSION_MAJOR_SHIFT 16 85 #define PSCI_VERSION_MINOR_MASK \ 86 ((1U << PSCI_VERSION_MAJOR_SHIFT) - 1) 87 #define PSCI_VERSION_MAJOR_MASK ~PSCI_VERSION_MINOR_MASK 88 #define PSCI_VERSION_MAJOR(ver) \ 89 (((ver) & PSCI_VERSION_MAJOR_MASK) >> PSCI_VERSION_MAJOR_SHIFT) 90 #define PSCI_VERSION_MINOR(ver) \ 91 ((ver) & PSCI_VERSION_MINOR_MASK) 92 93 #define PSCI_VERSION(major, minor) \ 94 (((major) << PSCI_VERSION_MAJOR_SHIFT) | (minor)) 95 96 #endif /* __ASM_PSCI_H__ */ 97 98 /* 99 * Local variables: 100 * mode: C 101 * c-file-style: "BSD" 102 * c-basic-offset: 4 103 * tab-width: 4 104 * indent-tabs-mode: nil 105 * End: 106 */ 107