aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-mips
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2007-11-19 07:23:51 -0500
committerRalf Baechle <ralf@linux-mips.org>2008-01-29 05:14:57 -0500
commit87353d8ac39c52784da605ecbe965ecdfad609ad (patch)
treec95ce7cbe9b099c21cab71a195621801b04bc05a /include/asm-mips
parent19388fb092d89e179575bd0b44f51b57e175edf5 (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.h2
-rw-r--r--include/asm-mips/smp-ops.h56
-rw-r--r--include/asm-mips/smp.h61
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;
48extern void sb1250_time_init(void); 48extern void sb1250_time_init(void);
49extern void sb1250_mask_irq(int cpu, int irq); 49extern void sb1250_mask_irq(int cpu, int irq);
50extern void sb1250_unmask_irq(int cpu, int irq); 50extern void sb1250_unmask_irq(int cpu, int irq);
51extern void sb1250_smp_finish(void);
52 51
53extern void bcm1480_time_init(void); 52extern void bcm1480_time_init(void);
54extern void bcm1480_mask_irq(int cpu, int irq); 53extern void bcm1480_mask_irq(int cpu, int irq);
55extern void bcm1480_unmask_irq(int cpu, int irq); 54extern void bcm1480_unmask_irq(int cpu, int irq);
56extern 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
18struct 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
29extern void register_smp_ops(struct plat_smp_ops *ops);
30
31static 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
40struct plat_smp_ops;
41
42static inline void plat_smp_setup(void)
43{
44 /* UP, nothing to do ... */
45}
46
47static inline void register_smp_ops(struct plat_smp_ops *ops)
48{
49}
50
51#endif /* !CONFIG_SMP */
52
53extern struct plat_smp_ops up_smp_ops;
54extern 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
23extern int smp_num_siblings; 22extern int smp_num_siblings;
24extern cpumask_t cpu_sibling_map[]; 23extern cpumask_t cpu_sibling_map[];
@@ -52,56 +51,6 @@ extern struct call_data_struct *call_data;
52extern cpumask_t phys_cpu_present_map; 51extern 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 */
64extern void core_send_ipi(int cpu, unsigned int action);
65
66static 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 */
78extern 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 */
84extern void prom_init_secondary(void);
85
86/*
87 * Populate cpu_possible_map before smp_init, called from setup_arch.
88 */
89extern void plat_smp_setup(void);
90
91/*
92 * Called in smp_prepare_cpus.
93 */
94extern 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 */
100extern void prom_smp_finish(void);
101
102/* Hook for after all CPUs are online */
103extern void prom_cpus_done(void);
104
105extern void asmlinkage smp_bootstrap(void); 54extern void asmlinkage smp_bootstrap(void);
106 55
107/* 56/*
@@ -111,11 +60,11 @@ extern void asmlinkage smp_bootstrap(void);
111 */ 60 */
112static inline void smp_send_reschedule(int cpu) 61static 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
117extern asmlinkage void smp_call_function_interrupt(void); 68extern asmlinkage void smp_call_function_interrupt(void);
118 69
119#endif /* CONFIG_SMP */
120
121#endif /* __ASM_SMP_H */ 70#endif /* __ASM_SMP_H */