1 /* 2 * Copyright 2002-2005, Axel Dörfler, axeld@pinc-software.de. 3 * Distributed under the terms of the MIT License. 4 * 5 * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. 6 * Distributed under the terms of the NewOS License. 7 */ 8 #ifndef KERNEL_SMP_H 9 #define KERNEL_SMP_H 10 11 12 #include <KernelExport.h> 13 14 struct kernel_args; 15 16 17 // intercpu messages 18 enum { 19 SMP_MSG_INVL_PAGE_RANGE = 0, 20 SMP_MSG_INVL_PAGE_LIST, 21 SMP_MSG_GLOBAL_INVL_PAGE, 22 SMP_MSG_RESCHEDULE, 23 SMP_MSG_CPU_HALT, 24 SMP_MSG_CALL_FUNCTION, 25 }; 26 27 enum { 28 SMP_MSG_FLAG_ASYNC = 0x0, 29 SMP_MSG_FLAG_SYNC = 0x1, 30 SMP_MSG_FLAG_FREE_ARG = 0x2, 31 }; 32 33 typedef void (*smp_call_func)(uint32 data1, int32 currentCPU, uint32 data2, uint32 data3); 34 35 36 #ifdef __cplusplus 37 extern "C" { 38 #endif 39 40 status_t smp_init(struct kernel_args *args); 41 status_t smp_per_cpu_init(struct kernel_args *args, int32 cpu); 42 bool smp_trap_non_boot_cpus(int32 cpu); 43 void smp_wake_up_non_boot_cpus(void); 44 void smp_wait_for_non_boot_cpus(void); 45 void smp_send_ici(int32 targetCPU, int32 message, uint32 data, uint32 data2, uint32 data3, 46 void *data_ptr, uint32 flags); 47 void smp_send_broadcast_ici(int32 message, uint32 data, uint32 data2, uint32 data3, 48 void *data_ptr, uint32 flags); 49 50 int32 smp_get_num_cpus(void); 51 void smp_set_num_cpus(int32 numCPUs); 52 int32 smp_get_current_cpu(void); 53 54 int smp_intercpu_int_handler(void); 55 56 #ifdef __cplusplus 57 } 58 #endif 59 60 #endif /* KERNEL_SMP_H */ 61