Glauber Costa | c27cfef | 2008-03-03 14:12:29 -0300 | [diff] [blame] | 1 | #ifndef _ASM_X86_SMP_H_ |
| 2 | #define _ASM_X86_SMP_H_ |
| 3 | #ifndef __ASSEMBLY__ |
Glauber Costa | 53ebef4 | 2008-03-03 14:12:31 -0300 | [diff] [blame] | 4 | #include <linux/cpumask.h> |
Glauber Costa | 93b016f | 2008-03-03 14:12:40 -0300 | [diff] [blame] | 5 | #include <linux/init.h> |
Glauber Costa | 53ebef4 | 2008-03-03 14:12:31 -0300 | [diff] [blame] | 6 | |
| 7 | extern cpumask_t cpu_callout_map; |
| 8 | |
| 9 | extern int smp_num_siblings; |
| 10 | extern unsigned int num_processors; |
Glauber Costa | c27cfef | 2008-03-03 14:12:29 -0300 | [diff] [blame] | 11 | |
Glauber Costa | 4206882 | 2008-03-03 14:13:09 -0300 | [diff] [blame] | 12 | /* |
| 13 | * Trampoline 80x86 program as an array. |
| 14 | */ |
| 15 | extern const unsigned char trampoline_data []; |
| 16 | extern const unsigned char trampoline_end []; |
Glauber Costa | 91718e8 | 2008-03-03 14:13:12 -0300 | [diff] [blame] | 17 | extern unsigned char *trampoline_base; |
Glauber Costa | 4206882 | 2008-03-03 14:13:09 -0300 | [diff] [blame] | 18 | |
Glauber Costa | 1669402 | 2008-03-03 14:12:32 -0300 | [diff] [blame] | 19 | struct 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 Costa | 1452207 | 2008-03-03 14:12:59 -0300 | [diff] [blame] | 32 | /* Globals due to paravirt */ |
| 33 | extern void set_cpu_sibling_map(int cpu); |
| 34 | |
Glauber Costa | c76cb36 | 2008-03-03 14:12:33 -0300 | [diff] [blame] | 35 | #ifdef CONFIG_SMP |
Glauber de Oliveira Costa | d0173ae | 2008-03-19 14:24:59 -0300 | [diff] [blame^] | 36 | #ifndef CONFIG_PARAVIRT |
| 37 | #define startup_ipi_hook(phys_apicid, start_eip, start_esp) do { } while (0) |
| 38 | #endif |
Glauber Costa | c76cb36 | 2008-03-03 14:12:33 -0300 | [diff] [blame] | 39 | extern struct smp_ops smp_ops; |
Glauber Costa | 8678969 | 2008-03-03 14:12:34 -0300 | [diff] [blame] | 40 | |
Glauber Costa | 377d698 | 2008-03-03 14:12:51 -0300 | [diff] [blame] | 41 | static inline void smp_send_stop(void) |
| 42 | { |
| 43 | smp_ops.smp_send_stop(); |
| 44 | } |
| 45 | |
Glauber Costa | 1e3fac8 | 2008-03-03 14:12:37 -0300 | [diff] [blame] | 46 | static inline void smp_prepare_boot_cpu(void) |
| 47 | { |
| 48 | smp_ops.smp_prepare_boot_cpu(); |
| 49 | } |
| 50 | |
Glauber Costa | 7557da6 | 2008-03-03 14:12:38 -0300 | [diff] [blame] | 51 | static inline void smp_prepare_cpus(unsigned int max_cpus) |
| 52 | { |
| 53 | smp_ops.smp_prepare_cpus(max_cpus); |
| 54 | } |
| 55 | |
Glauber Costa | c559764 | 2008-03-03 14:12:39 -0300 | [diff] [blame] | 56 | static inline void smp_cpus_done(unsigned int max_cpus) |
| 57 | { |
| 58 | smp_ops.smp_cpus_done(max_cpus); |
| 59 | } |
| 60 | |
Glauber Costa | 71d1954 | 2008-03-03 14:12:36 -0300 | [diff] [blame] | 61 | static inline int __cpu_up(unsigned int cpu) |
| 62 | { |
| 63 | return smp_ops.cpu_up(cpu); |
| 64 | } |
| 65 | |
Glauber Costa | 8678969 | 2008-03-03 14:12:34 -0300 | [diff] [blame] | 66 | static inline void smp_send_reschedule(int cpu) |
| 67 | { |
| 68 | smp_ops.smp_send_reschedule(cpu); |
| 69 | } |
Glauber Costa | 64b1a21e0 | 2008-03-03 14:12:35 -0300 | [diff] [blame] | 70 | |
| 71 | static 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 Costa | 71d1954 | 2008-03-03 14:12:36 -0300 | [diff] [blame] | 77 | |
Glauber Costa | 1e3fac8 | 2008-03-03 14:12:37 -0300 | [diff] [blame] | 78 | void native_smp_prepare_boot_cpu(void); |
Glauber Costa | 7557da6 | 2008-03-03 14:12:38 -0300 | [diff] [blame] | 79 | void native_smp_prepare_cpus(unsigned int max_cpus); |
Glauber Costa | c559764 | 2008-03-03 14:12:39 -0300 | [diff] [blame] | 80 | void native_smp_cpus_done(unsigned int max_cpus); |
Glauber Costa | 71d1954 | 2008-03-03 14:12:36 -0300 | [diff] [blame] | 81 | int native_cpu_up(unsigned int cpunum); |
Glauber Costa | 93b016f | 2008-03-03 14:12:40 -0300 | [diff] [blame] | 82 | |
Glauber Costa | 69c18c1 | 2008-03-03 14:13:07 -0300 | [diff] [blame] | 83 | extern int __cpu_disable(void); |
| 84 | extern void __cpu_die(unsigned int cpu); |
| 85 | |
Glauber Costa | 93b016f | 2008-03-03 14:12:40 -0300 | [diff] [blame] | 86 | extern unsigned disabled_cpus; |
Glauber Costa | 68a1c3f | 2008-03-03 14:12:42 -0300 | [diff] [blame] | 87 | extern void prefill_possible_map(void); |
Glauber Costa | 91718e8 | 2008-03-03 14:13:12 -0300 | [diff] [blame] | 88 | |
| 89 | #define SMP_TRAMPOLINE_BASE 0x6000 |
| 90 | extern unsigned long setup_trampoline(void); |
Glauber Costa | c76cb36 | 2008-03-03 14:12:33 -0300 | [diff] [blame] | 91 | #endif |
Glauber Costa | 1669402 | 2008-03-03 14:12:32 -0300 | [diff] [blame] | 92 | |
Thomas Gleixner | 96a388d | 2007-10-11 11:20:03 +0200 | [diff] [blame] | 93 | #ifdef CONFIG_X86_32 |
| 94 | # include "smp_32.h" |
| 95 | #else |
| 96 | # include "smp_64.h" |
| 97 | #endif |
Glauber Costa | c27cfef | 2008-03-03 14:12:29 -0300 | [diff] [blame] | 98 | |
Glauber Costa | 1dbb472 | 2008-03-03 14:13:01 -0300 | [diff] [blame] | 99 | #ifdef CONFIG_HOTPLUG_CPU |
| 100 | extern void cpu_exit_clear(void); |
| 101 | extern void cpu_uninit(void); |
| 102 | extern void remove_siblinginfo(int cpu); |
| 103 | #endif |
| 104 | |
Glauber Costa | 639acb1 | 2008-03-03 14:12:30 -0300 | [diff] [blame] | 105 | extern void smp_alloc_memory(void); |
| 106 | extern void lock_ipi_call_lock(void); |
| 107 | extern void unlock_ipi_call_lock(void); |
Glauber Costa | c27cfef | 2008-03-03 14:12:29 -0300 | [diff] [blame] | 108 | #endif /* __ASSEMBLY__ */ |
| 109 | #endif |