summaryrefslogtreecommitdiff
path: root/release/src/linux/linux/arch/mips/mm/cex-sb1.S
blob: 1840ed759a41a79857ec8b0827e3834036157069 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
 * Copyright (C) 2001 Broadcom Corporation
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
#include <linux/config.h>

#include <asm/asm.h>
#include <asm/regdef.h>
#include <asm/mipsregs.h>
#include <asm/stackframe.h>
#include <asm/sibyte/board.h>

	.text
	/* Special Cache Error handler for SB1 for now */
	LEAF(except_vec2_sb1)
	.set	noat
	.set	mips0
	/*
	 * This is a very bad place to be.  Our cache error detection has
	 * triggered.  If we have write-back data in the cache, we may not be
	 * able to recover.  As a first-order desperate measure, turn off KSEG0
	 * cacheing.
	 */
	.set	push
	#.set	mips64
	.set	mips4
	.set	reorder
	mfc0	k1, $26				# mfc0	k1, $26, 0
	# check if error was recoverable
	# XXXKW - count them
	bltz	k1, leave_cerr
#ifdef CONFIG_SB1_PASS_1_WORKAROUNDS
	# look for signature of spurious CErr
	lui	k0, 0x4000
	bne	k0, k1, real_cerr
	.word	0x401Bd801			# mfc0	k1, $27, 1
	lui	k0, 0xffe0
	and	k1, k0, k1
	lui	k0, 0x0200
	beq	k0, k1, leave_cerr
	# XXXKW - count them
#endif

real_cerr:
	mfc0	k0,CP0_CONFIG
	li	k1,~CONF_CM_CMASK
	and	k0,k0,k1
	ori	k0,k0,CONF_CM_UNCACHED
	mtc0	k0,CP0_CONFIG

	SSNOP
	SSNOP
	SSNOP
	SSNOP
	bnezl	$0, 1f
1:
	mfc0	k0, CP0_STATUS
	sll	k0, k0, 3			# check CU0 (kernel?)
	bltz	k0, 2f
	GET_SAVED_SP
	move	sp, k0				# want Kseg SP (so uncached)
2:
	j	sb1_cache_error

leave_cerr:
	# clear/unlock the registers
	mtc0	zero, $26			# mtc0	zero, $26, 0
	mtc0	zero, $27			# mtc0	zero, $27, 0
	.word	0x4080d801			# mtc0	zero, $27, 1
	.word	0x4080d803			# mtc0	zero, $27, 3
	eret

	.set	pop
	END(except_vec2_sb1)