Interrupt handlers and smp_calls take a void*
[akaros.git] / kern / smp.h
1 #ifndef ROS_INC_SMP_H
2 #define ROS_INC_SMP_H
3
4 /* SMP related functions */
5
6 #include <inc/types.h>
7 #include <inc/queue.h>
8
9 #include <kern/trap.h>
10 #include <kern/atomic.h>
11
12 #ifdef __BOCHS__
13 #define SMP_CALL_FUNCTION_TIMEOUT    0x00ffffff
14 #define SMP_BOOT_TIMEOUT             0x0000ffff
15 #else
16 #define SMP_CALL_FUNCTION_TIMEOUT    0x7ffffff0
17 #define SMP_BOOT_TIMEOUT             0x002fffff
18 #endif
19
20 // be careful changing this, esp if you go over 16
21 #define NUM_HANDLER_WRAPPERS            5
22
23 typedef struct HandlerWrapper {
24         checklist_t* cpu_list;
25         uint8_t vector;
26 } handler_wrapper_t;
27
28 /* SMP bootup functions */
29 void smp_boot(void);
30 void smp_idle(void);
31
32 /* SMP utility functions */
33 int smp_call_function_self(isr_t handler, void* data,
34                            handler_wrapper_t** wait_wrapper);
35 int smp_call_function_all(isr_t handler, void* data,
36                           handler_wrapper_t** wait_wrapper);
37 int smp_call_function_single(uint8_t dest, isr_t handler, void* data,
38                              handler_wrapper_t** wait_wrapper);
39 int smp_call_wait(handler_wrapper_t* wrapper);
40
41 #endif /* !ROS_INC_SMP_H */