diff options
author | Sam Ravnborg <sam@ravnborg.org> | 2011-01-28 17:08:20 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-16 21:19:09 -0400 |
commit | aba20a8295a76310cd062be0736103ba5aee34fa (patch) | |
tree | 391f73a2c6817b3adb018570a8f85a38db4e7585 /arch/sparc/kernel/sun4m_smp.c | |
parent | e787098cfe69dad4e7cccf50352e830f539cd50a (diff) |
sparc32,sun4m: irq, smp files cleanup
- drop filename in file header
- drop unused includes
- add description of sun4m interrupts (from davem)
- add KERN_* to printk
- fix spaces => tabs
- add spaces after reserved words
- drop all externs, they are now in header files
This is partly based on a patch from: David Miller <davem@davemloft.net>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel/sun4m_smp.c')
-rw-r--r-- | arch/sparc/kernel/sun4m_smp.c | 91 |
1 files changed, 22 insertions, 69 deletions
diff --git a/arch/sparc/kernel/sun4m_smp.c b/arch/sparc/kernel/sun4m_smp.c index 762d6eedd944..5cc7dc51de3d 100644 --- a/arch/sparc/kernel/sun4m_smp.c +++ b/arch/sparc/kernel/sun4m_smp.c | |||
@@ -1,59 +1,22 @@ | |||
1 | /* sun4m_smp.c: Sparc SUN4M SMP support. | 1 | /* |
2 | * sun4m SMP support. | ||
2 | * | 3 | * |
3 | * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) | 4 | * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) |
4 | */ | 5 | */ |
5 | 6 | ||
6 | #include <asm/head.h> | ||
7 | |||
8 | #include <linux/kernel.h> | ||
9 | #include <linux/sched.h> | ||
10 | #include <linux/threads.h> | ||
11 | #include <linux/smp.h> | ||
12 | #include <linux/interrupt.h> | 7 | #include <linux/interrupt.h> |
13 | #include <linux/kernel_stat.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/spinlock.h> | ||
16 | #include <linux/mm.h> | ||
17 | #include <linux/swap.h> | ||
18 | #include <linux/profile.h> | 8 | #include <linux/profile.h> |
19 | #include <linux/delay.h> | 9 | #include <linux/delay.h> |
20 | #include <linux/cpu.h> | 10 | #include <linux/cpu.h> |
21 | 11 | ||
22 | #include <asm/cacheflush.h> | 12 | #include <asm/cacheflush.h> |
23 | #include <asm/tlbflush.h> | 13 | #include <asm/tlbflush.h> |
24 | #include <asm/irq_regs.h> | ||
25 | |||
26 | #include <asm/ptrace.h> | ||
27 | #include <asm/atomic.h> | ||
28 | |||
29 | #include <asm/irq.h> | ||
30 | #include <asm/page.h> | ||
31 | #include <asm/pgalloc.h> | ||
32 | #include <asm/pgtable.h> | ||
33 | #include <asm/oplib.h> | ||
34 | #include <asm/cpudata.h> | ||
35 | 14 | ||
36 | #include "irq.h" | 15 | #include "irq.h" |
16 | #include "kernel.h" | ||
37 | 17 | ||
38 | #define IRQ_CROSS_CALL 15 | 18 | #define IRQ_CROSS_CALL 15 |
39 | 19 | ||
40 | extern ctxd_t *srmmu_ctx_table_phys; | ||
41 | |||
42 | extern volatile unsigned long cpu_callin_map[NR_CPUS]; | ||
43 | extern unsigned char boot_cpu_id; | ||
44 | |||
45 | extern cpumask_t smp_commenced_mask; | ||
46 | |||
47 | extern int __smp4m_processor_id(void); | ||
48 | |||
49 | /*#define SMP_DEBUG*/ | ||
50 | |||
51 | #ifdef SMP_DEBUG | ||
52 | #define SMP_PRINTK(x) printk x | ||
53 | #else | ||
54 | #define SMP_PRINTK(x) | ||
55 | #endif | ||
56 | |||
57 | static inline unsigned long | 20 | static inline unsigned long |
58 | swap_ulong(volatile unsigned long *ptr, unsigned long val) | 21 | swap_ulong(volatile unsigned long *ptr, unsigned long val) |
59 | { | 22 | { |
@@ -64,7 +27,6 @@ swap_ulong(volatile unsigned long *ptr, unsigned long val) | |||
64 | } | 27 | } |
65 | 28 | ||
66 | static void smp_setup_percpu_timer(void); | 29 | static void smp_setup_percpu_timer(void); |
67 | extern void cpu_probe(void); | ||
68 | 30 | ||
69 | void __cpuinit smp4m_callin(void) | 31 | void __cpuinit smp4m_callin(void) |
70 | { | 32 | { |
@@ -96,7 +58,7 @@ void __cpuinit smp4m_callin(void) | |||
96 | /* XXX: What's up with all the flushes? */ | 58 | /* XXX: What's up with all the flushes? */ |
97 | local_flush_cache_all(); | 59 | local_flush_cache_all(); |
98 | local_flush_tlb_all(); | 60 | local_flush_tlb_all(); |
99 | 61 | ||
100 | cpu_probe(); | 62 | cpu_probe(); |
101 | 63 | ||
102 | /* Fix idle thread fields. */ | 64 | /* Fix idle thread fields. */ |
@@ -119,9 +81,6 @@ void __cpuinit smp4m_callin(void) | |||
119 | /* | 81 | /* |
120 | * Cycle through the processors asking the PROM to start each one. | 82 | * Cycle through the processors asking the PROM to start each one. |
121 | */ | 83 | */ |
122 | |||
123 | extern struct linux_prom_registers smp_penguin_ctable; | ||
124 | |||
125 | void __init smp4m_boot_cpus(void) | 84 | void __init smp4m_boot_cpus(void) |
126 | { | 85 | { |
127 | smp_setup_percpu_timer(); | 86 | smp_setup_percpu_timer(); |
@@ -130,7 +89,6 @@ void __init smp4m_boot_cpus(void) | |||
130 | 89 | ||
131 | int __cpuinit smp4m_boot_one_cpu(int i) | 90 | int __cpuinit smp4m_boot_one_cpu(int i) |
132 | { | 91 | { |
133 | extern unsigned long sun4m_cpu_startup; | ||
134 | unsigned long *entry = &sun4m_cpu_startup; | 92 | unsigned long *entry = &sun4m_cpu_startup; |
135 | struct task_struct *p; | 93 | struct task_struct *p; |
136 | int timeout; | 94 | int timeout; |
@@ -142,7 +100,7 @@ int __cpuinit smp4m_boot_one_cpu(int i) | |||
142 | p = fork_idle(i); | 100 | p = fork_idle(i); |
143 | current_set[i] = task_thread_info(p); | 101 | current_set[i] = task_thread_info(p); |
144 | /* See trampoline.S for details... */ | 102 | /* See trampoline.S for details... */ |
145 | entry += ((i-1) * 3); | 103 | entry += ((i - 1) * 3); |
146 | 104 | ||
147 | /* | 105 | /* |
148 | * Initialize the contexts table | 106 | * Initialize the contexts table |
@@ -154,20 +112,19 @@ int __cpuinit smp4m_boot_one_cpu(int i) | |||
154 | smp_penguin_ctable.reg_size = 0; | 112 | smp_penguin_ctable.reg_size = 0; |
155 | 113 | ||
156 | /* whirrr, whirrr, whirrrrrrrrr... */ | 114 | /* whirrr, whirrr, whirrrrrrrrr... */ |
157 | printk("Starting CPU %d at %p\n", i, entry); | 115 | printk(KERN_INFO "Starting CPU %d at %p\n", i, entry); |
158 | local_flush_cache_all(); | 116 | local_flush_cache_all(); |
159 | prom_startcpu(cpu_node, | 117 | prom_startcpu(cpu_node, &smp_penguin_ctable, 0, (char *)entry); |
160 | &smp_penguin_ctable, 0, (char *)entry); | ||
161 | 118 | ||
162 | /* wheee... it's going... */ | 119 | /* wheee... it's going... */ |
163 | for(timeout = 0; timeout < 10000; timeout++) { | 120 | for (timeout = 0; timeout < 10000; timeout++) { |
164 | if(cpu_callin_map[i]) | 121 | if (cpu_callin_map[i]) |
165 | break; | 122 | break; |
166 | udelay(200); | 123 | udelay(200); |
167 | } | 124 | } |
168 | 125 | ||
169 | if (!(cpu_callin_map[i])) { | 126 | if (!(cpu_callin_map[i])) { |
170 | printk("Processor %d is stuck.\n", i); | 127 | printk(KERN_ERR "Processor %d is stuck.\n", i); |
171 | return -ENODEV; | 128 | return -ENODEV; |
172 | } | 129 | } |
173 | 130 | ||
@@ -202,6 +159,7 @@ void __init smp4m_smp_done(void) | |||
202 | void smp4m_irq_rotate(int cpu) | 159 | void smp4m_irq_rotate(int cpu) |
203 | { | 160 | { |
204 | int next = cpu_data(cpu).next; | 161 | int next = cpu_data(cpu).next; |
162 | |||
205 | if (next != cpu) | 163 | if (next != cpu) |
206 | set_irq_udt(next); | 164 | set_irq_udt(next); |
207 | } | 165 | } |
@@ -243,7 +201,7 @@ static void smp4m_cross_call(smpfunc_t func, cpumask_t mask, unsigned long arg1, | |||
243 | 201 | ||
244 | cpu_clear(smp_processor_id(), mask); | 202 | cpu_clear(smp_processor_id(), mask); |
245 | cpus_and(mask, cpu_online_map, mask); | 203 | cpus_and(mask, cpu_online_map, mask); |
246 | for(i = 0; i < ncpus; i++) { | 204 | for (i = 0; i < ncpus; i++) { |
247 | if (cpu_isset(i, mask)) { | 205 | if (cpu_isset(i, mask)) { |
248 | ccall_info.processors_in[i] = 0; | 206 | ccall_info.processors_in[i] = 0; |
249 | ccall_info.processors_out[i] = 0; | 207 | ccall_info.processors_out[i] = 0; |
@@ -262,19 +220,18 @@ static void smp4m_cross_call(smpfunc_t func, cpumask_t mask, unsigned long arg1, | |||
262 | do { | 220 | do { |
263 | if (!cpu_isset(i, mask)) | 221 | if (!cpu_isset(i, mask)) |
264 | continue; | 222 | continue; |
265 | while(!ccall_info.processors_in[i]) | 223 | while (!ccall_info.processors_in[i]) |
266 | barrier(); | 224 | barrier(); |
267 | } while(++i < ncpus); | 225 | } while (++i < ncpus); |
268 | 226 | ||
269 | i = 0; | 227 | i = 0; |
270 | do { | 228 | do { |
271 | if (!cpu_isset(i, mask)) | 229 | if (!cpu_isset(i, mask)) |
272 | continue; | 230 | continue; |
273 | while(!ccall_info.processors_out[i]) | 231 | while (!ccall_info.processors_out[i]) |
274 | barrier(); | 232 | barrier(); |
275 | } while(++i < ncpus); | 233 | } while (++i < ncpus); |
276 | } | 234 | } |
277 | |||
278 | spin_unlock_irqrestore(&cross_call_lock, flags); | 235 | spin_unlock_irqrestore(&cross_call_lock, flags); |
279 | } | 236 | } |
280 | 237 | ||
@@ -289,8 +246,6 @@ void smp4m_cross_call_irq(void) | |||
289 | ccall_info.processors_out[i] = 1; | 246 | ccall_info.processors_out[i] = 1; |
290 | } | 247 | } |
291 | 248 | ||
292 | extern void sun4m_clear_profile_irq(int cpu); | ||
293 | |||
294 | void smp4m_percpu_timer_interrupt(struct pt_regs *regs) | 249 | void smp4m_percpu_timer_interrupt(struct pt_regs *regs) |
295 | { | 250 | { |
296 | struct pt_regs *old_regs; | 251 | struct pt_regs *old_regs; |
@@ -302,7 +257,7 @@ void smp4m_percpu_timer_interrupt(struct pt_regs *regs) | |||
302 | 257 | ||
303 | profile_tick(CPU_PROFILING); | 258 | profile_tick(CPU_PROFILING); |
304 | 259 | ||
305 | if(!--prof_counter(cpu)) { | 260 | if (!--prof_counter(cpu)) { |
306 | int user = user_mode(regs); | 261 | int user = user_mode(regs); |
307 | 262 | ||
308 | irq_enter(); | 263 | irq_enter(); |
@@ -314,8 +269,6 @@ void smp4m_percpu_timer_interrupt(struct pt_regs *regs) | |||
314 | set_irq_regs(old_regs); | 269 | set_irq_regs(old_regs); |
315 | } | 270 | } |
316 | 271 | ||
317 | extern unsigned int lvl14_resolution; | ||
318 | |||
319 | static void __cpuinit smp_setup_percpu_timer(void) | 272 | static void __cpuinit smp_setup_percpu_timer(void) |
320 | { | 273 | { |
321 | int cpu = smp_processor_id(); | 274 | int cpu = smp_processor_id(); |
@@ -323,7 +276,7 @@ static void __cpuinit smp_setup_percpu_timer(void) | |||
323 | prof_counter(cpu) = prof_multiplier(cpu) = 1; | 276 | prof_counter(cpu) = prof_multiplier(cpu) = 1; |
324 | load_profile_irq(cpu, lvl14_resolution); | 277 | load_profile_irq(cpu, lvl14_resolution); |
325 | 278 | ||
326 | if(cpu == boot_cpu_id) | 279 | if (cpu == boot_cpu_id) |
327 | enable_pil_irq(14); | 280 | enable_pil_irq(14); |
328 | } | 281 | } |
329 | 282 | ||
@@ -331,9 +284,9 @@ static void __init smp4m_blackbox_id(unsigned *addr) | |||
331 | { | 284 | { |
332 | int rd = *addr & 0x3e000000; | 285 | int rd = *addr & 0x3e000000; |
333 | int rs1 = rd >> 11; | 286 | int rs1 = rd >> 11; |
334 | 287 | ||
335 | addr[0] = 0x81580000 | rd; /* rd %tbr, reg */ | 288 | addr[0] = 0x81580000 | rd; /* rd %tbr, reg */ |
336 | addr[1] = 0x8130200c | rd | rs1; /* srl reg, 0xc, reg */ | 289 | addr[1] = 0x8130200c | rd | rs1; /* srl reg, 0xc, reg */ |
337 | addr[2] = 0x80082003 | rd | rs1; /* and reg, 3, reg */ | 290 | addr[2] = 0x80082003 | rd | rs1; /* and reg, 3, reg */ |
338 | } | 291 | } |
339 | 292 | ||
@@ -341,9 +294,9 @@ static void __init smp4m_blackbox_current(unsigned *addr) | |||
341 | { | 294 | { |
342 | int rd = *addr & 0x3e000000; | 295 | int rd = *addr & 0x3e000000; |
343 | int rs1 = rd >> 11; | 296 | int rs1 = rd >> 11; |
344 | 297 | ||
345 | addr[0] = 0x81580000 | rd; /* rd %tbr, reg */ | 298 | addr[0] = 0x81580000 | rd; /* rd %tbr, reg */ |
346 | addr[2] = 0x8130200a | rd | rs1; /* srl reg, 0xa, reg */ | 299 | addr[2] = 0x8130200a | rd | rs1; /* srl reg, 0xa, reg */ |
347 | addr[4] = 0x8008200c | rd | rs1; /* and reg, 0xc, reg */ | 300 | addr[4] = 0x8008200c | rd | rs1; /* and reg, 0xc, reg */ |
348 | } | 301 | } |
349 | 302 | ||