diff options
author | Sam Ravnborg <sam@ravnborg.org> | 2012-05-14 11:58:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-14 17:05:09 -0400 |
commit | 50544bce4c46561fe9d3f817941bd95d8ae6fedd (patch) | |
tree | 1cfd92a777b634c5430ead3478d709093915181f | |
parent | 08c9388f5816ac9285dce7d07c8867ae1c1e4bcb (diff) |
sparc32: remove runtime btfix support
- remove all uses of btfixup header
- remove the btfixup header
- remove the btfixup code
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | arch/sparc/include/asm/asmmacro.h | 1 | ||||
-rw-r--r-- | arch/sparc/include/asm/btfixup.h | 207 | ||||
-rw-r--r-- | arch/sparc/include/asm/cmpxchg_32.h | 2 | ||||
-rw-r--r-- | arch/sparc/include/asm/mmu_context_32.h | 2 | ||||
-rw-r--r-- | arch/sparc/include/asm/page_32.h | 2 | ||||
-rw-r--r-- | arch/sparc/include/asm/pgalloc_32.h | 1 | ||||
-rw-r--r-- | arch/sparc/include/asm/pgtable_32.h | 1 | ||||
-rw-r--r-- | arch/sparc/include/asm/processor_32.h | 1 | ||||
-rw-r--r-- | arch/sparc/include/asm/smp_32.h | 1 | ||||
-rw-r--r-- | arch/sparc/include/asm/thread_info_32.h | 1 | ||||
-rw-r--r-- | arch/sparc/include/asm/timer_32.h | 1 | ||||
-rw-r--r-- | arch/sparc/kernel/irq.h | 1 | ||||
-rw-r--r-- | arch/sparc/kernel/irq_32.c | 1 | ||||
-rw-r--r-- | arch/sparc/kernel/time_32.c | 2 | ||||
-rw-r--r-- | arch/sparc/mm/Makefile | 2 | ||||
-rw-r--r-- | arch/sparc/mm/btfixup.c | 316 | ||||
-rw-r--r-- | arch/sparc/mm/init_32.c | 1 | ||||
-rw-r--r-- | arch/sparc/mm/iommu.c | 1 | ||||
-rw-r--r-- | arch/sparc/mm/srmmu.c | 3 | ||||
-rw-r--r-- | arch/sparc/mm/viking.S | 1 |
20 files changed, 1 insertions, 547 deletions
diff --git a/arch/sparc/include/asm/asmmacro.h b/arch/sparc/include/asm/asmmacro.h index 90db649f26dc..1d511615c7cd 100644 --- a/arch/sparc/include/asm/asmmacro.h +++ b/arch/sparc/include/asm/asmmacro.h | |||
@@ -6,7 +6,6 @@ | |||
6 | #ifndef _SPARC_ASMMACRO_H | 6 | #ifndef _SPARC_ASMMACRO_H |
7 | #define _SPARC_ASMMACRO_H | 7 | #define _SPARC_ASMMACRO_H |
8 | 8 | ||
9 | #include <asm/btfixup.h> | ||
10 | #include <asm/asi.h> | 9 | #include <asm/asi.h> |
11 | 10 | ||
12 | #define GET_PROCESSOR4M_ID(reg) \ | 11 | #define GET_PROCESSOR4M_ID(reg) \ |
diff --git a/arch/sparc/include/asm/btfixup.h b/arch/sparc/include/asm/btfixup.h deleted file mode 100644 index 48b01414b19e..000000000000 --- a/arch/sparc/include/asm/btfixup.h +++ /dev/null | |||
@@ -1,207 +0,0 @@ | |||
1 | /* | ||
2 | * asm/btfixup.h: Macros for boot time linking. | ||
3 | * | ||
4 | * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) | ||
5 | */ | ||
6 | |||
7 | #ifndef _SPARC_BTFIXUP_H | ||
8 | #define _SPARC_BTFIXUP_H | ||
9 | |||
10 | #include <linux/init.h> | ||
11 | |||
12 | #ifndef __ASSEMBLY__ | ||
13 | |||
14 | #ifdef MODULE | ||
15 | extern unsigned int ___illegal_use_of_BTFIXUP_SIMM13_in_module(void); | ||
16 | extern unsigned int ___illegal_use_of_BTFIXUP_SETHI_in_module(void); | ||
17 | extern unsigned int ___illegal_use_of_BTFIXUP_HALF_in_module(void); | ||
18 | extern unsigned int ___illegal_use_of_BTFIXUP_INT_in_module(void); | ||
19 | |||
20 | #define BTFIXUP_SIMM13(__name) ___illegal_use_of_BTFIXUP_SIMM13_in_module() | ||
21 | #define BTFIXUP_HALF(__name) ___illegal_use_of_BTFIXUP_HALF_in_module() | ||
22 | #define BTFIXUP_SETHI(__name) ___illegal_use_of_BTFIXUP_SETHI_in_module() | ||
23 | #define BTFIXUP_INT(__name) ___illegal_use_of_BTFIXUP_INT_in_module() | ||
24 | #define BTFIXUP_BLACKBOX(__name) ___illegal_use_of_BTFIXUP_BLACKBOX_in_module | ||
25 | |||
26 | #else | ||
27 | |||
28 | #define BTFIXUP_SIMM13(__name) ___sf_##__name() | ||
29 | #define BTFIXUP_HALF(__name) ___af_##__name() | ||
30 | #define BTFIXUP_SETHI(__name) ___hf_##__name() | ||
31 | #define BTFIXUP_INT(__name) ((unsigned int)&___i_##__name) | ||
32 | /* This must be written in assembly and present in a sethi */ | ||
33 | #define BTFIXUP_BLACKBOX(__name) ___b_##__name | ||
34 | #endif /* MODULE */ | ||
35 | |||
36 | /* Fixup call xx */ | ||
37 | |||
38 | #define BTFIXUPDEF_CALL(__type, __name, __args...) \ | ||
39 | extern __type ___f_##__name(__args); \ | ||
40 | extern unsigned ___fs_##__name[3]; | ||
41 | #define BTFIXUPDEF_CALL_CONST(__type, __name, __args...) \ | ||
42 | extern __type ___f_##__name(__args) __attribute_const__; \ | ||
43 | extern unsigned ___fs_##__name[3]; | ||
44 | #define BTFIXUP_CALL(__name) ___f_##__name | ||
45 | |||
46 | #define BTFIXUPDEF_BLACKBOX(__name) \ | ||
47 | extern unsigned ___bs_##__name[2]; | ||
48 | |||
49 | /* Put bottom 13bits into some register variable */ | ||
50 | |||
51 | #define BTFIXUPDEF_SIMM13(__name) \ | ||
52 | static inline unsigned int ___sf_##__name(void) __attribute_const__; \ | ||
53 | extern unsigned ___ss_##__name[2]; \ | ||
54 | static inline unsigned int ___sf_##__name(void) { \ | ||
55 | unsigned int ret; \ | ||
56 | __asm__ ("or %%g0, ___s_" #__name ", %0" : "=r"(ret)); \ | ||
57 | return ret; \ | ||
58 | } | ||
59 | #define BTFIXUPDEF_SIMM13_INIT(__name,__val) \ | ||
60 | static inline unsigned int ___sf_##__name(void) __attribute_const__; \ | ||
61 | extern unsigned ___ss_##__name[2]; \ | ||
62 | static inline unsigned int ___sf_##__name(void) { \ | ||
63 | unsigned int ret; \ | ||
64 | __asm__ ("or %%g0, ___s_" #__name "__btset_" #__val ", %0" : "=r"(ret));\ | ||
65 | return ret; \ | ||
66 | } | ||
67 | |||
68 | /* Put either bottom 13 bits, or upper 22 bits into some register variable | ||
69 | * (depending on the value, this will lead into sethi FIX, reg; or | ||
70 | * mov FIX, reg; ) | ||
71 | */ | ||
72 | |||
73 | #define BTFIXUPDEF_HALF(__name) \ | ||
74 | static inline unsigned int ___af_##__name(void) __attribute_const__; \ | ||
75 | extern unsigned ___as_##__name[2]; \ | ||
76 | static inline unsigned int ___af_##__name(void) { \ | ||
77 | unsigned int ret; \ | ||
78 | __asm__ ("or %%g0, ___a_" #__name ", %0" : "=r"(ret)); \ | ||
79 | return ret; \ | ||
80 | } | ||
81 | #define BTFIXUPDEF_HALF_INIT(__name,__val) \ | ||
82 | static inline unsigned int ___af_##__name(void) __attribute_const__; \ | ||
83 | extern unsigned ___as_##__name[2]; \ | ||
84 | static inline unsigned int ___af_##__name(void) { \ | ||
85 | unsigned int ret; \ | ||
86 | __asm__ ("or %%g0, ___a_" #__name "__btset_" #__val ", %0" : "=r"(ret));\ | ||
87 | return ret; \ | ||
88 | } | ||
89 | |||
90 | /* Put upper 22 bits into some register variable */ | ||
91 | |||
92 | #define BTFIXUPDEF_SETHI(__name) \ | ||
93 | static inline unsigned int ___hf_##__name(void) __attribute_const__; \ | ||
94 | extern unsigned ___hs_##__name[2]; \ | ||
95 | static inline unsigned int ___hf_##__name(void) { \ | ||
96 | unsigned int ret; \ | ||
97 | __asm__ ("sethi %%hi(___h_" #__name "), %0" : "=r"(ret)); \ | ||
98 | return ret; \ | ||
99 | } | ||
100 | #define BTFIXUPDEF_SETHI_INIT(__name,__val) \ | ||
101 | static inline unsigned int ___hf_##__name(void) __attribute_const__; \ | ||
102 | extern unsigned ___hs_##__name[2]; \ | ||
103 | static inline unsigned int ___hf_##__name(void) { \ | ||
104 | unsigned int ret; \ | ||
105 | __asm__ ("sethi %%hi(___h_" #__name "__btset_" #__val "), %0" : \ | ||
106 | "=r"(ret)); \ | ||
107 | return ret; \ | ||
108 | } | ||
109 | |||
110 | /* Put a full 32bit integer into some register variable */ | ||
111 | |||
112 | #define BTFIXUPDEF_INT(__name) \ | ||
113 | extern unsigned char ___i_##__name; \ | ||
114 | extern unsigned ___is_##__name[2]; | ||
115 | |||
116 | #define BTFIXUPCALL_NORM 0x00000000 /* Always call */ | ||
117 | #define BTFIXUPCALL_NOP 0x01000000 /* Possibly optimize to nop */ | ||
118 | #define BTFIXUPCALL_RETINT(i) (0x90102000|((i) & 0x1fff)) /* Possibly optimize to mov i, %o0 */ | ||
119 | #define BTFIXUPCALL_ORINT(i) (0x90122000|((i) & 0x1fff)) /* Possibly optimize to or %o0, i, %o0 */ | ||
120 | #define BTFIXUPCALL_RETO0 0x01000000 /* Return first parameter, actually a nop */ | ||
121 | #define BTFIXUPCALL_ANDNINT(i) (0x902a2000|((i) & 0x1fff)) /* Possibly optimize to andn %o0, i, %o0 */ | ||
122 | #define BTFIXUPCALL_SWAPO0O1 0xd27a0000 /* Possibly optimize to swap [%o0],%o1 */ | ||
123 | #define BTFIXUPCALL_SWAPG1G2 0xc4784000 /* Possibly optimize to swap [%g1],%g2 */ | ||
124 | #define BTFIXUPCALL_STG0O0 0xc0220000 /* Possibly optimize to st %g0,[%o0] */ | ||
125 | #define BTFIXUPCALL_STO1O0 0xd2220000 /* Possibly optimize to st %o1,[%o0] */ | ||
126 | |||
127 | #define BTFIXUPSET_CALL(__name, __addr, __insn) \ | ||
128 | do { \ | ||
129 | ___fs_##__name[0] |= 1; \ | ||
130 | ___fs_##__name[1] = (unsigned long)__addr; \ | ||
131 | ___fs_##__name[2] = __insn; \ | ||
132 | } while (0) | ||
133 | |||
134 | #define BTFIXUPSET_BLACKBOX(__name, __func) \ | ||
135 | do { \ | ||
136 | ___bs_##__name[0] |= 1; \ | ||
137 | ___bs_##__name[1] = (unsigned long)__func; \ | ||
138 | } while (0) | ||
139 | |||
140 | #define BTFIXUPCOPY_CALL(__name, __from) \ | ||
141 | do { \ | ||
142 | ___fs_##__name[0] |= 1; \ | ||
143 | ___fs_##__name[1] = ___fs_##__from[1]; \ | ||
144 | ___fs_##__name[2] = ___fs_##__from[2]; \ | ||
145 | } while (0) | ||
146 | |||
147 | #define BTFIXUPSET_SIMM13(__name, __val) \ | ||
148 | do { \ | ||
149 | ___ss_##__name[0] |= 1; \ | ||
150 | ___ss_##__name[1] = (unsigned)__val; \ | ||
151 | } while (0) | ||
152 | |||
153 | #define BTFIXUPCOPY_SIMM13(__name, __from) \ | ||
154 | do { \ | ||
155 | ___ss_##__name[0] |= 1; \ | ||
156 | ___ss_##__name[1] = ___ss_##__from[1]; \ | ||
157 | } while (0) | ||
158 | |||
159 | #define BTFIXUPSET_HALF(__name, __val) \ | ||
160 | do { \ | ||
161 | ___as_##__name[0] |= 1; \ | ||
162 | ___as_##__name[1] = (unsigned)__val; \ | ||
163 | } while (0) | ||
164 | |||
165 | #define BTFIXUPCOPY_HALF(__name, __from) \ | ||
166 | do { \ | ||
167 | ___as_##__name[0] |= 1; \ | ||
168 | ___as_##__name[1] = ___as_##__from[1]; \ | ||
169 | } while (0) | ||
170 | |||
171 | #define BTFIXUPSET_SETHI(__name, __val) \ | ||
172 | do { \ | ||
173 | ___hs_##__name[0] |= 1; \ | ||
174 | ___hs_##__name[1] = (unsigned)__val; \ | ||
175 | } while (0) | ||
176 | |||
177 | #define BTFIXUPCOPY_SETHI(__name, __from) \ | ||
178 | do { \ | ||
179 | ___hs_##__name[0] |= 1; \ | ||
180 | ___hs_##__name[1] = ___hs_##__from[1]; \ | ||
181 | } while (0) | ||
182 | |||
183 | #define BTFIXUPSET_INT(__name, __val) \ | ||
184 | do { \ | ||
185 | ___is_##__name[0] |= 1; \ | ||
186 | ___is_##__name[1] = (unsigned)__val; \ | ||
187 | } while (0) | ||
188 | |||
189 | #define BTFIXUPCOPY_INT(__name, __from) \ | ||
190 | do { \ | ||
191 | ___is_##__name[0] |= 1; \ | ||
192 | ___is_##__name[1] = ___is_##__from[1]; \ | ||
193 | } while (0) | ||
194 | |||
195 | #define BTFIXUPVAL_CALL(__name) \ | ||
196 | ((unsigned long)___fs_##__name[1]) | ||
197 | |||
198 | extern void btfixup(void); | ||
199 | |||
200 | #else /* __ASSEMBLY__ */ | ||
201 | |||
202 | #define BTFIXUP_SETHI(__name) %hi(___h_ ## __name) | ||
203 | #define BTFIXUP_SETHI_INIT(__name,__val) %hi(___h_ ## __name ## __btset_ ## __val) | ||
204 | |||
205 | #endif /* __ASSEMBLY__ */ | ||
206 | |||
207 | #endif /* !(_SPARC_BTFIXUP_H) */ | ||
diff --git a/arch/sparc/include/asm/cmpxchg_32.h b/arch/sparc/include/asm/cmpxchg_32.h index 78ac549f7355..1fae1a02e3c2 100644 --- a/arch/sparc/include/asm/cmpxchg_32.h +++ b/arch/sparc/include/asm/cmpxchg_32.h | |||
@@ -11,8 +11,6 @@ | |||
11 | #ifndef __ARCH_SPARC_CMPXCHG__ | 11 | #ifndef __ARCH_SPARC_CMPXCHG__ |
12 | #define __ARCH_SPARC_CMPXCHG__ | 12 | #define __ARCH_SPARC_CMPXCHG__ |
13 | 13 | ||
14 | #include <asm/btfixup.h> | ||
15 | |||
16 | static inline unsigned long xchg_u32(__volatile__ unsigned long *m, unsigned long val) | 14 | static inline unsigned long xchg_u32(__volatile__ unsigned long *m, unsigned long val) |
17 | { | 15 | { |
18 | __asm__ __volatile__("swap [%2], %0" | 16 | __asm__ __volatile__("swap [%2], %0" |
diff --git a/arch/sparc/include/asm/mmu_context_32.h b/arch/sparc/include/asm/mmu_context_32.h index 623b598bbdbf..01456c900720 100644 --- a/arch/sparc/include/asm/mmu_context_32.h +++ b/arch/sparc/include/asm/mmu_context_32.h | |||
@@ -1,8 +1,6 @@ | |||
1 | #ifndef __SPARC_MMU_CONTEXT_H | 1 | #ifndef __SPARC_MMU_CONTEXT_H |
2 | #define __SPARC_MMU_CONTEXT_H | 2 | #define __SPARC_MMU_CONTEXT_H |
3 | 3 | ||
4 | #include <asm/btfixup.h> | ||
5 | |||
6 | #ifndef __ASSEMBLY__ | 4 | #ifndef __ASSEMBLY__ |
7 | 5 | ||
8 | #include <asm-generic/mm_hooks.h> | 6 | #include <asm-generic/mm_hooks.h> |
diff --git a/arch/sparc/include/asm/page_32.h b/arch/sparc/include/asm/page_32.h index 0c902ae219c7..fab78a308ebf 100644 --- a/arch/sparc/include/asm/page_32.h +++ b/arch/sparc/include/asm/page_32.h | |||
@@ -14,8 +14,6 @@ | |||
14 | #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) | 14 | #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) |
15 | #define PAGE_MASK (~(PAGE_SIZE-1)) | 15 | #define PAGE_MASK (~(PAGE_SIZE-1)) |
16 | 16 | ||
17 | #include <asm/btfixup.h> | ||
18 | |||
19 | #ifndef __ASSEMBLY__ | 17 | #ifndef __ASSEMBLY__ |
20 | 18 | ||
21 | #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) | 19 | #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) |
diff --git a/arch/sparc/include/asm/pgalloc_32.h b/arch/sparc/include/asm/pgalloc_32.h index 47bf660ca2e3..e5b169b46d21 100644 --- a/arch/sparc/include/asm/pgalloc_32.h +++ b/arch/sparc/include/asm/pgalloc_32.h | |||
@@ -5,7 +5,6 @@ | |||
5 | #include <linux/sched.h> | 5 | #include <linux/sched.h> |
6 | 6 | ||
7 | #include <asm/pgtsrmmu.h> | 7 | #include <asm/pgtsrmmu.h> |
8 | #include <asm/btfixup.h> | ||
9 | #include <asm/pgtable.h> | 8 | #include <asm/pgtable.h> |
10 | #include <asm/vaddrs.h> | 9 | #include <asm/vaddrs.h> |
11 | #include <asm/page.h> | 10 | #include <asm/page.h> |
diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h index b7c202f7d13a..28a67bfa71c1 100644 --- a/arch/sparc/include/asm/pgtable_32.h +++ b/arch/sparc/include/asm/pgtable_32.h | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <asm/pgtsrmmu.h> | 19 | #include <asm/pgtsrmmu.h> |
20 | #include <asm/vaddrs.h> | 20 | #include <asm/vaddrs.h> |
21 | #include <asm/oplib.h> | 21 | #include <asm/oplib.h> |
22 | #include <asm/btfixup.h> | ||
23 | #include <asm/cpu_type.h> | 22 | #include <asm/cpu_type.h> |
24 | 23 | ||
25 | 24 | ||
diff --git a/arch/sparc/include/asm/processor_32.h b/arch/sparc/include/asm/processor_32.h index 09521c6a5edb..9cbd854fdfdd 100644 --- a/arch/sparc/include/asm/processor_32.h +++ b/arch/sparc/include/asm/processor_32.h | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <asm/ptrace.h> | 16 | #include <asm/ptrace.h> |
17 | #include <asm/head.h> | 17 | #include <asm/head.h> |
18 | #include <asm/signal.h> | 18 | #include <asm/signal.h> |
19 | #include <asm/btfixup.h> | ||
20 | #include <asm/page.h> | 19 | #include <asm/page.h> |
21 | 20 | ||
22 | /* | 21 | /* |
diff --git a/arch/sparc/include/asm/smp_32.h b/arch/sparc/include/asm/smp_32.h index d596061939d1..b9cf69704022 100644 --- a/arch/sparc/include/asm/smp_32.h +++ b/arch/sparc/include/asm/smp_32.h | |||
@@ -8,7 +8,6 @@ | |||
8 | 8 | ||
9 | #include <linux/threads.h> | 9 | #include <linux/threads.h> |
10 | #include <asm/head.h> | 10 | #include <asm/head.h> |
11 | #include <asm/btfixup.h> | ||
12 | 11 | ||
13 | #ifndef __ASSEMBLY__ | 12 | #ifndef __ASSEMBLY__ |
14 | 13 | ||
diff --git a/arch/sparc/include/asm/thread_info_32.h b/arch/sparc/include/asm/thread_info_32.h index 74316de84d87..cd0b2dc8fab9 100644 --- a/arch/sparc/include/asm/thread_info_32.h +++ b/arch/sparc/include/asm/thread_info_32.h | |||
@@ -15,7 +15,6 @@ | |||
15 | 15 | ||
16 | #ifndef __ASSEMBLY__ | 16 | #ifndef __ASSEMBLY__ |
17 | 17 | ||
18 | #include <asm/btfixup.h> | ||
19 | #include <asm/ptrace.h> | 18 | #include <asm/ptrace.h> |
20 | #include <asm/page.h> | 19 | #include <asm/page.h> |
21 | 20 | ||
diff --git a/arch/sparc/include/asm/timer_32.h b/arch/sparc/include/asm/timer_32.h index 703653ea4294..72f40a546de3 100644 --- a/arch/sparc/include/asm/timer_32.h +++ b/arch/sparc/include/asm/timer_32.h | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <asm-generic/percpu.h> | 14 | #include <asm-generic/percpu.h> |
15 | 15 | ||
16 | #include <asm/cpu_type.h> /* For SUN4M_NCPUS */ | 16 | #include <asm/cpu_type.h> /* For SUN4M_NCPUS */ |
17 | #include <asm/btfixup.h> | ||
18 | 17 | ||
19 | #define SBUS_CLOCK_RATE 2000000 /* 2MHz */ | 18 | #define SBUS_CLOCK_RATE 2000000 /* 2MHz */ |
20 | #define TIMER_VALUE_SHIFT 9 | 19 | #define TIMER_VALUE_SHIFT 9 |
diff --git a/arch/sparc/kernel/irq.h b/arch/sparc/kernel/irq.h index f558f710ee51..b66b6aad1d6d 100644 --- a/arch/sparc/kernel/irq.h +++ b/arch/sparc/kernel/irq.h | |||
@@ -1,6 +1,5 @@ | |||
1 | #include <linux/platform_device.h> | 1 | #include <linux/platform_device.h> |
2 | 2 | ||
3 | #include <asm/btfixup.h> | ||
4 | #include <asm/cpu_type.h> | 3 | #include <asm/cpu_type.h> |
5 | 4 | ||
6 | struct irq_bucket { | 5 | struct irq_bucket { |
diff --git a/arch/sparc/kernel/irq_32.c b/arch/sparc/kernel/irq_32.c index 998d90cb5439..a33009f24872 100644 --- a/arch/sparc/kernel/irq_32.c +++ b/arch/sparc/kernel/irq_32.c | |||
@@ -366,6 +366,5 @@ void __init init_IRQ(void) | |||
366 | prom_printf("Cannot initialize IRQs on this Sun machine..."); | 366 | prom_printf("Cannot initialize IRQs on this Sun machine..."); |
367 | break; | 367 | break; |
368 | } | 368 | } |
369 | btfixup(); | ||
370 | } | 369 | } |
371 | 370 | ||
diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c index 459cf66c143c..953641549e82 100644 --- a/arch/sparc/kernel/time_32.c +++ b/arch/sparc/kernel/time_32.c | |||
@@ -356,8 +356,6 @@ static void __init sbus_time_init(void) | |||
356 | 356 | ||
357 | void __init time_init(void) | 357 | void __init time_init(void) |
358 | { | 358 | { |
359 | btfixup(); | ||
360 | |||
361 | sparc_config.features = 0; | 359 | sparc_config.features = 0; |
362 | late_time_init = sparc32_late_time_init; | 360 | late_time_init = sparc32_late_time_init; |
363 | 361 | ||
diff --git a/arch/sparc/mm/Makefile b/arch/sparc/mm/Makefile index c7f156a6a016..69ffd3112fed 100644 --- a/arch/sparc/mm/Makefile +++ b/arch/sparc/mm/Makefile | |||
@@ -7,7 +7,7 @@ ccflags-y := -Werror | |||
7 | obj-$(CONFIG_SPARC64) += ultra.o tlb.o tsb.o gup.o | 7 | obj-$(CONFIG_SPARC64) += ultra.o tlb.o tsb.o gup.o |
8 | obj-y += fault_$(BITS).o | 8 | obj-y += fault_$(BITS).o |
9 | obj-y += init_$(BITS).o | 9 | obj-y += init_$(BITS).o |
10 | obj-$(CONFIG_SPARC32) += extable.o btfixup.o srmmu.o iommu.o io-unit.o | 10 | obj-$(CONFIG_SPARC32) += extable.o srmmu.o iommu.o io-unit.o |
11 | obj-$(CONFIG_SPARC32) += hypersparc.o viking.o tsunami.o swift.o | 11 | obj-$(CONFIG_SPARC32) += hypersparc.o viking.o tsunami.o swift.o |
12 | obj-$(CONFIG_SPARC_LEON)+= leon_mm.o | 12 | obj-$(CONFIG_SPARC_LEON)+= leon_mm.o |
13 | 13 | ||
diff --git a/arch/sparc/mm/btfixup.c b/arch/sparc/mm/btfixup.c deleted file mode 100644 index dcbb7ffcc82e..000000000000 --- a/arch/sparc/mm/btfixup.c +++ /dev/null | |||
@@ -1,316 +0,0 @@ | |||
1 | /* btfixup.c: Boot time code fixup and relocator, so that | ||
2 | * we can get rid of most indirect calls to achieve single | ||
3 | * image sun4c and srmmu kernel. | ||
4 | * | ||
5 | * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) | ||
6 | */ | ||
7 | |||
8 | #include <linux/kernel.h> | ||
9 | #include <linux/init.h> | ||
10 | #include <asm/btfixup.h> | ||
11 | #include <asm/page.h> | ||
12 | #include <asm/pgalloc.h> | ||
13 | #include <asm/pgtable.h> | ||
14 | #include <asm/oplib.h> | ||
15 | #include <asm/cacheflush.h> | ||
16 | |||
17 | #define BTFIXUP_OPTIMIZE_NOP | ||
18 | #define BTFIXUP_OPTIMIZE_OTHER | ||
19 | |||
20 | extern char *srmmu_name; | ||
21 | static char version[] __initdata = "Boot time fixup v1.6. 4/Mar/98 Jakub Jelinek (jj@ultra.linux.cz). Patching kernel for "; | ||
22 | static char str_srmmu[] __initdata = "srmmu[%s]/"; | ||
23 | static char str_iommu[] __initdata = "iommu\n"; | ||
24 | static char str_iounit[] __initdata = "io-unit\n"; | ||
25 | |||
26 | static int visited __initdata = 0; | ||
27 | extern unsigned int ___btfixup_start[], ___btfixup_end[], __init_begin[], __init_end[], __init_text_end[]; | ||
28 | extern unsigned int _stext[], _end[], __start___ksymtab[], __stop___ksymtab[]; | ||
29 | static char wrong_f[] __initdata = "Trying to set f fixup %p to invalid function %08x\n"; | ||
30 | static char wrong_b[] __initdata = "Trying to set b fixup %p to invalid function %08x\n"; | ||
31 | static char wrong_s[] __initdata = "Trying to set s fixup %p to invalid value %08x\n"; | ||
32 | static char wrong_h[] __initdata = "Trying to set h fixup %p to invalid value %08x\n"; | ||
33 | static char wrong_a[] __initdata = "Trying to set a fixup %p to invalid value %08x\n"; | ||
34 | static char wrong[] __initdata = "Wrong address for %c fixup %p\n"; | ||
35 | static char insn_f[] __initdata = "Fixup f %p refers to weird instructions at %p[%08x,%08x]\n"; | ||
36 | static char insn_b[] __initdata = "Fixup b %p doesn't refer to a SETHI at %p[%08x]\n"; | ||
37 | static char insn_s[] __initdata = "Fixup s %p doesn't refer to an OR at %p[%08x]\n"; | ||
38 | static char insn_h[] __initdata = "Fixup h %p doesn't refer to a SETHI at %p[%08x]\n"; | ||
39 | static char insn_a[] __initdata = "Fixup a %p doesn't refer to a SETHI nor OR at %p[%08x]\n"; | ||
40 | static char insn_i[] __initdata = "Fixup i %p doesn't refer to a valid instruction at %p[%08x]\n"; | ||
41 | static char wrong_setaddr[] __initdata = "Garbled CALL/INT patch at %p[%08x,%08x,%08x]=%08x\n"; | ||
42 | |||
43 | #ifdef BTFIXUP_OPTIMIZE_OTHER | ||
44 | static void __init set_addr(unsigned int *addr, unsigned int q1, int fmangled, unsigned int value) | ||
45 | { | ||
46 | if (!fmangled) | ||
47 | *addr = value; | ||
48 | else { | ||
49 | unsigned int *q = (unsigned int *)q1; | ||
50 | if (*addr == 0x01000000) { | ||
51 | /* Noped */ | ||
52 | *q = value; | ||
53 | } else if (addr[-1] == *q) { | ||
54 | /* Moved */ | ||
55 | addr[-1] = value; | ||
56 | *q = value; | ||
57 | } else { | ||
58 | prom_printf(wrong_setaddr, addr-1, addr[-1], *addr, *q, value); | ||
59 | prom_halt(); | ||
60 | } | ||
61 | } | ||
62 | } | ||
63 | #else | ||
64 | static inline void set_addr(unsigned int *addr, unsigned int q1, int fmangled, unsigned int value) | ||
65 | { | ||
66 | *addr = value; | ||
67 | } | ||
68 | #endif | ||
69 | |||
70 | void __init btfixup(void) | ||
71 | { | ||
72 | unsigned int *p, *q; | ||
73 | int type, count; | ||
74 | unsigned insn; | ||
75 | unsigned *addr; | ||
76 | int fmangled = 0; | ||
77 | |||
78 | if (!visited) { | ||
79 | visited++; | ||
80 | printk(version); | ||
81 | printk(str_srmmu, srmmu_name); | ||
82 | if (sparc_cpu_model == sun4d) | ||
83 | printk(str_iounit); | ||
84 | else | ||
85 | printk(str_iommu); | ||
86 | } | ||
87 | for (p = ___btfixup_start; p < ___btfixup_end; ) { | ||
88 | count = p[2]; | ||
89 | q = p + 3; | ||
90 | switch (type = *(unsigned char *)p) { | ||
91 | case 'f': | ||
92 | count = p[3]; | ||
93 | q = p + 4; | ||
94 | if (((p[0] & 1) || p[1]) | ||
95 | && ((p[1] & 3) || (unsigned *)(p[1]) < _stext || (unsigned *)(p[1]) >= _end)) { | ||
96 | prom_printf(wrong_f, p, p[1]); | ||
97 | prom_halt(); | ||
98 | } | ||
99 | break; | ||
100 | case 'b': | ||
101 | if (p[1] < (unsigned long)__init_begin || p[1] >= (unsigned long)__init_text_end || (p[1] & 3)) { | ||
102 | prom_printf(wrong_b, p, p[1]); | ||
103 | prom_halt(); | ||
104 | } | ||
105 | break; | ||
106 | case 's': | ||
107 | if (p[1] + 0x1000 >= 0x2000) { | ||
108 | prom_printf(wrong_s, p, p[1]); | ||
109 | prom_halt(); | ||
110 | } | ||
111 | break; | ||
112 | case 'h': | ||
113 | if (p[1] & 0x3ff) { | ||
114 | prom_printf(wrong_h, p, p[1]); | ||
115 | prom_halt(); | ||
116 | } | ||
117 | break; | ||
118 | case 'a': | ||
119 | if (p[1] + 0x1000 >= 0x2000 && (p[1] & 0x3ff)) { | ||
120 | prom_printf(wrong_a, p, p[1]); | ||
121 | prom_halt(); | ||
122 | } | ||
123 | break; | ||
124 | } | ||
125 | if (p[0] & 1) { | ||
126 | p[0] &= ~1; | ||
127 | while (count) { | ||
128 | fmangled = 0; | ||
129 | addr = (unsigned *)*q; | ||
130 | if (addr < _stext || addr >= _end) { | ||
131 | prom_printf(wrong, type, p); | ||
132 | prom_halt(); | ||
133 | } | ||
134 | insn = *addr; | ||
135 | #ifdef BTFIXUP_OPTIMIZE_OTHER | ||
136 | if (type != 'f' && q[1]) { | ||
137 | insn = *(unsigned int *)q[1]; | ||
138 | if (!insn || insn == 1) | ||
139 | insn = *addr; | ||
140 | else | ||
141 | fmangled = 1; | ||
142 | } | ||
143 | #endif | ||
144 | switch (type) { | ||
145 | case 'f': /* CALL */ | ||
146 | if (addr >= __start___ksymtab && addr < __stop___ksymtab) { | ||
147 | *addr = p[1]; | ||
148 | break; | ||
149 | } else if (!q[1]) { | ||
150 | if ((insn & 0xc1c00000) == 0x01000000) { /* SETHI */ | ||
151 | *addr = (insn & 0xffc00000) | (p[1] >> 10); break; | ||
152 | } else if ((insn & 0xc1f82000) == 0x80102000) { /* OR X, %LO(i), Y */ | ||
153 | *addr = (insn & 0xffffe000) | (p[1] & 0x3ff); break; | ||
154 | } else if ((insn & 0xc0000000) != 0x40000000) { /* !CALL */ | ||
155 | bad_f: | ||
156 | prom_printf(insn_f, p, addr, insn, addr[1]); | ||
157 | prom_halt(); | ||
158 | } | ||
159 | } else if (q[1] != 1) | ||
160 | addr[1] = q[1]; | ||
161 | if (p[2] == BTFIXUPCALL_NORM) { | ||
162 | norm_f: | ||
163 | *addr = 0x40000000 | ((p[1] - (unsigned)addr) >> 2); | ||
164 | q[1] = 0; | ||
165 | break; | ||
166 | } | ||
167 | #ifndef BTFIXUP_OPTIMIZE_NOP | ||
168 | goto norm_f; | ||
169 | #else | ||
170 | if (!(addr[1] & 0x80000000)) { | ||
171 | if ((addr[1] & 0xc1c00000) != 0x01000000) /* !SETHI */ | ||
172 | goto bad_f; /* CALL, Bicc, FBfcc, CBccc are weird in delay slot, aren't they? */ | ||
173 | } else { | ||
174 | if ((addr[1] & 0x01800000) == 0x01800000) { | ||
175 | if ((addr[1] & 0x01f80000) == 0x01e80000) { | ||
176 | /* RESTORE */ | ||
177 | goto norm_f; /* It is dangerous to patch that */ | ||
178 | } | ||
179 | goto bad_f; | ||
180 | } | ||
181 | if ((addr[1] & 0xffffe003) == 0x9e03e000) { | ||
182 | /* ADD %O7, XX, %o7 */ | ||
183 | int displac = (addr[1] << 19); | ||
184 | |||
185 | displac = (displac >> 21) + 2; | ||
186 | *addr = (0x10800000) + (displac & 0x3fffff); | ||
187 | q[1] = addr[1]; | ||
188 | addr[1] = p[2]; | ||
189 | break; | ||
190 | } | ||
191 | if ((addr[1] & 0x201f) == 0x200f || (addr[1] & 0x7c000) == 0x3c000) | ||
192 | goto norm_f; /* Someone is playing bad tricks with us: rs1 or rs2 is o7 */ | ||
193 | if ((addr[1] & 0x3e000000) == 0x1e000000) | ||
194 | goto norm_f; /* rd is %o7. We'd better take care. */ | ||
195 | } | ||
196 | if (p[2] == BTFIXUPCALL_NOP) { | ||
197 | *addr = 0x01000000; | ||
198 | q[1] = 1; | ||
199 | break; | ||
200 | } | ||
201 | #ifndef BTFIXUP_OPTIMIZE_OTHER | ||
202 | goto norm_f; | ||
203 | #else | ||
204 | if (addr[1] == 0x01000000) { /* NOP in the delay slot */ | ||
205 | q[1] = addr[1]; | ||
206 | *addr = p[2]; | ||
207 | break; | ||
208 | } | ||
209 | if ((addr[1] & 0xc0000000) != 0xc0000000) { | ||
210 | /* Not a memory operation */ | ||
211 | if ((addr[1] & 0x30000000) == 0x10000000) { | ||
212 | /* Ok, non-memory op with rd %oX */ | ||
213 | if ((addr[1] & 0x3e000000) == 0x1c000000) | ||
214 | goto bad_f; /* Aiee. Someone is playing strange %sp tricks */ | ||
215 | if ((addr[1] & 0x3e000000) > 0x12000000 || | ||
216 | ((addr[1] & 0x3e000000) == 0x12000000 && | ||
217 | p[2] != BTFIXUPCALL_STO1O0 && p[2] != BTFIXUPCALL_SWAPO0O1) || | ||
218 | ((p[2] & 0xffffe000) == BTFIXUPCALL_RETINT(0))) { | ||
219 | /* Nobody uses the result. We can nop it out. */ | ||
220 | *addr = p[2]; | ||
221 | q[1] = addr[1]; | ||
222 | addr[1] = 0x01000000; | ||
223 | break; | ||
224 | } | ||
225 | if ((addr[1] & 0xf1ffffe0) == 0x90100000) { | ||
226 | /* MOV %reg, %Ox */ | ||
227 | if ((addr[1] & 0x3e000000) == 0x10000000 && | ||
228 | (p[2] & 0x7c000) == 0x20000) { | ||
229 | /* Ok, it is call xx; mov reg, %o0 and call optimizes | ||
230 | to doing something on %o0. Patch the patch. */ | ||
231 | *addr = (p[2] & ~0x7c000) | ((addr[1] & 0x1f) << 14); | ||
232 | q[1] = addr[1]; | ||
233 | addr[1] = 0x01000000; | ||
234 | break; | ||
235 | } | ||
236 | if ((addr[1] & 0x3e000000) == 0x12000000 && | ||
237 | p[2] == BTFIXUPCALL_STO1O0) { | ||
238 | *addr = (p[2] & ~0x3e000000) | ((addr[1] & 0x1f) << 25); | ||
239 | q[1] = addr[1]; | ||
240 | addr[1] = 0x01000000; | ||
241 | break; | ||
242 | } | ||
243 | } | ||
244 | } | ||
245 | } | ||
246 | *addr = addr[1]; | ||
247 | q[1] = addr[1]; | ||
248 | addr[1] = p[2]; | ||
249 | break; | ||
250 | #endif /* BTFIXUP_OPTIMIZE_OTHER */ | ||
251 | #endif /* BTFIXUP_OPTIMIZE_NOP */ | ||
252 | case 'b': /* BLACKBOX */ | ||
253 | /* Has to be sethi i, xx */ | ||
254 | if ((insn & 0xc1c00000) != 0x01000000) { | ||
255 | prom_printf(insn_b, p, addr, insn); | ||
256 | prom_halt(); | ||
257 | } else { | ||
258 | void (*do_fixup)(unsigned *); | ||
259 | |||
260 | do_fixup = (void (*)(unsigned *))p[1]; | ||
261 | do_fixup(addr); | ||
262 | } | ||
263 | break; | ||
264 | case 's': /* SIMM13 */ | ||
265 | /* Has to be or %g0, i, xx */ | ||
266 | if ((insn & 0xc1ffe000) != 0x80102000) { | ||
267 | prom_printf(insn_s, p, addr, insn); | ||
268 | prom_halt(); | ||
269 | } | ||
270 | set_addr(addr, q[1], fmangled, (insn & 0xffffe000) | (p[1] & 0x1fff)); | ||
271 | break; | ||
272 | case 'h': /* SETHI */ | ||
273 | /* Has to be sethi i, xx */ | ||
274 | if ((insn & 0xc1c00000) != 0x01000000) { | ||
275 | prom_printf(insn_h, p, addr, insn); | ||
276 | prom_halt(); | ||
277 | } | ||
278 | set_addr(addr, q[1], fmangled, (insn & 0xffc00000) | (p[1] >> 10)); | ||
279 | break; | ||
280 | case 'a': /* HALF */ | ||
281 | /* Has to be sethi i, xx or or %g0, i, xx */ | ||
282 | if ((insn & 0xc1c00000) != 0x01000000 && | ||
283 | (insn & 0xc1ffe000) != 0x80102000) { | ||
284 | prom_printf(insn_a, p, addr, insn); | ||
285 | prom_halt(); | ||
286 | } | ||
287 | if (p[1] & 0x3ff) | ||
288 | set_addr(addr, q[1], fmangled, | ||
289 | (insn & 0x3e000000) | 0x80102000 | (p[1] & 0x1fff)); | ||
290 | else | ||
291 | set_addr(addr, q[1], fmangled, | ||
292 | (insn & 0x3e000000) | 0x01000000 | (p[1] >> 10)); | ||
293 | break; | ||
294 | case 'i': /* INT */ | ||
295 | if ((insn & 0xc1c00000) == 0x01000000) /* %HI */ | ||
296 | set_addr(addr, q[1], fmangled, (insn & 0xffc00000) | (p[1] >> 10)); | ||
297 | else if ((insn & 0x80002000) == 0x80002000) /* %LO */ | ||
298 | set_addr(addr, q[1], fmangled, (insn & 0xffffe000) | (p[1] & 0x3ff)); | ||
299 | else { | ||
300 | prom_printf(insn_i, p, addr, insn); | ||
301 | prom_halt(); | ||
302 | } | ||
303 | break; | ||
304 | } | ||
305 | count -= 2; | ||
306 | q += 2; | ||
307 | } | ||
308 | } else | ||
309 | p = q + count; | ||
310 | } | ||
311 | #ifdef CONFIG_SMP | ||
312 | local_ops->cache_all(); | ||
313 | #else | ||
314 | sparc32_cachetlb_ops->cache_all(); | ||
315 | #endif | ||
316 | } | ||
diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c index a64b0bbda0ce..ef5c779ec855 100644 --- a/arch/sparc/mm/init_32.c +++ b/arch/sparc/mm/init_32.c | |||
@@ -308,7 +308,6 @@ void __init paging_init(void) | |||
308 | prom_halt(); | 308 | prom_halt(); |
309 | } | 309 | } |
310 | 310 | ||
311 | btfixup(); | ||
312 | prom_build_devicetree(); | 311 | prom_build_devicetree(); |
313 | of_fill_in_cpu_data(); | 312 | of_fill_in_cpu_data(); |
314 | device_scan(); | 313 | device_scan(); |
diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c index 720bea2c7fdd..a8a58cad9d2b 100644 --- a/arch/sparc/mm/iommu.c +++ b/arch/sparc/mm/iommu.c | |||
@@ -141,7 +141,6 @@ static int __init iommu_init(void) | |||
141 | 141 | ||
142 | subsys_initcall(iommu_init); | 142 | subsys_initcall(iommu_init); |
143 | 143 | ||
144 | /* This begs to be btfixup-ed by srmmu. */ | ||
145 | /* Flush the iotlb entries to ram. */ | 144 | /* Flush the iotlb entries to ram. */ |
146 | /* This could be better if we didn't have to flush whole pages. */ | 145 | /* This could be better if we didn't have to flush whole pages. */ |
147 | static void iommu_flush_iotlb(iopte_t *iopte, unsigned int niopte) | 146 | static void iommu_flush_iotlb(iopte_t *iopte, unsigned int niopte) |
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c index cba05fa3fbc7..765b1a5ab5e0 100644 --- a/arch/sparc/mm/srmmu.c +++ b/arch/sparc/mm/srmmu.c | |||
@@ -48,8 +48,6 @@ | |||
48 | #include <asm/turbosparc.h> | 48 | #include <asm/turbosparc.h> |
49 | #include <asm/leon.h> | 49 | #include <asm/leon.h> |
50 | 50 | ||
51 | #include <asm/btfixup.h> | ||
52 | |||
53 | enum mbus_module srmmu_modtype; | 51 | enum mbus_module srmmu_modtype; |
54 | static unsigned int hwbug_bitmask; | 52 | static unsigned int hwbug_bitmask; |
55 | int vac_cache_size; | 53 | int vac_cache_size; |
@@ -2186,5 +2184,4 @@ void __init load_mmu(void) | |||
2186 | else | 2184 | else |
2187 | sun4m_init_smp(); | 2185 | sun4m_init_smp(); |
2188 | #endif | 2186 | #endif |
2189 | btfixup(); | ||
2190 | } | 2187 | } |
diff --git a/arch/sparc/mm/viking.S b/arch/sparc/mm/viking.S index 6dfcc13d3100..bf8ee0613ae7 100644 --- a/arch/sparc/mm/viking.S +++ b/arch/sparc/mm/viking.S | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <asm/page.h> | 14 | #include <asm/page.h> |
15 | #include <asm/pgtsrmmu.h> | 15 | #include <asm/pgtsrmmu.h> |
16 | #include <asm/viking.h> | 16 | #include <asm/viking.h> |
17 | #include <asm/btfixup.h> | ||
18 | 17 | ||
19 | #ifdef CONFIG_SMP | 18 | #ifdef CONFIG_SMP |
20 | .data | 19 | .data |