cleanup
[linux-2.4.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 extern void disable_irq(unsigned int);
15 extern void disable_irq_nosync(unsigned int);
16 extern void enable_irq(unsigned int);
17
18 /* Need to keep at 256 (minimum) for iSeries */
19 #define NR_IRQS  256
20
21 #define MAX_IRQS (1<<24)
22
23 extern unsigned int _next_irq(unsigned int irq);
24
25 /* Define a way to iterate across irqs fairly efficiently. */
26 #define for_each_irq(i) \
27         for ((i) = 0; (i) < MAX_IRQS; (i) = _next_irq(i))
28
29
30 extern void *_irqdesc(unsigned int irq);
31 extern void *_real_irqdesc(unsigned int irq);
32 #define irqdesc(irq) ((irq_desc_t *)_irqdesc(irq))
33 #define real_irqdesc(irq) ((irq_desc_t *)_real_irqdesc(irq))
34
35 /*
36  * This gets called from serial.c, which is now used on
37  * powermacs as well as prep/chrp boxes.
38  * Prep and chrp both have cascaded 8259 PICs.
39  */
40 static __inline__ int irq_cannonicalize(int irq)
41 {
42         return irq;
43 }
44
45 /*
46  * Because many systems have two overlapping names spaces for
47  * interrupts (ISA and XICS for example), and the ISA interrupts
48  * have historically not been easy to renumber, we allow ISA
49  * interrupts to take values 0 - 15, and shift up the remaining
50  * interrupts by 0x10.
51  *
52  * This would be nice to remove at some point as it adds confusion
53  * and adds a nasty end case if any platform native interrupts have
54  * values within 0x10 of the end of that namespace.
55  */
56
57 #define NUM_ISA_INTERRUPTS      0x10
58
59 extern inline int irq_offset_up(int irq)
60 {
61         return(irq + NUM_ISA_INTERRUPTS);
62 }
63
64 extern inline int irq_offset_down(int irq)
65 {
66         return(irq - NUM_ISA_INTERRUPTS);
67 }
68
69 extern inline int irq_offset_value(void)
70 {
71         return NUM_ISA_INTERRUPTS;
72 }
73
74 #endif /* _ASM_IRQ_H */
75 #endif /* __KERNEL__ */