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_INVALIDATE_PAGE_RANGE = 0, 20 SMP_MSG_INVALIDATE_PAGE_LIST, 21 SMP_MSG_USER_INVALIDATE_PAGES, 22 SMP_MSG_GLOBAL_INVALIDATE_PAGES, 23 SMP_MSG_CPU_HALT, 24 SMP_MSG_CALL_FUNCTION, 25 SMP_MSG_RESCHEDULE 26 }; 27 28 enum { 29 SMP_MSG_FLAG_ASYNC = 0x0, 30 SMP_MSG_FLAG_SYNC = 0x1, 31 SMP_MSG_FLAG_FREE_ARG = 0x2, 32 }; 33 34 typedef uint32 cpu_mask_t; 35 36 typedef void (*smp_call_func)(uint32 data1, int32 currentCPU, uint32 data2, uint32 data3); 37 38 39 #ifdef __cplusplus 40 extern "C" { 41 #endif 42 43 status_t smp_init(struct kernel_args *args); 44 status_t smp_per_cpu_init(struct kernel_args *args, int32 cpu); 45 status_t smp_init_post_generic_syscalls(void); 46 bool smp_trap_non_boot_cpus(int32 cpu); 47 void smp_wake_up_non_boot_cpus(void); 48 void smp_cpu_rendezvous(volatile uint32 *var, int current_cpu); 49 void smp_send_ici(int32 targetCPU, int32 message, uint32 data, uint32 data2, uint32 data3, 50 void *data_ptr, uint32 flags); 51 void smp_send_multicast_ici(cpu_mask_t cpuMask, int32 message, uint32 data, 52 uint32 data2, uint32 data3, void *data_ptr, uint32 flags); 53 void smp_send_broadcast_ici(int32 message, uint32 data, uint32 data2, uint32 data3, 54 void *data_ptr, uint32 flags); 55 void smp_send_broadcast_ici_interrupts_disabled(int32 currentCPU, int32 message, 56 uint32 data, uint32 data2, uint32 data3, void *data_ptr, uint32 flags); 57 58 int32 smp_get_num_cpus(void); 59 void smp_set_num_cpus(int32 numCPUs); 60 int32 smp_get_current_cpu(void); 61 62 int smp_intercpu_int_handler(int32 cpu); 63 64 #ifdef __cplusplus 65 } 66 #endif 67 68 #endif /* KERNEL_SMP_H */ 69