VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[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 <linux/config.h>
13 #include <linux/threads.h>
14
15 /*
16  * Maximum number of interrupt sources that we can handle.
17  */
18 #define NR_IRQS         512
19
20 extern void disable_irq(unsigned int);
21 extern void disable_irq_nosync(unsigned int);
22 extern void enable_irq(unsigned int);
23
24 /* this number is used when no interrupt has been assigned */
25 #define NO_IRQ                  (-1)
26
27 #define get_irq_desc(irq) (&irq_desc[(irq)])
28
29 /* Define a way to iterate across irqs. */
30 #define for_each_irq(i) \
31         for ((i) = 0; (i) < NR_IRQS; ++(i))
32
33 /* Interrupt numbers are virtual in case they are sparsely
34  * distributed by the hardware.
35  */
36 extern unsigned int virt_irq_to_real_map[NR_IRQS];
37
38 /* Create a mapping for a real_irq if it doesn't already exist.
39  * Return the virtual irq as a convenience.
40  */
41 int virt_irq_create_mapping(unsigned int real_irq);
42 void virt_irq_init(void);
43
44 static inline unsigned int virt_irq_to_real(unsigned int virt_irq)
45 {
46         return virt_irq_to_real_map[virt_irq];
47 }
48
49 extern unsigned int real_irq_to_virt_slowpath(unsigned int real_irq);
50
51 /*
52  * Because many systems have two overlapping names spaces for
53  * interrupts (ISA and XICS for example), and the ISA interrupts
54  * have historically not been easy to renumber, we allow ISA
55  * interrupts to take values 0 - 15, and shift up the remaining
56  * interrupts by 0x10.
57  */
58 #define NUM_ISA_INTERRUPTS      0x10
59 extern int __irq_offset_value;
60
61 static inline int irq_offset_up(int irq)
62 {
63         return(irq + __irq_offset_value);
64 }
65
66 static inline int irq_offset_down(int irq)
67 {
68         return(irq - __irq_offset_value);
69 }
70
71 static inline int irq_offset_value(void)
72 {
73         return __irq_offset_value;
74 }
75
76 static __inline__ int irq_canonicalize(int irq)
77 {
78         return irq;
79 }
80
81 struct irqaction;
82 struct pt_regs;
83 int handle_irq_event(int, struct pt_regs *, struct irqaction *);
84
85 #ifdef CONFIG_IRQSTACKS
86 /*
87  * Per-cpu stacks for handling hard and soft interrupts.
88  */
89 extern struct thread_info *hardirq_ctx[NR_CPUS];
90 extern struct thread_info *softirq_ctx[NR_CPUS];
91
92 extern void irq_ctx_init(void);
93 extern void call_do_softirq(struct thread_info *tp);
94 extern int call_handle_irq_event(int irq, struct pt_regs *regs,
95                         struct irqaction *action, struct thread_info *tp);
96
97 #define __ARCH_HAS_DO_SOFTIRQ
98
99 #else
100 #define irq_ctx_init()
101
102 #endif /* CONFIG_IRQSTACKS */
103
104 #endif /* _ASM_IRQ_H */
105 #endif /* __KERNEL__ */