1 // Copyright 2016 The Fuchsia Authors 2 // Copyright (c) 2014 Travis Geiselbrecht 3 // 4 // Use of this source code is governed by a MIT-style 5 // license that can be found in the LICENSE file or at 6 // https://opensource.org/licenses/MIT 7 8 #pragma once 9 10 #include <sys/types.h> 11 #include <kernel/cpu.h> 12 #include <kernel/mp.h> 13 #include <zircon/types.h> 14 15 __BEGIN_CDECLS 16 17 /* send inter processor interrupt, if supported */ 18 zx_status_t arch_mp_send_ipi(mp_ipi_target_t, cpu_mask_t mask, mp_ipi_t ipi); 19 20 /* Reschedules tasks on the cpus specified by mask. Mask will not 21 * contain the local cpu_id. Will be called under the thread lock. 22 */ 23 zx_status_t arch_mp_reschedule(cpu_mask_t mask); 24 /* Sets the idle state of the current cpu. Will be called under the 25 * thread lock. */ 26 void arch_prepare_current_cpu_idle_state(bool idle); 27 28 /* Bring a CPU up and enter it into the scheduler */ 29 zx_status_t platform_mp_cpu_hotplug(cpu_num_t cpu_id); 30 31 /* Prepare for CPU unplug. The platform may want to shift 32 * around external interrupts at this time. */ 33 zx_status_t platform_mp_prep_cpu_unplug(cpu_num_t cpu_id); 34 35 /* shutdown the specified CPU. called after it is no longer 36 * being scheduled on. */ 37 zx_status_t platform_mp_cpu_unplug(cpu_num_t cpu_id); 38 39 /* Should be invoked by platform_mp_cpu_hotplug to ask the arch 40 * to bring a CPU up and enter it into the scheduler */ 41 zx_status_t arch_mp_cpu_hotplug(cpu_num_t cpu_id); 42 43 /* Should be invoked by platform_mp_prep_cpu_unplug to ask the 44 * arch to do whatever it needs to do to stop the CPU */ 45 zx_status_t arch_mp_prep_cpu_unplug(cpu_num_t cpu_id); 46 47 /* Should be invoked by platform_mp_cpu_unplug to ask the 48 * arch to do whatever it needs to do to stop the CPU */ 49 zx_status_t arch_mp_cpu_unplug(cpu_num_t cpu_id); 50 51 void arch_mp_init_percpu(void); 52 53 __END_CDECLS 54