]> nv-tegra.nvidia Code Review - linux-3.10.git/blob - include/asm-x86/smp.h
x86: integrate do_boot_cpu
[linux-3.10.git] / include / asm-x86 / smp.h
1 #ifndef _ASM_X86_SMP_H_
2 #define _ASM_X86_SMP_H_
3 #ifndef __ASSEMBLY__
4 #include <linux/cpumask.h>
5 #include <linux/init.h>
6 #include <asm/percpu.h>
7
8 extern cpumask_t cpu_callout_map;
9
10 extern int smp_num_siblings;
11 extern unsigned int num_processors;
12 extern cpumask_t cpu_initialized;
13
14 extern u16 x86_cpu_to_apicid_init[];
15 extern u16 x86_bios_cpu_apicid_init[];
16 extern void *x86_cpu_to_apicid_early_ptr;
17 extern void *x86_bios_cpu_apicid_early_ptr;
18
19 DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
20 DECLARE_PER_CPU(cpumask_t, cpu_core_map);
21 DECLARE_PER_CPU(u16, cpu_llc_id);
22 DECLARE_PER_CPU(u16, x86_cpu_to_apicid);
23 DECLARE_PER_CPU(u16, x86_bios_cpu_apicid);
24
25 /*
26  * Trampoline 80x86 program as an array.
27  */
28 extern const unsigned char trampoline_data [];
29 extern const unsigned char trampoline_end  [];
30 extern unsigned char *trampoline_base;
31
32 /* Static state in head.S used to set up a CPU */
33 extern struct {
34         void *sp;
35         unsigned short ss;
36 } stack_start;
37
38 extern unsigned long init_rsp;
39 extern unsigned long initial_code;
40
41 struct smp_ops {
42         void (*smp_prepare_boot_cpu)(void);
43         void (*smp_prepare_cpus)(unsigned max_cpus);
44         int (*cpu_up)(unsigned cpu);
45         void (*smp_cpus_done)(unsigned max_cpus);
46
47         void (*smp_send_stop)(void);
48         void (*smp_send_reschedule)(int cpu);
49         int (*smp_call_function_mask)(cpumask_t mask,
50                                       void (*func)(void *info), void *info,
51                                       int wait);
52 };
53
54 /* Globals due to paravirt */
55 extern void set_cpu_sibling_map(int cpu);
56
57 #ifdef CONFIG_SMP
58 #ifndef CONFIG_PARAVIRT
59 #define startup_ipi_hook(phys_apicid, start_eip, start_esp) do { } while (0)
60 #endif
61 extern struct smp_ops smp_ops;
62
63 static inline void smp_send_stop(void)
64 {
65         smp_ops.smp_send_stop();
66 }
67
68 static inline void smp_prepare_boot_cpu(void)
69 {
70         smp_ops.smp_prepare_boot_cpu();
71 }
72
73 static inline void smp_prepare_cpus(unsigned int max_cpus)
74 {
75         smp_ops.smp_prepare_cpus(max_cpus);
76 }
77
78 static inline void smp_cpus_done(unsigned int max_cpus)
79 {
80         smp_ops.smp_cpus_done(max_cpus);
81 }
82
83 static inline int __cpu_up(unsigned int cpu)
84 {
85         return smp_ops.cpu_up(cpu);
86 }
87
88 static inline void smp_send_reschedule(int cpu)
89 {
90         smp_ops.smp_send_reschedule(cpu);
91 }
92
93 static inline int smp_call_function_mask(cpumask_t mask,
94                                          void (*func) (void *info), void *info,
95                                          int wait)
96 {
97         return smp_ops.smp_call_function_mask(mask, func, info, wait);
98 }
99
100 void native_smp_prepare_boot_cpu(void);
101 void native_smp_prepare_cpus(unsigned int max_cpus);
102 void native_smp_cpus_done(unsigned int max_cpus);
103 int native_cpu_up(unsigned int cpunum);
104
105 extern int __cpu_disable(void);
106 extern void __cpu_die(unsigned int cpu);
107
108 extern unsigned disabled_cpus;
109 extern void prefill_possible_map(void);
110
111 #define SMP_TRAMPOLINE_BASE 0x6000
112 extern unsigned long setup_trampoline(void);
113
114 void smp_store_cpu_info(int id);
115 #define cpu_physical_id(cpu)    per_cpu(x86_cpu_to_apicid, cpu)
116 #else
117 #define cpu_physical_id(cpu)            boot_cpu_physical_apicid
118 #endif
119
120 #ifdef CONFIG_X86_32
121 # include "smp_32.h"
122 #else
123 # include "smp_64.h"
124 #endif
125
126 #ifdef CONFIG_HOTPLUG_CPU
127 extern void cpu_exit_clear(void);
128 extern void cpu_uninit(void);
129 extern void remove_siblinginfo(int cpu);
130 #endif
131
132 extern void smp_alloc_memory(void);
133 extern void lock_ipi_call_lock(void);
134 extern void unlock_ipi_call_lock(void);
135 #endif /* __ASSEMBLY__ */
136 #endif