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 /arch/mips/sibyte/sb1250/smp.c | |
parent | 19388fb092d89e179575bd0b44f51b57e175edf5 (diff) |
[MIPS] SMP: Call platform methods via ops structure.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/sibyte/sb1250/smp.c')
-rw-r--r-- | arch/mips/sibyte/sb1250/smp.c | 100 |
1 files changed, 93 insertions, 7 deletions
diff --git a/arch/mips/sibyte/sb1250/smp.c b/arch/mips/sibyte/sb1250/smp.c index 3f52c95a4eb8..0734b933e969 100644 --- a/arch/mips/sibyte/sb1250/smp.c +++ b/arch/mips/sibyte/sb1250/smp.c | |||
@@ -24,6 +24,7 @@ | |||
24 | 24 | ||
25 | #include <asm/mmu_context.h> | 25 | #include <asm/mmu_context.h> |
26 | #include <asm/io.h> | 26 | #include <asm/io.h> |
27 | #include <asm/fw/cfe/cfe_api.h> | ||
27 | #include <asm/sibyte/sb1250.h> | 28 | #include <asm/sibyte/sb1250.h> |
28 | #include <asm/sibyte/sb1250_regs.h> | 29 | #include <asm/sibyte/sb1250_regs.h> |
29 | #include <asm/sibyte/sb1250_int.h> | 30 | #include <asm/sibyte/sb1250_int.h> |
@@ -55,7 +56,43 @@ void __cpuinit sb1250_smp_init(void) | |||
55 | change_c0_status(ST0_IM, imask); | 56 | change_c0_status(ST0_IM, imask); |
56 | } | 57 | } |
57 | 58 | ||
58 | void __cpuinit sb1250_smp_finish(void) | 59 | /* |
60 | * These are routines for dealing with the sb1250 smp capabilities | ||
61 | * independent of board/firmware | ||
62 | */ | ||
63 | |||
64 | /* | ||
65 | * Simple enough; everything is set up, so just poke the appropriate mailbox | ||
66 | * register, and we should be set | ||
67 | */ | ||
68 | static void sb1250_send_ipi_single(int cpu, unsigned int action) | ||
69 | { | ||
70 | __raw_writeq((((u64)action) << 48), mailbox_set_regs[cpu]); | ||
71 | } | ||
72 | |||
73 | static inline void sb1250_send_ipi_mask(cpumask_t mask, unsigned int action) | ||
74 | { | ||
75 | unsigned int i; | ||
76 | |||
77 | for_each_cpu_mask(i, mask) | ||
78 | sb1250_send_ipi_single(i, action); | ||
79 | } | ||
80 | |||
81 | /* | ||
82 | * Code to run on secondary just after probing the CPU | ||
83 | */ | ||
84 | static void __cpuinit sb1250_init_secondary(void) | ||
85 | { | ||
86 | extern void sb1250_smp_init(void); | ||
87 | |||
88 | sb1250_smp_init(); | ||
89 | } | ||
90 | |||
91 | /* | ||
92 | * Do any tidying up before marking online and running the idle | ||
93 | * loop | ||
94 | */ | ||
95 | static void __cpuinit sb1250_smp_finish(void) | ||
59 | { | 96 | { |
60 | extern void sb1250_clockevent_init(void); | 97 | extern void sb1250_clockevent_init(void); |
61 | 98 | ||
@@ -64,19 +101,68 @@ void __cpuinit sb1250_smp_finish(void) | |||
64 | } | 101 | } |
65 | 102 | ||
66 | /* | 103 | /* |
67 | * These are routines for dealing with the sb1250 smp capabilities | 104 | * Final cleanup after all secondaries booted |
68 | * independent of board/firmware | ||
69 | */ | 105 | */ |
106 | static void sb1250_cpus_done(void) | ||
107 | { | ||
108 | } | ||
70 | 109 | ||
71 | /* | 110 | /* |
72 | * Simple enough; everything is set up, so just poke the appropriate mailbox | 111 | * Setup the PC, SP, and GP of a secondary processor and start it |
73 | * register, and we should be set | 112 | * running! |
74 | */ | 113 | */ |
75 | void core_send_ipi(int cpu, unsigned int action) | 114 | static void __cpuinit sb1250_boot_secondary(int cpu, struct task_struct *idle) |
76 | { | 115 | { |
77 | __raw_writeq((((u64)action) << 48), mailbox_set_regs[cpu]); | 116 | int retval; |
117 | |||
118 | retval = cfe_cpu_start(cpu_logical_map(cpu), &smp_bootstrap, | ||
119 | __KSTK_TOS(idle), | ||
120 | (unsigned long)task_thread_info(idle), 0); | ||
121 | if (retval != 0) | ||
122 | printk("cfe_start_cpu(%i) returned %i\n" , cpu, retval); | ||
78 | } | 123 | } |
79 | 124 | ||
125 | /* | ||
126 | * Use CFE to find out how many CPUs are available, setting up | ||
127 | * phys_cpu_present_map and the logical/physical mappings. | ||
128 | * XXXKW will the boot CPU ever not be physical 0? | ||
129 | * | ||
130 | * Common setup before any secondaries are started | ||
131 | */ | ||
132 | static void __init sb1250_smp_setup(void) | ||
133 | { | ||
134 | int i, num; | ||
135 | |||
136 | cpus_clear(phys_cpu_present_map); | ||
137 | cpu_set(0, phys_cpu_present_map); | ||
138 | __cpu_number_map[0] = 0; | ||
139 | __cpu_logical_map[0] = 0; | ||
140 | |||
141 | for (i = 1, num = 0; i < NR_CPUS; i++) { | ||
142 | if (cfe_cpu_stop(i) == 0) { | ||
143 | cpu_set(i, phys_cpu_present_map); | ||
144 | __cpu_number_map[i] = ++num; | ||
145 | __cpu_logical_map[num] = i; | ||
146 | } | ||
147 | } | ||
148 | printk(KERN_INFO "Detected %i available secondary CPU(s)\n", num); | ||
149 | } | ||
150 | |||
151 | static void __init sb1250_prepare_cpus(unsigned int max_cpus) | ||
152 | { | ||
153 | } | ||
154 | |||
155 | struct plat_smp_ops sb_smp_ops = { | ||
156 | .send_ipi_single = sb1250_send_ipi_single, | ||
157 | .send_ipi_mask = sb1250_send_ipi_mask, | ||
158 | .init_secondary = sb1250_init_secondary, | ||
159 | .smp_finish = sb1250_smp_finish, | ||
160 | .cpus_done = sb1250_cpus_done, | ||
161 | .boot_secondary = sb1250_boot_secondary, | ||
162 | .smp_setup = sb1250_smp_setup, | ||
163 | .prepare_cpus = sb1250_prepare_cpus, | ||
164 | }; | ||
165 | |||
80 | void sb1250_mailbox_interrupt(void) | 166 | void sb1250_mailbox_interrupt(void) |
81 | { | 167 | { |
82 | int cpu = smp_processor_id(); | 168 | int cpu = smp_processor_id(); |