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 | |
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')
-rw-r--r-- | arch/sparc/kernel/sun4m_irq.c | 182 | ||||
-rw-r--r-- | arch/sparc/kernel/sun4m_smp.c | 91 |
2 files changed, 115 insertions, 158 deletions
diff --git a/arch/sparc/kernel/sun4m_irq.c b/arch/sparc/kernel/sun4m_irq.c index 7f3b97ff62c1..3c6657a4caec 100644 --- a/arch/sparc/kernel/sun4m_irq.c +++ b/arch/sparc/kernel/sun4m_irq.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* sun4m_irq.c | 1 | /* |
2 | * arch/sparc/kernel/sun4m_irq.c: | 2 | * sun4m irq support |
3 | * | 3 | * |
4 | * djhr: Hacked out of irq.c into a CPU dependent version. | 4 | * djhr: Hacked out of irq.c into a CPU dependent version. |
5 | * | 5 | * |
@@ -9,36 +9,92 @@ | |||
9 | * Copyright (C) 1996 Dave Redman (djhr@tadpole.co.uk) | 9 | * Copyright (C) 1996 Dave Redman (djhr@tadpole.co.uk) |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/errno.h> | ||
13 | #include <linux/linkage.h> | ||
14 | #include <linux/kernel_stat.h> | ||
15 | #include <linux/signal.h> | ||
16 | #include <linux/sched.h> | ||
17 | #include <linux/ptrace.h> | ||
18 | #include <linux/smp.h> | ||
19 | #include <linux/interrupt.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/ioport.h> | ||
22 | #include <linux/of.h> | ||
23 | #include <linux/of_device.h> | ||
24 | |||
25 | #include <asm/ptrace.h> | ||
26 | #include <asm/processor.h> | ||
27 | #include <asm/system.h> | ||
28 | #include <asm/psr.h> | ||
29 | #include <asm/vaddrs.h> | ||
30 | #include <asm/timer.h> | 12 | #include <asm/timer.h> |
31 | #include <asm/openprom.h> | ||
32 | #include <asm/oplib.h> | ||
33 | #include <asm/traps.h> | 13 | #include <asm/traps.h> |
34 | #include <asm/pgalloc.h> | 14 | #include <asm/pgalloc.h> |
35 | #include <asm/pgtable.h> | 15 | #include <asm/pgtable.h> |
36 | #include <asm/smp.h> | ||
37 | #include <asm/irq.h> | 16 | #include <asm/irq.h> |
38 | #include <asm/io.h> | 17 | #include <asm/io.h> |
39 | #include <asm/cacheflush.h> | 18 | #include <asm/cacheflush.h> |
40 | 19 | ||
41 | #include "irq.h" | 20 | #include "irq.h" |
21 | #include "kernel.h" | ||
22 | |||
23 | /* Sample sun4m IRQ layout: | ||
24 | * | ||
25 | * 0x22 - Power | ||
26 | * 0x24 - ESP SCSI | ||
27 | * 0x26 - Lance ethernet | ||
28 | * 0x2b - Floppy | ||
29 | * 0x2c - Zilog uart | ||
30 | * 0x32 - SBUS level 0 | ||
31 | * 0x33 - Parallel port, SBUS level 1 | ||
32 | * 0x35 - SBUS level 2 | ||
33 | * 0x37 - SBUS level 3 | ||
34 | * 0x39 - Audio, Graphics card, SBUS level 4 | ||
35 | * 0x3b - SBUS level 5 | ||
36 | * 0x3d - SBUS level 6 | ||
37 | * | ||
38 | * Each interrupt source has a mask bit in the interrupt registers. | ||
39 | * When the mask bit is set, this blocks interrupt deliver. So you | ||
40 | * clear the bit to enable the interrupt. | ||
41 | * | ||
42 | * Interrupts numbered less than 0x10 are software triggered interrupts | ||
43 | * and unused by Linux. | ||
44 | * | ||
45 | * Interrupt level assignment on sun4m: | ||
46 | * | ||
47 | * level source | ||
48 | * ------------------------------------------------------------ | ||
49 | * 1 softint-1 | ||
50 | * 2 softint-2, VME/SBUS level 1 | ||
51 | * 3 softint-3, VME/SBUS level 2 | ||
52 | * 4 softint-4, onboard SCSI | ||
53 | * 5 softint-5, VME/SBUS level 3 | ||
54 | * 6 softint-6, onboard ETHERNET | ||
55 | * 7 softint-7, VME/SBUS level 4 | ||
56 | * 8 softint-8, onboard VIDEO | ||
57 | * 9 softint-9, VME/SBUS level 5, Module Interrupt | ||
58 | * 10 softint-10, system counter/timer | ||
59 | * 11 softint-11, VME/SBUS level 6, Floppy | ||
60 | * 12 softint-12, Keyboard/Mouse, Serial | ||
61 | * 13 softint-13, VME/SBUS level 7, ISDN Audio | ||
62 | * 14 softint-14, per-processor counter/timer | ||
63 | * 15 softint-15, Asynchronous Errors (broadcast) | ||
64 | * | ||
65 | * Each interrupt source is masked distinctly in the sun4m interrupt | ||
66 | * registers. The PIL level alone is therefore ambiguous, since multiple | ||
67 | * interrupt sources map to a single PIL. | ||
68 | * | ||
69 | * This ambiguity is resolved in the 'intr' property for device nodes | ||
70 | * in the OF device tree. Each 'intr' property entry is composed of | ||
71 | * two 32-bit words. The first word is the IRQ priority value, which | ||
72 | * is what we're intersted in. The second word is the IRQ vector, which | ||
73 | * is unused. | ||
74 | * | ||
75 | * The low 4 bits of the IRQ priority indicate the PIL, and the upper | ||
76 | * 4 bits indicate onboard vs. SBUS leveled vs. VME leveled. 0x20 | ||
77 | * means onboard, 0x30 means SBUS leveled, and 0x40 means VME leveled. | ||
78 | * | ||
79 | * For example, an 'intr' IRQ priority value of 0x24 is onboard SCSI | ||
80 | * whereas a value of 0x33 is SBUS level 2. Here are some sample | ||
81 | * 'intr' property IRQ priority values from ss4, ss5, ss10, ss20, and | ||
82 | * Tadpole S3 GX systems. | ||
83 | * | ||
84 | * esp: 0x24 onboard ESP SCSI | ||
85 | * le: 0x26 onboard Lance ETHERNET | ||
86 | * p9100: 0x32 SBUS level 1 P9100 video | ||
87 | * bpp: 0x33 SBUS level 2 BPP parallel port device | ||
88 | * DBRI: 0x39 SBUS level 5 DBRI ISDN audio | ||
89 | * SUNW,leo: 0x39 SBUS level 5 LEO video | ||
90 | * pcmcia: 0x3b SBUS level 6 PCMCIA controller | ||
91 | * uctrl: 0x3b SBUS level 6 UCTRL device | ||
92 | * modem: 0x3d SBUS level 7 MODEM | ||
93 | * zs: 0x2c onboard keyboard/mouse/serial | ||
94 | * floppy: 0x2b onboard Floppy | ||
95 | * power: 0x22 onboard power device (XXX unknown mask bit XXX) | ||
96 | */ | ||
97 | |||
42 | 98 | ||
43 | struct sun4m_irq_percpu { | 99 | struct sun4m_irq_percpu { |
44 | u32 pending; | 100 | u32 pending; |
@@ -61,9 +117,9 @@ struct sun4m_irq_global __iomem *sun4m_irq_global; | |||
61 | /* Dave Redman (djhr@tadpole.co.uk) | 117 | /* Dave Redman (djhr@tadpole.co.uk) |
62 | * The sun4m interrupt registers. | 118 | * The sun4m interrupt registers. |
63 | */ | 119 | */ |
64 | #define SUN4M_INT_ENABLE 0x80000000 | 120 | #define SUN4M_INT_ENABLE 0x80000000 |
65 | #define SUN4M_INT_E14 0x00000080 | 121 | #define SUN4M_INT_E14 0x00000080 |
66 | #define SUN4M_INT_E10 0x00080000 | 122 | #define SUN4M_INT_E10 0x00080000 |
67 | 123 | ||
68 | #define SUN4M_HARD_INT(x) (0x000000001 << (x)) | 124 | #define SUN4M_HARD_INT(x) (0x000000001 << (x)) |
69 | #define SUN4M_SOFT_INT(x) (0x000010000 << (x)) | 125 | #define SUN4M_SOFT_INT(x) (0x000010000 << (x)) |
@@ -99,59 +155,6 @@ struct sun4m_irq_global __iomem *sun4m_irq_global; | |||
99 | #define OBP_INT_LEVEL_SBUS 0x30 | 155 | #define OBP_INT_LEVEL_SBUS 0x30 |
100 | #define OBP_INT_LEVEL_VME 0x40 | 156 | #define OBP_INT_LEVEL_VME 0x40 |
101 | 157 | ||
102 | /* Interrupt level assignment on sun4m: | ||
103 | * | ||
104 | * level source | ||
105 | * ------------------------------------------------------------ | ||
106 | * 1 softint-1 | ||
107 | * 2 softint-2, VME/SBUS level 1 | ||
108 | * 3 softint-3, VME/SBUS level 2 | ||
109 | * 4 softint-4, onboard SCSI | ||
110 | * 5 softint-5, VME/SBUS level 3 | ||
111 | * 6 softint-6, onboard ETHERNET | ||
112 | * 7 softint-7, VME/SBUS level 4 | ||
113 | * 8 softint-8, onboard VIDEO | ||
114 | * 9 softint-9, VME/SBUS level 5, Module Interrupt | ||
115 | * 10 softint-10, system counter/timer | ||
116 | * 11 softint-11, VME/SBUS level 6, Floppy | ||
117 | * 12 softint-12, Keyboard/Mouse, Serial | ||
118 | * 13 softint-13, VME/SBUS level 7, ISDN Audio | ||
119 | * 14 softint-14, per-processor counter/timer | ||
120 | * 15 softint-15, Asynchronous Errors (broadcast) | ||
121 | * | ||
122 | * Each interrupt source is masked distinctly in the sun4m interrupt | ||
123 | * registers. The PIL level alone is therefore ambiguous, since multiple | ||
124 | * interrupt sources map to a single PIL. | ||
125 | * | ||
126 | * This ambiguity is resolved in the 'intr' property for device nodes | ||
127 | * in the OF device tree. Each 'intr' property entry is composed of | ||
128 | * two 32-bit words. The first word is the IRQ priority value, which | ||
129 | * is what we're intersted in. The second word is the IRQ vector, which | ||
130 | * is unused. | ||
131 | * | ||
132 | * The low 4 bits of the IRQ priority indicate the PIL, and the upper | ||
133 | * 4 bits indicate onboard vs. SBUS leveled vs. VME leveled. 0x20 | ||
134 | * means onboard, 0x30 means SBUS leveled, and 0x40 means VME leveled. | ||
135 | * | ||
136 | * For example, an 'intr' IRQ priority value of 0x24 is onboard SCSI | ||
137 | * whereas a value of 0x33 is SBUS level 2. Here are some sample | ||
138 | * 'intr' property IRQ priority values from ss4, ss5, ss10, ss20, and | ||
139 | * Tadpole S3 GX systems. | ||
140 | * | ||
141 | * esp: 0x24 onboard ESP SCSI | ||
142 | * le: 0x26 onboard Lance ETHERNET | ||
143 | * p9100: 0x32 SBUS level 1 P9100 video | ||
144 | * bpp: 0x33 SBUS level 2 BPP parallel port device | ||
145 | * DBRI: 0x39 SBUS level 5 DBRI ISDN audio | ||
146 | * SUNW,leo: 0x39 SBUS level 5 LEO video | ||
147 | * pcmcia: 0x3b SBUS level 6 PCMCIA controller | ||
148 | * uctrl: 0x3b SBUS level 6 UCTRL device | ||
149 | * modem: 0x3d SBUS level 7 MODEM | ||
150 | * zs: 0x2c onboard keyboard/mouse/serial | ||
151 | * floppy: 0x2b onboard Floppy | ||
152 | * power: 0x22 onboard power device (XXX unknown mask bit XXX) | ||
153 | */ | ||
154 | |||
155 | static unsigned long irq_mask[0x50] = { | 158 | static unsigned long irq_mask[0x50] = { |
156 | /* SMP */ | 159 | /* SMP */ |
157 | 0, SUN4M_SOFT_INT(1), | 160 | 0, SUN4M_SOFT_INT(1), |
@@ -193,7 +196,7 @@ static unsigned long irq_mask[0x50] = { | |||
193 | static unsigned long sun4m_get_irqmask(unsigned int irq) | 196 | static unsigned long sun4m_get_irqmask(unsigned int irq) |
194 | { | 197 | { |
195 | unsigned long mask; | 198 | unsigned long mask; |
196 | 199 | ||
197 | if (irq < 0x50) | 200 | if (irq < 0x50) |
198 | mask = irq_mask[irq]; | 201 | mask = irq_mask[irq]; |
199 | else | 202 | else |
@@ -217,7 +220,7 @@ static void sun4m_disable_irq(unsigned int irq_nr) | |||
217 | sbus_writel(mask, &sun4m_irq_global->mask_set); | 220 | sbus_writel(mask, &sun4m_irq_global->mask_set); |
218 | else | 221 | else |
219 | sbus_writel(mask, &sun4m_irq_percpu[cpu]->set); | 222 | sbus_writel(mask, &sun4m_irq_percpu[cpu]->set); |
220 | local_irq_restore(flags); | 223 | local_irq_restore(flags); |
221 | } | 224 | } |
222 | 225 | ||
223 | static void sun4m_enable_irq(unsigned int irq_nr) | 226 | static void sun4m_enable_irq(unsigned int irq_nr) |
@@ -226,17 +229,17 @@ static void sun4m_enable_irq(unsigned int irq_nr) | |||
226 | int cpu = smp_processor_id(); | 229 | int cpu = smp_processor_id(); |
227 | 230 | ||
228 | /* Dreadful floppy hack. When we use 0x2b instead of | 231 | /* Dreadful floppy hack. When we use 0x2b instead of |
229 | * 0x0b the system blows (it starts to whistle!). | 232 | * 0x0b the system blows (it starts to whistle!). |
230 | * So we continue to use 0x0b. Fixme ASAP. --P3 | 233 | * So we continue to use 0x0b. Fixme ASAP. --P3 |
231 | */ | 234 | */ |
232 | if (irq_nr != 0x0b) { | 235 | if (irq_nr != 0x0b) { |
233 | mask = sun4m_get_irqmask(irq_nr); | 236 | mask = sun4m_get_irqmask(irq_nr); |
234 | local_irq_save(flags); | 237 | local_irq_save(flags); |
235 | if (irq_nr > 15) | 238 | if (irq_nr > 15) |
236 | sbus_writel(mask, &sun4m_irq_global->mask_clear); | 239 | sbus_writel(mask, &sun4m_irq_global->mask_clear); |
237 | else | 240 | else |
238 | sbus_writel(mask, &sun4m_irq_percpu[cpu]->clear); | 241 | sbus_writel(mask, &sun4m_irq_percpu[cpu]->clear); |
239 | local_irq_restore(flags); | 242 | local_irq_restore(flags); |
240 | } else { | 243 | } else { |
241 | local_irq_save(flags); | 244 | local_irq_save(flags); |
242 | sbus_writel(SUN4M_INT_FLOPPY, &sun4m_irq_global->mask_clear); | 245 | sbus_writel(SUN4M_INT_FLOPPY, &sun4m_irq_global->mask_clear); |
@@ -260,7 +263,7 @@ static unsigned long cpu_pil_to_imask[16] = { | |||
260 | /*12*/ SUN4M_INT_SERIAL | SUN4M_INT_KBDMS, | 263 | /*12*/ SUN4M_INT_SERIAL | SUN4M_INT_KBDMS, |
261 | /*13*/ SUN4M_INT_SBUS(6) | SUN4M_INT_VME(6) | SUN4M_INT_AUDIO, | 264 | /*13*/ SUN4M_INT_SBUS(6) | SUN4M_INT_VME(6) | SUN4M_INT_AUDIO, |
262 | /*14*/ SUN4M_INT_E14, | 265 | /*14*/ SUN4M_INT_E14, |
263 | /*15*/ SUN4M_INT_ERROR | 266 | /*15*/ SUN4M_INT_ERROR, |
264 | }; | 267 | }; |
265 | 268 | ||
266 | /* We assume the caller has disabled local interrupts when these are called, | 269 | /* We assume the caller has disabled local interrupts when these are called, |
@@ -280,12 +283,14 @@ static void sun4m_enable_pil_irq(unsigned int pil) | |||
280 | static void sun4m_send_ipi(int cpu, int level) | 283 | static void sun4m_send_ipi(int cpu, int level) |
281 | { | 284 | { |
282 | unsigned long mask = sun4m_get_irqmask(level); | 285 | unsigned long mask = sun4m_get_irqmask(level); |
286 | |||
283 | sbus_writel(mask, &sun4m_irq_percpu[cpu]->set); | 287 | sbus_writel(mask, &sun4m_irq_percpu[cpu]->set); |
284 | } | 288 | } |
285 | 289 | ||
286 | static void sun4m_clear_ipi(int cpu, int level) | 290 | static void sun4m_clear_ipi(int cpu, int level) |
287 | { | 291 | { |
288 | unsigned long mask = sun4m_get_irqmask(level); | 292 | unsigned long mask = sun4m_get_irqmask(level); |
293 | |||
289 | sbus_writel(mask, &sun4m_irq_percpu[cpu]->clear); | 294 | sbus_writel(mask, &sun4m_irq_percpu[cpu]->clear); |
290 | } | 295 | } |
291 | 296 | ||
@@ -314,7 +319,7 @@ struct sun4m_timer_global { | |||
314 | 319 | ||
315 | static struct sun4m_timer_global __iomem *timers_global; | 320 | static struct sun4m_timer_global __iomem *timers_global; |
316 | 321 | ||
317 | #define TIMER_IRQ (OBP_INT_LEVEL_ONBOARD | 10) | 322 | #define TIMER_IRQ (OBP_INT_LEVEL_ONBOARD | 10) |
318 | 323 | ||
319 | unsigned int lvl14_resolution = (((1000000/HZ) + 1) << 10); | 324 | unsigned int lvl14_resolution = (((1000000/HZ) + 1) << 10); |
320 | 325 | ||
@@ -407,7 +412,6 @@ static void __init sun4m_init_timers(irq_handler_t counter_fn) | |||
407 | #ifdef CONFIG_SMP | 412 | #ifdef CONFIG_SMP |
408 | { | 413 | { |
409 | unsigned long flags; | 414 | unsigned long flags; |
410 | extern unsigned long lvl14_save[4]; | ||
411 | struct tt_entry *trap_table = &sparc_ttable[SP_TRAP_IRQ1 + (14 - 1)]; | 415 | struct tt_entry *trap_table = &sparc_ttable[SP_TRAP_IRQ1 + (14 - 1)]; |
412 | 416 | ||
413 | /* For SMP we use the level 14 ticker, however the bootup code | 417 | /* For SMP we use the level 14 ticker, however the bootup code |
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 | ||