File: /usr/include/linux/smp.h

1     #ifndef __LINUX_SMP_H
2     #define __LINUX_SMP_H
3     
4     /*
5      *	Generic SMP support
6      *		Alan Cox. <alan@redhat.com>
7      */
8     
9     #include <linux/config.h>
10     
11     #ifdef CONFIG_SMP
12     
13     #include <linux/kernel.h>
14     #include <asm/smp.h>
15     
16     /*
17      * main cross-CPU interfaces, handles INIT, TLB flush, STOP, etc.
18      * (defined in asm header):
19      */ 
20     
21     /*
22      * stops all CPUs but the current one:
23      */
24     extern void smp_send_stop(void);
25     
26     /*
27      * sends a 'reschedule' event to another CPU:
28      */
29     extern void FASTCALL(smp_send_reschedule(int cpu));
30     
31     
32     /*
33      * Boot processor call to load the other CPU's
34      */
35     extern void smp_boot_cpus(void);
36     
37     /*
38      * Processor call in. Must hold processors until ..
39      */
40     extern void smp_callin(void);
41     
42     /*
43      * Multiprocessors may now schedule
44      */
45     extern void smp_commence(void);
46     
47     /*
48      * Call a function on all other processors
49      */
50     extern int smp_call_function (void (*func) (void *info), void *info,
51     			      int retry, int wait);
52     
53     /*
54      * True once the per process idle is forked
55      */
56     extern int smp_threads_ready;
57     
58     extern int smp_num_cpus;
59     
60     extern volatile unsigned long smp_msg_data;
61     extern volatile int smp_src_cpu;
62     extern volatile int smp_msg_id;
63     
64     #define MSG_ALL_BUT_SELF	0x8000	/* Assume <32768 CPU's */
65     #define MSG_ALL			0x8001
66     
67     #define MSG_INVALIDATE_TLB	0x0001	/* Remote processor TLB invalidate */
68     #define MSG_STOP_CPU		0x0002	/* Sent to shut down slave CPU's
69     					 * when rebooting
70     					 */
71     #define MSG_RESCHEDULE		0x0003	/* Reschedule request from master CPU*/
72     #define MSG_CALL_FUNCTION       0x0004  /* Call function on all other CPUs */
73     
74     #else
75     
76     /*
77      *	These macros fold the SMP functionality into a single CPU system
78      */
79     
80     #define NR_CPUS					1 
81     #define smp_num_cpus				1
82     #define smp_processor_id()			0
83     #define hard_smp_processor_id()			0
84     #define smp_threads_ready			1
85     #define kernel_lock()
86     #define cpu_logical_map(cpu)			0
87     #define cpu_number_map(cpu)			0
88     #define smp_call_function(func,info,retry,wait)	({ 0; })
89     #define cpu_online_map				1
90     
91     #endif
92     #endif
93