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/bcm1480/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/bcm1480/smp.c')
-rw-r--r-- | arch/mips/sibyte/bcm1480/smp.c | 101 |
1 files changed, 94 insertions, 7 deletions
diff --git a/arch/mips/sibyte/bcm1480/smp.c b/arch/mips/sibyte/bcm1480/smp.c index 436ba78359ab..183c460b9ca1 100644 --- a/arch/mips/sibyte/bcm1480/smp.c +++ b/arch/mips/sibyte/bcm1480/smp.c | |||
@@ -23,6 +23,7 @@ | |||
23 | 23 | ||
24 | #include <asm/mmu_context.h> | 24 | #include <asm/mmu_context.h> |
25 | #include <asm/io.h> | 25 | #include <asm/io.h> |
26 | #include <asm/fw/cfe/cfe_api.h> | ||
26 | #include <asm/sibyte/sb1250.h> | 27 | #include <asm/sibyte/sb1250.h> |
27 | #include <asm/sibyte/bcm1480_regs.h> | 28 | #include <asm/sibyte/bcm1480_regs.h> |
28 | #include <asm/sibyte/bcm1480_int.h> | 29 | #include <asm/sibyte/bcm1480_int.h> |
@@ -67,28 +68,114 @@ void __cpuinit bcm1480_smp_init(void) | |||
67 | change_c0_status(ST0_IM, imask); | 68 | change_c0_status(ST0_IM, imask); |
68 | } | 69 | } |
69 | 70 | ||
70 | void __cpuinit bcm1480_smp_finish(void) | 71 | /* |
72 | * These are routines for dealing with the sb1250 smp capabilities | ||
73 | * independent of board/firmware | ||
74 | */ | ||
75 | |||
76 | /* | ||
77 | * Simple enough; everything is set up, so just poke the appropriate mailbox | ||
78 | * register, and we should be set | ||
79 | */ | ||
80 | static void bcm1480_send_ipi_single(int cpu, unsigned int action) | ||
81 | { | ||
82 | __raw_writeq((((u64)action)<< 48), mailbox_0_set_regs[cpu]); | ||
83 | } | ||
84 | |||
85 | static void bcm1480_send_ipi_mask(cpumask_t mask, unsigned int action) | ||
86 | { | ||
87 | unsigned int i; | ||
88 | |||
89 | for_each_cpu_mask(i, mask) | ||
90 | bcm1480_send_ipi_single(i, action); | ||
91 | } | ||
92 | |||
93 | /* | ||
94 | * Code to run on secondary just after probing the CPU | ||
95 | */ | ||
96 | static void __cpuinit bcm1480_init_secondary(void) | ||
97 | { | ||
98 | extern void bcm1480_smp_init(void); | ||
99 | |||
100 | bcm1480_smp_init(); | ||
101 | } | ||
102 | |||
103 | /* | ||
104 | * Do any tidying up before marking online and running the idle | ||
105 | * loop | ||
106 | */ | ||
107 | static void __cpuinit bcm1480_smp_finish(void) | ||
71 | { | 108 | { |
72 | extern void sb1480_clockevent_init(void); | 109 | extern void sb1480_clockevent_init(void); |
73 | 110 | ||
74 | sb1480_clockevent_init(); | 111 | sb1480_clockevent_init(); |
75 | local_irq_enable(); | 112 | local_irq_enable(); |
113 | bcm1480_smp_finish(); | ||
76 | } | 114 | } |
77 | 115 | ||
78 | /* | 116 | /* |
79 | * These are routines for dealing with the sb1250 smp capabilities | 117 | * Final cleanup after all secondaries booted |
80 | * independent of board/firmware | ||
81 | */ | 118 | */ |
119 | static void bcm1480_cpus_done(void) | ||
120 | { | ||
121 | } | ||
82 | 122 | ||
83 | /* | 123 | /* |
84 | * Simple enough; everything is set up, so just poke the appropriate mailbox | 124 | * Setup the PC, SP, and GP of a secondary processor and start it |
85 | * register, and we should be set | 125 | * running! |
86 | */ | 126 | */ |
87 | void core_send_ipi(int cpu, unsigned int action) | 127 | static void __cpuinit bcm1480_boot_secondary(int cpu, struct task_struct *idle) |
88 | { | 128 | { |
89 | __raw_writeq((((u64)action)<< 48), mailbox_0_set_regs[cpu]); | 129 | int retval; |
130 | |||
131 | retval = cfe_cpu_start(cpu_logical_map(cpu), &smp_bootstrap, | ||
132 | __KSTK_TOS(idle), | ||
133 | (unsigned long)task_thread_info(idle), 0); | ||
134 | if (retval != 0) | ||
135 | printk("cfe_start_cpu(%i) returned %i\n" , cpu, retval); | ||
90 | } | 136 | } |
91 | 137 | ||
138 | /* | ||
139 | * Use CFE to find out how many CPUs are available, setting up | ||
140 | * phys_cpu_present_map and the logical/physical mappings. | ||
141 | * XXXKW will the boot CPU ever not be physical 0? | ||
142 | * | ||
143 | * Common setup before any secondaries are started | ||
144 | */ | ||
145 | static void __init bcm1480_smp_setup(void) | ||
146 | { | ||
147 | int i, num; | ||
148 | |||
149 | cpus_clear(phys_cpu_present_map); | ||
150 | cpu_set(0, phys_cpu_present_map); | ||
151 | __cpu_number_map[0] = 0; | ||
152 | __cpu_logical_map[0] = 0; | ||
153 | |||
154 | for (i = 1, num = 0; i < NR_CPUS; i++) { | ||
155 | if (cfe_cpu_stop(i) == 0) { | ||
156 | cpu_set(i, phys_cpu_present_map); | ||
157 | __cpu_number_map[i] = ++num; | ||
158 | __cpu_logical_map[num] = i; | ||
159 | } | ||
160 | } | ||
161 | printk(KERN_INFO "Detected %i available secondary CPU(s)\n", num); | ||
162 | } | ||
163 | |||
164 | static void __init bcm1480_prepare_cpus(unsigned int max_cpus) | ||
165 | { | ||
166 | } | ||
167 | |||
168 | struct plat_smp_ops bcm1480_smp_ops = { | ||
169 | .send_ipi_single = bcm1480_send_ipi_single, | ||
170 | .send_ipi_mask = bcm1480_send_ipi_mask, | ||
171 | .init_secondary = bcm1480_init_secondary, | ||
172 | .smp_finish = bcm1480_smp_finish, | ||
173 | .cpus_done = bcm1480_cpus_done, | ||
174 | .boot_secondary = bcm1480_boot_secondary, | ||
175 | .smp_setup = bcm1480_smp_setup, | ||
176 | .prepare_cpus = bcm1480_prepare_cpus, | ||
177 | }; | ||
178 | |||
92 | void bcm1480_mailbox_interrupt(void) | 179 | void bcm1480_mailbox_interrupt(void) |
93 | { | 180 | { |
94 | int cpu = smp_processor_id(); | 181 | int cpu = smp_processor_id(); |