summaryrefslogtreecommitdiffstats
path: root/arch/mips/sni/int-handler.S
blob: 3c920954d8ebc3d39a26a685704559567876b9f5 (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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
/* $Id: int-handler.S,v 1.2 1997/12/01 17:57:40 ralf Exp $
 *
 * SNI RM200 PCI specific interrupt handler code.
 *
 * Copyright (C) 1994 - 1997 by Ralf Baechle
 */
#include <asm/asm.h>
#include <linux/config.h>
#include <asm/mipsconfig.h>
#include <asm/mipsregs.h>
#include <asm/regdef.h>
#include <asm/sni.h>
#include <asm/stackframe.h>

		.set	noreorder
		.set	noat
		.align	5
		NESTED(sni_rm200_pci_handle_int, PT_SIZE, sp)
		SAVE_ALL
		CLI
		.set	at

		lb	t0,led_cache
		addiu	t0,1
		sb	t0,led_cache
		sb	t0,PCIMT_CSLED
		.data
led_cache:	.byte	0
		.text

		mfc0	t0,CP0_STATUS
		mfc0	t1,CP0_CAUSE
		and	t0,t1

		 andi	t1,t0,0x0800			# hardware interrupt 1
		bnez	t1,hwint1
		 andi	t1,t0,0x4000			# hardware interrupt 4
		bnez	t1,eth_int

		 andi	t1,t0,0x1000			# hardware interrupt 2
		bnez	t1,hwint2
		 andi	t1,t0,0x2000			# hardware interrupt 3
		bnez	t1,hwint3
		 andi	t1,t0,0x8000			# hardware interrupt 5
		bnez	t1,hwint5
		 andi	t1,t0,0x0400			# hardware interrupt 0
		bnez	t1,hwint0
		 nop

		j	spurious_interrupt		# Nothing up ...
		 nop

 ##############################################################################

swint0:		PANIC("swint0")
swint1:		PANIC("swint1")

 /* ------------------------------------------------------------------------ */

hwint1:		lbu	t0,PCIMT_CSITPEND

		 andi	t1,t0,0x20
		bnez	t1,eisa_int

#ifdef CONFIG_SCSI_NCR53C8XX
		 andi	t1,t0,0x40
		beqz	t1,scsi_int
#endif
		 nop

		j	spurious_interrupt
		 nop

 /* ------------------------------------------------------------------------ */

hwint0:		lbu	t0,PCIMT_CSITPEND

		 andi	t1,t0,0x01
		beqz	t1,int2

go_spurious:	j	spurious_interrupt		# we got fooled
		 nop

eisa_int:	lui	s0,%hi(SNI_PORT_BASE)
		li	a0,0x0f
		sb	a0,%lo(SNI_PORT_BASE+0x20)(s0)	# poll command
		lb	a0,%lo(SNI_PORT_BASE+0x20)(s0)	# read result
		bgtz	a0,poll_second
		 andi	a0,7
		beq	a0,2,poll_second		# cascade?
		 li	s1,1
		/*
		 * Acknowledge first pic
		 */
		lb	t2,%lo(SNI_PORT_BASE+0x21)(s0)
		lui	s4,%hi(cache_21)
		lb	t0,%lo(cache_21)(s4)
		sllv	s1,s1,a0
		or	t0,s1
		sb	t0,%lo(cache_21)(s4)
		sb	t0,%lo(SNI_PORT_BASE+0x21)(s0)
		li	t2,0x20
		sb	t2,%lo(SNI_PORT_BASE+0x20)(s0)
		/*
		 * Now call the real handler
		 */
		jal	do_IRQ
		 move	a1,sp
		/*
		 * Unblock first pic
		 */
		lbu	t1,%lo(SNI_PORT_BASE+0x21)(s0)
		lb	t1,%lo(cache_21)(s4)
		nor	s1,zero,s1
		and	t1,s1
		sb	t1,%lo(cache_21)(s4)
		j	ret_from_irq
		 sb	t1,%lo(SNI_PORT_BASE+0x21)(s0)

		/*
		 * Cascade interrupt from second PIC
		 */
		.align	5
poll_second:	li	a0,0x0f
		sb	a0,%lo(SNI_PORT_BASE+0xa0)(s0)	# poll command
		lb	a0,%lo(SNI_PORT_BASE+0xa0)(s0)	# read result
		bgtz	a0,go_spurious
		 andi	a0,7
		/*
		 * Acknowledge second pic
		 */
		lbu	t2,%lo(SNI_PORT_BASE+0xa1)(s0)
		lui	s4,%hi(cache_A1)
		lb	t3,%lo(cache_A1)(s4)
		sllv	s1,s1,a0
		or	t3,s1
		sb	t3,%lo(cache_A1)(s4)
		sb	t3,%lo(SNI_PORT_BASE+0xa1)(s0)
		li	t3,0x20
		sb	t3,%lo(SNI_PORT_BASE+0xa0)(s0)
		sb	t3,%lo(SNI_PORT_BASE+0x20)(s0)
		/*
		 * Now call the real handler
		 */
		addiu	a0,8
		jal	do_IRQ
		 move	a1,sp
		/*
		 * Unblock second pic
		 */
		lb	t1,%lo(SNI_PORT_BASE+0xa1)(s0)
		lb	t1,%lo(cache_A1)(s4)
		subu	t0,1
		nor	s1,zero,s1
		and	t1,t1,s1
		sb	t1,%lo(cache_A1)(s4)
		j	ret_from_irq
		 sb	t1,%lo(SNI_PORT_BASE+0xa1)(s0)

/*
 * ... check if we were interrupted by the Lance ...
 */
eth_int:	mfc0	s0,CP0_STATUS
		ori	t0,s0,0x4000
		xori	t0,0x4000
		mtc0	t0,CP0_STATUS

		li	a0,PCIMT_IRQ_ETHERNET
		jal	do_IRQ
		 move	a1,sp

		mtc0	s0,CP0_STATUS

		j	ret_from_irq
		 nop

#ifdef CONFIG_SCSI_NCR53C8XX

/*
 * ... check if we were interrupted by the NCR ...
 */
scsi_int:	li	a0,PCIMT_IRQ_SCSI
		jal	do_IRQ
		 move	a1,sp
		j	ret_from_irq
		 nop

#endif /* CONFIG_SCSI_NCR53C8XX */

pci_int:	PANIC("Received PCI interrupt but no handler yet ...\n")
1:		j	1b
		 nop

int2:		PANIC("Received int2 but no handler yet ...\n")
1:		j	1b
		 nop

hwint2:		PANIC("hwint2 and no handler yet")
hwint3:		PANIC("hwint3 and no handler yet")
hwint5:		PANIC("hwint5 and no handler yet")

		END(sni_rm200_pci_handle_int)