diff options
Diffstat (limited to 'arch/powerpc/xmon/xmon.c')
-rw-r--r-- | arch/powerpc/xmon/xmon.c | 75 |
1 files changed, 63 insertions, 12 deletions
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index 121b04d165d1..a34172ddc468 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <asm/spu.h> | 40 | #include <asm/spu.h> |
41 | #include <asm/spu_priv1.h> | 41 | #include <asm/spu_priv1.h> |
42 | #include <asm/firmware.h> | 42 | #include <asm/firmware.h> |
43 | #include <asm/setjmp.h> | ||
43 | 44 | ||
44 | #ifdef CONFIG_PPC64 | 45 | #ifdef CONFIG_PPC64 |
45 | #include <asm/hvcall.h> | 46 | #include <asm/hvcall.h> |
@@ -71,12 +72,9 @@ static unsigned long ncsum = 4096; | |||
71 | static int termch; | 72 | static int termch; |
72 | static char tmpstr[128]; | 73 | static char tmpstr[128]; |
73 | 74 | ||
74 | #define JMP_BUF_LEN 23 | ||
75 | static long bus_error_jmp[JMP_BUF_LEN]; | 75 | static long bus_error_jmp[JMP_BUF_LEN]; |
76 | static int catch_memory_errors; | 76 | static int catch_memory_errors; |
77 | static long *xmon_fault_jmp[NR_CPUS]; | 77 | static long *xmon_fault_jmp[NR_CPUS]; |
78 | #define setjmp xmon_setjmp | ||
79 | #define longjmp xmon_longjmp | ||
80 | 78 | ||
81 | /* Breakpoint stuff */ | 79 | /* Breakpoint stuff */ |
82 | struct bpt { | 80 | struct bpt { |
@@ -153,13 +151,15 @@ static const char *getvecname(unsigned long vec); | |||
153 | 151 | ||
154 | static int do_spu_cmd(void); | 152 | static int do_spu_cmd(void); |
155 | 153 | ||
154 | #ifdef CONFIG_44x | ||
155 | static void dump_tlb_44x(void); | ||
156 | #endif | ||
157 | |||
156 | int xmon_no_auto_backtrace; | 158 | int xmon_no_auto_backtrace; |
157 | 159 | ||
158 | extern void xmon_enter(void); | 160 | extern void xmon_enter(void); |
159 | extern void xmon_leave(void); | 161 | extern void xmon_leave(void); |
160 | 162 | ||
161 | extern long setjmp(long *); | ||
162 | extern void longjmp(long *, long); | ||
163 | extern void xmon_save_regs(struct pt_regs *); | 163 | extern void xmon_save_regs(struct pt_regs *); |
164 | 164 | ||
165 | #ifdef CONFIG_PPC64 | 165 | #ifdef CONFIG_PPC64 |
@@ -231,6 +231,9 @@ Commands:\n\ | |||
231 | #ifdef CONFIG_PPC_STD_MMU_32 | 231 | #ifdef CONFIG_PPC_STD_MMU_32 |
232 | " u dump segment registers\n" | 232 | " u dump segment registers\n" |
233 | #endif | 233 | #endif |
234 | #ifdef CONFIG_44x | ||
235 | " u dump TLB\n" | ||
236 | #endif | ||
234 | " ? help\n" | 237 | " ? help\n" |
235 | " zr reboot\n\ | 238 | " zr reboot\n\ |
236 | zh halt\n" | 239 | zh halt\n" |
@@ -856,6 +859,11 @@ cmds(struct pt_regs *excp) | |||
856 | dump_segments(); | 859 | dump_segments(); |
857 | break; | 860 | break; |
858 | #endif | 861 | #endif |
862 | #ifdef CONFIG_4xx | ||
863 | case 'u': | ||
864 | dump_tlb_44x(); | ||
865 | break; | ||
866 | #endif | ||
859 | default: | 867 | default: |
860 | printf("Unrecognized command: "); | 868 | printf("Unrecognized command: "); |
861 | do { | 869 | do { |
@@ -2527,16 +2535,33 @@ static void xmon_print_symbol(unsigned long address, const char *mid, | |||
2527 | static void dump_slb(void) | 2535 | static void dump_slb(void) |
2528 | { | 2536 | { |
2529 | int i; | 2537 | int i; |
2530 | unsigned long tmp; | 2538 | unsigned long esid,vsid,valid; |
2539 | unsigned long llp; | ||
2531 | 2540 | ||
2532 | printf("SLB contents of cpu %x\n", smp_processor_id()); | 2541 | printf("SLB contents of cpu %x\n", smp_processor_id()); |
2533 | 2542 | ||
2534 | for (i = 0; i < SLB_NUM_ENTRIES; i++) { | 2543 | for (i = 0; i < mmu_slb_size; i++) { |
2535 | asm volatile("slbmfee %0,%1" : "=r" (tmp) : "r" (i)); | 2544 | asm volatile("slbmfee %0,%1" : "=r" (esid) : "r" (i)); |
2536 | printf("%02d %016lx ", i, tmp); | 2545 | asm volatile("slbmfev %0,%1" : "=r" (vsid) : "r" (i)); |
2537 | 2546 | valid = (esid & SLB_ESID_V); | |
2538 | asm volatile("slbmfev %0,%1" : "=r" (tmp) : "r" (i)); | 2547 | if (valid | esid | vsid) { |
2539 | printf("%016lx\n", tmp); | 2548 | printf("%02d %016lx %016lx", i, esid, vsid); |
2549 | if (valid) { | ||
2550 | llp = vsid & SLB_VSID_LLP; | ||
2551 | if (vsid & SLB_VSID_B_1T) { | ||
2552 | printf(" 1T ESID=%9lx VSID=%13lx LLP:%3lx \n", | ||
2553 | GET_ESID_1T(esid), | ||
2554 | (vsid & ~SLB_VSID_B) >> SLB_VSID_SHIFT_1T, | ||
2555 | llp); | ||
2556 | } else { | ||
2557 | printf(" 256M ESID=%9lx VSID=%13lx LLP:%3lx \n", | ||
2558 | GET_ESID(esid), | ||
2559 | (vsid & ~SLB_VSID_B) >> SLB_VSID_SHIFT, | ||
2560 | llp); | ||
2561 | } | ||
2562 | } else | ||
2563 | printf("\n"); | ||
2564 | } | ||
2540 | } | 2565 | } |
2541 | } | 2566 | } |
2542 | 2567 | ||
@@ -2581,6 +2606,32 @@ void dump_segments(void) | |||
2581 | } | 2606 | } |
2582 | #endif | 2607 | #endif |
2583 | 2608 | ||
2609 | #ifdef CONFIG_44x | ||
2610 | static void dump_tlb_44x(void) | ||
2611 | { | ||
2612 | int i; | ||
2613 | |||
2614 | for (i = 0; i < PPC44x_TLB_SIZE; i++) { | ||
2615 | unsigned long w0,w1,w2; | ||
2616 | asm volatile("tlbre %0,%1,0" : "=r" (w0) : "r" (i)); | ||
2617 | asm volatile("tlbre %0,%1,1" : "=r" (w1) : "r" (i)); | ||
2618 | asm volatile("tlbre %0,%1,2" : "=r" (w2) : "r" (i)); | ||
2619 | printf("[%02x] %08x %08x %08x ", i, w0, w1, w2); | ||
2620 | if (w0 & PPC44x_TLB_VALID) { | ||
2621 | printf("V %08x -> %01x%08x %c%c%c%c%c", | ||
2622 | w0 & PPC44x_TLB_EPN_MASK, | ||
2623 | w1 & PPC44x_TLB_ERPN_MASK, | ||
2624 | w1 & PPC44x_TLB_RPN_MASK, | ||
2625 | (w2 & PPC44x_TLB_W) ? 'W' : 'w', | ||
2626 | (w2 & PPC44x_TLB_I) ? 'I' : 'i', | ||
2627 | (w2 & PPC44x_TLB_M) ? 'M' : 'm', | ||
2628 | (w2 & PPC44x_TLB_G) ? 'G' : 'g', | ||
2629 | (w2 & PPC44x_TLB_E) ? 'E' : 'e'); | ||
2630 | } | ||
2631 | printf("\n"); | ||
2632 | } | ||
2633 | } | ||
2634 | #endif /* CONFIG_44x */ | ||
2584 | void xmon_init(int enable) | 2635 | void xmon_init(int enable) |
2585 | { | 2636 | { |
2586 | #ifdef CONFIG_PPC_ISERIES | 2637 | #ifdef CONFIG_PPC_ISERIES |