Merge branch 'master' of git://www.denx.de/git/u-boot-fdt
[oweals/u-boot.git] / cpu / ppc4xx / traps.c
old mode 100755 (executable)
new mode 100644 (file)
index 6b15a9e..8b7e32a
@@ -38,7 +38,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
+#if defined(CONFIG_CMD_KGDB)
 int (*debugger_exception_handler)(struct pt_regs *) = 0;
 #endif
 
@@ -78,7 +78,7 @@ static __inline__ unsigned long get_esr(void)
 #define ESR_DIZ 0x00400000
 #define ESR_U0F 0x00008000
 
-#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
+#if defined(CONFIG_CMD_BEDBUG)
 extern void do_bedbug_breakpoint(struct pt_regs *);
 #endif
 
@@ -151,21 +151,15 @@ MachineCheckException(struct pt_regs *regs)
        int uncorr_ecc = 0;
 #endif
 
-       /* Probing PCI(E) using config cycles may cause this exception
-        * when a device is not present. To gracefully recover in such
-        * scenarios config read/write routines need to be instrumented in
-        * order to return via fixup handler. For examples refer to
-        * pcie_in_8(), pcie_in_le16() and pcie_in_le32()
-        */
        if ((fixup = search_exception_table(regs->nip)) != 0) {
                regs->nip = fixup;
                val = mfspr(MCSR);
                /* Clear MCSR */
-                mtspr(SPRN_MCSR, val);
+               mtspr(SPRN_MCSR, val);
                return;
        }
 
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
+#if defined(CONFIG_CMD_KGDB)
        if (debugger_exception_handler && (*debugger_exception_handler)(regs))
                return;
 #endif
@@ -176,7 +170,7 @@ MachineCheckException(struct pt_regs *regs)
 
        val = get_esr();
 
-#if !defined(CONFIG_440)
+#if !defined(CONFIG_440) && !defined(CONFIG_405EX)
        if (val& ESR_IMCP) {
                printf("Instruction");
                mtspr(ESR, val & ~ESR_IMCP);
@@ -185,7 +179,7 @@ MachineCheckException(struct pt_regs *regs)
        }
        printf(" machine check.\n");
 
-#elif defined(CONFIG_440)
+#elif defined(CONFIG_440) || defined(CONFIG_405EX)
        if (val& ESR_IMCP){
                printf("Instruction Synchronous Machine Check exception\n");
                mtspr(SPRN_ESR, val & ~ESR_IMCP);
@@ -193,10 +187,15 @@ MachineCheckException(struct pt_regs *regs)
                val = mfspr(MCSR);
                if (val & MCSR_IB)
                        printf("Instruction Read PLB Error\n");
+#if defined(CONFIG_440)
                if (val & MCSR_DRB)
                        printf("Data Read PLB Error\n");
                if (val & MCSR_DWB)
                        printf("Data Write PLB Error\n");
+#else
+               if (val & MCSR_DB)
+                       printf("Data PLB Error\n");
+#endif
                if (val & MCSR_TLBP)
                        printf("TLB Parity Error\n");
                if (val & MCSR_ICP){
@@ -312,7 +311,7 @@ MachineCheckException(struct pt_regs *regs)
 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
@@ -327,7 +326,7 @@ ProgramCheckException(struct pt_regs *regs)
 {
        long esr_val;
 
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
+#if defined(CONFIG_CMD_KGDB)
        if (debugger_exception_handler && (*debugger_exception_handler)(regs))
                return;
 #endif
@@ -364,7 +363,7 @@ DecrementerPITException(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
@@ -379,7 +378,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
 }