blob: 513c8571a4a00b0a8215b93062665238d9398e36 [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 Costa53ebef42008-03-03 14:12:31 -03006
7extern cpumask_t cpu_callout_map;
8
9extern int smp_num_siblings;
10extern unsigned int num_processors;
Glauber Costac27cfef2008-03-03 14:12:29 -030011
Glauber Costa42068822008-03-03 14:13:09 -030012/*
13 * Trampoline 80x86 program as an array.
14 */
15extern const unsigned char trampoline_data [];
16extern const unsigned char trampoline_end [];
Glauber Costa91718e82008-03-03 14:13:12 -030017extern unsigned char *trampoline_base;
Glauber Costa42068822008-03-03 14:13:09 -030018
Glauber Costa16694022008-03-03 14:12:32 -030019struct smp_ops {
20 void (*smp_prepare_boot_cpu)(void);
21 void (*smp_prepare_cpus)(unsigned max_cpus);
22 int (*cpu_up)(unsigned cpu);
23 void (*smp_cpus_done)(unsigned max_cpus);
24
25 void (*smp_send_stop)(void);
26 void (*smp_send_reschedule)(int cpu);
27 int (*smp_call_function_mask)(cpumask_t mask,
28 void (*func)(void *info), void *info,
29 int wait);
30};
31
Glauber Costa14522072008-03-03 14:12:59 -030032/* Globals due to paravirt */
33extern void set_cpu_sibling_map(int cpu);
34
Glauber Costac76cb362008-03-03 14:12:33 -030035#ifdef CONFIG_SMP
36extern struct smp_ops smp_ops;
Glauber Costa86789692008-03-03 14:12:34 -030037
Glauber Costa377d6982008-03-03 14:12:51 -030038static inline void smp_send_stop(void)
39{
40 smp_ops.smp_send_stop();
41}
42
Glauber Costa1e3fac82008-03-03 14:12:37 -030043static inline void smp_prepare_boot_cpu(void)
44{
45 smp_ops.smp_prepare_boot_cpu();
46}
47
Glauber Costa7557da62008-03-03 14:12:38 -030048static inline void smp_prepare_cpus(unsigned int max_cpus)
49{
50 smp_ops.smp_prepare_cpus(max_cpus);
51}
52
Glauber Costac5597642008-03-03 14:12:39 -030053static inline void smp_cpus_done(unsigned int max_cpus)
54{
55 smp_ops.smp_cpus_done(max_cpus);
56}
57
Glauber Costa71d19542008-03-03 14:12:36 -030058static inline int __cpu_up(unsigned int cpu)
59{
60 return smp_ops.cpu_up(cpu);
61}
62
Glauber Costa86789692008-03-03 14:12:34 -030063static inline void smp_send_reschedule(int cpu)
64{
65 smp_ops.smp_send_reschedule(cpu);
66}
Glauber Costa64b1a212008-03-03 14:12:35 -030067
68static inline int smp_call_function_mask(cpumask_t mask,
69 void (*func) (void *info), void *info,
70 int wait)
71{
72 return smp_ops.smp_call_function_mask(mask, func, info, wait);
73}
Glauber Costa71d19542008-03-03 14:12:36 -030074
Glauber Costa1e3fac82008-03-03 14:12:37 -030075void native_smp_prepare_boot_cpu(void);
Glauber Costa7557da62008-03-03 14:12:38 -030076void native_smp_prepare_cpus(unsigned int max_cpus);
Glauber Costac5597642008-03-03 14:12:39 -030077void native_smp_cpus_done(unsigned int max_cpus);
Glauber Costa71d19542008-03-03 14:12:36 -030078int native_cpu_up(unsigned int cpunum);
Glauber Costa93b016f2008-03-03 14:12:40 -030079
Glauber Costa69c18c12008-03-03 14:13:07 -030080extern int __cpu_disable(void);
81extern void __cpu_die(unsigned int cpu);
82
Glauber Costa93b016f2008-03-03 14:12:40 -030083extern unsigned disabled_cpus;
Glauber Costa68a1c3f2008-03-03 14:12:42 -030084extern void prefill_possible_map(void);
Glauber Costa91718e82008-03-03 14:13:12 -030085
86#define SMP_TRAMPOLINE_BASE 0x6000
87extern unsigned long setup_trampoline(void);
Glauber Costac76cb362008-03-03 14:12:33 -030088#endif
Glauber Costa16694022008-03-03 14:12:32 -030089
Thomas Gleixner96a388d2007-10-11 11:20:03 +020090#ifdef CONFIG_X86_32
91# include "smp_32.h"
92#else
93# include "smp_64.h"
94#endif
Glauber Costac27cfef2008-03-03 14:12:29 -030095
Glauber Costa1dbb4722008-03-03 14:13:01 -030096#ifdef CONFIG_HOTPLUG_CPU
97extern void cpu_exit_clear(void);
98extern void cpu_uninit(void);
99extern void remove_siblinginfo(int cpu);
100#endif
101
Glauber Costa639acb12008-03-03 14:12:30 -0300102extern void smp_alloc_memory(void);
103extern void lock_ipi_call_lock(void);
104extern void unlock_ipi_call_lock(void);
Glauber Costac27cfef2008-03-03 14:12:29 -0300105#endif /* __ASSEMBLY__ */
106#endif