forked from luck/tmp_suning_uos_patched
8a98495c70
Since commit 4bcc595ccd
("printk: reinstate KERN_CONT for printing
continuation lines") the output from TLB dumps on MIPS has been
pretty unreadable due to the lack of KERN_CONT markers. Use pr_cont to
provide the appropriate markers & restore the expected output.
Continuation is also used for the second line of each TLB entry printed
in dump_tlb.c even though it has a newline, since it is a continuation
of the interpretation of the same TLB entry. For example:
[ 46.371884] Index: 0 pgmask=16kb va=77654000 asid=73 gid=00
[ri=0 xi=0 pa=ffc18000 c=5 d=0 v=1 g=0] [ri=0 xi=0 pa=ffc1c000 c=5 d=0 v=1 g=0]
[ 46.385380] Index: 12 pgmask=16kb va=004b4000 asid=73 gid=00
[ri=0 xi=0 pa=00000000 c=0 d=0 v=0 g=0] [ri=0 xi=0 pa=ffb00000 c=5 d=1 v=1 g=0]
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Maciej W. Rozycki <macro@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14444/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
76 lines
1.7 KiB
C
76 lines
1.7 KiB
C
/*
|
|
* Dump R3000 TLB for debugging purposes.
|
|
*
|
|
* Copyright (C) 1994, 1995 by Waldorf Electronics, written by Ralf Baechle.
|
|
* Copyright (C) 1999 by Silicon Graphics, Inc.
|
|
* Copyright (C) 1999 by Harald Koerfgen
|
|
*/
|
|
#include <linux/kernel.h>
|
|
#include <linux/mm.h>
|
|
|
|
#include <asm/mipsregs.h>
|
|
#include <asm/mmu_context.h>
|
|
#include <asm/page.h>
|
|
#include <asm/pgtable.h>
|
|
#include <asm/tlbdebug.h>
|
|
|
|
extern int r3k_have_wired_reg;
|
|
|
|
void dump_tlb_regs(void)
|
|
{
|
|
pr_info("Index : %0x\n", read_c0_index());
|
|
pr_info("EntryHi : %0lx\n", read_c0_entryhi());
|
|
pr_info("EntryLo : %0lx\n", read_c0_entrylo0());
|
|
if (r3k_have_wired_reg)
|
|
pr_info("Wired : %0x\n", read_c0_wired());
|
|
}
|
|
|
|
static void dump_tlb(int first, int last)
|
|
{
|
|
int i;
|
|
unsigned int asid;
|
|
unsigned long entryhi, entrylo0, asid_mask;
|
|
|
|
asid_mask = cpu_asid_mask(¤t_cpu_data);
|
|
asid = read_c0_entryhi() & asid_mask;
|
|
|
|
for (i = first; i <= last; i++) {
|
|
write_c0_index(i<<8);
|
|
__asm__ __volatile__(
|
|
".set\tnoreorder\n\t"
|
|
"tlbr\n\t"
|
|
"nop\n\t"
|
|
".set\treorder");
|
|
entryhi = read_c0_entryhi();
|
|
entrylo0 = read_c0_entrylo0();
|
|
|
|
/* Unused entries have a virtual address of KSEG0. */
|
|
if ((entryhi & PAGE_MASK) != KSEG0 &&
|
|
(entrylo0 & R3K_ENTRYLO_G ||
|
|
(entryhi & asid_mask) == asid)) {
|
|
/*
|
|
* Only print entries in use
|
|
*/
|
|
printk("Index: %2d ", i);
|
|
|
|
pr_cont("va=%08lx asid=%08lx"
|
|
" [pa=%06lx n=%d d=%d v=%d g=%d]",
|
|
entryhi & PAGE_MASK,
|
|
entryhi & asid_mask,
|
|
entrylo0 & PAGE_MASK,
|
|
(entrylo0 & R3K_ENTRYLO_N) ? 1 : 0,
|
|
(entrylo0 & R3K_ENTRYLO_D) ? 1 : 0,
|
|
(entrylo0 & R3K_ENTRYLO_V) ? 1 : 0,
|
|
(entrylo0 & R3K_ENTRYLO_G) ? 1 : 0);
|
|
}
|
|
}
|
|
printk("\n");
|
|
|
|
write_c0_entryhi(asid);
|
|
}
|
|
|
|
void dump_tlb_all(void)
|
|
{
|
|
dump_tlb(0, current_cpu_data.tlbsize - 1);
|
|
}
|