Merge branch 'master' into proc-work
[akaros.git] / kern / include / smp.h
1 /*
2  * Copyright (c) 2009 The Regents of the University of California
3  * Barret Rhoden <brho@cs.berkeley.edu>
4  * See LICENSE for details.
5  */
6
7 #ifndef ROS_INC_SMP_H
8 #define ROS_INC_SMP_H
9
10 /* SMP related functions */
11
12 #include <arch/smp.h>
13 #include <arch/types.h>
14 #include <trap.h>
15 #include <atomic.h>
16 #include <workqueue.h>
17
18 // will want this padded out to cacheline alignment
19 struct per_cpu_info {
20         uint32_t lock;
21         struct workqueue workqueue;
22 };
23 extern struct per_cpu_info  per_cpu_info[MAX_NUM_CPUS];
24 extern volatile uint8_t num_cpus;
25
26 /* SMP bootup functions */
27 void smp_boot(void);
28 void smp_idle(void);
29
30 /* SMP utility functions */
31 int smp_call_function_self(isr_t handler, void* data,
32                            handler_wrapper_t** wait_wrapper);
33 int smp_call_function_all(isr_t handler, void* data,
34                           handler_wrapper_t** wait_wrapper);
35 int smp_call_function_single(uint8_t dest, isr_t handler, void* data,
36                              handler_wrapper_t** wait_wrapper);
37 int smp_call_wait(handler_wrapper_t*SAFE wrapper);
38
39 #endif /* !ROS_INC_SMP_H */