smp_call wait / backend work
[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* front_cpu_list;
25         checklist_t* back_cpu_list;
26         uint8_t vector;
27 } handler_wrapper_t;
28
29 /* SMP bootup functions */
30 void smp_boot(void);
31 void smp_idle(void);
32
33 /* SMP utility functions */
34 int smp_call_function_self(isr_t handler, handler_wrapper_t** wait_wrapper);
35 int smp_call_function_all(isr_t handler, handler_wrapper_t** wait_wrapper);
36 int smp_call_function_single(uint8_t dest, isr_t handler,
37                              handler_wrapper_t** wait_wrapper);
38 int smp_call_wait(handler_wrapper_t* wrapper);
39
40 #endif /* !ROS_INC_SMP_H */