The x86 timer interrupt handler is the only handler not traced in the
[linux-2.6/next.git] / arch / mips / include / asm / irq.h
blob2354c870a63a1f8eb06bcce96d7036b767bb0497
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.
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
12 #include <linux/linkage.h>
13 #include <linux/smp.h>
15 #include <asm/mipsmtregs.h>
17 #include <irq.h>
19 static inline void irq_dispose_mapping(unsigned int virq)
23 #ifdef CONFIG_I8259
24 static inline int irq_canonicalize(int irq)
26 return ((irq == I8259A_IRQ_BASE + 2) ? I8259A_IRQ_BASE + 9 : irq);
28 #else
29 #define irq_canonicalize(irq) (irq) /* Sane hardware, sane code ... */
30 #endif
32 #ifdef CONFIG_MIPS_MT_SMTC
34 struct irqaction;
36 extern unsigned long irq_hwmask[];
37 extern int setup_irq_smtc(unsigned int irq, struct irqaction * new,
38 unsigned long hwmask);
40 static inline void smtc_im_ack_irq(unsigned int irq)
42 if (irq_hwmask[irq] & ST0_IM)
43 set_c0_status(irq_hwmask[irq] & ST0_IM);
46 #else
48 static inline void smtc_im_ack_irq(unsigned int irq)
52 #endif /* CONFIG_MIPS_MT_SMTC */
54 #ifdef CONFIG_MIPS_MT_SMTC_IRQAFF
55 #include <linux/cpumask.h>
57 extern int plat_set_irq_affinity(struct irq_data *d,
58 const struct cpumask *affinity, bool force);
59 extern void smtc_forward_irq(struct irq_data *d);
62 * IRQ affinity hook invoked at the beginning of interrupt dispatch
63 * if option is enabled.
65 * Up through Linux 2.6.22 (at least) cpumask operations are very
66 * inefficient on MIPS. Initial prototypes of SMTC IRQ affinity
67 * used a "fast path" per-IRQ-descriptor cache of affinity information
68 * to reduce latency. As there is a project afoot to optimize the
69 * cpumask implementations, this version is optimistically assuming
70 * that cpumask.h macro overhead is reasonable during interrupt dispatch.
72 static inline int handle_on_other_cpu(unsigned int irq)
74 struct irq_data *d = irq_get_irq_data(irq);
76 if (cpumask_test_cpu(smp_processor_id(), d->affinity))
77 return 0;
78 smtc_forward_irq(d);
79 return 1;
82 #else /* Not doing SMTC affinity */
84 static inline int handle_on_other_cpu(unsigned int irq) { return 0; }
86 #endif /* CONFIG_MIPS_MT_SMTC_IRQAFF */
88 #ifdef CONFIG_MIPS_MT_SMTC_IM_BACKSTOP
90 static inline void smtc_im_backstop(unsigned int irq)
92 if (irq_hwmask[irq] & 0x0000ff00)
93 write_c0_tccontext(read_c0_tccontext() &
94 ~(irq_hwmask[irq] & 0x0000ff00));
98 * Clear interrupt mask handling "backstop" if irq_hwmask
99 * entry so indicates. This implies that the ack() or end()
100 * functions will take over re-enabling the low-level mask.
101 * Otherwise it will be done on return from exception.
103 static inline int smtc_handle_on_other_cpu(unsigned int irq)
105 int ret = handle_on_other_cpu(irq);
107 if (!ret)
108 smtc_im_backstop(irq);
109 return ret;
112 #else
114 static inline void smtc_im_backstop(unsigned int irq) { }
115 static inline int smtc_handle_on_other_cpu(unsigned int irq)
117 return handle_on_other_cpu(irq);
120 #endif
122 extern void do_IRQ(unsigned int irq);
124 #ifdef CONFIG_MIPS_MT_SMTC_IRQAFF
126 extern void do_IRQ_no_affinity(unsigned int irq);
128 #endif /* CONFIG_MIPS_MT_SMTC_IRQAFF */
130 extern void arch_init_irq(void);
131 extern void spurious_interrupt(void);
133 extern int allocate_irqno(void);
134 extern void alloc_legacy_irqno(void);
135 extern void free_irqno(unsigned int irq);
138 * Before R2 the timer and performance counter interrupts were both fixed to
139 * IE7. Since R2 their number has to be read from the c0_intctl register.
141 #define CP0_LEGACY_COMPARE_IRQ 7
143 extern int cp0_compare_irq;
144 extern int cp0_compare_irq_shift;
145 extern int cp0_perfcount_irq;
147 #endif /* _ASM_IRQ_H */