Annotated i386/smp.c i386/smp_boot.c
[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         bool preempt_pending;
22         struct workqueue workqueue;
23 };
24 extern struct per_cpu_info  per_cpu_info[MAX_NUM_CPUS];
25 extern volatile uint8_t num_cpus;
26
27 /* SMP bootup functions */
28 void smp_boot(void);
29 void smp_idle(void);
30
31 /* SMP utility functions */
32 int smp_call_function_self(poly_isr_t handler, TV(t) data,
33                            handler_wrapper_t** wait_wrapper);
34 int smp_call_function_all(poly_isr_t handler, TV(t) data,
35                           handler_wrapper_t** wait_wrapper);
36 int smp_call_function_single(uint8_t dest, poly_isr_t handler, TV(t) data,
37                              handler_wrapper_t** wait_wrapper);
38 int smp_call_wait(handler_wrapper_t*SAFE wrapper);
39
40 #endif /* !ROS_INC_SMP_H */