| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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) 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include <linux/linkage.h> | 
| Ralf Baechle | 41c594a | 2006-04-05 09:45:45 +0100 | [diff] [blame] | 13 |  | 
 | 14 | #include <asm/mipsmtregs.h> | 
 | 15 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | #include <irq.h> | 
 | 17 |  | 
 | 18 | #ifdef CONFIG_I8259 | 
 | 19 | static 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 |  | 
 | 27 | struct pt_regs; | 
 | 28 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | extern asmlinkage unsigned int do_IRQ(unsigned int irq, struct pt_regs *regs); | 
 | 30 |  | 
| Ralf Baechle | 41c594a | 2006-04-05 09:45:45 +0100 | [diff] [blame] | 31 | #ifdef CONFIG_MIPS_MT_SMTC | 
 | 32 | /* | 
 | 33 |  * Clear interrupt mask handling "backstop" if irq_hwmask | 
 | 34 |  * entry so indicates. This implies that the ack() or end() | 
 | 35 |  * functions will take over re-enabling the low-level mask. | 
 | 36 |  * Otherwise it will be done on return from exception. | 
 | 37 |  */ | 
 | 38 | #define __DO_IRQ_SMTC_HOOK()						\ | 
 | 39 | do {									\ | 
 | 40 | 	if (irq_hwmask[irq] & 0x0000ff00)				\ | 
 | 41 | 		write_c0_tccontext(read_c0_tccontext() &		\ | 
 | 42 | 		                   ~(irq_hwmask[irq] & 0x0000ff00));	\ | 
 | 43 | } while (0) | 
 | 44 | #else | 
 | 45 | #define __DO_IRQ_SMTC_HOOK() do { } while (0) | 
 | 46 | #endif | 
 | 47 |  | 
| Ralf Baechle | fe00f94 | 2005-03-01 19:22:29 +0000 | [diff] [blame] | 48 | #ifdef CONFIG_PREEMPT | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 |  | 
 | 50 | /* | 
 | 51 |  * do_IRQ handles all normal device IRQ's (the special | 
 | 52 |  * SMP cross-CPU interrupts have their own specific | 
 | 53 |  * handlers). | 
 | 54 |  * | 
 | 55 |  * Ideally there should be away to get this into kernel/irq/handle.c to | 
 | 56 |  * avoid the overhead of a call for just a tiny function ... | 
 | 57 |  */ | 
 | 58 | #define do_IRQ(irq, regs)						\ | 
 | 59 | do {									\ | 
 | 60 | 	irq_enter();							\ | 
| Ralf Baechle | 41c594a | 2006-04-05 09:45:45 +0100 | [diff] [blame] | 61 | 	__DO_IRQ_SMTC_HOOK();						\ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | 	__do_IRQ((irq), (regs));					\ | 
 | 63 | 	irq_exit();							\ | 
 | 64 | } while (0) | 
 | 65 |  | 
 | 66 | #endif | 
 | 67 |  | 
 | 68 | extern void arch_init_irq(void); | 
| Ralf Baechle | 93373ed | 2006-04-01 21:17:45 +0100 | [diff] [blame] | 69 | extern void spurious_interrupt(struct pt_regs *regs); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 |  | 
| Ralf Baechle | 41c594a | 2006-04-05 09:45:45 +0100 | [diff] [blame] | 71 | #ifdef CONFIG_MIPS_MT_SMTC | 
 | 72 | struct irqaction; | 
 | 73 |  | 
 | 74 | extern unsigned long irq_hwmask[]; | 
 | 75 | extern int setup_irq_smtc(unsigned int irq, struct irqaction * new, | 
 | 76 |                           unsigned long hwmask); | 
 | 77 | #endif /* CONFIG_MIPS_MT_SMTC */ | 
 | 78 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | #endif /* _ASM_IRQ_H */ |