8ea49529f3248be1767fada1df474979c44d56c6
[linux-2.6-microblaze.git] / include / asm-x86 / smp_64.h
1 #ifndef __ASM_SMP_H
2 #define __ASM_SMP_H
3
4 extern cpumask_t cpu_initialized;
5 extern cpumask_t cpu_callin_map;
6
7 extern int smp_call_function_mask(cpumask_t mask, void (*func)(void *),
8                                   void *info, int wait);
9
10 #ifdef CONFIG_SMP
11
12 #define raw_smp_processor_id()  read_pda(cpunumber)
13
14 #define stack_smp_processor_id()                                        \
15 ({                                                                      \
16         struct thread_info *ti;                                         \
17         asm("andq %%rsp,%0; ":"=r" (ti) : "0" (CURRENT_MASK));  \
18         ti->cpu;                                                        \
19 })
20
21 /*
22  * On x86 all CPUs are mapped 1:1 to the APIC space. This simplifies
23  * scheduling and IPI sending and compresses data structures.
24  */
25 static inline int num_booting_cpus(void)
26 {
27         return cpus_weight(cpu_callout_map);
28 }
29
30 #define safe_smp_processor_id()         smp_processor_id()
31 #else /* CONFIG_SMP */
32 #define stack_smp_processor_id() 0
33 #define safe_smp_processor_id() 0
34 #endif /* !CONFIG_SMP */
35
36
37 #endif
38