]> git.sur5r.net Git - u-boot/blobdiff - cpu/mpc8260/traps.c
ppc4xx: Correct GPIO offset in gpio_config()
[u-boot] / cpu / mpc8260 / traps.c
index a7f6f7e1a78777b9e8e57bff18af1dc14cf58b9b..b5d416c9741d87239fdfc592710b0afedb908b66 100644 (file)
@@ -35,8 +35,9 @@
 #include <common.h>
 #include <command.h>
 #include <asm/processor.h>
+#include <asm/m8260_pci.h>
 
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
+#if defined(CONFIG_CMD_KGDB)
 int (*debugger_exception_handler)(struct pt_regs *) = 0;
 #endif
 
@@ -57,19 +58,19 @@ print_backtrace(unsigned long *sp)
        int cnt = 0;
        unsigned long i;
 
-       printf("Call backtrace: ");
+       puts ("Call backtrace: ");
        while (sp) {
                if ((uint)sp > END_OF_MEM)
                        break;
 
                i = sp[1];
                if (cnt++ % 7 == 0)
-                       printf("\n");
+                       putc ('\n');
                printf("%08lX ", i);
                if (cnt > 32) break;
                sp = (unsigned long *)*sp;
        }
-       printf("\n");
+       putc ('\n');
 }
 
 void show_regs(struct pt_regs * regs)
@@ -84,17 +85,15 @@ void show_regs(struct pt_regs * regs)
               regs->msr&MSR_IR ? 1 : 0,
               regs->msr&MSR_DR ? 1 : 0);
 
-       printf("\n");
+       putc ('\n');
        for (i = 0;  i < 32;  i++) {
-               if ((i % 8) == 0)
-               {
+               if ((i % 8) == 0) {
                        printf("GPR%02d: ", i);
                }
 
                printf("%08lX ", regs->gpr[i]);
-               if ((i % 8) == 7)
-               {
-                       printf("\n");
+               if ((i % 8) == 7) {
+                       putc ('\n');
                }
        }
 }
@@ -108,6 +107,24 @@ _exception(int signr, struct pt_regs *regs)
        panic("Exception in kernel pc %lx signal %d",regs->nip,signr);
 }
 
+#ifdef CONFIG_PCI
+void dump_pci (void)
+{
+
+       volatile immap_t *immap = (immap_t *) CFG_IMMR;
+
+       printf ("PCI: err status %x err mask %x err ctrl %x\n",
+               le32_to_cpu (immap->im_pci.pci_esr),
+               le32_to_cpu (immap->im_pci.pci_emr),
+               le32_to_cpu (immap->im_pci.pci_ecr));
+       printf ("     error address %x error data %x ctrl %x\n",
+               le32_to_cpu (immap->im_pci.pci_eacr),
+               le32_to_cpu (immap->im_pci.pci_edcr),
+               le32_to_cpu (immap->im_pci.pci_eccr));
+
+}
+#endif
+
 void
 MachineCheckException(struct pt_regs *regs)
 {
@@ -117,46 +134,59 @@ MachineCheckException(struct pt_regs *regs)
         * when a device is not present.  Catch it and return to
         * the PCI exception handler.
         */
+#ifdef CONFIG_PCI
+       volatile immap_t *immap  = (immap_t *)CFG_IMMR;
+#ifdef DEBUG
+       dump_pci();
+#endif
+       /* clear the error in the error status register */
+       if(immap->im_pci.pci_esr & cpu_to_le32(PCI_ERROR_PCI_NO_RSP)) {
+               immap->im_pci.pci_esr = cpu_to_le32(PCI_ERROR_PCI_NO_RSP);
+               return;
+       }
+#endif
        if ((fixup = search_exception_table(regs->nip)) != 0) {
                regs->nip = fixup;
                return;
        }
 
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
+#if defined(CONFIG_CMD_KGDB)
        if (debugger_exception_handler && (*debugger_exception_handler)(regs))
                return;
 #endif
 
-       printf("Machine check in kernel mode.\n");
-       printf("Caused by (from msr): ");
+       puts ("Machine check in kernel mode.\n"
+               "Caused by (from msr): ");
        printf("regs %p ",regs);
-       switch( regs->msr & 0x0000F000)
-       {
-       case (1<<12) :
-               printf("Machine check signal - probably due to mm fault\n"
+       switch( regs->msr & 0x000F0000) {
+       case (0x80000000>>12):
+               puts ("Machine check signal - probably due to mm fault\n"
                        "with mmu off\n");
                break;
-       case (1<<13) :
-               printf("Transfer error ack signal\n");
+       case (0x80000000>>13):
+               puts ("Transfer error ack signal\n");
                break;
-       case (1<<14) :
-               printf("Data parity signal\n");
+       case (0x80000000>>14):
+               puts ("Data parity signal\n");
                break;
-       case (1<<15) :
-               printf("Address parity signal\n");
+       case (0x80000000>>15):
+               puts ("Address parity signal\n");
                break;
        default:
-               printf("Unknown values in msr\n");
+               puts ("Unknown values in msr\n");
        }
        show_regs(regs);
        print_backtrace((unsigned long *)regs->gpr[1]);
+#ifdef CONFIG_PCI
+       dump_pci();
+#endif
        panic("machine check");
 }
 
 void
 AlignmentException(struct pt_regs *regs)
 {
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
+#if defined(CONFIG_CMD_KGDB)
        if (debugger_exception_handler && (*debugger_exception_handler)(regs))
                return;
 #endif
@@ -168,7 +198,7 @@ AlignmentException(struct pt_regs *regs)
 void
 ProgramCheckException(struct pt_regs *regs)
 {
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
+#if defined(CONFIG_CMD_KGDB)
        if (debugger_exception_handler && (*debugger_exception_handler)(regs))
                return;
 #endif
@@ -180,7 +210,7 @@ ProgramCheckException(struct pt_regs *regs)
 void
 SoftEmuException(struct pt_regs *regs)
 {
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
+#if defined(CONFIG_CMD_KGDB)
        if (debugger_exception_handler && (*debugger_exception_handler)(regs))
                return;
 #endif
@@ -193,7 +223,7 @@ SoftEmuException(struct pt_regs *regs)
 void
 UnknownException(struct pt_regs *regs)
 {
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
+#if defined(CONFIG_CMD_KGDB)
        if (debugger_exception_handler && (*debugger_exception_handler)(regs))
                return;
 #endif
@@ -202,7 +232,7 @@ UnknownException(struct pt_regs *regs)
        _exception(0, regs);
 }
 
-#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
+#if defined(CONFIG_CMD_BEDBUG)
 extern void do_bedbug_breakpoint(struct pt_regs *);
 #endif
 
@@ -212,7 +242,7 @@ DebugException(struct pt_regs *regs)
 
   printf("Debugger trap at @ %lx\n", regs->nip );
   show_regs(regs);
-#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
+#if defined(CONFIG_CMD_BEDBUG)
   do_bedbug_breakpoint( regs );
 #endif
 }