diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2007-11-19 07:23:51 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2008-01-29 05:14:57 -0500 |
commit | 87353d8ac39c52784da605ecbe965ecdfad609ad (patch) | |
tree | c95ce7cbe9b099c21cab71a195621801b04bc05a /include/asm-mips | |
parent | 19388fb092d89e179575bd0b44f51b57e175edf5 (diff) |
[MIPS] SMP: Call platform methods via ops structure.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'include/asm-mips')
-rw-r--r-- | include/asm-mips/sibyte/sb1250.h | 2 | ||||
-rw-r--r-- | include/asm-mips/smp-ops.h | 56 | ||||
-rw-r--r-- | include/asm-mips/smp.h | 61 |
3 files changed, 61 insertions, 58 deletions
diff --git a/include/asm-mips/sibyte/sb1250.h b/include/asm-mips/sibyte/sb1250.h index 0dad844a3b5..80c1a052662 100644 --- a/include/asm-mips/sibyte/sb1250.h +++ b/include/asm-mips/sibyte/sb1250.h | |||
@@ -48,12 +48,10 @@ extern unsigned int zbbus_mhz; | |||
48 | extern void sb1250_time_init(void); | 48 | extern void sb1250_time_init(void); |
49 | extern void sb1250_mask_irq(int cpu, int irq); | 49 | extern void sb1250_mask_irq(int cpu, int irq); |
50 | extern void sb1250_unmask_irq(int cpu, int irq); | 50 | extern void sb1250_unmask_irq(int cpu, int irq); |
51 | extern void sb1250_smp_finish(void); | ||
52 | 51 | ||
53 | extern void bcm1480_time_init(void); | 52 | extern void bcm1480_time_init(void); |
54 | extern void bcm1480_mask_irq(int cpu, int irq); | 53 | extern void bcm1480_mask_irq(int cpu, int irq); |
55 | extern void bcm1480_unmask_irq(int cpu, int irq); | 54 | extern void bcm1480_unmask_irq(int cpu, int irq); |
56 | extern void bcm1480_smp_finish(void); | ||
57 | 55 | ||
58 | #define AT_spin \ | 56 | #define AT_spin \ |
59 | __asm__ __volatile__ ( \ | 57 | __asm__ __volatile__ ( \ |
diff --git a/include/asm-mips/smp-ops.h b/include/asm-mips/smp-ops.h new file mode 100644 index 00000000000..b17fdfb5d81 --- /dev/null +++ b/include/asm-mips/smp-ops.h | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General | ||
3 | * Public License. See the file "COPYING" in the main directory of this | ||
4 | * archive for more details. | ||
5 | * | ||
6 | * Copyright (C) 2000 - 2001 by Kanoj Sarcar (kanoj@sgi.com) | ||
7 | * Copyright (C) 2000 - 2001 by Silicon Graphics, Inc. | ||
8 | * Copyright (C) 2000, 2001, 2002 Ralf Baechle | ||
9 | * Copyright (C) 2000, 2001 Broadcom Corporation | ||
10 | */ | ||
11 | #ifndef __ASM_SMP_OPS_H | ||
12 | #define __ASM_SMP_OPS_H | ||
13 | |||
14 | #ifdef CONFIG_SMP | ||
15 | |||
16 | #include <linux/cpumask.h> | ||
17 | |||
18 | struct plat_smp_ops { | ||
19 | void (*send_ipi_single)(int cpu, unsigned int action); | ||
20 | void (*send_ipi_mask)(cpumask_t mask, unsigned int action); | ||
21 | void (*init_secondary)(void); | ||
22 | void (*smp_finish)(void); | ||
23 | void (*cpus_done)(void); | ||
24 | void (*boot_secondary)(int cpu, struct task_struct *idle); | ||
25 | void (*smp_setup)(void); | ||
26 | void (*prepare_cpus)(unsigned int max_cpus); | ||
27 | }; | ||
28 | |||
29 | extern void register_smp_ops(struct plat_smp_ops *ops); | ||
30 | |||
31 | static inline void plat_smp_setup(void) | ||
32 | { | ||
33 | extern struct plat_smp_ops *mp_ops; /* private */ | ||
34 | |||
35 | mp_ops->smp_setup(); | ||
36 | } | ||
37 | |||
38 | #else /* !CONFIG_SMP */ | ||
39 | |||
40 | struct plat_smp_ops; | ||
41 | |||
42 | static inline void plat_smp_setup(void) | ||
43 | { | ||
44 | /* UP, nothing to do ... */ | ||
45 | } | ||
46 | |||
47 | static inline void register_smp_ops(struct plat_smp_ops *ops) | ||
48 | { | ||
49 | } | ||
50 | |||
51 | #endif /* !CONFIG_SMP */ | ||
52 | |||
53 | extern struct plat_smp_ops up_smp_ops; | ||
54 | extern struct plat_smp_ops vsmp_smp_ops; | ||
55 | |||
56 | #endif /* __ASM_SMP_OPS_H */ | ||
diff --git a/include/asm-mips/smp.h b/include/asm-mips/smp.h index 23265879cee..84fef1aeec0 100644 --- a/include/asm-mips/smp.h +++ b/include/asm-mips/smp.h | |||
@@ -11,14 +11,13 @@ | |||
11 | #ifndef __ASM_SMP_H | 11 | #ifndef __ASM_SMP_H |
12 | #define __ASM_SMP_H | 12 | #define __ASM_SMP_H |
13 | 13 | ||
14 | |||
15 | #ifdef CONFIG_SMP | ||
16 | |||
17 | #include <linux/bitops.h> | 14 | #include <linux/bitops.h> |
18 | #include <linux/linkage.h> | 15 | #include <linux/linkage.h> |
19 | #include <linux/threads.h> | 16 | #include <linux/threads.h> |
20 | #include <linux/cpumask.h> | 17 | #include <linux/cpumask.h> |
18 | |||
21 | #include <asm/atomic.h> | 19 | #include <asm/atomic.h> |
20 | #include <asm/smp-ops.h> | ||
22 | 21 | ||
23 | extern int smp_num_siblings; | 22 | extern int smp_num_siblings; |
24 | extern cpumask_t cpu_sibling_map[]; | 23 | extern cpumask_t cpu_sibling_map[]; |
@@ -52,56 +51,6 @@ extern struct call_data_struct *call_data; | |||
52 | extern cpumask_t phys_cpu_present_map; | 51 | extern cpumask_t phys_cpu_present_map; |
53 | #define cpu_possible_map phys_cpu_present_map | 52 | #define cpu_possible_map phys_cpu_present_map |
54 | 53 | ||
55 | /* | ||
56 | * These are defined by the board-specific code. | ||
57 | */ | ||
58 | |||
59 | /* | ||
60 | * Cause the function described by call_data to be executed on the passed | ||
61 | * cpu. When the function has finished, increment the finished field of | ||
62 | * call_data. | ||
63 | */ | ||
64 | extern void core_send_ipi(int cpu, unsigned int action); | ||
65 | |||
66 | static inline void core_send_ipi_mask(cpumask_t mask, unsigned int action) | ||
67 | { | ||
68 | unsigned int i; | ||
69 | |||
70 | for_each_cpu_mask(i, mask) | ||
71 | core_send_ipi(i, action); | ||
72 | } | ||
73 | |||
74 | |||
75 | /* | ||
76 | * Firmware CPU startup hook | ||
77 | */ | ||
78 | extern void prom_boot_secondary(int cpu, struct task_struct *idle); | ||
79 | |||
80 | /* | ||
81 | * After we've done initial boot, this function is called to allow the | ||
82 | * board code to clean up state, if needed | ||
83 | */ | ||
84 | extern void prom_init_secondary(void); | ||
85 | |||
86 | /* | ||
87 | * Populate cpu_possible_map before smp_init, called from setup_arch. | ||
88 | */ | ||
89 | extern void plat_smp_setup(void); | ||
90 | |||
91 | /* | ||
92 | * Called in smp_prepare_cpus. | ||
93 | */ | ||
94 | extern void plat_prepare_cpus(unsigned int max_cpus); | ||
95 | |||
96 | /* | ||
97 | * Last chance for the board code to finish SMP initialization before | ||
98 | * the CPU is "online". | ||
99 | */ | ||
100 | extern void prom_smp_finish(void); | ||
101 | |||
102 | /* Hook for after all CPUs are online */ | ||
103 | extern void prom_cpus_done(void); | ||
104 | |||
105 | extern void asmlinkage smp_bootstrap(void); | 54 | extern void asmlinkage smp_bootstrap(void); |
106 | 55 | ||
107 | /* | 56 | /* |
@@ -111,11 +60,11 @@ extern void asmlinkage smp_bootstrap(void); | |||
111 | */ | 60 | */ |
112 | static inline void smp_send_reschedule(int cpu) | 61 | static inline void smp_send_reschedule(int cpu) |
113 | { | 62 | { |
114 | core_send_ipi(cpu, SMP_RESCHEDULE_YOURSELF); | 63 | extern struct plat_smp_ops *mp_ops; /* private */ |
64 | |||
65 | mp_ops->send_ipi_single(cpu, SMP_RESCHEDULE_YOURSELF); | ||
115 | } | 66 | } |
116 | 67 | ||
117 | extern asmlinkage void smp_call_function_interrupt(void); | 68 | extern asmlinkage void smp_call_function_interrupt(void); |
118 | 69 | ||
119 | #endif /* CONFIG_SMP */ | ||
120 | |||
121 | #endif /* __ASM_SMP_H */ | 70 | #endif /* __ASM_SMP_H */ |