Merge master.kernel.org:/home/rmk/linux-2.6-serial
[pandora-kernel.git] / arch / powerpc / xmon / xmon.c
index 22612ed..179b10c 100644 (file)
@@ -8,7 +8,6 @@
  *      as published by the Free Software Foundation; either version
  *      2 of the License, or (at your option) any later version.
  */
-#include <linux/config.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/smp.h>
@@ -26,9 +25,6 @@
 #include <asm/prom.h>
 #include <asm/machdep.h>
 #include <asm/xmon.h>
-#ifdef CONFIG_PMAC_BACKLIGHT
-#include <asm/backlight.h>
-#endif
 #include <asm/processor.h>
 #include <asm/pgtable.h>
 #include <asm/mmu.h>
@@ -191,6 +187,7 @@ Commands:\n\
   di   dump instructions\n\
   df   dump float values\n\
   dd   dump double values\n\
+  dr   dump stream of raw bytes\n\
   e    print exception information\n\
   f    flush cache\n\
   la   lookup symbol+offset of specified address\n\
@@ -311,7 +308,7 @@ static void release_output_lock(void)
 }
 #endif
 
-int xmon_core(struct pt_regs *regs, int fromipi)
+static int xmon_core(struct pt_regs *regs, int fromipi)
 {
        int cmd = 0;
        unsigned long msr;
@@ -528,7 +525,7 @@ xmon_irq(int irq, void *d, struct pt_regs *regs)
        return IRQ_HANDLED;
 }
 
-int xmon_bpt(struct pt_regs *regs)
+static int xmon_bpt(struct pt_regs *regs)
 {
        struct bpt *bp;
        unsigned long offset;
@@ -554,7 +551,7 @@ int xmon_bpt(struct pt_regs *regs)
        return 1;
 }
 
-int xmon_sstep(struct pt_regs *regs)
+static int xmon_sstep(struct pt_regs *regs)
 {
        if (user_mode(regs))
                return 0;
@@ -562,7 +559,7 @@ int xmon_sstep(struct pt_regs *regs)
        return 1;
 }
 
-int xmon_dabr_match(struct pt_regs *regs)
+static int xmon_dabr_match(struct pt_regs *regs)
 {
        if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) != (MSR_IR|MSR_SF))
                return 0;
@@ -572,7 +569,7 @@ int xmon_dabr_match(struct pt_regs *regs)
        return 1;
 }
 
-int xmon_iabr_match(struct pt_regs *regs)
+static int xmon_iabr_match(struct pt_regs *regs)
 {
        if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) != (MSR_IR|MSR_SF))
                return 0;
@@ -582,7 +579,7 @@ int xmon_iabr_match(struct pt_regs *regs)
        return 1;
 }
 
-int xmon_ipi(struct pt_regs *regs)
+static int xmon_ipi(struct pt_regs *regs)
 {
 #ifdef CONFIG_SMP
        if (in_xmon && !cpu_isset(smp_processor_id(), cpus_in_xmon))
@@ -591,7 +588,7 @@ int xmon_ipi(struct pt_regs *regs)
        return 0;
 }
 
-int xmon_fault_handler(struct pt_regs *regs)
+static int xmon_fault_handler(struct pt_regs *regs)
 {
        struct bpt *bp;
        unsigned long offset;
@@ -1938,6 +1935,28 @@ bsesc(void)
        return c;
 }
 
+static void xmon_rawdump (unsigned long adrs, long ndump)
+{
+       long n, m, r, nr;
+       unsigned char temp[16];
+
+       for (n = ndump; n > 0;) {
+               r = n < 16? n: 16;
+               nr = mread(adrs, temp, r);
+               adrs += nr;
+               for (m = 0; m < r; ++m) {
+                       if (m < nr)
+                               printf("%.2x", temp[m]);
+                       else
+                               printf("%s", fault_chars[fault_type]);
+               }
+               n -= r;
+               if (nr < r)
+                       break;
+       }
+       printf("\n");
+}
+
 #define isxdigit(c)    (('0' <= (c) && (c) <= '9') \
                         || ('a' <= (c) && (c) <= 'f') \
                         || ('A' <= (c) && (c) <= 'F'))
@@ -1960,6 +1979,13 @@ dump(void)
                        nidump = MAX_DUMP;
                adrs += ppc_inst_dump(adrs, nidump, 1);
                last_cmd = "di\n";
+       } else if (c == 'r') {
+               scanhex(&ndump);
+               if (ndump == 0)
+                       ndump = 64;
+               xmon_rawdump(adrs, ndump);
+               adrs += ndump;
+               last_cmd = "dr\n";
        } else {
                scanhex(&ndump);
                if (ndump == 0)