x86: merge extern variables definitions
[wandboard.git] / include / asm-x86 / smp_32.h
blob9a4057d9436707fde3340d621b2288c475d809ae
1 #ifndef __ASM_SMP_H
2 #define __ASM_SMP_H
4 #ifndef __ASSEMBLY__
5 #include <linux/cpumask.h>
6 #include <linux/init.h>
8 /*
9 * We need the APIC definitions automatically as part of 'smp.h'
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
19 extern cpumask_t cpu_callin_map;
21 extern void (*mtrr_hook) (void);
22 extern void zap_low_mappings (void);
24 extern u8 __initdata x86_cpu_to_apicid_init[];
25 extern void *x86_cpu_to_apicid_early_ptr;
27 DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
28 DECLARE_PER_CPU(cpumask_t, cpu_core_map);
29 DECLARE_PER_CPU(u8, cpu_llc_id);
30 DECLARE_PER_CPU(u8, x86_cpu_to_apicid);
32 #ifdef CONFIG_HOTPLUG_CPU
33 extern void cpu_exit_clear(void);
34 extern void cpu_uninit(void);
35 extern void remove_siblinginfo(int cpu);
36 #endif
38 /* Globals due to paravirt */
39 extern void set_cpu_sibling_map(int cpu);
41 struct smp_ops
43 void (*smp_prepare_boot_cpu)(void);
44 void (*smp_prepare_cpus)(unsigned max_cpus);
45 int (*cpu_up)(unsigned cpu);
46 void (*smp_cpus_done)(unsigned max_cpus);
48 void (*smp_send_stop)(void);
49 void (*smp_send_reschedule)(int cpu);
50 int (*smp_call_function_mask)(cpumask_t mask,
51 void (*func)(void *info), void *info,
52 int wait);
55 #ifdef CONFIG_SMP
56 extern struct smp_ops smp_ops;
58 static inline void smp_prepare_boot_cpu(void)
60 smp_ops.smp_prepare_boot_cpu();
62 static inline void smp_prepare_cpus(unsigned int max_cpus)
64 smp_ops.smp_prepare_cpus(max_cpus);
66 static inline int __cpu_up(unsigned int cpu)
68 return smp_ops.cpu_up(cpu);
70 static inline void smp_cpus_done(unsigned int max_cpus)
72 smp_ops.smp_cpus_done(max_cpus);
75 static inline void smp_send_stop(void)
77 smp_ops.smp_send_stop();
79 static inline void smp_send_reschedule(int cpu)
81 smp_ops.smp_send_reschedule(cpu);
83 static inline int smp_call_function_mask(cpumask_t mask,
84 void (*func) (void *info), void *info,
85 int wait)
87 return smp_ops.smp_call_function_mask(mask, func, info, wait);
90 void native_smp_prepare_boot_cpu(void);
91 void native_smp_prepare_cpus(unsigned int max_cpus);
92 int native_cpu_up(unsigned int cpunum);
93 void native_smp_cpus_done(unsigned int max_cpus);
95 #ifndef CONFIG_PARAVIRT
96 #define startup_ipi_hook(phys_apicid, start_eip, start_esp) do { } while (0)
97 #endif
99 extern int __cpu_disable(void);
100 extern void __cpu_die(unsigned int cpu);
103 * This function is needed by all SMP systems. It must _always_ be valid
104 * from the initial startup. We map APIC_BASE very early in page_setup(),
105 * so this is correct in the x86 case.
107 DECLARE_PER_CPU(int, cpu_number);
108 #define raw_smp_processor_id() (x86_read_percpu(cpu_number))
110 #define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu)
112 extern int safe_smp_processor_id(void);
114 void __cpuinit smp_store_cpu_info(int id);
116 /* We don't mark CPUs online until __cpu_up(), so we need another measure */
117 static inline int num_booting_cpus(void)
119 return cpus_weight(cpu_callout_map);
122 #else /* CONFIG_SMP */
124 #define safe_smp_processor_id() 0
125 #define cpu_physical_id(cpu) boot_cpu_physical_apicid
127 #endif /* !CONFIG_SMP */
129 #ifdef CONFIG_X86_LOCAL_APIC
131 static __inline int logical_smp_processor_id(void)
133 /* we don't want to mark this access volatile - bad code generation */
134 return GET_APIC_LOGICAL_ID(*(u32 *)(APIC_BASE + APIC_LDR));
137 # ifdef APIC_DEFINITION
138 extern int hard_smp_processor_id(void);
139 # else
140 # include <mach_apicdef.h>
141 static inline int hard_smp_processor_id(void)
143 /* we don't want to mark this access volatile - bad code generation */
144 return GET_APIC_ID(*(u32 *)(APIC_BASE + APIC_ID));
146 # endif /* APIC_DEFINITION */
148 #else /* CONFIG_X86_LOCAL_APIC */
150 # ifndef CONFIG_SMP
151 # define hard_smp_processor_id() 0
152 # endif
154 #endif /* CONFIG_X86_LOCAL_APIC */
156 #endif /* !ASSEMBLY */
157 #endif