blob: b4c5143d7f8dc862e24a812a7b841a07d72f4592 [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
Glauber de Oliveira Costad0173ae2008-03-19 14:24:59 -030036#ifndef CONFIG_PARAVIRT
37#define startup_ipi_hook(phys_apicid, start_eip, start_esp) do { } while (0)
38#endif
Glauber Costac76cb362008-03-03 14:12:33 -030039extern struct smp_ops smp_ops;
Glauber Costa86789692008-03-03 14:12:34 -030040
Glauber Costa377d6982008-03-03 14:12:51 -030041static inline void smp_send_stop(void)
42{
43 smp_ops.smp_send_stop();
44}
45
Glauber Costa1e3fac82008-03-03 14:12:37 -030046static inline void smp_prepare_boot_cpu(void)
47{
48 smp_ops.smp_prepare_boot_cpu();
49}
50
Glauber Costa7557da62008-03-03 14:12:38 -030051static inline void smp_prepare_cpus(unsigned int max_cpus)
52{
53 smp_ops.smp_prepare_cpus(max_cpus);
54}
55
Glauber Costac5597642008-03-03 14:12:39 -030056static inline void smp_cpus_done(unsigned int max_cpus)
57{
58 smp_ops.smp_cpus_done(max_cpus);
59}
60
Glauber Costa71d19542008-03-03 14:12:36 -030061static inline int __cpu_up(unsigned int cpu)
62{
63 return smp_ops.cpu_up(cpu);
64}
65
Glauber Costa86789692008-03-03 14:12:34 -030066static inline void smp_send_reschedule(int cpu)
67{
68 smp_ops.smp_send_reschedule(cpu);
69}
Glauber Costa64b1a21e02008-03-03 14:12:35 -030070
71static inline int smp_call_function_mask(cpumask_t mask,
72 void (*func) (void *info), void *info,
73 int wait)
74{
75 return smp_ops.smp_call_function_mask(mask, func, info, wait);
76}
Glauber Costa71d19542008-03-03 14:12:36 -030077
Glauber Costa1e3fac82008-03-03 14:12:37 -030078void native_smp_prepare_boot_cpu(void);
Glauber Costa7557da62008-03-03 14:12:38 -030079void native_smp_prepare_cpus(unsigned int max_cpus);
Glauber Costac5597642008-03-03 14:12:39 -030080void native_smp_cpus_done(unsigned int max_cpus);
Glauber Costa71d19542008-03-03 14:12:36 -030081int native_cpu_up(unsigned int cpunum);
Glauber Costa93b016f2008-03-03 14:12:40 -030082
Glauber Costa69c18c12008-03-03 14:13:07 -030083extern int __cpu_disable(void);
84extern void __cpu_die(unsigned int cpu);
85
Glauber Costa93b016f2008-03-03 14:12:40 -030086extern unsigned disabled_cpus;
Glauber Costa68a1c3f2008-03-03 14:12:42 -030087extern void prefill_possible_map(void);
Glauber Costa91718e82008-03-03 14:13:12 -030088
89#define SMP_TRAMPOLINE_BASE 0x6000
90extern unsigned long setup_trampoline(void);
Glauber de Oliveira Costa1d89a7f2008-03-19 14:25:05 -030091
92void smp_store_cpu_info(int id);
Glauber Costac76cb362008-03-03 14:12:33 -030093#endif
Glauber Costa16694022008-03-03 14:12:32 -030094
Thomas Gleixner96a388d2007-10-11 11:20:03 +020095#ifdef CONFIG_X86_32
96# include "smp_32.h"
97#else
98# include "smp_64.h"
99#endif
Glauber Costac27cfef2008-03-03 14:12:29 -0300100
Glauber Costa1dbb4722008-03-03 14:13:01 -0300101#ifdef CONFIG_HOTPLUG_CPU
102extern void cpu_exit_clear(void);
103extern void cpu_uninit(void);
104extern void remove_siblinginfo(int cpu);
105#endif
106
Glauber Costa639acb12008-03-03 14:12:30 -0300107extern void smp_alloc_memory(void);
108extern void lock_ipi_call_lock(void);
109extern void unlock_ipi_call_lock(void);
Glauber Costac27cfef2008-03-03 14:12:29 -0300110#endif /* __ASSEMBLY__ */
111#endif