Added more SharC annotations
[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 <ros/common.h>
14 #include <trap.h>
15 #include <atomic.h>
16 #include <process.h>
17 #include <workqueue.h>
18 #include <env.h>
19
20 // will want this padded out to cacheline alignment
21 struct per_cpu_info {
22         spinlock_t lock;
23         bool preempt_pending;
24         struct workqueue NTPTV(t) workqueue;
25 #ifdef __i386__
26         spinlock_t amsg_lock;
27         unsigned LCKD(&amsg_lock) amsg_current;
28         active_message_t LCKD(&amsg_lock) (RO active_msgs)[NUM_ACTIVE_MESSAGES];
29 #endif
30 };
31
32 typedef struct per_cpu_info NTPTV(t) NTPTV(a0t) NTPTV(a1t) NTPTV(a2t) per_cpu_info_t;
33
34 extern per_cpu_info_t (RO per_cpu_info)[MAX_NUM_CPUS];
35 extern volatile uint8_t RO num_cpus;
36
37 /* SMP bootup functions */
38 void smp_boot(void);
39 void smp_idle(void);
40
41 /* SMP utility functions */
42 int smp_call_function_self(poly_isr_t handler, TV(t) data,
43                            handler_wrapper_t** wait_wrapper);
44 int smp_call_function_all(poly_isr_t handler, TV(t) data,
45                           handler_wrapper_t** wait_wrapper);
46 int smp_call_function_single(uint32_t dest, poly_isr_t handler, TV(t) data,
47                              handler_wrapper_t** wait_wrapper);
48 int smp_call_wait(handler_wrapper_t*SAFE wrapper);
49
50 #endif /* !ROS_INC_SMP_H */