blob: 35a05ca5560cf75bf4d8cc865cc21231a08311cc [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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) 1994 by Waldorf GMBH, written by Ralf Baechle
7 * Copyright (C) 1995, 96, 97, 98, 99, 2000, 01, 02, 03 by Ralf Baechle
8 */
9#ifndef _ASM_IRQ_H
10#define _ASM_IRQ_H
11
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <linux/linkage.h>
Ralf Baechle41c594a2006-04-05 09:45:45 +010013
14#include <asm/mipsmtregs.h>
15
Linus Torvalds1da177e2005-04-16 15:20:36 -070016#include <irq.h>
17
18#ifdef CONFIG_I8259
19static inline int irq_canonicalize(int irq)
20{
21 return ((irq == 2) ? 9 : irq);
22}
23#else
24#define irq_canonicalize(irq) (irq) /* Sane hardware, sane code ... */
25#endif
26
Ralf Baechle937a8012006-10-07 19:44:33 +010027extern asmlinkage unsigned int do_IRQ(unsigned int irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -070028
Ralf Baechle41c594a2006-04-05 09:45:45 +010029#ifdef CONFIG_MIPS_MT_SMTC
30/*
31 * Clear interrupt mask handling "backstop" if irq_hwmask
32 * entry so indicates. This implies that the ack() or end()
33 * functions will take over re-enabling the low-level mask.
34 * Otherwise it will be done on return from exception.
35 */
36#define __DO_IRQ_SMTC_HOOK() \
37do { \
38 if (irq_hwmask[irq] & 0x0000ff00) \
39 write_c0_tccontext(read_c0_tccontext() & \
40 ~(irq_hwmask[irq] & 0x0000ff00)); \
41} while (0)
42#else
43#define __DO_IRQ_SMTC_HOOK() do { } while (0)
44#endif
45
Ralf Baechlefe00f942005-03-01 19:22:29 +000046#ifdef CONFIG_PREEMPT
Linus Torvalds1da177e2005-04-16 15:20:36 -070047
48/*
49 * do_IRQ handles all normal device IRQ's (the special
50 * SMP cross-CPU interrupts have their own specific
51 * handlers).
52 *
53 * Ideally there should be away to get this into kernel/irq/handle.c to
54 * avoid the overhead of a call for just a tiny function ...
55 */
Ralf Baechle937a8012006-10-07 19:44:33 +010056#define do_IRQ(irq) \
Linus Torvalds1da177e2005-04-16 15:20:36 -070057do { \
58 irq_enter(); \
Ralf Baechle41c594a2006-04-05 09:45:45 +010059 __DO_IRQ_SMTC_HOOK(); \
Ralf Baechle937a8012006-10-07 19:44:33 +010060 __do_IRQ((irq)); \
Linus Torvalds1da177e2005-04-16 15:20:36 -070061 irq_exit(); \
62} while (0)
63
64#endif
65
66extern void arch_init_irq(void);
Ralf Baechle937a8012006-10-07 19:44:33 +010067extern void spurious_interrupt(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070068
Ralf Baechle41c594a2006-04-05 09:45:45 +010069#ifdef CONFIG_MIPS_MT_SMTC
70struct irqaction;
71
72extern unsigned long irq_hwmask[];
73extern int setup_irq_smtc(unsigned int irq, struct irqaction * new,
74 unsigned long hwmask);
75#endif /* CONFIG_MIPS_MT_SMTC */
76
Ralf Baechle4a4cf772006-11-06 17:41:06 +000077extern int allocate_irqno(void);
78extern void alloc_legacy_irqno(void);
79extern void free_irqno(unsigned int irq);
80
Linus Torvalds1da177e2005-04-16 15:20:36 -070081#endif /* _ASM_IRQ_H */