diff options
Diffstat (limited to 'arch/sh/lib64')
-rw-r--r-- | arch/sh/lib64/.gitignore | 1 | ||||
-rw-r--r-- | arch/sh/lib64/dbg.c | 182 | ||||
-rw-r--r-- | arch/sh/lib64/panic.c | 43 | ||||
-rw-r--r-- | arch/sh/lib64/sdivsi3.S | 6 | ||||
-rw-r--r-- | arch/sh/lib64/udelay.c | 2 |
5 files changed, 6 insertions, 228 deletions
diff --git a/arch/sh/lib64/.gitignore b/arch/sh/lib64/.gitignore deleted file mode 100644 index 3508c2cb23c4..000000000000 --- a/arch/sh/lib64/.gitignore +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | syscalltab.h | ||
diff --git a/arch/sh/lib64/dbg.c b/arch/sh/lib64/dbg.c index 2fb8eaf6de60..6152a6a6d9c6 100644 --- a/arch/sh/lib64/dbg.c +++ b/arch/sh/lib64/dbg.c | |||
@@ -135,140 +135,6 @@ void print_itlb(void) | |||
135 | (" =============================================================\n"); | 135 | (" =============================================================\n"); |
136 | } | 136 | } |
137 | 137 | ||
138 | /* ======================================================================= */ | ||
139 | |||
140 | #ifdef CONFIG_POOR_MANS_STRACE | ||
141 | |||
142 | #include "syscalltab.h" | ||
143 | |||
144 | struct ring_node { | ||
145 | int evt; | ||
146 | int ret_addr; | ||
147 | int event; | ||
148 | int tra; | ||
149 | int pid; | ||
150 | unsigned long sp; | ||
151 | unsigned long pc; | ||
152 | }; | ||
153 | |||
154 | static struct ring_node event_ring[16]; | ||
155 | static int event_ptr = 0; | ||
156 | |||
157 | struct stored_syscall_data { | ||
158 | int pid; | ||
159 | int syscall_number; | ||
160 | }; | ||
161 | |||
162 | #define N_STORED_SYSCALLS 16 | ||
163 | |||
164 | static struct stored_syscall_data stored_syscalls[N_STORED_SYSCALLS]; | ||
165 | static int syscall_next=0; | ||
166 | static int syscall_next_print=0; | ||
167 | |||
168 | void evt_debug(int evt, int ret_addr, int event, int tra, struct pt_regs *regs) | ||
169 | { | ||
170 | int syscallno = tra & 0xff; | ||
171 | unsigned long sp; | ||
172 | unsigned long stack_bottom; | ||
173 | int pid; | ||
174 | struct ring_node *rr; | ||
175 | |||
176 | pid = current->pid; | ||
177 | stack_bottom = (unsigned long) task_stack_page(current); | ||
178 | asm volatile("ori r15, 0, %0" : "=r" (sp)); | ||
179 | rr = event_ring + event_ptr; | ||
180 | rr->evt = evt; | ||
181 | rr->ret_addr = ret_addr; | ||
182 | rr->event = event; | ||
183 | rr->tra = tra; | ||
184 | rr->pid = pid; | ||
185 | rr->sp = sp; | ||
186 | rr->pc = regs->pc; | ||
187 | |||
188 | if (sp < stack_bottom + 3092) { | ||
189 | int i, j; | ||
190 | printk("evt_debug : stack underflow report\n"); | ||
191 | for (j=0, i = event_ptr; j<16; j++) { | ||
192 | rr = event_ring + i; | ||
193 | printk("evt=%08x event=%08x tra=%08x pid=%5d sp=%08lx pc=%08lx\n", | ||
194 | rr->evt, rr->event, rr->tra, rr->pid, rr->sp, rr->pc); | ||
195 | i--; | ||
196 | i &= 15; | ||
197 | } | ||
198 | panic("STACK UNDERFLOW\n"); | ||
199 | } | ||
200 | |||
201 | event_ptr = (event_ptr + 1) & 15; | ||
202 | |||
203 | if ((event == 2) && (evt == 0x160)) { | ||
204 | if (syscallno < NUM_SYSCALL_INFO_ENTRIES) { | ||
205 | /* Store the syscall information to print later. We | ||
206 | * can't print this now - currently we're running with | ||
207 | * SR.BL=1, so we can't take a tlbmiss (which could occur | ||
208 | * in the console drivers under printk). | ||
209 | * | ||
210 | * Just overwrite old entries on ring overflow - this | ||
211 | * is only for last-hope debugging. */ | ||
212 | stored_syscalls[syscall_next].pid = current->pid; | ||
213 | stored_syscalls[syscall_next].syscall_number = syscallno; | ||
214 | syscall_next++; | ||
215 | syscall_next &= (N_STORED_SYSCALLS - 1); | ||
216 | } | ||
217 | } | ||
218 | } | ||
219 | |||
220 | static void drain_syscalls(void) { | ||
221 | while (syscall_next_print != syscall_next) { | ||
222 | printk("Task %d: %s()\n", | ||
223 | stored_syscalls[syscall_next_print].pid, | ||
224 | syscall_info_table[stored_syscalls[syscall_next_print].syscall_number].name); | ||
225 | syscall_next_print++; | ||
226 | syscall_next_print &= (N_STORED_SYSCALLS - 1); | ||
227 | } | ||
228 | } | ||
229 | |||
230 | void evt_debug2(unsigned int ret) | ||
231 | { | ||
232 | drain_syscalls(); | ||
233 | printk("Task %d: syscall returns %08x\n", current->pid, ret); | ||
234 | } | ||
235 | |||
236 | void evt_debug_ret_from_irq(struct pt_regs *regs) | ||
237 | { | ||
238 | int pid; | ||
239 | struct ring_node *rr; | ||
240 | |||
241 | pid = current->pid; | ||
242 | rr = event_ring + event_ptr; | ||
243 | rr->evt = 0xffff; | ||
244 | rr->ret_addr = 0; | ||
245 | rr->event = 0; | ||
246 | rr->tra = 0; | ||
247 | rr->pid = pid; | ||
248 | rr->pc = regs->pc; | ||
249 | event_ptr = (event_ptr + 1) & 15; | ||
250 | } | ||
251 | |||
252 | void evt_debug_ret_from_exc(struct pt_regs *regs) | ||
253 | { | ||
254 | int pid; | ||
255 | struct ring_node *rr; | ||
256 | |||
257 | pid = current->pid; | ||
258 | rr = event_ring + event_ptr; | ||
259 | rr->evt = 0xfffe; | ||
260 | rr->ret_addr = 0; | ||
261 | rr->event = 0; | ||
262 | rr->tra = 0; | ||
263 | rr->pid = pid; | ||
264 | rr->pc = regs->pc; | ||
265 | event_ptr = (event_ptr + 1) & 15; | ||
266 | } | ||
267 | |||
268 | #endif /* CONFIG_POOR_MANS_STRACE */ | ||
269 | |||
270 | /* ======================================================================= */ | ||
271 | |||
272 | void show_excp_regs(char *from, int trapnr, int signr, struct pt_regs *regs) | 138 | void show_excp_regs(char *from, int trapnr, int signr, struct pt_regs *regs) |
273 | { | 139 | { |
274 | 140 | ||
@@ -380,51 +246,3 @@ void show_excp_regs(char *from, int trapnr, int signr, struct pt_regs *regs) | |||
380 | print_dtlb(); | 246 | print_dtlb(); |
381 | print_itlb(); | 247 | print_itlb(); |
382 | } | 248 | } |
383 | |||
384 | /* ======================================================================= */ | ||
385 | |||
386 | /* | ||
387 | ** Depending on <base> scan the MMU, Data or Instruction side | ||
388 | ** looking for a valid mapping matching Eaddr & asid. | ||
389 | ** Return -1 if not found or the TLB id entry otherwise. | ||
390 | ** Note: it works only for 4k pages! | ||
391 | */ | ||
392 | static unsigned long | ||
393 | lookup_mmu_side(unsigned long base, unsigned long Eaddr, unsigned long asid) | ||
394 | { | ||
395 | regType_t pteH; | ||
396 | unsigned long epn; | ||
397 | int count; | ||
398 | |||
399 | epn = Eaddr & 0xfffff000; | ||
400 | |||
401 | for (count = 0; count < MAX_TLBs; count++, base += TLB_STEP) { | ||
402 | pteH = getConfigReg(base); | ||
403 | if (GET_VALID(pteH)) | ||
404 | if ((unsigned long) GET_EPN(pteH) == epn) | ||
405 | if ((unsigned long) GET_ASID(pteH) == asid) | ||
406 | break; | ||
407 | } | ||
408 | return ((unsigned long) ((count < MAX_TLBs) ? base : -1)); | ||
409 | } | ||
410 | |||
411 | unsigned long lookup_dtlb(unsigned long Eaddr) | ||
412 | { | ||
413 | unsigned long asid = get_asid(); | ||
414 | return (lookup_mmu_side((u64) DTLB_BASE, Eaddr, asid)); | ||
415 | } | ||
416 | |||
417 | unsigned long lookup_itlb(unsigned long Eaddr) | ||
418 | { | ||
419 | unsigned long asid = get_asid(); | ||
420 | return (lookup_mmu_side((u64) ITLB_BASE, Eaddr, asid)); | ||
421 | } | ||
422 | |||
423 | void print_page(struct page *page) | ||
424 | { | ||
425 | printk(" page[%p] -> index 0x%lx, count 0x%x, flags 0x%lx\n", | ||
426 | page, page->index, page_count(page), page->flags); | ||
427 | printk(" address_space = %p, pages =%ld\n", page->mapping, | ||
428 | page->mapping->nrpages); | ||
429 | |||
430 | } | ||
diff --git a/arch/sh/lib64/panic.c b/arch/sh/lib64/panic.c index da32ba7b5fcc..38c954e04f6a 100644 --- a/arch/sh/lib64/panic.c +++ b/arch/sh/lib64/panic.c | |||
@@ -6,53 +6,10 @@ | |||
6 | * for more details. | 6 | * for more details. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/kernel.h> | ||
10 | #include <asm/io.h> | ||
11 | #include <cpu/registers.h> | ||
12 | |||
13 | /* THIS IS A PHYSICAL ADDRESS */ | ||
14 | #define HDSP2534_ADDR (0x04002100) | ||
15 | |||
16 | #ifdef CONFIG_SH_CAYMAN | ||
17 | |||
18 | static void poor_mans_delay(void) | ||
19 | { | ||
20 | int i; | ||
21 | for (i = 0; i < 2500000; i++) { | ||
22 | } /* poor man's delay */ | ||
23 | } | ||
24 | |||
25 | static void show_value(unsigned long x) | ||
26 | { | ||
27 | int i; | ||
28 | unsigned nibble; | ||
29 | for (i = 0; i < 8; i++) { | ||
30 | nibble = ((x >> (i * 4)) & 0xf); | ||
31 | |||
32 | ctrl_outb(nibble + ((nibble > 9) ? 55 : 48), | ||
33 | HDSP2534_ADDR + 0xe0 + ((7 - i) << 2)); | ||
34 | } | ||
35 | } | ||
36 | |||
37 | #endif | ||
38 | |||
39 | void | 9 | void |
40 | panic_handler(unsigned long panicPC, unsigned long panicSSR, | 10 | panic_handler(unsigned long panicPC, unsigned long panicSSR, |
41 | unsigned long panicEXPEVT) | 11 | unsigned long panicEXPEVT) |
42 | { | 12 | { |
43 | #ifdef CONFIG_SH_CAYMAN | ||
44 | while (1) { | ||
45 | /* This piece of code displays the PC on the LED display */ | ||
46 | show_value(panicPC); | ||
47 | poor_mans_delay(); | ||
48 | show_value(panicSSR); | ||
49 | poor_mans_delay(); | ||
50 | show_value(panicEXPEVT); | ||
51 | poor_mans_delay(); | ||
52 | } | ||
53 | #endif | ||
54 | |||
55 | /* Never return from the panic handler */ | 13 | /* Never return from the panic handler */ |
56 | for (;;) ; | 14 | for (;;) ; |
57 | |||
58 | } | 15 | } |
diff --git a/arch/sh/lib64/sdivsi3.S b/arch/sh/lib64/sdivsi3.S index 6a800c6a4904..1963bbd42288 100644 --- a/arch/sh/lib64/sdivsi3.S +++ b/arch/sh/lib64/sdivsi3.S | |||
@@ -1,4 +1,6 @@ | |||
1 | .global __sdivsi3 | 1 | .global __sdivsi3 |
2 | .global __sdivsi3_1 | ||
3 | .global __sdivsi3_2 | ||
2 | .section .text..SHmedia32,"ax" | 4 | .section .text..SHmedia32,"ax" |
3 | .align 2 | 5 | .align 2 |
4 | 6 | ||
@@ -6,13 +8,15 @@ | |||
6 | /* clobbered: r1,r18,r19,r20,r21,r25,tr0 */ | 8 | /* clobbered: r1,r18,r19,r20,r21,r25,tr0 */ |
7 | /* result in r0 */ | 9 | /* result in r0 */ |
8 | __sdivsi3: | 10 | __sdivsi3: |
11 | __sdivsi3_1: | ||
9 | ptb __div_table,tr0 | 12 | ptb __div_table,tr0 |
13 | gettr tr0,r20 | ||
10 | 14 | ||
15 | __sdivsi3_2: | ||
11 | nsb r5, r1 | 16 | nsb r5, r1 |
12 | shlld r5, r1, r25 /* normalize; [-2 ..1, 1..2) in s2.62 */ | 17 | shlld r5, r1, r25 /* normalize; [-2 ..1, 1..2) in s2.62 */ |
13 | shari r25, 58, r21 /* extract 5(6) bit index (s2.4 with hole -1..1) */ | 18 | shari r25, 58, r21 /* extract 5(6) bit index (s2.4 with hole -1..1) */ |
14 | /* bubble */ | 19 | /* bubble */ |
15 | gettr tr0,r20 | ||
16 | ldx.ub r20, r21, r19 /* u0.8 */ | 20 | ldx.ub r20, r21, r19 /* u0.8 */ |
17 | shari r25, 32, r25 /* normalize to s2.30 */ | 21 | shari r25, 32, r25 /* normalize to s2.30 */ |
18 | shlli r21, 1, r21 | 22 | shlli r21, 1, r21 |
diff --git a/arch/sh/lib64/udelay.c b/arch/sh/lib64/udelay.c index d76bd801194f..f215b063da70 100644 --- a/arch/sh/lib64/udelay.c +++ b/arch/sh/lib64/udelay.c | |||
@@ -33,7 +33,7 @@ void __delay(unsigned long loops) | |||
33 | :"0"(loops)); | 33 | :"0"(loops)); |
34 | } | 34 | } |
35 | 35 | ||
36 | inline void __const_udelay(unsigned long xloops) | 36 | void __const_udelay(unsigned long xloops) |
37 | { | 37 | { |
38 | __delay(xloops * (HZ * cpu_data[raw_smp_processor_id()].loops_per_jiffy)); | 38 | __delay(xloops * (HZ * cpu_data[raw_smp_processor_id()].loops_per_jiffy)); |
39 | } | 39 | } |