ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-ppc64 / irq.h
1 #ifdef __KERNEL__
2 #ifndef _ASM_IRQ_H
3 #define _ASM_IRQ_H
4
5 /*
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version
9  * 2 of the License, or (at your option) any later version.
10  */
11
12 #include <asm/atomic.h>
13
14 /*
15  * Maximum number of interrupt sources that we can handle.
16  */
17 #define NR_IRQS         512
18
19 extern void disable_irq(unsigned int);
20 extern void disable_irq_nosync(unsigned int);
21 extern void enable_irq(unsigned int);
22
23 /* this number is used when no interrupt has been assigned */
24 #define NO_IRQ                  (-1)
25
26 #define get_irq_desc(irq) (&irq_desc[(irq)])
27
28 /* Define a way to iterate across irqs. */
29 #define for_each_irq(i) \
30         for ((i) = 0; (i) < NR_IRQS; ++(i))
31
32 /* Interrupt numbers are virtual in case they are sparsely
33  * distributed by the hardware.
34  */
35 extern unsigned int virt_irq_to_real_map[NR_IRQS];
36
37 /* Create a mapping for a real_irq if it doesn't already exist.
38  * Return the virtual irq as a convenience.
39  */
40 int virt_irq_create_mapping(unsigned int real_irq);
41 void virt_irq_init(void);
42
43 static inline unsigned int virt_irq_to_real(unsigned int virt_irq)
44 {
45         return virt_irq_to_real_map[virt_irq];
46 }
47
48 /*
49  * Because many systems have two overlapping names spaces for
50  * interrupts (ISA and XICS for example), and the ISA interrupts
51  * have historically not been easy to renumber, we allow ISA
52  * interrupts to take values 0 - 15, and shift up the remaining
53  * interrupts by 0x10.
54  */
55 #define NUM_ISA_INTERRUPTS      0x10
56 extern int __irq_offset_value;
57
58 static inline int irq_offset_up(int irq)
59 {
60         return(irq + __irq_offset_value);
61 }
62
63 static inline int irq_offset_down(int irq)
64 {
65         return(irq - __irq_offset_value);
66 }
67
68 static inline int irq_offset_value(void)
69 {
70         return __irq_offset_value;
71 }
72
73 static __inline__ int irq_canonicalize(int irq)
74 {
75         return irq;
76 }
77
78 struct irqaction;
79 struct pt_regs;
80 int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
81
82 #endif /* _ASM_IRQ_H */
83 #endif /* __KERNEL__ */