diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-01-28 11:55:37 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-01-29 08:16:42 -0500 |
commit | 1dcdd3d15ecea0c22a09d4d001a39d425fceff2c (patch) | |
tree | 91419ae421b2d1cac6297c9671eac2ff7723d7c2 /arch/x86/include/asm/genapic.h | |
parent | 7c20dcc545d78946e40e8fab99637fe815b1d211 (diff) |
x86: remove mach_apic.h
Spread mach_apic.h definitions into genapic.h. (with some knock-on effects
on smp.h and apic.h.)
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/include/asm/genapic.h')
-rw-r--r-- | arch/x86/include/asm/genapic.h | 139 |
1 files changed, 139 insertions, 0 deletions
diff --git a/arch/x86/include/asm/genapic.h b/arch/x86/include/asm/genapic.h index 1772dad01b1d..ce3655a4948d 100644 --- a/arch/x86/include/asm/genapic.h +++ b/arch/x86/include/asm/genapic.h | |||
@@ -120,4 +120,143 @@ static inline void default_wait_for_init_deassert(atomic_t *deassert) | |||
120 | return; | 120 | return; |
121 | } | 121 | } |
122 | 122 | ||
123 | extern void generic_bigsmp_probe(void); | ||
124 | |||
125 | |||
126 | #ifdef CONFIG_X86_LOCAL_APIC | ||
127 | |||
128 | #include <asm/smp.h> | ||
129 | |||
130 | #define APIC_DFR_VALUE (APIC_DFR_FLAT) | ||
131 | |||
132 | static inline const struct cpumask *default_target_cpus(void) | ||
133 | { | ||
134 | #ifdef CONFIG_SMP | ||
135 | return cpu_online_mask; | ||
136 | #else | ||
137 | return cpumask_of(0); | ||
138 | #endif | ||
139 | } | ||
140 | |||
141 | DECLARE_EARLY_PER_CPU(u16, x86_bios_cpu_apicid); | ||
142 | |||
143 | |||
144 | static inline unsigned int read_apic_id(void) | ||
145 | { | ||
146 | unsigned int reg; | ||
147 | |||
148 | reg = *(u32 *)(APIC_BASE + APIC_ID); | ||
149 | |||
150 | return apic->get_apic_id(reg); | ||
151 | } | ||
152 | |||
153 | #ifdef CONFIG_X86_64 | ||
154 | extern void default_setup_apic_routing(void); | ||
155 | #else | ||
156 | |||
157 | /* | ||
158 | * Set up the logical destination ID. | ||
159 | * | ||
160 | * Intel recommends to set DFR, LDR and TPR before enabling | ||
161 | * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel | ||
162 | * document number 292116). So here it goes... | ||
163 | */ | ||
164 | extern void default_init_apic_ldr(void); | ||
165 | |||
166 | static inline int default_apic_id_registered(void) | ||
167 | { | ||
168 | return physid_isset(read_apic_id(), phys_cpu_present_map); | ||
169 | } | ||
170 | |||
171 | static inline unsigned int | ||
172 | default_cpu_mask_to_apicid(const struct cpumask *cpumask) | ||
173 | { | ||
174 | return cpumask_bits(cpumask)[0]; | ||
175 | } | ||
176 | |||
177 | static inline unsigned int | ||
178 | default_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | ||
179 | const struct cpumask *andmask) | ||
180 | { | ||
181 | unsigned long mask1 = cpumask_bits(cpumask)[0]; | ||
182 | unsigned long mask2 = cpumask_bits(andmask)[0]; | ||
183 | unsigned long mask3 = cpumask_bits(cpu_online_mask)[0]; | ||
184 | |||
185 | return (unsigned int)(mask1 & mask2 & mask3); | ||
186 | } | ||
187 | |||
188 | static inline int default_phys_pkg_id(int cpuid_apic, int index_msb) | ||
189 | { | ||
190 | return cpuid_apic >> index_msb; | ||
191 | } | ||
192 | |||
193 | static inline void default_setup_apic_routing(void) | ||
194 | { | ||
195 | #ifdef CONFIG_X86_IO_APIC | ||
196 | printk("Enabling APIC mode: %s. Using %d I/O APICs\n", | ||
197 | "Flat", nr_ioapics); | ||
198 | #endif | ||
199 | } | ||
200 | |||
201 | extern int default_apicid_to_node(int logical_apicid); | ||
202 | |||
203 | #endif | ||
204 | |||
205 | static inline unsigned long default_check_apicid_used(physid_mask_t bitmap, int apicid) | ||
206 | { | ||
207 | return physid_isset(apicid, bitmap); | ||
208 | } | ||
209 | |||
210 | static inline unsigned long default_check_apicid_present(int bit) | ||
211 | { | ||
212 | return physid_isset(bit, phys_cpu_present_map); | ||
213 | } | ||
214 | |||
215 | static inline physid_mask_t default_ioapic_phys_id_map(physid_mask_t phys_map) | ||
216 | { | ||
217 | return phys_map; | ||
218 | } | ||
219 | |||
220 | /* Mapping from cpu number to logical apicid */ | ||
221 | static inline int default_cpu_to_logical_apicid(int cpu) | ||
222 | { | ||
223 | return 1 << cpu; | ||
224 | } | ||
225 | |||
226 | static inline int __default_cpu_present_to_apicid(int mps_cpu) | ||
227 | { | ||
228 | if (mps_cpu < nr_cpu_ids && cpu_present(mps_cpu)) | ||
229 | return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu); | ||
230 | else | ||
231 | return BAD_APICID; | ||
232 | } | ||
233 | |||
234 | static inline int | ||
235 | __default_check_phys_apicid_present(int boot_cpu_physical_apicid) | ||
236 | { | ||
237 | return physid_isset(boot_cpu_physical_apicid, phys_cpu_present_map); | ||
238 | } | ||
239 | |||
240 | #ifdef CONFIG_X86_32 | ||
241 | static inline int default_cpu_present_to_apicid(int mps_cpu) | ||
242 | { | ||
243 | return __default_cpu_present_to_apicid(mps_cpu); | ||
244 | } | ||
245 | |||
246 | static inline int | ||
247 | default_check_phys_apicid_present(int boot_cpu_physical_apicid) | ||
248 | { | ||
249 | return __default_check_phys_apicid_present(boot_cpu_physical_apicid); | ||
250 | } | ||
251 | #else | ||
252 | extern int default_cpu_present_to_apicid(int mps_cpu); | ||
253 | extern int default_check_phys_apicid_present(int boot_cpu_physical_apicid); | ||
254 | #endif | ||
255 | |||
256 | static inline physid_mask_t default_apicid_to_cpu_present(int phys_apicid) | ||
257 | { | ||
258 | return physid_mask_of_physid(phys_apicid); | ||
259 | } | ||
260 | |||
261 | #endif /* CONFIG_X86_LOCAL_APIC */ | ||
123 | #endif /* _ASM_X86_GENAPIC_64_H */ | 262 | #endif /* _ASM_X86_GENAPIC_64_H */ |