| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * 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>
 | 
					
						
							| 
									
										
										
										
											2014-10-30 22:07:37 +09:00
										 |  |  | #include <asm/mmu_context.h>
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #include <asm/page.h>
 | 
					
						
							|  |  |  | #include <asm/pgtable.h>
 | 
					
						
							| 
									
										
										
										
											2007-07-12 00:51:00 +09:00
										 |  |  | #include <asm/tlbdebug.h>
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-06-02 00:30:25 +09:00
										 |  |  | static void dump_tlb(int first, int last) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							|  |  |  | 	int	i; | 
					
						
							|  |  |  | 	unsigned int asid; | 
					
						
							|  |  |  | 	unsigned long entryhi, entrylo0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 22:07:37 +09:00
										 |  |  | 	asid = read_c0_entryhi() & ASID_MASK; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	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"); | 
					
						
							| 
									
										
										
										
											2013-01-22 12:59:30 +01:00
										 |  |  | 		entryhi	 = read_c0_entryhi(); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 		entrylo0 = read_c0_entrylo0(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		/* Unused entries have a virtual address of KSEG0.  */ | 
					
						
							| 
									
										
										
										
											2015-05-19 09:50:35 +01:00
										 |  |  | 		if ((entryhi & PAGE_MASK) != KSEG0 && | 
					
						
							|  |  |  | 		    (entrylo0 & R3K_ENTRYLO_G || | 
					
						
							|  |  |  | 		     (entryhi & ASID_MASK) == asid)) { | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 			/*
 | 
					
						
							|  |  |  | 			 * Only print entries in use | 
					
						
							|  |  |  | 			 */ | 
					
						
							|  |  |  | 			printk("Index: %2d ", i); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			printk("va=%08lx asid=%08lx" | 
					
						
							|  |  |  | 			       "  [pa=%06lx n=%d d=%d v=%d g=%d]", | 
					
						
							| 
									
										
										
										
											2014-10-30 22:07:38 +09:00
										 |  |  | 			       entryhi & PAGE_MASK, | 
					
						
							| 
									
										
										
										
											2014-10-30 22:07:37 +09:00
										 |  |  | 			       entryhi & ASID_MASK, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 			       entrylo0 & PAGE_MASK, | 
					
						
							| 
									
										
										
										
											2015-05-19 09:50:34 +01:00
										 |  |  | 			       (entrylo0 & R3K_ENTRYLO_N) ? 1 : 0, | 
					
						
							|  |  |  | 			       (entrylo0 & R3K_ENTRYLO_D) ? 1 : 0, | 
					
						
							|  |  |  | 			       (entrylo0 & R3K_ENTRYLO_V) ? 1 : 0, | 
					
						
							|  |  |  | 			       (entrylo0 & R3K_ENTRYLO_G) ? 1 : 0); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	printk("\n"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	write_c0_entryhi(asid); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void dump_tlb_all(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	dump_tlb(0, current_cpu_data.tlbsize - 1); | 
					
						
							|  |  |  | } |