diff options
author | David S. Miller <davem@davemloft.net> | 2012-05-14 02:09:04 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-14 16:31:38 -0400 |
commit | c68e5d39a502d01421cbc70d25c377e9215facef (patch) | |
tree | 9135a68681381d94a929b57a28a1878df0134ff7 /arch/sparc | |
parent | 5d83d66635bb1642f3c6a3690c28ff4afdf1ae5f (diff) |
sparc32: Implement hard_smp_processor_id() via instruction patching.
This is the last non-trivial user of btfixup.
Like sparc64, use a special patch section to resolve the various
implementations of how to read the current CPU's ID when we don't
have current_thread_info()->cpu necessarily available.
Signed-off-by: David S. Miller <davem@davemloft.net>
Tested-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'arch/sparc')
-rw-r--r-- | arch/sparc/include/asm/smp_32.h | 43 | ||||
-rw-r--r-- | arch/sparc/include/asm/winmacro.h | 49 | ||||
-rw-r--r-- | arch/sparc/kernel/entry.S | 23 | ||||
-rw-r--r-- | arch/sparc/kernel/kernel.h | 2 | ||||
-rw-r--r-- | arch/sparc/kernel/leon_smp.c | 29 | ||||
-rw-r--r-- | arch/sparc/kernel/setup_32.c | 51 | ||||
-rw-r--r-- | arch/sparc/kernel/sparc_ksyms_32.c | 5 | ||||
-rw-r--r-- | arch/sparc/kernel/sun4d_smp.c | 27 | ||||
-rw-r--r-- | arch/sparc/kernel/sun4m_smp.c | 23 | ||||
-rw-r--r-- | arch/sparc/kernel/trampoline_32.S | 22 |
10 files changed, 99 insertions, 175 deletions
diff --git a/arch/sparc/include/asm/smp_32.h b/arch/sparc/include/asm/smp_32.h index 01c51c704341..f5b325e731dd 100644 --- a/arch/sparc/include/asm/smp_32.h +++ b/arch/sparc/include/asm/smp_32.h | |||
@@ -59,12 +59,9 @@ void smp_bogo(struct seq_file *); | |||
59 | void smp_info(struct seq_file *); | 59 | void smp_info(struct seq_file *); |
60 | 60 | ||
61 | BTFIXUPDEF_CALL(void, smp_cross_call, smpfunc_t, cpumask_t, unsigned long, unsigned long, unsigned long, unsigned long) | 61 | BTFIXUPDEF_CALL(void, smp_cross_call, smpfunc_t, cpumask_t, unsigned long, unsigned long, unsigned long, unsigned long) |
62 | BTFIXUPDEF_CALL(int, __hard_smp_processor_id, void) | ||
63 | BTFIXUPDEF_CALL(void, smp_ipi_resched, int); | 62 | BTFIXUPDEF_CALL(void, smp_ipi_resched, int); |
64 | BTFIXUPDEF_CALL(void, smp_ipi_single, int); | 63 | BTFIXUPDEF_CALL(void, smp_ipi_single, int); |
65 | BTFIXUPDEF_CALL(void, smp_ipi_mask_one, int); | 64 | BTFIXUPDEF_CALL(void, smp_ipi_mask_one, int); |
66 | BTFIXUPDEF_BLACKBOX(hard_smp_processor_id) | ||
67 | BTFIXUPDEF_BLACKBOX(load_current) | ||
68 | 65 | ||
69 | #define smp_cross_call(func,mask,arg1,arg2,arg3,arg4) BTFIXUP_CALL(smp_cross_call)(func,mask,arg1,arg2,arg3,arg4) | 66 | #define smp_cross_call(func,mask,arg1,arg2,arg3,arg4) BTFIXUP_CALL(smp_cross_call)(func,mask,arg1,arg2,arg3,arg4) |
70 | 67 | ||
@@ -117,45 +114,7 @@ extern inline int hard_smpleon_processor_id(void) | |||
117 | return cpuid; | 114 | return cpuid; |
118 | } | 115 | } |
119 | 116 | ||
120 | #ifndef MODULE | 117 | extern int hard_smp_processor_id(void); |
121 | static inline int hard_smp_processor_id(void) | ||
122 | { | ||
123 | int cpuid; | ||
124 | |||
125 | /* Black box - sun4m | ||
126 | __asm__ __volatile__("rd %%tbr, %0\n\t" | ||
127 | "srl %0, 12, %0\n\t" | ||
128 | "and %0, 3, %0\n\t" : | ||
129 | "=&r" (cpuid)); | ||
130 | - sun4d | ||
131 | __asm__ __volatile__("lda [%g0] ASI_M_VIKING_TMP1, %0\n\t" | ||
132 | "nop; nop" : | ||
133 | "=&r" (cpuid)); | ||
134 | - leon | ||
135 | __asm__ __volatile__( "rd %asr17, %0\n\t" | ||
136 | "srl %0, 0x1c, %0\n\t" | ||
137 | "nop\n\t" : | ||
138 | "=&r" (cpuid)); | ||
139 | See btfixup.h and btfixupprep.c to understand how a blackbox works. | ||
140 | */ | ||
141 | __asm__ __volatile__("sethi %%hi(___b_hard_smp_processor_id), %0\n\t" | ||
142 | "sethi %%hi(boot_cpu_id), %0\n\t" | ||
143 | "ldub [%0 + %%lo(boot_cpu_id)], %0\n\t" : | ||
144 | "=&r" (cpuid)); | ||
145 | return cpuid; | ||
146 | } | ||
147 | #else | ||
148 | static inline int hard_smp_processor_id(void) | ||
149 | { | ||
150 | int cpuid; | ||
151 | |||
152 | __asm__ __volatile__("mov %%o7, %%g1\n\t" | ||
153 | "call ___f___hard_smp_processor_id\n\t" | ||
154 | " nop\n\t" | ||
155 | "mov %%g2, %0\n\t" : "=r"(cpuid) : : "g1", "g2"); | ||
156 | return cpuid; | ||
157 | } | ||
158 | #endif | ||
159 | 118 | ||
160 | #define raw_smp_processor_id() (current_thread_info()->cpu) | 119 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
161 | 120 | ||
diff --git a/arch/sparc/include/asm/winmacro.h b/arch/sparc/include/asm/winmacro.h index a9be04b0d049..9b7b21764cde 100644 --- a/arch/sparc/include/asm/winmacro.h +++ b/arch/sparc/include/asm/winmacro.h | |||
@@ -103,37 +103,24 @@ | |||
103 | st %scratch, [%cur_reg + TI_W_SAVED]; | 103 | st %scratch, [%cur_reg + TI_W_SAVED]; |
104 | 104 | ||
105 | #ifdef CONFIG_SMP | 105 | #ifdef CONFIG_SMP |
106 | /* Results of LOAD_CURRENT() after BTFIXUP for SUN4M, SUN4D & LEON (comments) */ | 106 | #define LOAD_CURRENT(dest_reg, idreg) \ |
107 | #define LOAD_CURRENT4M(dest_reg, idreg) \ | 107 | 661: rd %tbr, %idreg; \ |
108 | rd %tbr, %idreg; \ | 108 | srl %idreg, 10, %idreg; \ |
109 | sethi %hi(current_set), %dest_reg; \ | 109 | and %idreg, 0xc, %idreg; \ |
110 | srl %idreg, 10, %idreg; \ | 110 | .section .cpuid_patch, "ax"; \ |
111 | or %dest_reg, %lo(current_set), %dest_reg; \ | 111 | /* Instruction location. */ \ |
112 | and %idreg, 0xc, %idreg; \ | 112 | .word 661b; \ |
113 | ld [%idreg + %dest_reg], %dest_reg; | 113 | /* SUN4D implementation. */ \ |
114 | 114 | lda [%g0] ASI_M_VIKING_TMP1, %idreg; \ | |
115 | #define LOAD_CURRENT4D(dest_reg, idreg) \ | 115 | sll %idreg, 2, %idreg; \ |
116 | lda [%g0] ASI_M_VIKING_TMP1, %idreg; \ | 116 | nop; \ |
117 | sethi %hi(C_LABEL(current_set)), %dest_reg; \ | 117 | /* LEON implementation. */ \ |
118 | sll %idreg, 2, %idreg; \ | 118 | rd %asr17, %idreg; \ |
119 | or %dest_reg, %lo(C_LABEL(current_set)), %dest_reg; \ | 119 | srl %idreg, 0x1c, %idreg; \ |
120 | ld [%idreg + %dest_reg], %dest_reg; | 120 | sll %idreg, 0x02, %idreg; \ |
121 | 121 | .previous; \ | |
122 | #define LOAD_CURRENT_LEON(dest_reg, idreg) \ | 122 | sethi %hi(current_set), %dest_reg; \ |
123 | rd %asr17, %idreg; \ | 123 | or %dest_reg, %lo(current_set), %dest_reg;\ |
124 | sethi %hi(current_set), %dest_reg; \ | ||
125 | srl %idreg, 0x1c, %idreg; \ | ||
126 | or %dest_reg, %lo(current_set), %dest_reg; \ | ||
127 | sll %idreg, 0x2, %idreg; \ | ||
128 | ld [%idreg + %dest_reg], %dest_reg; | ||
129 | |||
130 | /* Blackbox - take care with this... - check smp4m and smp4d before changing this. */ | ||
131 | #define LOAD_CURRENT(dest_reg, idreg) \ | ||
132 | sethi %hi(___b_load_current), %idreg; \ | ||
133 | sethi %hi(current_set), %dest_reg; \ | ||
134 | sethi %hi(boot_cpu_id4), %idreg; \ | ||
135 | or %dest_reg, %lo(current_set), %dest_reg; \ | ||
136 | ldub [%idreg + %lo(boot_cpu_id4)], %idreg; \ | ||
137 | ld [%idreg + %dest_reg], %dest_reg; | 124 | ld [%idreg + %dest_reg], %dest_reg; |
138 | #else | 125 | #else |
139 | #define LOAD_CURRENT(dest_reg, idreg) \ | 126 | #define LOAD_CURRENT(dest_reg, idreg) \ |
diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S index d7143ba6a8ff..773f3f05bf26 100644 --- a/arch/sparc/kernel/entry.S +++ b/arch/sparc/kernel/entry.S | |||
@@ -7,6 +7,7 @@ | |||
7 | * Copyright (C) 1997 Anton Blanchard (anton@progsoc.uts.edu.au) | 7 | * Copyright (C) 1997 Anton Blanchard (anton@progsoc.uts.edu.au) |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/linkage.h> | ||
10 | #include <linux/errno.h> | 11 | #include <linux/errno.h> |
11 | 12 | ||
12 | #include <asm/head.h> | 13 | #include <asm/head.h> |
@@ -1347,4 +1348,26 @@ flushw_all: | |||
1347 | ret | 1348 | ret |
1348 | restore | 1349 | restore |
1349 | 1350 | ||
1351 | #ifdef CONFIG_SMP | ||
1352 | ENTRY(hard_smp_processor_id) | ||
1353 | 661: rd %tbr, %g1 | ||
1354 | srl %g1, 12, %o0 | ||
1355 | and %o0, 3, %o0 | ||
1356 | .section .cpuid_patch, "ax" | ||
1357 | /* Instruction location. */ | ||
1358 | .word 661b | ||
1359 | /* SUN4D implementation. */ | ||
1360 | lda [%g0] ASI_M_VIKING_TMP1, %o0 | ||
1361 | nop | ||
1362 | nop | ||
1363 | /* LEON implementation. */ | ||
1364 | rd %asr17, %o0 | ||
1365 | srl %o0, 0x1c, %o0 | ||
1366 | nop | ||
1367 | .previous | ||
1368 | retl | ||
1369 | nop | ||
1370 | ENDPROC(hard_smp_processor_id) | ||
1371 | #endif | ||
1372 | |||
1350 | /* End of entry.S */ | 1373 | /* End of entry.S */ |
diff --git a/arch/sparc/kernel/kernel.h b/arch/sparc/kernel/kernel.h index 8278df5d4ce7..1c1a7d39c7e1 100644 --- a/arch/sparc/kernel/kernel.h +++ b/arch/sparc/kernel/kernel.h | |||
@@ -80,8 +80,6 @@ extern unsigned int patchme_maybe_smp_msg[]; | |||
80 | extern void floppy_hardint(void); | 80 | extern void floppy_hardint(void); |
81 | 81 | ||
82 | /* trampoline_32.S */ | 82 | /* trampoline_32.S */ |
83 | extern int __smp4m_processor_id(void); | ||
84 | extern int __smp4d_processor_id(void); | ||
85 | extern unsigned long sun4m_cpu_startup; | 83 | extern unsigned long sun4m_cpu_startup; |
86 | extern unsigned long sun4d_cpu_startup; | 84 | extern unsigned long sun4d_cpu_startup; |
87 | 85 | ||
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c index f3e3630e31a3..faff792d53c8 100644 --- a/arch/sparc/kernel/leon_smp.c +++ b/arch/sparc/kernel/leon_smp.c | |||
@@ -73,7 +73,7 @@ static inline unsigned long do_swap(volatile unsigned long *ptr, | |||
73 | 73 | ||
74 | void __cpuinit leon_callin(void) | 74 | void __cpuinit leon_callin(void) |
75 | { | 75 | { |
76 | int cpuid = hard_smpleon_processor_id(); | 76 | int cpuid = hard_smp_processor_id(); |
77 | 77 | ||
78 | local_ops->cache_all(); | 78 | local_ops->cache_all(); |
79 | local_ops->tlb_all(); | 79 | local_ops->tlb_all(); |
@@ -491,39 +491,12 @@ void leon_cross_call_irq(void) | |||
491 | ccall_info.processors_out[i] = 1; | 491 | ccall_info.processors_out[i] = 1; |
492 | } | 492 | } |
493 | 493 | ||
494 | void __init leon_blackbox_id(unsigned *addr) | ||
495 | { | ||
496 | int rd = *addr & 0x3e000000; | ||
497 | int rs1 = rd >> 11; | ||
498 | |||
499 | /* patch places where ___b_hard_smp_processor_id appears */ | ||
500 | addr[0] = 0x81444000 | rd; /* rd %asr17, reg */ | ||
501 | addr[1] = 0x8130201c | rd | rs1; /* srl reg, 0x1c, reg */ | ||
502 | addr[2] = 0x01000000; /* nop */ | ||
503 | } | ||
504 | |||
505 | void __init leon_blackbox_current(unsigned *addr) | ||
506 | { | ||
507 | int rd = *addr & 0x3e000000; | ||
508 | int rs1 = rd >> 11; | ||
509 | |||
510 | /* patch LOAD_CURRENT macro where ___b_load_current appears */ | ||
511 | addr[0] = 0x81444000 | rd; /* rd %asr17, reg */ | ||
512 | addr[2] = 0x8130201c | rd | rs1; /* srl reg, 0x1c, reg */ | ||
513 | addr[4] = 0x81282002 | rd | rs1; /* sll reg, 0x2, reg */ | ||
514 | |||
515 | } | ||
516 | |||
517 | void __init leon_init_smp(void) | 494 | void __init leon_init_smp(void) |
518 | { | 495 | { |
519 | /* Patch ipi15 trap table */ | 496 | /* Patch ipi15 trap table */ |
520 | t_nmi[1] = t_nmi[1] + (linux_trap_ipi15_leon - linux_trap_ipi15_sun4m); | 497 | t_nmi[1] = t_nmi[1] + (linux_trap_ipi15_leon - linux_trap_ipi15_sun4m); |
521 | 498 | ||
522 | BTFIXUPSET_BLACKBOX(hard_smp_processor_id, leon_blackbox_id); | ||
523 | BTFIXUPSET_BLACKBOX(load_current, leon_blackbox_current); | ||
524 | BTFIXUPSET_CALL(smp_cross_call, leon_cross_call, BTFIXUPCALL_NORM); | 499 | BTFIXUPSET_CALL(smp_cross_call, leon_cross_call, BTFIXUPCALL_NORM); |
525 | BTFIXUPSET_CALL(__hard_smp_processor_id, __leon_processor_id, | ||
526 | BTFIXUPCALL_NORM); | ||
527 | BTFIXUPSET_CALL(smp_ipi_resched, leon_ipi_resched, BTFIXUPCALL_NORM); | 500 | BTFIXUPSET_CALL(smp_ipi_resched, leon_ipi_resched, BTFIXUPCALL_NORM); |
528 | BTFIXUPSET_CALL(smp_ipi_single, leon_ipi_single, BTFIXUPCALL_NORM); | 501 | BTFIXUPSET_CALL(smp_ipi_single, leon_ipi_single, BTFIXUPCALL_NORM); |
529 | BTFIXUPSET_CALL(smp_ipi_mask_one, leon_ipi_mask_one, BTFIXUPCALL_NORM); | 502 | BTFIXUPSET_CALL(smp_ipi_mask_one, leon_ipi_mask_one, BTFIXUPCALL_NORM); |
diff --git a/arch/sparc/kernel/setup_32.c b/arch/sparc/kernel/setup_32.c index 6f294f371d68..2f7cfb5f7569 100644 --- a/arch/sparc/kernel/setup_32.c +++ b/arch/sparc/kernel/setup_32.c | |||
@@ -192,6 +192,52 @@ extern int root_mountflags; | |||
192 | 192 | ||
193 | char reboot_command[COMMAND_LINE_SIZE]; | 193 | char reboot_command[COMMAND_LINE_SIZE]; |
194 | 194 | ||
195 | struct cpuid_patch_entry { | ||
196 | unsigned int addr; | ||
197 | unsigned int sun4d[3]; | ||
198 | unsigned int leon[3]; | ||
199 | }; | ||
200 | extern struct cpuid_patch_entry __cpuid_patch, __cpuid_patch_end; | ||
201 | |||
202 | static void __init per_cpu_patch(void) | ||
203 | { | ||
204 | struct cpuid_patch_entry *p; | ||
205 | |||
206 | if (sparc_cpu_model == sun4m) { | ||
207 | /* Nothing to do, this is what the unpatched code | ||
208 | * targets. | ||
209 | */ | ||
210 | return; | ||
211 | } | ||
212 | |||
213 | p = &__cpuid_patch; | ||
214 | while (p < &__cpuid_patch_end) { | ||
215 | unsigned long addr = p->addr; | ||
216 | unsigned int *insns; | ||
217 | |||
218 | switch (sparc_cpu_model) { | ||
219 | case sun4d: | ||
220 | insns = &p->sun4d[0]; | ||
221 | break; | ||
222 | |||
223 | case sparc_leon: | ||
224 | insns = &p->leon[0]; | ||
225 | break; | ||
226 | default: | ||
227 | prom_printf("Unknown cpu type, halting.\n"); | ||
228 | prom_halt(); | ||
229 | } | ||
230 | *(unsigned int *) (addr + 0) = insns[0]; | ||
231 | *(unsigned int *) (addr + 4) = insns[1]; | ||
232 | *(unsigned int *) (addr + 8) = insns[2]; | ||
233 | } | ||
234 | #ifdef CONFIG_SMP | ||
235 | local_ops->cache_all(); | ||
236 | #else | ||
237 | sparc32_cachetlb_ops->cache_all(); | ||
238 | #endif | ||
239 | } | ||
240 | |||
195 | enum sparc_cpu sparc_cpu_model; | 241 | enum sparc_cpu sparc_cpu_model; |
196 | EXPORT_SYMBOL(sparc_cpu_model); | 242 | EXPORT_SYMBOL(sparc_cpu_model); |
197 | 243 | ||
@@ -295,6 +341,11 @@ void __init setup_arch(char **cmdline_p) | |||
295 | 341 | ||
296 | paging_init(); | 342 | paging_init(); |
297 | 343 | ||
344 | /* Now that we have the cache ops hooked up, we can patch | ||
345 | * instructions. | ||
346 | */ | ||
347 | per_cpu_patch(); | ||
348 | |||
298 | smp_setup_cpu_possible_map(); | 349 | smp_setup_cpu_possible_map(); |
299 | } | 350 | } |
300 | 351 | ||
diff --git a/arch/sparc/kernel/sparc_ksyms_32.c b/arch/sparc/kernel/sparc_ksyms_32.c index 4ad7377e2d0f..e521c54560f9 100644 --- a/arch/sparc/kernel/sparc_ksyms_32.c +++ b/arch/sparc/kernel/sparc_ksyms_32.c | |||
@@ -28,10 +28,5 @@ EXPORT_SYMBOL(__ndelay); | |||
28 | EXPORT_SYMBOL(__ret_efault); | 28 | EXPORT_SYMBOL(__ret_efault); |
29 | EXPORT_SYMBOL(empty_zero_page); | 29 | EXPORT_SYMBOL(empty_zero_page); |
30 | 30 | ||
31 | /* Defined using magic */ | ||
32 | #ifdef CONFIG_SMP | ||
33 | EXPORT_SYMBOL(BTFIXUP_CALL(__hard_smp_processor_id)); | ||
34 | #endif | ||
35 | |||
36 | /* Exporting a symbol from /init/main.c */ | 31 | /* Exporting a symbol from /init/main.c */ |
37 | EXPORT_SYMBOL(saved_command_line); | 32 | EXPORT_SYMBOL(saved_command_line); |
diff --git a/arch/sparc/kernel/sun4d_smp.c b/arch/sparc/kernel/sun4d_smp.c index f17fd287bf7d..38ca0aac2ef2 100644 --- a/arch/sparc/kernel/sun4d_smp.c +++ b/arch/sparc/kernel/sun4d_smp.c | |||
@@ -52,7 +52,7 @@ static inline void show_leds(int cpuid) | |||
52 | 52 | ||
53 | void __cpuinit smp4d_callin(void) | 53 | void __cpuinit smp4d_callin(void) |
54 | { | 54 | { |
55 | int cpuid = hard_smp4d_processor_id(); | 55 | int cpuid = hard_smp_processor_id(); |
56 | unsigned long flags; | 56 | unsigned long flags; |
57 | 57 | ||
58 | /* Show we are alive */ | 58 | /* Show we are alive */ |
@@ -354,7 +354,7 @@ static void smp4d_cross_call(smpfunc_t func, cpumask_t mask, unsigned long arg1, | |||
354 | /* Running cross calls. */ | 354 | /* Running cross calls. */ |
355 | void smp4d_cross_call_irq(void) | 355 | void smp4d_cross_call_irq(void) |
356 | { | 356 | { |
357 | int i = hard_smp4d_processor_id(); | 357 | int i = hard_smp_processor_id(); |
358 | 358 | ||
359 | ccall_info.processors_in[i] = 1; | 359 | ccall_info.processors_in[i] = 1; |
360 | ccall_info.func(ccall_info.arg1, ccall_info.arg2, ccall_info.arg3, | 360 | ccall_info.func(ccall_info.arg1, ccall_info.arg2, ccall_info.arg3, |
@@ -365,7 +365,7 @@ void smp4d_cross_call_irq(void) | |||
365 | void smp4d_percpu_timer_interrupt(struct pt_regs *regs) | 365 | void smp4d_percpu_timer_interrupt(struct pt_regs *regs) |
366 | { | 366 | { |
367 | struct pt_regs *old_regs; | 367 | struct pt_regs *old_regs; |
368 | int cpu = hard_smp4d_processor_id(); | 368 | int cpu = hard_smp_processor_id(); |
369 | struct clock_event_device *ce; | 369 | struct clock_event_device *ce; |
370 | static int cpu_tick[NR_CPUS]; | 370 | static int cpu_tick[NR_CPUS]; |
371 | static char led_mask[] = { 0xe, 0xd, 0xb, 0x7, 0xb, 0xd }; | 371 | static char led_mask[] = { 0xe, 0xd, 0xb, 0x7, 0xb, 0xd }; |
@@ -391,24 +391,6 @@ void smp4d_percpu_timer_interrupt(struct pt_regs *regs) | |||
391 | set_irq_regs(old_regs); | 391 | set_irq_regs(old_regs); |
392 | } | 392 | } |
393 | 393 | ||
394 | void __init smp4d_blackbox_id(unsigned *addr) | ||
395 | { | ||
396 | int rd = *addr & 0x3e000000; | ||
397 | |||
398 | addr[0] = 0xc0800800 | rd; /* lda [%g0] ASI_M_VIKING_TMP1, reg */ | ||
399 | addr[1] = 0x01000000; /* nop */ | ||
400 | addr[2] = 0x01000000; /* nop */ | ||
401 | } | ||
402 | |||
403 | void __init smp4d_blackbox_current(unsigned *addr) | ||
404 | { | ||
405 | int rd = *addr & 0x3e000000; | ||
406 | |||
407 | addr[0] = 0xc0800800 | rd; /* lda [%g0] ASI_M_VIKING_TMP1, reg */ | ||
408 | addr[2] = 0x81282002 | rd | (rd >> 11); /* sll reg, 2, reg */ | ||
409 | addr[4] = 0x01000000; /* nop */ | ||
410 | } | ||
411 | |||
412 | void __init sun4d_init_smp(void) | 394 | void __init sun4d_init_smp(void) |
413 | { | 395 | { |
414 | int i; | 396 | int i; |
@@ -417,10 +399,7 @@ void __init sun4d_init_smp(void) | |||
417 | t_nmi[1] = t_nmi[1] + (linux_trap_ipi15_sun4d - linux_trap_ipi15_sun4m); | 399 | t_nmi[1] = t_nmi[1] + (linux_trap_ipi15_sun4d - linux_trap_ipi15_sun4m); |
418 | 400 | ||
419 | /* And set btfixup... */ | 401 | /* And set btfixup... */ |
420 | BTFIXUPSET_BLACKBOX(hard_smp_processor_id, smp4d_blackbox_id); | ||
421 | BTFIXUPSET_BLACKBOX(load_current, smp4d_blackbox_current); | ||
422 | BTFIXUPSET_CALL(smp_cross_call, smp4d_cross_call, BTFIXUPCALL_NORM); | 402 | BTFIXUPSET_CALL(smp_cross_call, smp4d_cross_call, BTFIXUPCALL_NORM); |
423 | BTFIXUPSET_CALL(__hard_smp_processor_id, __smp4d_processor_id, BTFIXUPCALL_NORM); | ||
424 | BTFIXUPSET_CALL(smp_ipi_resched, smp4d_ipi_resched, BTFIXUPCALL_NORM); | 403 | BTFIXUPSET_CALL(smp_ipi_resched, smp4d_ipi_resched, BTFIXUPCALL_NORM); |
425 | BTFIXUPSET_CALL(smp_ipi_single, smp4d_ipi_single, BTFIXUPCALL_NORM); | 404 | BTFIXUPSET_CALL(smp_ipi_single, smp4d_ipi_single, BTFIXUPCALL_NORM); |
426 | BTFIXUPSET_CALL(smp_ipi_mask_one, smp4d_ipi_mask_one, BTFIXUPCALL_NORM); | 405 | BTFIXUPSET_CALL(smp_ipi_mask_one, smp4d_ipi_mask_one, BTFIXUPCALL_NORM); |
diff --git a/arch/sparc/kernel/sun4m_smp.c b/arch/sparc/kernel/sun4m_smp.c index afcf6743f0eb..ff74d33e2709 100644 --- a/arch/sparc/kernel/sun4m_smp.c +++ b/arch/sparc/kernel/sun4m_smp.c | |||
@@ -281,32 +281,9 @@ void smp4m_percpu_timer_interrupt(struct pt_regs *regs) | |||
281 | set_irq_regs(old_regs); | 281 | set_irq_regs(old_regs); |
282 | } | 282 | } |
283 | 283 | ||
284 | static void __init smp4m_blackbox_id(unsigned *addr) | ||
285 | { | ||
286 | int rd = *addr & 0x3e000000; | ||
287 | int rs1 = rd >> 11; | ||
288 | |||
289 | addr[0] = 0x81580000 | rd; /* rd %tbr, reg */ | ||
290 | addr[1] = 0x8130200c | rd | rs1; /* srl reg, 0xc, reg */ | ||
291 | addr[2] = 0x80082003 | rd | rs1; /* and reg, 3, reg */ | ||
292 | } | ||
293 | |||
294 | static void __init smp4m_blackbox_current(unsigned *addr) | ||
295 | { | ||
296 | int rd = *addr & 0x3e000000; | ||
297 | int rs1 = rd >> 11; | ||
298 | |||
299 | addr[0] = 0x81580000 | rd; /* rd %tbr, reg */ | ||
300 | addr[2] = 0x8130200a | rd | rs1; /* srl reg, 0xa, reg */ | ||
301 | addr[4] = 0x8008200c | rd | rs1; /* and reg, 0xc, reg */ | ||
302 | } | ||
303 | |||
304 | void __init sun4m_init_smp(void) | 284 | void __init sun4m_init_smp(void) |
305 | { | 285 | { |
306 | BTFIXUPSET_BLACKBOX(hard_smp_processor_id, smp4m_blackbox_id); | ||
307 | BTFIXUPSET_BLACKBOX(load_current, smp4m_blackbox_current); | ||
308 | BTFIXUPSET_CALL(smp_cross_call, smp4m_cross_call, BTFIXUPCALL_NORM); | 286 | BTFIXUPSET_CALL(smp_cross_call, smp4m_cross_call, BTFIXUPCALL_NORM); |
309 | BTFIXUPSET_CALL(__hard_smp_processor_id, __smp4m_processor_id, BTFIXUPCALL_NORM); | ||
310 | BTFIXUPSET_CALL(smp_ipi_resched, smp4m_ipi_resched, BTFIXUPCALL_NORM); | 287 | BTFIXUPSET_CALL(smp_ipi_resched, smp4m_ipi_resched, BTFIXUPCALL_NORM); |
311 | BTFIXUPSET_CALL(smp_ipi_single, smp4m_ipi_single, BTFIXUPCALL_NORM); | 288 | BTFIXUPSET_CALL(smp_ipi_single, smp4m_ipi_single, BTFIXUPCALL_NORM); |
312 | BTFIXUPSET_CALL(smp_ipi_mask_one, smp4m_ipi_mask_one, BTFIXUPCALL_NORM); | 289 | BTFIXUPSET_CALL(smp_ipi_mask_one, smp4m_ipi_mask_one, BTFIXUPCALL_NORM); |
diff --git a/arch/sparc/kernel/trampoline_32.S b/arch/sparc/kernel/trampoline_32.S index 691f484e03b3..7364ddc9e5aa 100644 --- a/arch/sparc/kernel/trampoline_32.S +++ b/arch/sparc/kernel/trampoline_32.S | |||
@@ -15,8 +15,8 @@ | |||
15 | #include <asm/contregs.h> | 15 | #include <asm/contregs.h> |
16 | #include <asm/thread_info.h> | 16 | #include <asm/thread_info.h> |
17 | 17 | ||
18 | .globl sun4m_cpu_startup, __smp4m_processor_id, __leon_processor_id | 18 | .globl sun4m_cpu_startup |
19 | .globl sun4d_cpu_startup, __smp4d_processor_id | 19 | .globl sun4d_cpu_startup |
20 | 20 | ||
21 | __CPUINIT | 21 | __CPUINIT |
22 | .align 4 | 22 | .align 4 |
@@ -94,24 +94,6 @@ smp_do_cpu_idle: | |||
94 | call cpu_panic | 94 | call cpu_panic |
95 | nop | 95 | nop |
96 | 96 | ||
97 | __smp4m_processor_id: | ||
98 | rd %tbr, %g2 | ||
99 | srl %g2, 12, %g2 | ||
100 | and %g2, 3, %g2 | ||
101 | retl | ||
102 | mov %g1, %o7 | ||
103 | |||
104 | __smp4d_processor_id: | ||
105 | lda [%g0] ASI_M_VIKING_TMP1, %g2 | ||
106 | retl | ||
107 | mov %g1, %o7 | ||
108 | |||
109 | __leon_processor_id: | ||
110 | rd %asr17,%g2 | ||
111 | srl %g2,28,%g2 | ||
112 | retl | ||
113 | mov %g1, %o7 | ||
114 | |||
115 | /* CPUID in bootbus can be found at PA 0xff0140000 */ | 97 | /* CPUID in bootbus can be found at PA 0xff0140000 */ |
116 | #define SUN4D_BOOTBUS_CPUID 0xf0140000 | 98 | #define SUN4D_BOOTBUS_CPUID 0xf0140000 |
117 | 99 | ||