include/asm-x86/vdso.h: checkpatch cleanups - formatting only
[sfrench/cifs-2.6.git] / include / asm-x86 / smp_32.h
1 #ifndef __ASM_SMP_H
2 #define __ASM_SMP_H
3
4 #ifndef __ASSEMBLY__
5 #include <linux/cpumask.h>
6 #include <linux/init.h>
7
8 /*
9  * We need the APIC definitions automatically as part of 'smp.h'
10  */
11 #ifdef CONFIG_X86_LOCAL_APIC
12 # include <asm/mpspec.h>
13 # include <asm/apic.h>
14 # ifdef CONFIG_X86_IO_APIC
15 #  include <asm/io_apic.h>
16 # endif
17 #endif
18
19 extern cpumask_t cpu_callin_map;
20
21 extern void (*mtrr_hook)(void);
22 extern void zap_low_mappings(void);
23
24 #ifdef CONFIG_SMP
25 /*
26  * This function is needed by all SMP systems. It must _always_ be valid
27  * from the initial startup. We map APIC_BASE very early in page_setup(),
28  * so this is correct in the x86 case.
29  */
30 DECLARE_PER_CPU(int, cpu_number);
31 #define raw_smp_processor_id() (x86_read_percpu(cpu_number))
32
33 extern int safe_smp_processor_id(void);
34
35 /* We don't mark CPUs online until __cpu_up(), so we need another measure */
36 static inline int num_booting_cpus(void)
37 {
38         return cpus_weight(cpu_callout_map);
39 }
40
41 #else /* CONFIG_SMP */
42 #define safe_smp_processor_id()         0
43 #endif /* !CONFIG_SMP */
44
45 #ifdef CONFIG_X86_LOCAL_APIC
46
47 static inline int logical_smp_processor_id(void)
48 {
49         /* we don't want to mark this access volatile - bad code generation */
50         return GET_APIC_LOGICAL_ID(*(u32 *)(APIC_BASE + APIC_LDR));
51 }
52
53 # ifdef APIC_DEFINITION
54 extern int hard_smp_processor_id(void);
55 # else
56 #  include <mach_apicdef.h>
57 static inline int hard_smp_processor_id(void)
58 {
59         /* we don't want to mark this access volatile - bad code generation */
60         return GET_APIC_ID(*(u32 *)(APIC_BASE + APIC_ID));
61 }
62 # endif /* APIC_DEFINITION */
63
64 #else /* CONFIG_X86_LOCAL_APIC */
65
66 # ifndef CONFIG_SMP
67 #  define hard_smp_processor_id()       0
68 # endif
69
70 #endif /* CONFIG_X86_LOCAL_APIC */
71
72 #endif /* !ASSEMBLY */
73 #endif