blob: 6e37a8765bc0a659b3c9e7c5f3a5dfbd7dd672b5 [file] [log] [blame]
Robin Getz2a12c462010-03-11 16:24:18 +00001/* provide some functions which dump the trace buffer, in a nice way for people
2 * to read it, and understand what is going on
3 *
4 * Copyright 2004-2010 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later
7 */
8
9#include <linux/kernel.h>
10#include <linux/hardirq.h>
11#include <linux/thread_info.h>
12#include <linux/mm.h>
13#include <linux/uaccess.h>
14#include <linux/module.h>
15#include <linux/kallsyms.h>
16#include <linux/err.h>
17#include <linux/fs.h>
18#include <asm/dma.h>
19#include <asm/trace.h>
20#include <asm/fixed_code.h>
21#include <asm/traps.h>
22
Robin Getz2a12c462010-03-11 16:24:18 +000023void decode_address(char *buf, unsigned long address)
24{
Robin Getz2a12c462010-03-11 16:24:18 +000025 struct task_struct *p;
26 struct mm_struct *mm;
27 unsigned long flags, offset;
28 unsigned char in_atomic = (bfin_read_IPEND() & 0x10) || in_atomic();
29 struct rb_node *n;
30
31#ifdef CONFIG_KALLSYMS
32 unsigned long symsize;
33 const char *symname;
34 char *modname;
35 char *delim = ":";
36 char namebuf[128];
37#endif
38
39 buf += sprintf(buf, "<0x%08lx> ", address);
40
41#ifdef CONFIG_KALLSYMS
42 /* look up the address and see if we are in kernel space */
43 symname = kallsyms_lookup(address, &symsize, &offset, &modname, namebuf);
44
45 if (symname) {
46 /* yeah! kernel space! */
47 if (!modname)
48 modname = delim = "";
49 sprintf(buf, "{ %s%s%s%s + 0x%lx }",
50 delim, modname, delim, symname,
51 (unsigned long)offset);
52 return;
53 }
54#endif
55
56 if (address >= FIXED_CODE_START && address < FIXED_CODE_END) {
57 /* Problem in fixed code section? */
58 strcat(buf, "/* Maybe fixed code section */");
59 return;
60
61 } else if (address < CONFIG_BOOT_LOAD) {
62 /* Problem somewhere before the kernel start address */
63 strcat(buf, "/* Maybe null pointer? */");
64 return;
65
66 } else if (address >= COREMMR_BASE) {
67 strcat(buf, "/* core mmrs */");
68 return;
69
70 } else if (address >= SYSMMR_BASE) {
71 strcat(buf, "/* system mmrs */");
72 return;
73
74 } else if (address >= L1_ROM_START && address < L1_ROM_START + L1_ROM_LENGTH) {
75 strcat(buf, "/* on-chip L1 ROM */");
76 return;
77 }
78
79 /*
80 * Don't walk any of the vmas if we are oopsing, it has been known
81 * to cause problems - corrupt vmas (kernel crashes) cause double faults
82 */
83 if (oops_in_progress) {
84 strcat(buf, "/* kernel dynamic memory (maybe user-space) */");
85 return;
86 }
87
88 /* looks like we're off in user-land, so let's walk all the
89 * mappings of all our processes and see if we can't be a whee
90 * bit more specific
91 */
92 write_lock_irqsave(&tasklist_lock, flags);
93 for_each_process(p) {
94 mm = (in_atomic ? p->mm : get_task_mm(p));
95 if (!mm)
96 continue;
97
98 if (!down_read_trylock(&mm->mmap_sem)) {
99 if (!in_atomic)
100 mmput(mm);
101 continue;
102 }
103
104 for (n = rb_first(&mm->mm_rb); n; n = rb_next(n)) {
105 struct vm_area_struct *vma;
106
107 vma = rb_entry(n, struct vm_area_struct, vm_rb);
108
109 if (address >= vma->vm_start && address < vma->vm_end) {
110 char _tmpbuf[256];
111 char *name = p->comm;
112 struct file *file = vma->vm_file;
113
114 if (file) {
115 char *d_name = d_path(&file->f_path, _tmpbuf,
116 sizeof(_tmpbuf));
117 if (!IS_ERR(d_name))
118 name = d_name;
119 }
120
121 /* FLAT does not have its text aligned to the start of
122 * the map while FDPIC ELF does ...
123 */
124
125 /* before we can check flat/fdpic, we need to
126 * make sure current is valid
127 */
128 if ((unsigned long)current >= FIXED_CODE_START &&
129 !((unsigned long)current & 0x3)) {
130 if (current->mm &&
131 (address > current->mm->start_code) &&
132 (address < current->mm->end_code))
133 offset = address - current->mm->start_code;
134 else
135 offset = (address - vma->vm_start) +
136 (vma->vm_pgoff << PAGE_SHIFT);
137
138 sprintf(buf, "[ %s + 0x%lx ]", name, offset);
139 } else
140 sprintf(buf, "[ %s vma:0x%lx-0x%lx]",
141 name, vma->vm_start, vma->vm_end);
142
143 up_read(&mm->mmap_sem);
144 if (!in_atomic)
145 mmput(mm);
146
147 if (buf[0] == '\0')
148 sprintf(buf, "[ %s ] dynamic memory", name);
149
150 goto done;
151 }
152 }
153
154 up_read(&mm->mmap_sem);
155 if (!in_atomic)
156 mmput(mm);
157 }
158
159 /*
160 * we were unable to find this address anywhere,
161 * or some MMs were skipped because they were in use.
162 */
163 sprintf(buf, "/* kernel dynamic memory */");
164
165done:
166 write_unlock_irqrestore(&tasklist_lock, flags);
Robin Getz2a12c462010-03-11 16:24:18 +0000167}
168
169#define EXPAND_LEN ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN) * 256 - 1)
170
171/*
172 * Similar to get_user, do some address checking, then dereference
173 * Return true on success, false on bad address
174 */
175bool get_instruction(unsigned short *val, unsigned short *address)
176{
177 unsigned long addr = (unsigned long)address;
178
179 /* Check for odd addresses */
180 if (addr & 0x1)
181 return false;
182
183 /* MMR region will never have instructions */
184 if (addr >= SYSMMR_BASE)
185 return false;
186
187 switch (bfin_mem_access_type(addr, 2)) {
188 case BFIN_MEM_ACCESS_CORE:
189 case BFIN_MEM_ACCESS_CORE_ONLY:
190 *val = *address;
191 return true;
192 case BFIN_MEM_ACCESS_DMA:
193 dma_memcpy(val, address, 2);
194 return true;
195 case BFIN_MEM_ACCESS_ITEST:
196 isram_memcpy(val, address, 2);
197 return true;
198 default: /* invalid access */
199 return false;
200 }
201}
202
203/*
204 * decode the instruction if we are printing out the trace, as it
205 * makes things easier to follow, without running it through objdump
206 * These are the normal instructions which cause change of flow, which
207 * would be at the source of the trace buffer
208 */
Robin Getzd28cff42010-03-11 19:26:38 +0000209#if defined(CONFIG_DEBUG_BFIN_HWTRACE_ON)
Robin Getz2a12c462010-03-11 16:24:18 +0000210static void decode_instruction(unsigned short *address)
211{
212 unsigned short opcode;
213
214 if (get_instruction(&opcode, address)) {
215 if (opcode == 0x0010)
Robin Getzd28cff42010-03-11 19:26:38 +0000216 pr_cont("RTS");
Robin Getz2a12c462010-03-11 16:24:18 +0000217 else if (opcode == 0x0011)
Robin Getzd28cff42010-03-11 19:26:38 +0000218 pr_cont("RTI");
Robin Getz2a12c462010-03-11 16:24:18 +0000219 else if (opcode == 0x0012)
Robin Getzd28cff42010-03-11 19:26:38 +0000220 pr_cont("RTX");
Robin Getz2a12c462010-03-11 16:24:18 +0000221 else if (opcode == 0x0013)
Robin Getzd28cff42010-03-11 19:26:38 +0000222 pr_cont("RTN");
Robin Getz2a12c462010-03-11 16:24:18 +0000223 else if (opcode == 0x0014)
Robin Getzd28cff42010-03-11 19:26:38 +0000224 pr_cont("RTE");
Robin Getz2a12c462010-03-11 16:24:18 +0000225 else if (opcode == 0x0025)
Robin Getzd28cff42010-03-11 19:26:38 +0000226 pr_cont("EMUEXCPT");
Robin Getz2a12c462010-03-11 16:24:18 +0000227 else if (opcode >= 0x0040 && opcode <= 0x0047)
Robin Getzd28cff42010-03-11 19:26:38 +0000228 pr_cont("STI R%i", opcode & 7);
Robin Getz2a12c462010-03-11 16:24:18 +0000229 else if (opcode >= 0x0050 && opcode <= 0x0057)
Robin Getzd28cff42010-03-11 19:26:38 +0000230 pr_cont("JUMP (P%i)", opcode & 7);
Robin Getz2a12c462010-03-11 16:24:18 +0000231 else if (opcode >= 0x0060 && opcode <= 0x0067)
Robin Getzd28cff42010-03-11 19:26:38 +0000232 pr_cont("CALL (P%i)", opcode & 7);
Robin Getz2a12c462010-03-11 16:24:18 +0000233 else if (opcode >= 0x0070 && opcode <= 0x0077)
Robin Getzd28cff42010-03-11 19:26:38 +0000234 pr_cont("CALL (PC+P%i)", opcode & 7);
Robin Getz2a12c462010-03-11 16:24:18 +0000235 else if (opcode >= 0x0080 && opcode <= 0x0087)
Robin Getzd28cff42010-03-11 19:26:38 +0000236 pr_cont("JUMP (PC+P%i)", opcode & 7);
Robin Getz2a12c462010-03-11 16:24:18 +0000237 else if (opcode >= 0x0090 && opcode <= 0x009F)
Robin Getzd28cff42010-03-11 19:26:38 +0000238 pr_cont("RAISE 0x%x", opcode & 0xF);
Robin Getz2a12c462010-03-11 16:24:18 +0000239 else if (opcode >= 0x00A0 && opcode <= 0x00AF)
Robin Getzd28cff42010-03-11 19:26:38 +0000240 pr_cont("EXCPT 0x%x", opcode & 0xF);
Robin Getz2a12c462010-03-11 16:24:18 +0000241 else if ((opcode >= 0x1000 && opcode <= 0x13FF) || (opcode >= 0x1800 && opcode <= 0x1BFF))
Robin Getzd28cff42010-03-11 19:26:38 +0000242 pr_cont("IF !CC JUMP");
Robin Getz2a12c462010-03-11 16:24:18 +0000243 else if ((opcode >= 0x1400 && opcode <= 0x17ff) || (opcode >= 0x1c00 && opcode <= 0x1fff))
Robin Getzd28cff42010-03-11 19:26:38 +0000244 pr_cont("IF CC JUMP");
Robin Getz2a12c462010-03-11 16:24:18 +0000245 else if (opcode >= 0x2000 && opcode <= 0x2fff)
Robin Getzd28cff42010-03-11 19:26:38 +0000246 pr_cont("JUMP.S");
Robin Getz2a12c462010-03-11 16:24:18 +0000247 else if (opcode >= 0xe080 && opcode <= 0xe0ff)
Robin Getzd28cff42010-03-11 19:26:38 +0000248 pr_cont("LSETUP");
Robin Getz2a12c462010-03-11 16:24:18 +0000249 else if (opcode >= 0xe200 && opcode <= 0xe2ff)
Robin Getzd28cff42010-03-11 19:26:38 +0000250 pr_cont("JUMP.L");
Robin Getz2a12c462010-03-11 16:24:18 +0000251 else if (opcode >= 0xe300 && opcode <= 0xe3ff)
Robin Getzd28cff42010-03-11 19:26:38 +0000252 pr_cont("CALL pcrel");
Robin Getz2a12c462010-03-11 16:24:18 +0000253 else
Robin Getzd28cff42010-03-11 19:26:38 +0000254 pr_cont("0x%04x", opcode);
Robin Getz2a12c462010-03-11 16:24:18 +0000255 }
256
257}
258#endif
259
260void dump_bfin_trace_buffer(void)
261{
Robin Getz2a12c462010-03-11 16:24:18 +0000262#ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
263 int tflags, i = 0;
264 char buf[150];
265 unsigned short *addr;
266#ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
267 int j, index;
268#endif
269
270 trace_buffer_save(tflags);
271
Robin Getzd28cff42010-03-11 19:26:38 +0000272 pr_notice("Hardware Trace:\n");
Robin Getz2a12c462010-03-11 16:24:18 +0000273
274#ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
Robin Getzd28cff42010-03-11 19:26:38 +0000275 pr_notice("WARNING: Expanded trace turned on - can not trace exceptions\n");
Robin Getz2a12c462010-03-11 16:24:18 +0000276#endif
277
278 if (likely(bfin_read_TBUFSTAT() & TBUFCNT)) {
279 for (; bfin_read_TBUFSTAT() & TBUFCNT; i++) {
280 decode_address(buf, (unsigned long)bfin_read_TBUF());
Robin Getzd28cff42010-03-11 19:26:38 +0000281 pr_notice("%4i Target : %s\n", i, buf);
Robin Getz2a12c462010-03-11 16:24:18 +0000282 addr = (unsigned short *)bfin_read_TBUF();
283 decode_address(buf, (unsigned long)addr);
Robin Getzd28cff42010-03-11 19:26:38 +0000284 pr_notice(" Source : %s ", buf);
Robin Getz2a12c462010-03-11 16:24:18 +0000285 decode_instruction(addr);
Robin Getzd28cff42010-03-11 19:26:38 +0000286 pr_cont("\n");
Robin Getz2a12c462010-03-11 16:24:18 +0000287 }
288 }
289
290#ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
291 if (trace_buff_offset)
292 index = trace_buff_offset / 4;
293 else
294 index = EXPAND_LEN;
295
296 j = (1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN) * 128;
297 while (j) {
298 decode_address(buf, software_trace_buff[index]);
Robin Getzd28cff42010-03-11 19:26:38 +0000299 pr_notice("%4i Target : %s\n", i, buf);
Robin Getz2a12c462010-03-11 16:24:18 +0000300 index -= 1;
301 if (index < 0)
302 index = EXPAND_LEN;
303 decode_address(buf, software_trace_buff[index]);
Robin Getzd28cff42010-03-11 19:26:38 +0000304 pr_notice(" Source : %s ", buf);
Robin Getz2a12c462010-03-11 16:24:18 +0000305 decode_instruction((unsigned short *)software_trace_buff[index]);
Robin Getzd28cff42010-03-11 19:26:38 +0000306 pr_cont("\n");
Robin Getz2a12c462010-03-11 16:24:18 +0000307 index -= 1;
308 if (index < 0)
309 index = EXPAND_LEN;
310 j--;
311 i++;
312 }
313#endif
314
315 trace_buffer_restore(tflags);
316#endif
Robin Getz2a12c462010-03-11 16:24:18 +0000317}
318EXPORT_SYMBOL(dump_bfin_trace_buffer);
319
320void dump_bfin_process(struct pt_regs *fp)
321{
Robin Getz2a12c462010-03-11 16:24:18 +0000322 /* We should be able to look at fp->ipend, but we don't push it on the
323 * stack all the time, so do this until we fix that */
324 unsigned int context = bfin_read_IPEND();
325
326 if (oops_in_progress)
Robin Getzd28cff42010-03-11 19:26:38 +0000327 pr_emerg("Kernel OOPS in progress\n");
Robin Getz2a12c462010-03-11 16:24:18 +0000328
329 if (context & 0x0020 && (fp->seqstat & SEQSTAT_EXCAUSE) == VEC_HWERR)
Robin Getzd28cff42010-03-11 19:26:38 +0000330 pr_notice("HW Error context\n");
Robin Getz2a12c462010-03-11 16:24:18 +0000331 else if (context & 0x0020)
Robin Getzd28cff42010-03-11 19:26:38 +0000332 pr_notice("Deferred Exception context\n");
Robin Getz2a12c462010-03-11 16:24:18 +0000333 else if (context & 0x3FC0)
Robin Getzd28cff42010-03-11 19:26:38 +0000334 pr_notice("Interrupt context\n");
Robin Getz2a12c462010-03-11 16:24:18 +0000335 else if (context & 0x4000)
Robin Getzd28cff42010-03-11 19:26:38 +0000336 pr_notice("Deferred Interrupt context\n");
Robin Getz2a12c462010-03-11 16:24:18 +0000337 else if (context & 0x8000)
Robin Getzd28cff42010-03-11 19:26:38 +0000338 pr_notice("Kernel process context\n");
Robin Getz2a12c462010-03-11 16:24:18 +0000339
340 /* Because we are crashing, and pointers could be bad, we check things
341 * pretty closely before we use them
342 */
343 if ((unsigned long)current >= FIXED_CODE_START &&
344 !((unsigned long)current & 0x3) && current->pid) {
Robin Getzd28cff42010-03-11 19:26:38 +0000345 pr_notice("CURRENT PROCESS:\n");
Robin Getz2a12c462010-03-11 16:24:18 +0000346 if (current->comm >= (char *)FIXED_CODE_START)
Robin Getzd28cff42010-03-11 19:26:38 +0000347 pr_notice("COMM=%s PID=%d",
Robin Getz2a12c462010-03-11 16:24:18 +0000348 current->comm, current->pid);
349 else
Robin Getzd28cff42010-03-11 19:26:38 +0000350 pr_notice("COMM= invalid");
Robin Getz2a12c462010-03-11 16:24:18 +0000351
Robin Getzd28cff42010-03-11 19:26:38 +0000352 pr_cont(" CPU=%d\n", current_thread_info()->cpu);
353 if (!((unsigned long)current->mm & 0x3) &&
354 (unsigned long)current->mm >= FIXED_CODE_START) {
355 pr_notice("TEXT = 0x%p-0x%p DATA = 0x%p-0x%p\n",
Robin Getz2a12c462010-03-11 16:24:18 +0000356 (void *)current->mm->start_code,
357 (void *)current->mm->end_code,
358 (void *)current->mm->start_data,
Robin Getzd28cff42010-03-11 19:26:38 +0000359 (void *)current->mm->end_data);
360 pr_notice(" BSS = 0x%p-0x%p USER-STACK = 0x%p\n\n",
Robin Getz2a12c462010-03-11 16:24:18 +0000361 (void *)current->mm->end_data,
362 (void *)current->mm->brk,
363 (void *)current->mm->start_stack);
Robin Getzd28cff42010-03-11 19:26:38 +0000364 } else
365 pr_notice("invalid mm\n");
Robin Getz2a12c462010-03-11 16:24:18 +0000366 } else
Robin Getzd28cff42010-03-11 19:26:38 +0000367 pr_notice("No Valid process in current context\n");
Robin Getz2a12c462010-03-11 16:24:18 +0000368}
369
370void dump_bfin_mem(struct pt_regs *fp)
371{
Robin Getz2a12c462010-03-11 16:24:18 +0000372 unsigned short *addr, *erraddr, val = 0, err = 0;
373 char sti = 0, buf[6];
374
375 erraddr = (void *)fp->pc;
376
Robin Getzd28cff42010-03-11 19:26:38 +0000377 pr_notice("return address: [0x%p]; contents of:", erraddr);
Robin Getz2a12c462010-03-11 16:24:18 +0000378
379 for (addr = (unsigned short *)((unsigned long)erraddr & ~0xF) - 0x10;
380 addr < (unsigned short *)((unsigned long)erraddr & ~0xF) + 0x10;
381 addr++) {
382 if (!((unsigned long)addr & 0xF))
Robin Getzd28cff42010-03-11 19:26:38 +0000383 pr_notice("0x%p: ", addr);
Robin Getz2a12c462010-03-11 16:24:18 +0000384
385 if (!get_instruction(&val, addr)) {
386 val = 0;
387 sprintf(buf, "????");
388 } else
389 sprintf(buf, "%04x", val);
390
391 if (addr == erraddr) {
Robin Getzd28cff42010-03-11 19:26:38 +0000392 pr_cont("[%s]", buf);
Robin Getz2a12c462010-03-11 16:24:18 +0000393 err = val;
394 } else
Robin Getzd28cff42010-03-11 19:26:38 +0000395 pr_cont(" %s ", buf);
Robin Getz2a12c462010-03-11 16:24:18 +0000396
397 /* Do any previous instructions turn on interrupts? */
398 if (addr <= erraddr && /* in the past */
399 ((val >= 0x0040 && val <= 0x0047) || /* STI instruction */
400 val == 0x017b)) /* [SP++] = RETI */
401 sti = 1;
402 }
403
Robin Getzd28cff42010-03-11 19:26:38 +0000404 pr_cont("\n");
Robin Getz2a12c462010-03-11 16:24:18 +0000405
406 /* Hardware error interrupts can be deferred */
407 if (unlikely(sti && (fp->seqstat & SEQSTAT_EXCAUSE) == VEC_HWERR &&
408 oops_in_progress)){
Robin Getzd28cff42010-03-11 19:26:38 +0000409 pr_notice("Looks like this was a deferred error - sorry\n");
Robin Getz2a12c462010-03-11 16:24:18 +0000410#ifndef CONFIG_DEBUG_HWERR
Robin Getzd28cff42010-03-11 19:26:38 +0000411 pr_notice("The remaining message may be meaningless\n");
412 pr_notice("You should enable CONFIG_DEBUG_HWERR to get a better idea where it came from\n");
Robin Getz2a12c462010-03-11 16:24:18 +0000413#else
414 /* If we are handling only one peripheral interrupt
415 * and current mm and pid are valid, and the last error
416 * was in that user space process's text area
417 * print it out - because that is where the problem exists
418 */
419 if ((!(((fp)->ipend & ~0x30) & (((fp)->ipend & ~0x30) - 1))) &&
420 (current->pid && current->mm)) {
421 /* And the last RETI points to the current userspace context */
422 if ((fp + 1)->pc >= current->mm->start_code &&
423 (fp + 1)->pc <= current->mm->end_code) {
Robin Getzd28cff42010-03-11 19:26:38 +0000424 pr_notice("It might be better to look around here :\n");
425 pr_notice("-------------------------------------------\n");
Robin Getz2a12c462010-03-11 16:24:18 +0000426 show_regs(fp + 1);
Robin Getzd28cff42010-03-11 19:26:38 +0000427 pr_notice("-------------------------------------------\n");
Robin Getz2a12c462010-03-11 16:24:18 +0000428 }
429 }
430#endif
431 }
Robin Getz2a12c462010-03-11 16:24:18 +0000432}
433
434void show_regs(struct pt_regs *fp)
435{
Robin Getz2a12c462010-03-11 16:24:18 +0000436 char buf[150];
437 struct irqaction *action;
438 unsigned int i;
439 unsigned long flags = 0;
440 unsigned int cpu = raw_smp_processor_id();
441 unsigned char in_atomic = (bfin_read_IPEND() & 0x10) || in_atomic();
442
Robin Getzd28cff42010-03-11 19:26:38 +0000443 pr_notice("\n");
Robin Getz2a12c462010-03-11 16:24:18 +0000444 if (CPUID != bfin_cpuid())
Robin Getzd28cff42010-03-11 19:26:38 +0000445 pr_notice("Compiled for cpu family 0x%04x (Rev %d), "
Robin Getz2a12c462010-03-11 16:24:18 +0000446 "but running on:0x%04x (Rev %d)\n",
447 CPUID, bfin_compiled_revid(), bfin_cpuid(), bfin_revid());
448
Robin Getzd28cff42010-03-11 19:26:38 +0000449 pr_notice("ADSP-%s-0.%d",
Robin Getz2a12c462010-03-11 16:24:18 +0000450 CPU, bfin_compiled_revid());
451
452 if (bfin_compiled_revid() != bfin_revid())
Robin Getzd28cff42010-03-11 19:26:38 +0000453 pr_cont("(Detected 0.%d)", bfin_revid());
Robin Getz2a12c462010-03-11 16:24:18 +0000454
Robin Getzd28cff42010-03-11 19:26:38 +0000455 pr_cont(" %lu(MHz CCLK) %lu(MHz SCLK) (%s)\n",
Robin Getz2a12c462010-03-11 16:24:18 +0000456 get_cclk()/1000000, get_sclk()/1000000,
457#ifdef CONFIG_MPU
458 "mpu on"
459#else
460 "mpu off"
461#endif
462 );
463
Robin Getzd28cff42010-03-11 19:26:38 +0000464 pr_notice("%s", linux_banner);
Robin Getz2a12c462010-03-11 16:24:18 +0000465
Robin Getzd28cff42010-03-11 19:26:38 +0000466 pr_notice("\nSEQUENCER STATUS:\t\t%s\n", print_tainted());
467 pr_notice(" SEQSTAT: %08lx IPEND: %04lx IMASK: %04lx SYSCFG: %04lx\n",
Robin Getz2a12c462010-03-11 16:24:18 +0000468 (long)fp->seqstat, fp->ipend, cpu_pda[raw_smp_processor_id()].ex_imask, fp->syscfg);
469 if (fp->ipend & EVT_IRPTEN)
Robin Getzd28cff42010-03-11 19:26:38 +0000470 pr_notice(" Global Interrupts Disabled (IPEND[4])\n");
Robin Getz2a12c462010-03-11 16:24:18 +0000471 if (!(cpu_pda[raw_smp_processor_id()].ex_imask & (EVT_IVG13 | EVT_IVG12 | EVT_IVG11 |
472 EVT_IVG10 | EVT_IVG9 | EVT_IVG8 | EVT_IVG7 | EVT_IVTMR)))
Robin Getzd28cff42010-03-11 19:26:38 +0000473 pr_notice(" Peripheral interrupts masked off\n");
Robin Getz2a12c462010-03-11 16:24:18 +0000474 if (!(cpu_pda[raw_smp_processor_id()].ex_imask & (EVT_IVG15 | EVT_IVG14)))
Robin Getzd28cff42010-03-11 19:26:38 +0000475 pr_notice(" Kernel interrupts masked off\n");
Robin Getz2a12c462010-03-11 16:24:18 +0000476 if ((fp->seqstat & SEQSTAT_EXCAUSE) == VEC_HWERR) {
Robin Getzd28cff42010-03-11 19:26:38 +0000477 pr_notice(" HWERRCAUSE: 0x%lx\n",
Robin Getz2a12c462010-03-11 16:24:18 +0000478 (fp->seqstat & SEQSTAT_HWERRCAUSE) >> 14);
479#ifdef EBIU_ERRMST
480 /* If the error was from the EBIU, print it out */
481 if (bfin_read_EBIU_ERRMST() & CORE_ERROR) {
Robin Getzd28cff42010-03-11 19:26:38 +0000482 pr_notice(" EBIU Error Reason : 0x%04x\n",
Robin Getz2a12c462010-03-11 16:24:18 +0000483 bfin_read_EBIU_ERRMST());
Robin Getzd28cff42010-03-11 19:26:38 +0000484 pr_notice(" EBIU Error Address : 0x%08x\n",
Robin Getz2a12c462010-03-11 16:24:18 +0000485 bfin_read_EBIU_ERRADD());
486 }
487#endif
488 }
Robin Getzd28cff42010-03-11 19:26:38 +0000489 pr_notice(" EXCAUSE : 0x%lx\n",
Robin Getz2a12c462010-03-11 16:24:18 +0000490 fp->seqstat & SEQSTAT_EXCAUSE);
491 for (i = 2; i <= 15 ; i++) {
492 if (fp->ipend & (1 << i)) {
493 if (i != 4) {
494 decode_address(buf, bfin_read32(EVT0 + 4*i));
Robin Getzd28cff42010-03-11 19:26:38 +0000495 pr_notice(" physical IVG%i asserted : %s\n", i, buf);
Robin Getz2a12c462010-03-11 16:24:18 +0000496 } else
Robin Getzd28cff42010-03-11 19:26:38 +0000497 pr_notice(" interrupts disabled\n");
Robin Getz2a12c462010-03-11 16:24:18 +0000498 }
499 }
500
501 /* if no interrupts are going off, don't print this out */
502 if (fp->ipend & ~0x3F) {
503 for (i = 0; i < (NR_IRQS - 1); i++) {
504 if (!in_atomic)
505 raw_spin_lock_irqsave(&irq_desc[i].lock, flags);
506
507 action = irq_desc[i].action;
508 if (!action)
509 goto unlock;
510
511 decode_address(buf, (unsigned int)action->handler);
Robin Getzd28cff42010-03-11 19:26:38 +0000512 pr_notice(" logical irq %3d mapped : %s", i, buf);
Robin Getz2a12c462010-03-11 16:24:18 +0000513 for (action = action->next; action; action = action->next) {
514 decode_address(buf, (unsigned int)action->handler);
Robin Getzd28cff42010-03-11 19:26:38 +0000515 pr_cont(", %s", buf);
Robin Getz2a12c462010-03-11 16:24:18 +0000516 }
Robin Getzd28cff42010-03-11 19:26:38 +0000517 pr_cont("\n");
Robin Getz2a12c462010-03-11 16:24:18 +0000518unlock:
519 if (!in_atomic)
520 raw_spin_unlock_irqrestore(&irq_desc[i].lock, flags);
521 }
522 }
523
524 decode_address(buf, fp->rete);
Robin Getzd28cff42010-03-11 19:26:38 +0000525 pr_notice(" RETE: %s\n", buf);
Robin Getz2a12c462010-03-11 16:24:18 +0000526 decode_address(buf, fp->retn);
Robin Getzd28cff42010-03-11 19:26:38 +0000527 pr_notice(" RETN: %s\n", buf);
Robin Getz2a12c462010-03-11 16:24:18 +0000528 decode_address(buf, fp->retx);
Robin Getzd28cff42010-03-11 19:26:38 +0000529 pr_notice(" RETX: %s\n", buf);
Robin Getz2a12c462010-03-11 16:24:18 +0000530 decode_address(buf, fp->rets);
Robin Getzd28cff42010-03-11 19:26:38 +0000531 pr_notice(" RETS: %s\n", buf);
Robin Getz2a12c462010-03-11 16:24:18 +0000532 decode_address(buf, fp->pc);
Robin Getzd28cff42010-03-11 19:26:38 +0000533 pr_notice(" PC : %s\n", buf);
Robin Getz2a12c462010-03-11 16:24:18 +0000534
535 if (((long)fp->seqstat & SEQSTAT_EXCAUSE) &&
536 (((long)fp->seqstat & SEQSTAT_EXCAUSE) != VEC_HWERR)) {
537 decode_address(buf, cpu_pda[cpu].dcplb_fault_addr);
Robin Getzd28cff42010-03-11 19:26:38 +0000538 pr_notice("DCPLB_FAULT_ADDR: %s\n", buf);
Robin Getz2a12c462010-03-11 16:24:18 +0000539 decode_address(buf, cpu_pda[cpu].icplb_fault_addr);
Robin Getzd28cff42010-03-11 19:26:38 +0000540 pr_notice("ICPLB_FAULT_ADDR: %s\n", buf);
Robin Getz2a12c462010-03-11 16:24:18 +0000541 }
542
Robin Getzd28cff42010-03-11 19:26:38 +0000543 pr_notice("PROCESSOR STATE:\n");
544 pr_notice(" R0 : %08lx R1 : %08lx R2 : %08lx R3 : %08lx\n",
Robin Getz2a12c462010-03-11 16:24:18 +0000545 fp->r0, fp->r1, fp->r2, fp->r3);
Robin Getzd28cff42010-03-11 19:26:38 +0000546 pr_notice(" R4 : %08lx R5 : %08lx R6 : %08lx R7 : %08lx\n",
Robin Getz2a12c462010-03-11 16:24:18 +0000547 fp->r4, fp->r5, fp->r6, fp->r7);
Robin Getzd28cff42010-03-11 19:26:38 +0000548 pr_notice(" P0 : %08lx P1 : %08lx P2 : %08lx P3 : %08lx\n",
Robin Getz2a12c462010-03-11 16:24:18 +0000549 fp->p0, fp->p1, fp->p2, fp->p3);
Robin Getzd28cff42010-03-11 19:26:38 +0000550 pr_notice(" P4 : %08lx P5 : %08lx FP : %08lx SP : %08lx\n",
Robin Getz2a12c462010-03-11 16:24:18 +0000551 fp->p4, fp->p5, fp->fp, (long)fp);
Robin Getzd28cff42010-03-11 19:26:38 +0000552 pr_notice(" LB0: %08lx LT0: %08lx LC0: %08lx\n",
Robin Getz2a12c462010-03-11 16:24:18 +0000553 fp->lb0, fp->lt0, fp->lc0);
Robin Getzd28cff42010-03-11 19:26:38 +0000554 pr_notice(" LB1: %08lx LT1: %08lx LC1: %08lx\n",
Robin Getz2a12c462010-03-11 16:24:18 +0000555 fp->lb1, fp->lt1, fp->lc1);
Robin Getzd28cff42010-03-11 19:26:38 +0000556 pr_notice(" B0 : %08lx L0 : %08lx M0 : %08lx I0 : %08lx\n",
Robin Getz2a12c462010-03-11 16:24:18 +0000557 fp->b0, fp->l0, fp->m0, fp->i0);
Robin Getzd28cff42010-03-11 19:26:38 +0000558 pr_notice(" B1 : %08lx L1 : %08lx M1 : %08lx I1 : %08lx\n",
Robin Getz2a12c462010-03-11 16:24:18 +0000559 fp->b1, fp->l1, fp->m1, fp->i1);
Robin Getzd28cff42010-03-11 19:26:38 +0000560 pr_notice(" B2 : %08lx L2 : %08lx M2 : %08lx I2 : %08lx\n",
Robin Getz2a12c462010-03-11 16:24:18 +0000561 fp->b2, fp->l2, fp->m2, fp->i2);
Robin Getzd28cff42010-03-11 19:26:38 +0000562 pr_notice(" B3 : %08lx L3 : %08lx M3 : %08lx I3 : %08lx\n",
Robin Getz2a12c462010-03-11 16:24:18 +0000563 fp->b3, fp->l3, fp->m3, fp->i3);
Robin Getzd28cff42010-03-11 19:26:38 +0000564 pr_notice("A0.w: %08lx A0.x: %08lx A1.w: %08lx A1.x: %08lx\n",
Robin Getz2a12c462010-03-11 16:24:18 +0000565 fp->a0w, fp->a0x, fp->a1w, fp->a1x);
566
Robin Getzd28cff42010-03-11 19:26:38 +0000567 pr_notice("USP : %08lx ASTAT: %08lx\n",
Robin Getz2a12c462010-03-11 16:24:18 +0000568 rdusp(), fp->astat);
569
Robin Getzd28cff42010-03-11 19:26:38 +0000570 pr_notice("\n");
Robin Getz2a12c462010-03-11 16:24:18 +0000571}