diff options
Diffstat (limited to 'arch/mips/lib')
-rw-r--r-- | arch/mips/lib/Makefile | 21 | ||||
-rw-r--r-- | arch/mips/lib/dump_tlb.c | 101 | ||||
-rw-r--r-- | arch/mips/lib/r3k_dump_tlb.c | 63 | ||||
-rw-r--r-- | arch/mips/lib/ucmpdi2.c | 2 | ||||
-rw-r--r-- | arch/mips/lib/uncached.c | 1 |
5 files changed, 186 insertions, 2 deletions
diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile index 5dad13efba7e..91ed1eb33102 100644 --- a/arch/mips/lib/Makefile +++ b/arch/mips/lib/Makefile | |||
@@ -8,5 +8,24 @@ lib-y += csum_partial.o memcpy.o memcpy-inatomic.o memset.o strlen_user.o \ | |||
8 | obj-y += iomap.o | 8 | obj-y += iomap.o |
9 | obj-$(CONFIG_PCI) += iomap-pci.o | 9 | obj-$(CONFIG_PCI) += iomap-pci.o |
10 | 10 | ||
11 | obj-$(CONFIG_CPU_LOONGSON2) += dump_tlb.o | ||
12 | obj-$(CONFIG_CPU_MIPS32) += dump_tlb.o | ||
13 | obj-$(CONFIG_CPU_MIPS64) += dump_tlb.o | ||
14 | obj-$(CONFIG_CPU_NEVADA) += dump_tlb.o | ||
15 | obj-$(CONFIG_CPU_R10000) += dump_tlb.o | ||
16 | obj-$(CONFIG_CPU_R3000) += r3k_dump_tlb.o | ||
17 | obj-$(CONFIG_CPU_R4300) += dump_tlb.o | ||
18 | obj-$(CONFIG_CPU_R4X00) += dump_tlb.o | ||
19 | obj-$(CONFIG_CPU_R5000) += dump_tlb.o | ||
20 | obj-$(CONFIG_CPU_R5432) += dump_tlb.o | ||
21 | obj-$(CONFIG_CPU_R6000) += | ||
22 | obj-$(CONFIG_CPU_R8000) += | ||
23 | obj-$(CONFIG_CPU_RM7000) += dump_tlb.o | ||
24 | obj-$(CONFIG_CPU_RM9000) += dump_tlb.o | ||
25 | obj-$(CONFIG_CPU_SB1) += dump_tlb.o | ||
26 | obj-$(CONFIG_CPU_TX39XX) += r3k_dump_tlb.o | ||
27 | obj-$(CONFIG_CPU_TX49XX) += dump_tlb.o | ||
28 | obj-$(CONFIG_CPU_VR41XX) += dump_tlb.o | ||
29 | |||
11 | # libgcc-style stuff needed in the kernel | 30 | # libgcc-style stuff needed in the kernel |
12 | lib-y += ashldi3.o ashrdi3.o lshrdi3.o ucmpdi2.o | 31 | obj-y += ashldi3.o ashrdi3.o lshrdi3.o ucmpdi2.o |
diff --git a/arch/mips/lib/dump_tlb.c b/arch/mips/lib/dump_tlb.c new file mode 100644 index 000000000000..465ff0ec85b9 --- /dev/null +++ b/arch/mips/lib/dump_tlb.c | |||
@@ -0,0 +1,101 @@ | |||
1 | /* | ||
2 | * Dump R4x00 TLB for debugging purposes. | ||
3 | * | ||
4 | * Copyright (C) 1994, 1995 by Waldorf Electronics, written by Ralf Baechle. | ||
5 | * Copyright (C) 1999 by Silicon Graphics, Inc. | ||
6 | */ | ||
7 | #include <linux/kernel.h> | ||
8 | #include <linux/mm.h> | ||
9 | |||
10 | #include <asm/mipsregs.h> | ||
11 | #include <asm/page.h> | ||
12 | #include <asm/pgtable.h> | ||
13 | #include <asm/tlbdebug.h> | ||
14 | |||
15 | static inline const char *msk2str(unsigned int mask) | ||
16 | { | ||
17 | switch (mask) { | ||
18 | case PM_4K: return "4kb"; | ||
19 | case PM_16K: return "16kb"; | ||
20 | case PM_64K: return "64kb"; | ||
21 | case PM_256K: return "256kb"; | ||
22 | #ifndef CONFIG_CPU_VR41XX | ||
23 | case PM_1M: return "1Mb"; | ||
24 | case PM_4M: return "4Mb"; | ||
25 | case PM_16M: return "16Mb"; | ||
26 | case PM_64M: return "64Mb"; | ||
27 | case PM_256M: return "256Mb"; | ||
28 | #endif | ||
29 | } | ||
30 | return ""; | ||
31 | } | ||
32 | |||
33 | #define BARRIER() \ | ||
34 | __asm__ __volatile__( \ | ||
35 | ".set\tnoreorder\n\t" \ | ||
36 | "nop;nop;nop;nop;nop;nop;nop\n\t" \ | ||
37 | ".set\treorder"); | ||
38 | |||
39 | static void dump_tlb(int first, int last) | ||
40 | { | ||
41 | unsigned long s_entryhi, entryhi, asid; | ||
42 | unsigned long long entrylo0, entrylo1; | ||
43 | unsigned int s_index, pagemask, c0, c1, i; | ||
44 | |||
45 | s_entryhi = read_c0_entryhi(); | ||
46 | s_index = read_c0_index(); | ||
47 | asid = s_entryhi & 0xff; | ||
48 | |||
49 | for (i = first; i <= last; i++) { | ||
50 | write_c0_index(i); | ||
51 | BARRIER(); | ||
52 | tlb_read(); | ||
53 | BARRIER(); | ||
54 | pagemask = read_c0_pagemask(); | ||
55 | entryhi = read_c0_entryhi(); | ||
56 | entrylo0 = read_c0_entrylo0(); | ||
57 | entrylo1 = read_c0_entrylo1(); | ||
58 | |||
59 | /* Unused entries have a virtual address of CKSEG0. */ | ||
60 | if ((entryhi & ~0x1ffffUL) != CKSEG0 | ||
61 | && (entryhi & 0xff) == asid) { | ||
62 | #ifdef CONFIG_32BIT | ||
63 | int width = 8; | ||
64 | #else | ||
65 | int width = 11; | ||
66 | #endif | ||
67 | /* | ||
68 | * Only print entries in use | ||
69 | */ | ||
70 | printk("Index: %2d pgmask=%s ", i, msk2str(pagemask)); | ||
71 | |||
72 | c0 = (entrylo0 >> 3) & 7; | ||
73 | c1 = (entrylo1 >> 3) & 7; | ||
74 | |||
75 | printk("va=%0*lx asid=%02lx\n", | ||
76 | width, (entryhi & ~0x1fffUL), | ||
77 | entryhi & 0xff); | ||
78 | printk("\t[pa=%0*llx c=%d d=%d v=%d g=%d] ", | ||
79 | width, | ||
80 | (entrylo0 << 6) & PAGE_MASK, c0, | ||
81 | (entrylo0 & 4) ? 1 : 0, | ||
82 | (entrylo0 & 2) ? 1 : 0, | ||
83 | (entrylo0 & 1) ? 1 : 0); | ||
84 | printk("[pa=%0*llx c=%d d=%d v=%d g=%d]\n", | ||
85 | width, | ||
86 | (entrylo1 << 6) & PAGE_MASK, c1, | ||
87 | (entrylo1 & 4) ? 1 : 0, | ||
88 | (entrylo1 & 2) ? 1 : 0, | ||
89 | (entrylo1 & 1) ? 1 : 0); | ||
90 | } | ||
91 | } | ||
92 | printk("\n"); | ||
93 | |||
94 | write_c0_entryhi(s_entryhi); | ||
95 | write_c0_index(s_index); | ||
96 | } | ||
97 | |||
98 | void dump_tlb_all(void) | ||
99 | { | ||
100 | dump_tlb(0, current_cpu_data.tlbsize - 1); | ||
101 | } | ||
diff --git a/arch/mips/lib/r3k_dump_tlb.c b/arch/mips/lib/r3k_dump_tlb.c new file mode 100644 index 000000000000..9cee907975ae --- /dev/null +++ b/arch/mips/lib/r3k_dump_tlb.c | |||
@@ -0,0 +1,63 @@ | |||
1 | /* | ||
2 | * Dump R3000 TLB for debugging purposes. | ||
3 | * | ||
4 | * Copyright (C) 1994, 1995 by Waldorf Electronics, written by Ralf Baechle. | ||
5 | * Copyright (C) 1999 by Silicon Graphics, Inc. | ||
6 | * Copyright (C) 1999 by Harald Koerfgen | ||
7 | */ | ||
8 | #include <linux/kernel.h> | ||
9 | #include <linux/mm.h> | ||
10 | |||
11 | #include <asm/mipsregs.h> | ||
12 | #include <asm/page.h> | ||
13 | #include <asm/pgtable.h> | ||
14 | #include <asm/tlbdebug.h> | ||
15 | |||
16 | extern int r3k_have_wired_reg; /* defined in tlb-r3k.c */ | ||
17 | |||
18 | static void dump_tlb(int first, int last) | ||
19 | { | ||
20 | int i; | ||
21 | unsigned int asid; | ||
22 | unsigned long entryhi, entrylo0; | ||
23 | |||
24 | asid = read_c0_entryhi() & 0xfc0; | ||
25 | |||
26 | for (i = first; i <= last; i++) { | ||
27 | write_c0_index(i<<8); | ||
28 | __asm__ __volatile__( | ||
29 | ".set\tnoreorder\n\t" | ||
30 | "tlbr\n\t" | ||
31 | "nop\n\t" | ||
32 | ".set\treorder"); | ||
33 | entryhi = read_c0_entryhi(); | ||
34 | entrylo0 = read_c0_entrylo0(); | ||
35 | |||
36 | /* Unused entries have a virtual address of KSEG0. */ | ||
37 | if ((entryhi & 0xffffe000) != 0x80000000 | ||
38 | && (entryhi & 0xfc0) == asid) { | ||
39 | /* | ||
40 | * Only print entries in use | ||
41 | */ | ||
42 | printk("Index: %2d ", i); | ||
43 | |||
44 | printk("va=%08lx asid=%08lx" | ||
45 | " [pa=%06lx n=%d d=%d v=%d g=%d]", | ||
46 | (entryhi & 0xffffe000), | ||
47 | entryhi & 0xfc0, | ||
48 | entrylo0 & PAGE_MASK, | ||
49 | (entrylo0 & (1 << 11)) ? 1 : 0, | ||
50 | (entrylo0 & (1 << 10)) ? 1 : 0, | ||
51 | (entrylo0 & (1 << 9)) ? 1 : 0, | ||
52 | (entrylo0 & (1 << 8)) ? 1 : 0); | ||
53 | } | ||
54 | } | ||
55 | printk("\n"); | ||
56 | |||
57 | write_c0_entryhi(asid); | ||
58 | } | ||
59 | |||
60 | void dump_tlb_all(void) | ||
61 | { | ||
62 | dump_tlb(0, current_cpu_data.tlbsize - 1); | ||
63 | } | ||
diff --git a/arch/mips/lib/ucmpdi2.c b/arch/mips/lib/ucmpdi2.c index e9ff258ef028..e2ff6072b5a3 100644 --- a/arch/mips/lib/ucmpdi2.c +++ b/arch/mips/lib/ucmpdi2.c | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | #include "libgcc.h" | 3 | #include "libgcc.h" |
4 | 4 | ||
5 | word_type __ucmpdi2 (unsigned long a, unsigned long b) | 5 | word_type __ucmpdi2 (unsigned long long a, unsigned long long b) |
6 | { | 6 | { |
7 | const DWunion au = {.ll = a}; | 7 | const DWunion au = {.ll = a}; |
8 | const DWunion bu = {.ll = b}; | 8 | const DWunion bu = {.ll = b}; |
diff --git a/arch/mips/lib/uncached.c b/arch/mips/lib/uncached.c index 2388f7f3ffde..58d14f4d9349 100644 --- a/arch/mips/lib/uncached.c +++ b/arch/mips/lib/uncached.c | |||
@@ -12,6 +12,7 @@ | |||
12 | 12 | ||
13 | #include <asm/addrspace.h> | 13 | #include <asm/addrspace.h> |
14 | #include <asm/bug.h> | 14 | #include <asm/bug.h> |
15 | #include <asm/cacheflush.h> | ||
15 | 16 | ||
16 | #ifndef CKSEG2 | 17 | #ifndef CKSEG2 |
17 | #define CKSEG2 CKSSEG | 18 | #define CKSEG2 CKSSEG |