1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License.  See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1999 Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 */
9#include <asm/asm.h>
10#include <asm/mipsregs.h>
11#include <asm/regdef.h>
12#include <asm/stackframe.h>
13
14	.text
15	.set	noat
16	.align	5
17NESTED(ip27_irq, PT_SIZE, sp)
18	SAVE_ALL
19	CLI
20	.set	at
21
22	/* IP27 may signal interrupt which we're not interested in.
23	   Mask them out.  */
24	mfc0	s0, CP0_CAUSE
25	mfc0	t0, CP0_STATUS
26	and	s0, t0
27
28	/* First check for RT interrupt.  */
29	andi	a0, s0, CAUSEF_IP4
30	beqz	a0, 1f
31
32	/* Ok, a timer interrupt. */
33	move	a0, sp
34	jal	rt_timer_interrupt
35
36	j	ret_from_irq
37
381:	andi	a0, s0, (CAUSEF_IP2 | CAUSEF_IP3)
39	beqz	a0, 1f
40
41	/* ... a device interrupt ...  */
42	move	a0, sp
43	jal	ip27_do_irq
44
45	j	ret_from_irq
46
471:
48#if 1
49	mfc0	a1, CP0_STATUS
50	srl	a1, a1, 8
51	andi	a1, 0xff
52
53	mfc0	a2, CP0_CAUSE
54	srl	a2, a2, 8
55	andi	a2, 0xff
56
57	move	a3, s0
58	PRINT("Spurious interrupt, c0_status = %02x, c0_cause = %02x, pending %02x.\n")
59	ld	a1, PT_EPC(sp)
600:	b	0b
61#endif
62
63	j	ret_from_irq
64	END(ip27_irq)
65