diff options
Diffstat (limited to 'include/asm-i386/smp.h')
-rw-r--r-- | include/asm-i386/smp.h | 64 |
1 files changed, 57 insertions, 7 deletions
diff --git a/include/asm-i386/smp.h b/include/asm-i386/smp.h index 6bf0033a301c..090abc1da32a 100644 --- a/include/asm-i386/smp.h +++ b/include/asm-i386/smp.h | |||
@@ -8,19 +8,15 @@ | |||
8 | #include <linux/kernel.h> | 8 | #include <linux/kernel.h> |
9 | #include <linux/threads.h> | 9 | #include <linux/threads.h> |
10 | #include <linux/cpumask.h> | 10 | #include <linux/cpumask.h> |
11 | #include <asm/pda.h> | ||
12 | #endif | 11 | #endif |
13 | 12 | ||
14 | #ifdef CONFIG_X86_LOCAL_APIC | 13 | #if defined(CONFIG_X86_LOCAL_APIC) && !defined(__ASSEMBLY__) |
15 | #ifndef __ASSEMBLY__ | ||
16 | #include <asm/fixmap.h> | ||
17 | #include <asm/bitops.h> | 14 | #include <asm/bitops.h> |
18 | #include <asm/mpspec.h> | 15 | #include <asm/mpspec.h> |
16 | #include <asm/apic.h> | ||
19 | #ifdef CONFIG_X86_IO_APIC | 17 | #ifdef CONFIG_X86_IO_APIC |
20 | #include <asm/io_apic.h> | 18 | #include <asm/io_apic.h> |
21 | #endif | 19 | #endif |
22 | #include <asm/apic.h> | ||
23 | #endif | ||
24 | #endif | 20 | #endif |
25 | 21 | ||
26 | #define BAD_APICID 0xFFu | 22 | #define BAD_APICID 0xFFu |
@@ -52,6 +48,59 @@ extern void cpu_exit_clear(void); | |||
52 | extern void cpu_uninit(void); | 48 | extern void cpu_uninit(void); |
53 | #endif | 49 | #endif |
54 | 50 | ||
51 | struct smp_ops | ||
52 | { | ||
53 | void (*smp_prepare_boot_cpu)(void); | ||
54 | void (*smp_prepare_cpus)(unsigned max_cpus); | ||
55 | int (*cpu_up)(unsigned cpu); | ||
56 | void (*smp_cpus_done)(unsigned max_cpus); | ||
57 | |||
58 | void (*smp_send_stop)(void); | ||
59 | void (*smp_send_reschedule)(int cpu); | ||
60 | int (*smp_call_function_mask)(cpumask_t mask, | ||
61 | void (*func)(void *info), void *info, | ||
62 | int wait); | ||
63 | }; | ||
64 | |||
65 | extern struct smp_ops smp_ops; | ||
66 | |||
67 | static inline void smp_prepare_boot_cpu(void) | ||
68 | { | ||
69 | smp_ops.smp_prepare_boot_cpu(); | ||
70 | } | ||
71 | static inline void smp_prepare_cpus(unsigned int max_cpus) | ||
72 | { | ||
73 | smp_ops.smp_prepare_cpus(max_cpus); | ||
74 | } | ||
75 | static inline int __cpu_up(unsigned int cpu) | ||
76 | { | ||
77 | return smp_ops.cpu_up(cpu); | ||
78 | } | ||
79 | static inline void smp_cpus_done(unsigned int max_cpus) | ||
80 | { | ||
81 | smp_ops.smp_cpus_done(max_cpus); | ||
82 | } | ||
83 | |||
84 | static inline void smp_send_stop(void) | ||
85 | { | ||
86 | smp_ops.smp_send_stop(); | ||
87 | } | ||
88 | static inline void smp_send_reschedule(int cpu) | ||
89 | { | ||
90 | smp_ops.smp_send_reschedule(cpu); | ||
91 | } | ||
92 | static inline int smp_call_function_mask(cpumask_t mask, | ||
93 | void (*func) (void *info), void *info, | ||
94 | int wait) | ||
95 | { | ||
96 | return smp_ops.smp_call_function_mask(mask, func, info, wait); | ||
97 | } | ||
98 | |||
99 | void native_smp_prepare_boot_cpu(void); | ||
100 | void native_smp_prepare_cpus(unsigned int max_cpus); | ||
101 | int native_cpu_up(unsigned int cpunum); | ||
102 | void native_smp_cpus_done(unsigned int max_cpus); | ||
103 | |||
55 | #ifndef CONFIG_PARAVIRT | 104 | #ifndef CONFIG_PARAVIRT |
56 | #define startup_ipi_hook(phys_apicid, start_eip, start_esp) \ | 105 | #define startup_ipi_hook(phys_apicid, start_eip, start_esp) \ |
57 | do { } while (0) | 106 | do { } while (0) |
@@ -62,7 +111,8 @@ do { } while (0) | |||
62 | * from the initial startup. We map APIC_BASE very early in page_setup(), | 111 | * from the initial startup. We map APIC_BASE very early in page_setup(), |
63 | * so this is correct in the x86 case. | 112 | * so this is correct in the x86 case. |
64 | */ | 113 | */ |
65 | #define raw_smp_processor_id() (read_pda(cpu_number)) | 114 | DECLARE_PER_CPU(int, cpu_number); |
115 | #define raw_smp_processor_id() (x86_read_percpu(cpu_number)) | ||
66 | 116 | ||
67 | extern cpumask_t cpu_callout_map; | 117 | extern cpumask_t cpu_callout_map; |
68 | extern cpumask_t cpu_callin_map; | 118 | extern cpumask_t cpu_callin_map; |