author | Florian Westphal <fw@strlen.de> |
Thu, 09 Apr 2009 12:07:21 +0200 | |
changeset 2 | d1f6d8b6f81c |
parent 0 | aa628870c1d3 |
permissions | -rw-r--r-- |
0
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
1 |
#ifndef __LINUX_SMP_H |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
2 |
#define __LINUX_SMP_H |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
3 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
4 |
/* |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
5 |
* Generic SMP support |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
6 |
* Alan Cox. <alan@redhat.com> |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
7 |
*/ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
8 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
9 |
#include <linux/errno.h> |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
10 |
#include <linux/types.h> |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
11 |
#include <linux/list.h> |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
12 |
#include <linux/cpumask.h> |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
13 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
14 |
extern void cpu_idle(void); |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
15 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
16 |
struct call_single_data { |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
17 |
struct list_head list; |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
18 |
void (*func) (void *info); |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
19 |
void *info; |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
20 |
u16 flags; |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
21 |
u16 priv; |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
22 |
}; |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
23 |
|
2 | 24 |
/* total number of cpus in this system (may exceed NR_CPUS) */ |
25 |
extern unsigned int total_cpus; |
|
26 |
||
27 |
int smp_call_function_single(int cpuid, void (*func) (void *info), void *info, |
|
28 |
int wait); |
|
29 |
||
0
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
30 |
#ifdef CONFIG_SMP |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
31 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
32 |
#include <linux/preempt.h> |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
33 |
#include <linux/kernel.h> |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
34 |
#include <linux/compiler.h> |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
35 |
#include <linux/thread_info.h> |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
36 |
#include <asm/smp.h> |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
37 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
38 |
/* |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
39 |
* main cross-CPU interfaces, handles INIT, TLB flush, STOP, etc. |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
40 |
* (defined in asm header): |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
41 |
*/ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
42 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
43 |
/* |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
44 |
* stops all CPUs but the current one: |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
45 |
*/ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
46 |
extern void smp_send_stop(void); |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
47 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
48 |
/* |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
49 |
* sends a 'reschedule' event to another CPU: |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
50 |
*/ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
51 |
extern void smp_send_reschedule(int cpu); |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
52 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
53 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
54 |
/* |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
55 |
* Prepare machine for booting other CPUs. |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
56 |
*/ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
57 |
extern void smp_prepare_cpus(unsigned int max_cpus); |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
58 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
59 |
/* |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
60 |
* Bring a CPU up |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
61 |
*/ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
62 |
extern int __cpu_up(unsigned int cpunum); |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
63 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
64 |
/* |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
65 |
* Final polishing of CPUs |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
66 |
*/ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
67 |
extern void smp_cpus_done(unsigned int max_cpus); |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
68 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
69 |
/* |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
70 |
* Call a function on all other processors |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
71 |
*/ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
72 |
int smp_call_function(void(*func)(void *info), void *info, int wait); |
2 | 73 |
void smp_call_function_many(const struct cpumask *mask, |
74 |
void (*func)(void *info), void *info, bool wait); |
|
0
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
75 |
|
2 | 76 |
/* Deprecated: Use smp_call_function_many which takes a pointer to the mask. */ |
77 |
static inline int |
|
78 |
smp_call_function_mask(cpumask_t mask, void(*func)(void *info), void *info, |
|
79 |
int wait) |
|
0
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
80 |
{ |
2 | 81 |
smp_call_function_many(&mask, func, info, wait); |
82 |
return 0; |
|
0
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
83 |
} |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
84 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
85 |
void __smp_call_function_single(int cpuid, struct call_single_data *data); |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
86 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
87 |
/* |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
88 |
* Generic and arch helpers |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
89 |
*/ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
90 |
#ifdef CONFIG_USE_GENERIC_SMP_HELPERS |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
91 |
void generic_smp_call_function_single_interrupt(void); |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
92 |
void generic_smp_call_function_interrupt(void); |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
93 |
void ipi_call_lock(void); |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
94 |
void ipi_call_unlock(void); |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
95 |
void ipi_call_lock_irq(void); |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
96 |
void ipi_call_unlock_irq(void); |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
97 |
#endif |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
98 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
99 |
/* |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
100 |
* Call a function on all processors |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
101 |
*/ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
102 |
int on_each_cpu(void (*func) (void *info), void *info, int wait); |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
103 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
104 |
#define MSG_ALL_BUT_SELF 0x8000 /* Assume <32768 CPU's */ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
105 |
#define MSG_ALL 0x8001 |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
106 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
107 |
#define MSG_INVALIDATE_TLB 0x0001 /* Remote processor TLB invalidate */ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
108 |
#define MSG_STOP_CPU 0x0002 /* Sent to shut down slave CPU's |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
109 |
* when rebooting |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
110 |
*/ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
111 |
#define MSG_RESCHEDULE 0x0003 /* Reschedule request from master CPU*/ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
112 |
#define MSG_CALL_FUNCTION 0x0004 /* Call function on all other CPUs */ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
113 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
114 |
/* |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
115 |
* Mark the boot cpu "online" so that it can call console drivers in |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
116 |
* printk() and can access its per-cpu storage. |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
117 |
*/ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
118 |
void smp_prepare_boot_cpu(void); |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
119 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
120 |
extern unsigned int setup_max_cpus; |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
121 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
122 |
#else /* !SMP */ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
123 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
124 |
/* |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
125 |
* These macros fold the SMP functionality into a single CPU system |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
126 |
*/ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
127 |
#define raw_smp_processor_id() 0 |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
128 |
static inline int up_smp_call_function(void (*func)(void *), void *info) |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
129 |
{ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
130 |
return 0; |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
131 |
} |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
132 |
#define smp_call_function(func, info, wait) \ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
133 |
(up_smp_call_function(func, info)) |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
134 |
#define on_each_cpu(func,info,wait) \ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
135 |
({ \ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
136 |
local_irq_disable(); \ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
137 |
func(info); \ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
138 |
local_irq_enable(); \ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
139 |
0; \ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
140 |
}) |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
141 |
static inline void smp_send_reschedule(int cpu) { } |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
142 |
#define num_booting_cpus() 1 |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
143 |
#define smp_prepare_boot_cpu() do {} while (0) |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
144 |
#define smp_call_function_mask(mask, func, info, wait) \ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
145 |
(up_smp_call_function(func, info)) |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
146 |
#define smp_call_function_many(mask, func, info, wait) \ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
147 |
(up_smp_call_function(func, info)) |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
148 |
static inline void init_call_single_data(void) |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
149 |
{ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
150 |
} |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
151 |
#endif /* !SMP */ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
152 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
153 |
/* |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
154 |
* smp_processor_id(): get the current CPU ID. |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
155 |
* |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
156 |
* if DEBUG_PREEMPT is enabled the we check whether it is |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
157 |
* used in a preemption-safe way. (smp_processor_id() is safe |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
158 |
* if it's used in a preemption-off critical section, or in |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
159 |
* a thread that is bound to the current CPU.) |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
160 |
* |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
161 |
* NOTE: raw_smp_processor_id() is for internal use only |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
162 |
* (smp_processor_id() is the preferred variant), but in rare |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
163 |
* instances it might also be used to turn off false positives |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
164 |
* (i.e. smp_processor_id() use that the debugging code reports but |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
165 |
* which use for some reason is legal). Don't use this to hack around |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
166 |
* the warning message, as your code might not work under PREEMPT. |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
167 |
*/ |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
168 |
#ifdef CONFIG_DEBUG_PREEMPT |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
169 |
extern unsigned int debug_smp_processor_id(void); |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
170 |
# define smp_processor_id() debug_smp_processor_id() |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
171 |
#else |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
172 |
# define smp_processor_id() raw_smp_processor_id() |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
173 |
#endif |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
174 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
175 |
#define get_cpu() ({ preempt_disable(); smp_processor_id(); }) |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
176 |
#define put_cpu() preempt_enable() |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
177 |
#define put_cpu_no_resched() preempt_enable_no_resched() |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
178 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
179 |
void smp_setup_processor_id(void); |
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
180 |
|
aa628870c1d3
Port of Linux 2.6.28 for use with network simulation cradle.
Florian Westphal <fw@strlen.de>
parents:
diff
changeset
|
181 |
#endif /* __LINUX_SMP_H */ |