aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/include/asm/winmacro.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-05-14 02:09:04 -0400
committerDavid S. Miller <davem@davemloft.net>2012-05-14 16:31:38 -0400
commitc68e5d39a502d01421cbc70d25c377e9215facef (patch)
tree9135a68681381d94a929b57a28a1878df0134ff7 /arch/sparc/include/asm/winmacro.h
parent5d83d66635bb1642f3c6a3690c28ff4afdf1ae5f (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/include/asm/winmacro.h')
-rw-r--r--arch/sparc/include/asm/winmacro.h49
1 files changed, 18 insertions, 31 deletions
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) \ 107661: 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) \