[PATCH] genirq: cleanup: remove fastcall
[safe/jmp/linux-2.6] / include / linux / irq.h
1 #ifndef __irq_h
2 #define __irq_h
3
4 /*
5  * Please do not include this file in generic code.  There is currently
6  * no requirement for any architecture to implement anything held
7  * within this file.
8  *
9  * Thanks. --rmk
10  */
11
12 #include <linux/smp.h>
13
14 #if !defined(CONFIG_S390)
15
16 #include <linux/linkage.h>
17 #include <linux/cache.h>
18 #include <linux/spinlock.h>
19 #include <linux/cpumask.h>
20 #include <linux/irqreturn.h>
21
22 #include <asm/irq.h>
23 #include <asm/ptrace.h>
24
25 /*
26  * IRQ line status.
27  */
28 #define IRQ_INPROGRESS  1       /* IRQ handler active - do not enter! */
29 #define IRQ_DISABLED    2       /* IRQ disabled - do not enter! */
30 #define IRQ_PENDING     4       /* IRQ pending - replay on enable */
31 #define IRQ_REPLAY      8       /* IRQ has been replayed but not acked yet */
32 #define IRQ_AUTODETECT  16      /* IRQ is being autodetected */
33 #define IRQ_WAITING     32      /* IRQ not yet seen - for autodetection */
34 #define IRQ_LEVEL       64      /* IRQ level triggered */
35 #define IRQ_MASKED      128     /* IRQ masked - shouldn't be seen again */
36 #if defined(ARCH_HAS_IRQ_PER_CPU)
37 # define IRQ_PER_CPU    256     /* IRQ is per CPU */
38 # define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU)
39 #else
40 # define CHECK_IRQ_PER_CPU(var) 0
41 #endif
42
43 /*
44  * Interrupt controller descriptor. This is all we need
45  * to describe about the low-level hardware. 
46  */
47 struct hw_interrupt_type {
48         const char * typename;
49         unsigned int (*startup)(unsigned int irq);
50         void (*shutdown)(unsigned int irq);
51         void (*enable)(unsigned int irq);
52         void (*disable)(unsigned int irq);
53         void (*ack)(unsigned int irq);
54         void (*end)(unsigned int irq);
55         void (*set_affinity)(unsigned int irq, cpumask_t dest);
56         /* Currently used only by UML, might disappear one day.*/
57 #ifdef CONFIG_IRQ_RELEASE_METHOD
58         void (*release)(unsigned int irq, void *dev_id);
59 #endif
60 };
61
62 typedef struct hw_interrupt_type  hw_irq_controller;
63
64 /*
65  * This is the "IRQ descriptor", which contains various information
66  * about the irq, including what kind of hardware handling it has,
67  * whether it is disabled etc etc.
68  *
69  * Pad this out to 32 bytes for cache and indexing reasons.
70  */
71 typedef struct irq_desc {
72         hw_irq_controller *chip;
73         void *chip_data;
74         struct irqaction *action;       /* IRQ action list */
75         unsigned int status;            /* IRQ status */
76         unsigned int depth;             /* nested irq disables */
77         unsigned int irq_count;         /* For detecting broken interrupts */
78         unsigned int irqs_unhandled;
79         spinlock_t lock;
80 #ifdef CONFIG_SMP
81         cpumask_t affinity;
82 #endif
83 #if defined (CONFIG_GENERIC_PENDING_IRQ) || defined (CONFIG_IRQBALANCE)
84         unsigned int move_irq;          /* Flag need to re-target intr dest*/
85 #endif
86 } ____cacheline_aligned irq_desc_t;
87
88 extern irq_desc_t irq_desc [NR_IRQS];
89
90 #include <asm/hw_irq.h> /* the arch dependent stuff */
91
92 extern int setup_irq(unsigned int irq, struct irqaction * new);
93
94 #ifdef CONFIG_GENERIC_HARDIRQS
95 #ifdef CONFIG_SMP
96 static inline void set_native_irq_info(int irq, cpumask_t mask)
97 {
98         irq_desc[irq].affinity = mask;
99 }
100 #else
101 static inline void set_native_irq_info(int irq, cpumask_t mask)
102 {
103 }
104 #endif
105
106 #ifdef CONFIG_SMP
107
108 #if defined (CONFIG_GENERIC_PENDING_IRQ) || defined (CONFIG_IRQBALANCE)
109 extern cpumask_t pending_irq_cpumask[NR_IRQS];
110
111 void set_pending_irq(unsigned int irq, cpumask_t mask);
112 void move_native_irq(int irq);
113
114 #ifdef CONFIG_PCI_MSI
115 /*
116  * Wonder why these are dummies?
117  * For e.g the set_ioapic_affinity_vector() calls the set_ioapic_affinity_irq()
118  * counter part after translating the vector to irq info. We need to perform
119  * this operation on the real irq, when we dont use vector, i.e when
120  * pci_use_vector() is false.
121  */
122 static inline void move_irq(int irq)
123 {
124 }
125
126 static inline void set_irq_info(int irq, cpumask_t mask)
127 {
128 }
129
130 #else // CONFIG_PCI_MSI
131
132 static inline void move_irq(int irq)
133 {
134         move_native_irq(irq);
135 }
136
137 static inline void set_irq_info(int irq, cpumask_t mask)
138 {
139         set_native_irq_info(irq, mask);
140 }
141 #endif // CONFIG_PCI_MSI
142
143 #else   // CONFIG_GENERIC_PENDING_IRQ || CONFIG_IRQBALANCE
144
145 #define move_irq(x)
146 #define move_native_irq(x)
147 #define set_pending_irq(x,y)
148 static inline void set_irq_info(int irq, cpumask_t mask)
149 {
150         set_native_irq_info(irq, mask);
151 }
152
153 #endif // CONFIG_GENERIC_PENDING_IRQ
154
155 #else // CONFIG_SMP
156
157 #define move_irq(x)
158 #define move_native_irq(x)
159
160 #endif // CONFIG_SMP
161
162 #ifdef CONFIG_IRQBALANCE
163 extern void set_balance_irq_affinity(unsigned int irq, cpumask_t mask);
164 #else
165 static inline void set_balance_irq_affinity(unsigned int irq, cpumask_t mask)
166 {
167 }
168 #endif
169
170 extern int no_irq_affinity;
171 extern int noirqdebug_setup(char *str);
172
173 extern irqreturn_t handle_IRQ_event(unsigned int irq, struct pt_regs *regs,
174                                     struct irqaction *action);
175 /*
176  * Explicit fastcall, because i386 4KSTACKS calls it from assembly:
177  */
178 extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs);
179
180 extern void note_interrupt(unsigned int irq, irq_desc_t *desc,
181                            int action_ret, struct pt_regs *regs);
182 extern int can_request_irq(unsigned int irq, unsigned long irqflags);
183
184 extern void init_irq_proc(void);
185
186 #ifdef CONFIG_AUTO_IRQ_AFFINITY
187 extern int select_smp_affinity(unsigned int irq);
188 #else
189 static inline int
190 select_smp_affinity(unsigned int irq)
191 {
192         return 1;
193 }
194 #endif
195
196 #endif
197
198 extern hw_irq_controller no_irq_type;  /* needed in every arch ? */
199
200 #endif
201
202 #endif /* __irq_h */