blob: d02e6eacee397adabb5f784ac37dae7d07887150 [file] [log] [blame]
Glauber Costac27cfef2008-03-03 14:12:29 -03001#ifndef _ASM_X86_SMP_H_
2#define _ASM_X86_SMP_H_
3#ifndef __ASSEMBLY__
Glauber Costa53ebef42008-03-03 14:12:31 -03004#include <linux/cpumask.h>
Glauber Costa93b016f2008-03-03 14:12:40 -03005#include <linux/init.h>
Glauber de Oliveira Costa7e1efc02008-03-19 14:25:18 -03006#include <asm/percpu.h>
Glauber Costa53ebef42008-03-03 14:12:31 -03007
8extern cpumask_t cpu_callout_map;
9
10extern int smp_num_siblings;
11extern unsigned int num_processors;
Glauber Costac27cfef2008-03-03 14:12:29 -030012
Glauber de Oliveira Costa7e1efc02008-03-19 14:25:18 -030013extern u16 x86_cpu_to_apicid_init[];
14extern u16 x86_bios_cpu_apicid_init[];
15extern void *x86_cpu_to_apicid_early_ptr;
16extern void *x86_bios_cpu_apicid_early_ptr;
17
18DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
19DECLARE_PER_CPU(cpumask_t, cpu_core_map);
20DECLARE_PER_CPU(u16, cpu_llc_id);
21DECLARE_PER_CPU(u16, x86_cpu_to_apicid);
22DECLARE_PER_CPU(u16, x86_bios_cpu_apicid);
23
Glauber Costa42068822008-03-03 14:13:09 -030024/*
25 * Trampoline 80x86 program as an array.
26 */
27extern const unsigned char trampoline_data [];
28extern const unsigned char trampoline_end [];
Glauber Costa91718e82008-03-03 14:13:12 -030029extern unsigned char *trampoline_base;
Glauber Costa42068822008-03-03 14:13:09 -030030
Glauber Costa16694022008-03-03 14:12:32 -030031struct smp_ops {
32 void (*smp_prepare_boot_cpu)(void);
33 void (*smp_prepare_cpus)(unsigned max_cpus);
34 int (*cpu_up)(unsigned cpu);
35 void (*smp_cpus_done)(unsigned max_cpus);
36
37 void (*smp_send_stop)(void);
38 void (*smp_send_reschedule)(int cpu);
39 int (*smp_call_function_mask)(cpumask_t mask,
40 void (*func)(void *info), void *info,
41 int wait);
42};
43
Glauber Costa14522072008-03-03 14:12:59 -030044/* Globals due to paravirt */
45extern void set_cpu_sibling_map(int cpu);
46
Glauber Costac76cb362008-03-03 14:12:33 -030047#ifdef CONFIG_SMP
Glauber de Oliveira Costad0173ae2008-03-19 14:24:59 -030048#ifndef CONFIG_PARAVIRT
49#define startup_ipi_hook(phys_apicid, start_eip, start_esp) do { } while (0)
50#endif
Glauber Costac76cb362008-03-03 14:12:33 -030051extern struct smp_ops smp_ops;
Glauber Costa86789692008-03-03 14:12:34 -030052
Glauber Costa377d6982008-03-03 14:12:51 -030053static inline void smp_send_stop(void)
54{
55 smp_ops.smp_send_stop();
56}
57
Glauber Costa1e3fac82008-03-03 14:12:37 -030058static inline void smp_prepare_boot_cpu(void)
59{
60 smp_ops.smp_prepare_boot_cpu();
61}
62
Glauber Costa7557da62008-03-03 14:12:38 -030063static inline void smp_prepare_cpus(unsigned int max_cpus)
64{
65 smp_ops.smp_prepare_cpus(max_cpus);
66}
67
Glauber Costac5597642008-03-03 14:12:39 -030068static inline void smp_cpus_done(unsigned int max_cpus)
69{
70 smp_ops.smp_cpus_done(max_cpus);
71}
72
Glauber Costa71d19542008-03-03 14:12:36 -030073static inline int __cpu_up(unsigned int cpu)
74{
75 return smp_ops.cpu_up(cpu);
76}
77
Glauber Costa86789692008-03-03 14:12:34 -030078static inline void smp_send_reschedule(int cpu)
79{
80 smp_ops.smp_send_reschedule(cpu);
81}
Glauber Costa64b1a21e02008-03-03 14:12:35 -030082
83static inline int smp_call_function_mask(cpumask_t mask,
84 void (*func) (void *info), void *info,
85 int wait)
86{
87 return smp_ops.smp_call_function_mask(mask, func, info, wait);
88}
Glauber Costa71d19542008-03-03 14:12:36 -030089
Glauber Costa1e3fac82008-03-03 14:12:37 -030090void native_smp_prepare_boot_cpu(void);
Glauber Costa7557da62008-03-03 14:12:38 -030091void native_smp_prepare_cpus(unsigned int max_cpus);
Glauber Costac5597642008-03-03 14:12:39 -030092void native_smp_cpus_done(unsigned int max_cpus);
Glauber Costa71d19542008-03-03 14:12:36 -030093int native_cpu_up(unsigned int cpunum);
Glauber Costa93b016f2008-03-03 14:12:40 -030094
Glauber Costa69c18c12008-03-03 14:13:07 -030095extern int __cpu_disable(void);
96extern void __cpu_die(unsigned int cpu);
97
Glauber Costa93b016f2008-03-03 14:12:40 -030098extern unsigned disabled_cpus;
Glauber Costa68a1c3f2008-03-03 14:12:42 -030099extern void prefill_possible_map(void);
Glauber Costa91718e82008-03-03 14:13:12 -0300100
101#define SMP_TRAMPOLINE_BASE 0x6000
102extern unsigned long setup_trampoline(void);
Glauber de Oliveira Costa1d89a7f2008-03-19 14:25:05 -0300103
104void smp_store_cpu_info(int id);
Glauber Costac76cb362008-03-03 14:12:33 -0300105#endif
Glauber Costa16694022008-03-03 14:12:32 -0300106
Thomas Gleixner96a388d2007-10-11 11:20:03 +0200107#ifdef CONFIG_X86_32
108# include "smp_32.h"
109#else
110# include "smp_64.h"
111#endif
Glauber Costac27cfef2008-03-03 14:12:29 -0300112
Glauber Costa1dbb4722008-03-03 14:13:01 -0300113#ifdef CONFIG_HOTPLUG_CPU
114extern void cpu_exit_clear(void);
115extern void cpu_uninit(void);
116extern void remove_siblinginfo(int cpu);
117#endif
118
Glauber Costa639acb12008-03-03 14:12:30 -0300119extern void smp_alloc_memory(void);
120extern void lock_ipi_call_lock(void);
121extern void unlock_ipi_call_lock(void);
Glauber Costac27cfef2008-03-03 14:12:29 -0300122#endif /* __ASSEMBLY__ */
123#endif