[PATCH] Move cpu notifiers et al to cpu.h
[linux-2.6/history.git] / include / linux / smp.h
blobade73fe7969bb03f727f3c7431298818e86b59b2
1 #ifndef __LINUX_SMP_H
2 #define __LINUX_SMP_H
4 /*
5 * Generic SMP support
6 * Alan Cox. <alan@redhat.com>
7 */
9 #include <linux/config.h>
11 #ifdef CONFIG_SMP
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>
21 * main cross-CPU interfaces, handles INIT, TLB flush, STOP, etc.
22 * (defined in asm header):
23 */
26 * stops all CPUs but the current one:
28 extern void smp_send_stop(void);
31 * sends a 'reschedule' event to another CPU:
33 extern void FASTCALL(smp_send_reschedule(int cpu));
37 * Prepare machine for booting other CPUs.
39 extern void smp_prepare_cpus(unsigned int max_cpus);
42 * Bring a CPU up
44 extern int __cpu_up(unsigned int cpunum);
47 * Final polishing of CPUs
49 extern void smp_cpus_done(unsigned int max_cpus);
52 * Call a function on all other processors
54 extern int smp_call_function (void (*func) (void *info), void *info,
55 int retry, int wait);
58 * Call a function on all processors
60 static inline int on_each_cpu(void (*func) (void *info), void *info,
61 int retry, int wait)
63 int ret = 0;
65 preempt_disable();
66 ret = smp_call_function(func, info, retry, wait);
67 func(info);
68 preempt_enable();
69 return ret;
73 * True once the per process idle is forked
75 extern int smp_threads_ready;
77 #define MSG_ALL_BUT_SELF 0x8000 /* Assume <32768 CPU's */
78 #define MSG_ALL 0x8001
80 #define MSG_INVALIDATE_TLB 0x0001 /* Remote processor TLB invalidate */
81 #define MSG_STOP_CPU 0x0002 /* Sent to shut down slave CPU's
82 * when rebooting
84 #define MSG_RESCHEDULE 0x0003 /* Reschedule request from master CPU*/
85 #define MSG_CALL_FUNCTION 0x0004 /* Call function on all other CPUs */
88 * Mark the boot cpu "online" so that it can call console drivers in
89 * printk() and can access its per-cpu storage.
91 void smp_prepare_boot_cpu(void);
93 #else /* !SMP */
96 * These macros fold the SMP functionality into a single CPU system
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; })
104 static inline void smp_send_reschedule(int cpu) { }
105 #define cpu_online_map 1
106 #define cpu_online(cpu) ({ BUG_ON((cpu) != 0); 1; })
107 #define num_online_cpus() 1
108 #define num_booting_cpus() 1
109 #define cpu_possible(cpu) ({ BUG_ON((cpu) != 0); 1; })
110 #define smp_prepare_boot_cpu() do {} while (0)
112 #endif /* !SMP */
114 #define get_cpu() ({ preempt_disable(); smp_processor_id(); })
115 #define put_cpu() preempt_enable()
116 #define put_cpu_no_resched() preempt_enable_no_resched()
118 #endif /* __LINUX_SMP_H */