1 // © 2021 Qualcomm Innovation Center, Inc. All rights reserved. 2 // 3 // SPDX-License-Identifier: BSD-3-Clause 4 5 // Platform wrappers for SMP support. 6 7 // Check whether a cpu_index maps to cpu that exists. Note however, a CPU that 8 // exists may not be functional. 9 bool 10 platform_cpu_exists(cpu_index_t cpu); 11 12 // Power on the specified CPU. 13 error_t 14 platform_cpu_on(cpu_index_t cpu); 15 16 // Power off the calling CPU. Returns after the CPU is powered on again by a 17 // platform_cpu_on() call on another CPU. 18 void 19 platform_cpu_off(void) REQUIRE_PREEMPT_DISABLED; 20 21 // The system and CPUs are reset, and will restart from the firmware/bootloader. 22 void 23 platform_system_reset(void) REQUIRE_PREEMPT_DISABLED; 24 25 // Suspend the calling CPU until a wakeup event occurs. 26 // 27 // The argument is a platform-specific power state value which represents the 28 // deepest sleep state this call is permitted to enter. On success, the result 29 // is true if the CPU woke from a power-off state, and false if it either 30 // woke from a retention state or returned without suspending due to a pending 31 // wakeup event. 32 // 33 // This may fail with ERROR_ARGUMENT_INVALID if the power state argument is 34 // not understood or not permitted by the platform, or ERROR_DENIED if the 35 // attempt to sleep was aborted due to a pending wakeup on another CPU in the 36 // same power domain. 37 bool_result_t 38 platform_cpu_suspend(platform_power_state_t power_state) 39 REQUIRE_PREEMPT_DISABLED; 40 41 // Set the suspend mode used by the hypervisor 42 // 43 // This function can only return OK if the following conditions are met: 44 // If switching from PC to OSI mode: 45 // - All cores are either Running, OFF (using CPU_OFF or not booted yet), 46 // or Suspended (using CPU_DEFAULT_SUSPEND) 47 // - None of the processors has called CPU_SUSPEND since the last change of 48 // mode or boot. 49 // If switching from OSI to PC mode: all cores other than the calling one are 50 // OFF (using CPU_OFF or not booted yet) 51 error_t 52 platform_psci_set_suspend_mode(psci_mode_t mode); 53 54 #if defined(PLATFORM_PSCI_DEFAULT_SUSPEND) 55 // Suspend the calling CPU until a wakeup event occurs. Similar to cpu suspend, 56 // but the caller does not need to specify a power state parameter. 57 bool_result_t 58 platform_cpu_default_suspend(void) REQUIRE_PREEMPT_DISABLED; 59 #endif 60 61 #if defined(ARCH_ARM) 62 platform_mpidr_mapping_t 63 platform_cpu_get_mpidr_mapping(void); 64 65 MPIDR_EL1_t 66 platform_cpu_map_index_to_mpidr(const platform_mpidr_mapping_t *mapping, 67 index_t index); 68 69 index_t 70 platform_cpu_map_mpidr_to_index(const platform_mpidr_mapping_t *mapping, 71 MPIDR_EL1_t mpidr); 72 73 bool 74 platform_cpu_map_mpidr_valid(const platform_mpidr_mapping_t *mapping, 75 MPIDR_EL1_t mpidr); 76 77 MPIDR_EL1_t 78 platform_cpu_index_to_mpidr(index_t index); 79 80 index_t 81 platform_cpu_mpidr_to_index(MPIDR_EL1_t mpidr); 82 83 bool 84 platform_cpu_mpidr_valid(MPIDR_EL1_t mpidr); 85 86 core_id_t 87 platform_cpu_get_coreid(MIDR_EL1_t midr); 88 #endif 89 90 #if defined(ARCH_ARM_FEAT_BTI) 91 bool 92 platform_cpu_bti_enabled(void); 93 #endif 94 95 uint32_t 96 platform_cpu_stack_size(void); 97