| 
									
										
										
										
											2009-01-08 16:46:40 -08:00
										 |  |  | /* | 
					
						
							|  |  |  |  * This file is subject to the terms and conditions of the GNU General Public | 
					
						
							|  |  |  |  * License.  See the file "COPYING" in the main directory of this archive | 
					
						
							|  |  |  |  * for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright (C) 2006 Cavium Networks | 
					
						
							|  |  |  |  * Cache error handler | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <asm/asm.h> | 
					
						
							|  |  |  | #include <asm/regdef.h> | 
					
						
							|  |  |  | #include <asm/mipsregs.h> | 
					
						
							|  |  |  | #include <asm/stackframe.h> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* | 
					
						
							|  |  |  |  * Handle cache error. Indicate to the second level handler whether | 
					
						
							|  |  |  |  * the exception is recoverable. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 	LEAF(except_vec2_octeon) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-22 12:59:30 +01:00
										 |  |  | 	.set	push
 | 
					
						
							| 
									
										
										
										
											2009-01-08 16:46:40 -08:00
										 |  |  | 	.set	mips64r2
 | 
					
						
							|  |  |  | 	.set	noreorder
 | 
					
						
							|  |  |  | 	.set	noat
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* due to an errata we need to read the COP0 CacheErr (Dcache) | 
					
						
							|  |  |  | 	 * before any cache/DRAM access	 */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-22 12:59:30 +01:00
										 |  |  | 	rdhwr	k0, $0	      /* get core_id */ | 
					
						
							|  |  |  | 	PTR_LA	k1, cache_err_dcache | 
					
						
							|  |  |  | 	sll	k0, k0, 3 | 
					
						
							| 
									
										
										
										
											2009-01-08 16:46:40 -08:00
										 |  |  | 	PTR_ADDU k1, k0, k1    /* k1 = &cache_err_dcache[core_id] */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-22 12:59:30 +01:00
										 |  |  | 	dmfc0	k0, CP0_CACHEERR, 1 | 
					
						
							|  |  |  | 	sd	k0, (k1) | 
					
						
							|  |  |  | 	dmtc0	$0, CP0_CACHEERR, 1 | 
					
						
							| 
									
										
										
										
											2009-01-08 16:46:40 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-22 12:59:30 +01:00
										 |  |  | 	/* check whether this is a nested exception */ | 
					
						
							|  |  |  | 	mfc0	k1, CP0_STATUS | 
					
						
							|  |  |  | 	andi	k1, k1, ST0_EXL | 
					
						
							|  |  |  | 	beqz	k1, 1f | 
					
						
							| 
									
										
										
										
											2009-01-08 16:46:40 -08:00
										 |  |  | 	 nop | 
					
						
							|  |  |  | 	j	cache_parity_error_octeon_non_recoverable | 
					
						
							|  |  |  | 	 nop | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* exception is recoverable */ | 
					
						
							|  |  |  | 1:	j	handle_cache_err | 
					
						
							|  |  |  | 	 nop | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-22 12:59:30 +01:00
										 |  |  | 	.set	pop
 | 
					
						
							| 
									
										
										
										
											2009-01-08 16:46:40 -08:00
										 |  |  | 	END(except_vec2_octeon) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  /* We need to jump to handle_cache_err so that the previous handler | 
					
						
							|  |  |  |   * can fit within 0x80 bytes. We also move from 0xFFFFFFFFAXXXXXXX | 
					
						
							| 
									
										
										
										
											2013-01-22 12:59:30 +01:00
										 |  |  |   * space (uncached) to the 0xFFFFFFFF8XXXXXXX space (cached).	*/ | 
					
						
							| 
									
										
										
										
											2009-01-08 16:46:40 -08:00
										 |  |  | 	LEAF(handle_cache_err) | 
					
						
							| 
									
										
										
										
											2013-01-22 12:59:30 +01:00
										 |  |  | 	.set	push
 | 
					
						
							|  |  |  | 	.set	noreorder
 | 
					
						
							|  |  |  | 	.set	noat
 | 
					
						
							| 
									
										
										
										
											2009-01-08 16:46:40 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	SAVE_ALL | 
					
						
							|  |  |  | 	KMODE | 
					
						
							| 
									
										
										
										
											2013-01-22 12:59:30 +01:00
										 |  |  | 	jal	cache_parity_error_octeon_recoverable | 
					
						
							| 
									
										
										
										
											2009-01-08 16:46:40 -08:00
										 |  |  | 	nop | 
					
						
							| 
									
										
										
										
											2013-01-22 12:59:30 +01:00
										 |  |  | 	j	ret_from_exception | 
					
						
							| 
									
										
										
										
											2009-01-08 16:46:40 -08:00
										 |  |  | 	nop | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.set pop
 | 
					
						
							|  |  |  | 	END(handle_cache_err) |