diff options
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/lib/dump_tlb.c | 144 | ||||
-rw-r--r-- | arch/mips/lib/r3k_dump_tlb.c | 122 | ||||
-rw-r--r-- | arch/mips/sgi-ip27/ip27-berr.c | 1 |
3 files changed, 2 insertions, 265 deletions
diff --git a/arch/mips/lib/dump_tlb.c b/arch/mips/lib/dump_tlb.c index fbf4b72f4306..1a4db7dc77cb 100644 --- a/arch/mips/lib/dump_tlb.c +++ b/arch/mips/lib/dump_tlb.c | |||
@@ -6,12 +6,7 @@ | |||
6 | */ | 6 | */ |
7 | #include <linux/kernel.h> | 7 | #include <linux/kernel.h> |
8 | #include <linux/mm.h> | 8 | #include <linux/mm.h> |
9 | #include <linux/sched.h> | ||
10 | #include <linux/string.h> | ||
11 | 9 | ||
12 | #include <asm/bootinfo.h> | ||
13 | #include <asm/cachectl.h> | ||
14 | #include <asm/cpu.h> | ||
15 | #include <asm/mipsregs.h> | 10 | #include <asm/mipsregs.h> |
16 | #include <asm/page.h> | 11 | #include <asm/page.h> |
17 | #include <asm/pgtable.h> | 12 | #include <asm/pgtable.h> |
@@ -40,7 +35,7 @@ static inline const char *msk2str(unsigned int mask) | |||
40 | "nop;nop;nop;nop;nop;nop;nop\n\t" \ | 35 | "nop;nop;nop;nop;nop;nop;nop\n\t" \ |
41 | ".set\treorder"); | 36 | ".set\treorder"); |
42 | 37 | ||
43 | void dump_tlb(int first, int last) | 38 | static void dump_tlb(int first, int last) |
44 | { | 39 | { |
45 | unsigned long s_entryhi, entryhi, asid; | 40 | unsigned long s_entryhi, entryhi, asid; |
46 | unsigned long long entrylo0, entrylo1; | 41 | unsigned long long entrylo0, entrylo1; |
@@ -103,140 +98,3 @@ void dump_tlb_all(void) | |||
103 | { | 98 | { |
104 | dump_tlb(0, current_cpu_data.tlbsize - 1); | 99 | dump_tlb(0, current_cpu_data.tlbsize - 1); |
105 | } | 100 | } |
106 | |||
107 | void dump_tlb_wired(void) | ||
108 | { | ||
109 | int wired; | ||
110 | |||
111 | wired = read_c0_wired(); | ||
112 | printk("Wired: %d", wired); | ||
113 | dump_tlb(0, read_c0_wired()); | ||
114 | } | ||
115 | |||
116 | void dump_tlb_addr(unsigned long addr) | ||
117 | { | ||
118 | unsigned int flags, oldpid; | ||
119 | int index; | ||
120 | |||
121 | local_irq_save(flags); | ||
122 | oldpid = read_c0_entryhi() & 0xff; | ||
123 | BARRIER(); | ||
124 | write_c0_entryhi((addr & PAGE_MASK) | oldpid); | ||
125 | BARRIER(); | ||
126 | tlb_probe(); | ||
127 | BARRIER(); | ||
128 | index = read_c0_index(); | ||
129 | write_c0_entryhi(oldpid); | ||
130 | local_irq_restore(flags); | ||
131 | |||
132 | if (index < 0) { | ||
133 | printk("No entry for address 0x%08lx in TLB\n", addr); | ||
134 | return; | ||
135 | } | ||
136 | |||
137 | printk("Entry %d maps address 0x%08lx\n", index, addr); | ||
138 | dump_tlb(index, index); | ||
139 | } | ||
140 | |||
141 | void dump_tlb_nonwired(void) | ||
142 | { | ||
143 | dump_tlb(read_c0_wired(), current_cpu_data.tlbsize - 1); | ||
144 | } | ||
145 | |||
146 | void dump_list_process(struct task_struct *t, void *address) | ||
147 | { | ||
148 | pgd_t *page_dir, *pgd; | ||
149 | pud_t *pud; | ||
150 | pmd_t *pmd; | ||
151 | pte_t *pte, page; | ||
152 | unsigned long addr, val; | ||
153 | int width = sizeof(long) * 2; | ||
154 | |||
155 | addr = (unsigned long) address; | ||
156 | |||
157 | printk("Addr == %08lx\n", addr); | ||
158 | #ifdef CONFIG_64BIT | ||
159 | printk("tasks->mm.pgd == %08lx\n", (unsigned long) t->mm->pgd); | ||
160 | #endif | ||
161 | |||
162 | #ifdef CONFIG_64BIT | ||
163 | page_dir = pgd_offset(t->mm, 0UL); | ||
164 | pgd = pgd_offset(t->mm, addr); | ||
165 | #else | ||
166 | if (addr > KSEG0) { | ||
167 | page_dir = pgd_offset_k(0); | ||
168 | pgd = pgd_offset_k(addr); | ||
169 | } else if (t->mm) { | ||
170 | page_dir = pgd_offset(t->mm, 0); | ||
171 | pgd = pgd_offset(t->mm, addr); | ||
172 | } else { | ||
173 | printk("Current thread has no mm\n"); | ||
174 | return; | ||
175 | } | ||
176 | #endif | ||
177 | printk("page_dir == %0*lx\n", width, (unsigned long) page_dir); | ||
178 | printk("pgd == %0*lx\n", width, (unsigned long) pgd); | ||
179 | |||
180 | pud = pud_offset(pgd, addr); | ||
181 | printk("pud == %0*lx\n", width, (unsigned long) pud); | ||
182 | |||
183 | pmd = pmd_offset(pud, addr); | ||
184 | printk("pmd == %0*lx\n", width, (unsigned long) pmd); | ||
185 | |||
186 | pte = pte_offset(pmd, addr); | ||
187 | printk("pte == %0*lx\n", width, (unsigned long) pte); | ||
188 | |||
189 | page = *pte; | ||
190 | #ifdef CONFIG_64BIT_PHYS_ADDR | ||
191 | printk("page == %08Lx\n", pte_val(page)); | ||
192 | #else | ||
193 | printk("page == %0*lx\n", width, pte_val(page)); | ||
194 | #endif | ||
195 | |||
196 | val = pte_val(page); | ||
197 | if (val & _PAGE_PRESENT) printk("present "); | ||
198 | if (val & _PAGE_READ) printk("read "); | ||
199 | if (val & _PAGE_WRITE) printk("write "); | ||
200 | if (val & _PAGE_ACCESSED) printk("accessed "); | ||
201 | if (val & _PAGE_MODIFIED) printk("modified "); | ||
202 | if (val & _PAGE_R4KBUG) printk("r4kbug "); | ||
203 | if (val & _PAGE_GLOBAL) printk("global "); | ||
204 | if (val & _PAGE_VALID) printk("valid "); | ||
205 | printk("\n"); | ||
206 | } | ||
207 | |||
208 | void dump_list_current(void *address) | ||
209 | { | ||
210 | dump_list_process(current, address); | ||
211 | } | ||
212 | |||
213 | unsigned long vtop(void *address) | ||
214 | { | ||
215 | pgd_t *pgd; | ||
216 | pud_t *pud; | ||
217 | pmd_t *pmd; | ||
218 | pte_t *pte; | ||
219 | unsigned long addr, paddr; | ||
220 | |||
221 | addr = (unsigned long) address; | ||
222 | pgd = pgd_offset(current->mm, addr); | ||
223 | pud = pud_offset(pgd, addr); | ||
224 | pmd = pmd_offset(pud, addr); | ||
225 | pte = pte_offset(pmd, addr); | ||
226 | paddr = (CKSEG1 | (unsigned int) pte_val(*pte)) & PAGE_MASK; | ||
227 | paddr |= (addr & ~PAGE_MASK); | ||
228 | |||
229 | return paddr; | ||
230 | } | ||
231 | |||
232 | void dump16(unsigned long *p) | ||
233 | { | ||
234 | int i; | ||
235 | |||
236 | for (i = 0; i < 8; i++) { | ||
237 | printk("*%08lx == %08lx, ", (unsigned long)p, *p); | ||
238 | p++; | ||
239 | printk("*%08lx == %08lx\n", (unsigned long)p, *p); | ||
240 | p++; | ||
241 | } | ||
242 | } | ||
diff --git a/arch/mips/lib/r3k_dump_tlb.c b/arch/mips/lib/r3k_dump_tlb.c index 4f2cb74f0766..52f87795ecc3 100644 --- a/arch/mips/lib/r3k_dump_tlb.c +++ b/arch/mips/lib/r3k_dump_tlb.c | |||
@@ -7,19 +7,14 @@ | |||
7 | */ | 7 | */ |
8 | #include <linux/kernel.h> | 8 | #include <linux/kernel.h> |
9 | #include <linux/mm.h> | 9 | #include <linux/mm.h> |
10 | #include <linux/sched.h> | ||
11 | #include <linux/string.h> | ||
12 | 10 | ||
13 | #include <asm/bootinfo.h> | ||
14 | #include <asm/cachectl.h> | ||
15 | #include <asm/cpu.h> | ||
16 | #include <asm/mipsregs.h> | 11 | #include <asm/mipsregs.h> |
17 | #include <asm/page.h> | 12 | #include <asm/page.h> |
18 | #include <asm/pgtable.h> | 13 | #include <asm/pgtable.h> |
19 | 14 | ||
20 | extern int r3k_have_wired_reg; /* defined in tlb-r3k.c */ | 15 | extern int r3k_have_wired_reg; /* defined in tlb-r3k.c */ |
21 | 16 | ||
22 | void dump_tlb(int first, int last) | 17 | static void dump_tlb(int first, int last) |
23 | { | 18 | { |
24 | int i; | 19 | int i; |
25 | unsigned int asid; | 20 | unsigned int asid; |
@@ -65,118 +60,3 @@ void dump_tlb_all(void) | |||
65 | { | 60 | { |
66 | dump_tlb(0, current_cpu_data.tlbsize - 1); | 61 | dump_tlb(0, current_cpu_data.tlbsize - 1); |
67 | } | 62 | } |
68 | |||
69 | void dump_tlb_wired(void) | ||
70 | { | ||
71 | int wired = r3k_have_wired_reg ? read_c0_wired() : 8; | ||
72 | |||
73 | printk("Wired: %d", wired); | ||
74 | dump_tlb(0, wired - 1); | ||
75 | } | ||
76 | |||
77 | void dump_tlb_addr(unsigned long addr) | ||
78 | { | ||
79 | unsigned long flags, oldpid; | ||
80 | int index; | ||
81 | |||
82 | local_irq_save(flags); | ||
83 | oldpid = read_c0_entryhi() & 0xff; | ||
84 | write_c0_entryhi((addr & PAGE_MASK) | oldpid); | ||
85 | tlb_probe(); | ||
86 | index = read_c0_index(); | ||
87 | write_c0_entryhi(oldpid); | ||
88 | local_irq_restore(flags); | ||
89 | |||
90 | if (index < 0) { | ||
91 | printk("No entry for address 0x%08lx in TLB\n", addr); | ||
92 | return; | ||
93 | } | ||
94 | |||
95 | printk("Entry %d maps address 0x%08lx\n", index, addr); | ||
96 | dump_tlb(index, index); | ||
97 | } | ||
98 | |||
99 | void dump_tlb_nonwired(void) | ||
100 | { | ||
101 | int wired = r3k_have_wired_reg ? read_c0_wired() : 8; | ||
102 | dump_tlb(wired, current_cpu_data.tlbsize - 1); | ||
103 | } | ||
104 | |||
105 | void dump_list_process(struct task_struct *t, void *address) | ||
106 | { | ||
107 | pgd_t *page_dir, *pgd; | ||
108 | pud_t *pud; | ||
109 | pmd_t *pmd; | ||
110 | pte_t *pte, page; | ||
111 | unsigned int addr; | ||
112 | unsigned long val; | ||
113 | |||
114 | addr = (unsigned int) address; | ||
115 | |||
116 | printk("Addr == %08x\n", addr); | ||
117 | printk("tasks->mm.pgd == %08x\n", (unsigned int) t->mm->pgd); | ||
118 | |||
119 | page_dir = pgd_offset(t->mm, 0); | ||
120 | printk("page_dir == %08x\n", (unsigned int) page_dir); | ||
121 | |||
122 | pgd = pgd_offset(t->mm, addr); | ||
123 | printk("pgd == %08x, ", (unsigned int) pgd); | ||
124 | |||
125 | pud = pud_offset(pgd, addr); | ||
126 | printk("pud == %08x, ", (unsigned int) pud); | ||
127 | |||
128 | pmd = pmd_offset(pud, addr); | ||
129 | printk("pmd == %08x, ", (unsigned int) pmd); | ||
130 | |||
131 | pte = pte_offset(pmd, addr); | ||
132 | printk("pte == %08x, ", (unsigned int) pte); | ||
133 | |||
134 | page = *pte; | ||
135 | printk("page == %08x\n", (unsigned int) pte_val(page)); | ||
136 | |||
137 | val = pte_val(page); | ||
138 | if (val & _PAGE_PRESENT) printk("present "); | ||
139 | if (val & _PAGE_READ) printk("read "); | ||
140 | if (val & _PAGE_WRITE) printk("write "); | ||
141 | if (val & _PAGE_ACCESSED) printk("accessed "); | ||
142 | if (val & _PAGE_MODIFIED) printk("modified "); | ||
143 | if (val & _PAGE_GLOBAL) printk("global "); | ||
144 | if (val & _PAGE_VALID) printk("valid "); | ||
145 | printk("\n"); | ||
146 | } | ||
147 | |||
148 | void dump_list_current(void *address) | ||
149 | { | ||
150 | dump_list_process(current, address); | ||
151 | } | ||
152 | |||
153 | unsigned int vtop(void *address) | ||
154 | { | ||
155 | pgd_t *pgd; | ||
156 | pud_t *pud; | ||
157 | pmd_t *pmd; | ||
158 | pte_t *pte; | ||
159 | unsigned int addr, paddr; | ||
160 | |||
161 | addr = (unsigned long) address; | ||
162 | pgd = pgd_offset(current->mm, addr); | ||
163 | pud = pud_offset(pgd, addr); | ||
164 | pmd = pmd_offset(pud, addr); | ||
165 | pte = pte_offset(pmd, addr); | ||
166 | paddr = (KSEG1 | (unsigned int) pte_val(*pte)) & PAGE_MASK; | ||
167 | paddr |= (addr & ~PAGE_MASK); | ||
168 | |||
169 | return paddr; | ||
170 | } | ||
171 | |||
172 | void dump16(unsigned long *p) | ||
173 | { | ||
174 | int i; | ||
175 | |||
176 | for (i = 0; i < 8; i++) { | ||
177 | printk("*%08lx == %08lx, ", (unsigned long)p, *p); | ||
178 | p++; | ||
179 | printk("*%08lx == %08lx\n", (unsigned long)p, *p); | ||
180 | p++; | ||
181 | } | ||
182 | } | ||
diff --git a/arch/mips/sgi-ip27/ip27-berr.c b/arch/mips/sgi-ip27/ip27-berr.c index ce907eda221b..123141ab21a2 100644 --- a/arch/mips/sgi-ip27/ip27-berr.c +++ b/arch/mips/sgi-ip27/ip27-berr.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <asm/traps.h> | 21 | #include <asm/traps.h> |
22 | #include <asm/uaccess.h> | 22 | #include <asm/uaccess.h> |
23 | 23 | ||
24 | extern void dump_tlb_addr(unsigned long addr); | ||
25 | extern void dump_tlb_all(void); | 24 | extern void dump_tlb_all(void); |
26 | 25 | ||
27 | static void dump_hub_information(unsigned long errst0, unsigned long errst1) | 26 | static void dump_hub_information(unsigned long errst0, unsigned long errst1) |