Merge branch 'master' into net-dev (with code changes listed below besides normal...
[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 #include <env.h>
18
19 // will want this padded out to cacheline alignment
20 struct per_cpu_info {
21         uint32_t lock;
22         bool preempt_pending;
23         struct workqueue workqueue;
24 };
25 extern struct per_cpu_info  per_cpu_info[MAX_NUM_CPUS];
26 extern volatile uint8_t num_cpus;
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(poly_isr_t handler, TV(t) data,
34                            handler_wrapper_t** wait_wrapper);
35 int smp_call_function_all(poly_isr_t handler, TV(t) data,
36                           handler_wrapper_t** wait_wrapper);
37 int smp_call_function_single(uint8_t dest, poly_isr_t handler, TV(t) data,
38                              handler_wrapper_t** wait_wrapper);
39 int smp_call_wait(handler_wrapper_t*SAFE wrapper);
40
41 #endif /* !ROS_INC_SMP_H */