1#ifndef __LINUX_SMP_H
2#define __LINUX_SMP_H
3
4
5
6
7
8
9#include <linux/config.h>
10
11#ifdef CONFIG_SMP
12
13#include <linux/preempt.h>
14#include <linux/kernel.h>
15#include <linux/compiler.h>
16#include <linux/thread_info.h>
17#include <asm/smp.h>
18#include <asm/bug.h>
19
20
21
22
23
24
25
26
27
28extern void smp_send_stop(void);
29
30
31
32
33extern void smp_send_reschedule(int cpu);
34
35
36
37
38
39extern void smp_prepare_cpus(unsigned int max_cpus);
40
41
42
43
44extern int __cpu_up(unsigned int cpunum);
45
46
47
48
49extern void smp_cpus_done(unsigned int max_cpus);
50
51
52
53
54extern int smp_call_function (void (*func) (void *info), void *info,
55 int retry, int wait);
56
57
58
59
60static inline int on_each_cpu(void (*func) (void *info), void *info,
61 int retry, int wait)
62{
63 int ret = 0;
64
65 preempt_disable();
66 ret = smp_call_function(func, info, retry, wait);
67 func(info);
68 preempt_enable();
69 return ret;
70}
71
72
73
74
75extern int smp_threads_ready;
76
77#define MSG_ALL_BUT_SELF 0x8000
78#define MSG_ALL 0x8001
79
80#define MSG_INVALIDATE_TLB 0x0001
81#define MSG_STOP_CPU 0x0002
82
83
84#define MSG_RESCHEDULE 0x0003
85#define MSG_CALL_FUNCTION 0x0004
86
87
88
89
90
91void smp_prepare_boot_cpu(void);
92
93#else
94
95
96
97
98
99#define smp_processor_id() 0
100#define hard_smp_processor_id() 0
101#define smp_threads_ready 1
102#define smp_call_function(func,info,retry,wait) ({ 0; })
103#define on_each_cpu(func,info,retry,wait) ({ func(info); 0; })
104static inline void smp_send_reschedule(int cpu) { }
105#define num_booting_cpus() 1
106#define smp_prepare_boot_cpu() do {} while (0)
107
108#endif
109
110#define get_cpu() ({ preempt_disable(); smp_processor_id(); })
111#define put_cpu() preempt_enable()
112#define put_cpu_no_resched() preempt_enable_no_resched()
113
114#endif
115