Update to cycle through multiple IPI vectors
[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 struct IPIWrapper;
21 typedef struct IPIWrapper ipi_wrapper_t;
22
23 LIST_HEAD(ipi_wrapper_list_t, ipi_wrapper_t);
24 typedef LIST_ENTRY(ipi_wrapper_t) ipi_wrapper_list_entry_t;
25
26 struct IPIWrapper {
27         ipi_wrapper_list_entry_t ipi_link;      /* list link */
28
29         checklist_t* front_cpu_list;
30         checklist_t* back_cpu_list;
31         uint8_t vector;
32 };
33
34 void smp_boot(void);
35 void smp_call_function_self(isr_t handler, bool wait);
36 void smp_call_function_all(isr_t handler, bool wait);
37 void smp_call_function_single(uint8_t dest, isr_t handler, bool wait);
38
39 #endif /* !ROS_INC_SMP_H */