Merge tag 'powerpc-5.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[linux-2.6-microblaze.git] / arch / powerpc / xmon / xmon.c
index bf7d696..c8173e9 100644 (file)
@@ -54,6 +54,7 @@
 #include <asm/code-patching.h>
 #include <asm/sections.h>
 #include <asm/inst.h>
+#include <asm/interrupt.h>
 
 #ifdef CONFIG_PPC64
 #include <asm/hvcall.h>
@@ -605,7 +606,7 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
                         * debugger break (IPI). This is similar to
                         * crash_kexec_secondary().
                         */
-                       if (TRAP(regs) != 0x100 || !wait_for_other_cpus(ncpus))
+                       if (TRAP(regs) !=  INTERRUPT_SYSTEM_RESET || !wait_for_other_cpus(ncpus))
                                smp_send_debugger_break();
 
                        wait_for_other_cpus(ncpus);
@@ -615,7 +616,7 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
 
                if (!locked_down) {
                        /* for breakpoint or single step, print curr insn */
-                       if (bp || TRAP(regs) == 0xd00)
+                       if (bp || TRAP(regs) == INTERRUPT_TRACE)
                                ppc_inst_dump(regs->nip, 1, 0);
                        printf("enter ? for help\n");
                }
@@ -684,7 +685,7 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
                disable_surveillance();
                if (!locked_down) {
                        /* for breakpoint or single step, print current insn */
-                       if (bp || TRAP(regs) == 0xd00)
+                       if (bp || TRAP(regs) == INTERRUPT_TRACE)
                                ppc_inst_dump(regs->nip, 1, 0);
                        printf("enter ? for help\n");
                }
@@ -1769,9 +1770,12 @@ static void excprint(struct pt_regs *fp)
        printf("    sp: %lx\n", fp->gpr[1]);
        printf("   msr: %lx\n", fp->msr);
 
-       if (trap == 0x300 || trap == 0x380 || trap == 0x600 || trap == 0x200) {
+       if (trap == INTERRUPT_DATA_STORAGE ||
+           trap == INTERRUPT_DATA_SEGMENT ||
+           trap == INTERRUPT_ALIGNMENT ||
+           trap == INTERRUPT_MACHINE_CHECK) {
                printf("   dar: %lx\n", fp->dar);
-               if (trap != 0x380)
+               if (trap != INTERRUPT_DATA_SEGMENT)
                        printf(" dsisr: %lx\n", fp->dsisr);
        }
 
@@ -1785,7 +1789,7 @@ static void excprint(struct pt_regs *fp)
                       current->pid, current->comm);
        }
 
-       if (trap == 0x700)
+       if (trap == INTERRUPT_PROGRAM)
                print_bug_trap(fp);
 
        printf(linux_banner);
@@ -1815,25 +1819,16 @@ static void prregs(struct pt_regs *fp)
        }
 
 #ifdef CONFIG_PPC64
-       if (FULL_REGS(fp)) {
-               for (n = 0; n < 16; ++n)
-                       printf("R%.2d = "REG"   R%.2d = "REG"\n",
-                              n, fp->gpr[n], n+16, fp->gpr[n+16]);
-       } else {
-               for (n = 0; n < 7; ++n)
-                       printf("R%.2d = "REG"   R%.2d = "REG"\n",
-                              n, fp->gpr[n], n+7, fp->gpr[n+7]);
-       }
+#define R_PER_LINE 2
 #else
+#define R_PER_LINE 4
+#endif
+
        for (n = 0; n < 32; ++n) {
-               printf("R%.2d = %.8lx%s", n, fp->gpr[n],
-                      (n & 3) == 3? "\n": "   ");
-               if (n == 12 && !FULL_REGS(fp)) {
-                       printf("\n");
-                       break;
-               }
+               printf("R%.2d = "REG"%s", n, fp->gpr[n],
+                       (n % R_PER_LINE) == R_PER_LINE - 1 ? "\n" : "   ");
        }
-#endif
+
        printf("pc  = ");
        xmon_print_symbol(fp->nip, " ", "\n");
        if (!trap_is_syscall(fp) && cpu_has_feature(CPU_FTR_CFAR)) {
@@ -1846,7 +1841,9 @@ static void prregs(struct pt_regs *fp)
        printf("ctr = "REG"   xer = "REG"   trap = %4lx\n",
               fp->ctr, fp->xer, fp->trap);
        trap = TRAP(fp);
-       if (trap == 0x300 || trap == 0x380 || trap == 0x600)
+       if (trap == INTERRUPT_DATA_STORAGE ||
+           trap == INTERRUPT_DATA_SEGMENT ||
+           trap == INTERRUPT_ALIGNMENT)
                printf("dar = "REG"   dsisr = %.8lx\n", fp->dar, fp->dsisr);
 }
 
@@ -2727,30 +2724,6 @@ static void dump_all_xives(void)
                dump_one_xive(cpu);
 }
 
-static void dump_one_xive_irq(u32 num, struct irq_data *d)
-{
-       xmon_xive_get_irq_config(num, d);
-}
-
-static void dump_all_xive_irq(void)
-{
-       unsigned int i;
-       struct irq_desc *desc;
-
-       for_each_irq_desc(i, desc) {
-               struct irq_data *d = irq_desc_get_irq_data(desc);
-               unsigned int hwirq;
-
-               if (!d)
-                       continue;
-
-               hwirq = (unsigned int)irqd_to_hwirq(d);
-               /* IPIs are special (HW number 0) */
-               if (hwirq)
-                       dump_one_xive_irq(hwirq, d);
-       }
-}
-
 static void dump_xives(void)
 {
        unsigned long num;
@@ -2767,9 +2740,9 @@ static void dump_xives(void)
                return;
        } else if (c == 'i') {
                if (scanhex(&num))
-                       dump_one_xive_irq(num, NULL);
+                       xmon_xive_get_irq_config(num, NULL);
                else
-                       dump_all_xive_irq();
+                       xmon_xive_get_irq_all();
                return;
        }
 
@@ -2980,7 +2953,7 @@ generic_inst_dump(unsigned long adr, long count, int praddr,
                if (!ppc_inst_prefixed(inst))
                        dump_func(ppc_inst_val(inst), adr);
                else
-                       dump_func(ppc_inst_as_u64(inst), adr);
+                       dump_func(ppc_inst_as_ulong(inst), adr);
                printf("\n");
        }
        return adr - first_adr;
@@ -4212,8 +4185,7 @@ static void dump_spu_fields(struct spu *spu)
        DUMP_FIELD(spu, "0x%p", pdata);
 }
 
-int
-spu_inst_dump(unsigned long adr, long count, int praddr)
+static int spu_inst_dump(unsigned long adr, long count, int praddr)
 {
        return generic_inst_dump(adr, count, praddr, print_insn_spu);
 }