]> pilppa.org Git - linux-2.6-omap-h63xx.git/blob - include/linux/irq.h
[PATCH] genirq: doc: comment include/linux/irq.h structures
[linux-2.6-omap-h63xx.git] / include / linux / irq.h
1 #ifndef _LINUX_IRQ_H
2 #define _LINUX_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 #ifndef 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 #ifdef CONFIG_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  * struct hw_interrupt_type - hardware interrupt type descriptor
45  *
46  * @name:               name for /proc/interrupts
47  * @startup:            start up the interrupt (defaults to ->enable if NULL)
48  * @shutdown:           shut down the interrupt (defaults to ->disable if NULL)
49  * @enable:             enable the interrupt (defaults to chip->unmask if NULL)
50  * @disable:            disable the interrupt (defaults to chip->mask if NULL)
51  * @handle_irq:         irq flow handler called from the arch IRQ glue code
52  * @ack:                start of a new interrupt
53  * @mask:               mask an interrupt source
54  * @mask_ack:           ack and mask an interrupt source
55  * @unmask:             unmask an interrupt source
56  * @hold:               same interrupt while the handler is running
57  * @end:                end of interrupt
58  * @set_affinity:       set the CPU affinity on SMP machines
59  * @retrigger:          resend an IRQ to the CPU
60  * @set_type:           set the flow type (IRQ_TYPE_LEVEL/etc.) of an IRQ
61  * @set_wake:           enable/disable power-management wake-on of an IRQ
62  *
63  * @release:            release function solely used by UML
64  */
65 struct hw_interrupt_type {
66         const char      *typename;
67         unsigned int    (*startup)(unsigned int irq);
68         void            (*shutdown)(unsigned int irq);
69         void            (*enable)(unsigned int irq);
70         void            (*disable)(unsigned int irq);
71         void            (*ack)(unsigned int irq);
72         void            (*end)(unsigned int irq);
73         void            (*set_affinity)(unsigned int irq, cpumask_t dest);
74         int             (*retrigger)(unsigned int irq);
75
76         /* Currently used only by UML, might disappear one day.*/
77 #ifdef CONFIG_IRQ_RELEASE_METHOD
78         void            (*release)(unsigned int irq, void *dev_id);
79 #endif
80 };
81
82 typedef struct hw_interrupt_type  hw_irq_controller;
83
84 struct proc_dir_entry;
85
86 /**
87  * struct irq_desc - interrupt descriptor
88  *
89  * @handler:            interrupt type dependent handler functions
90  * @handler_data:       data for the type handlers
91  * @action:             the irq action chain
92  * @status:             status information
93  * @depth:              disable-depth, for nested irq_disable() calls
94  * @irq_count:          stats field to detect stalled irqs
95  * @irqs_unhandled:     stats field for spurious unhandled interrupts
96  * @lock:               locking for SMP
97  * @affinity:           IRQ affinity on SMP
98  * @pending_mask:       pending rebalanced interrupts
99  * @move_irq:           need to re-target IRQ destination
100  * @dir:                /proc/irq/ procfs entry
101  * @affinity_entry:     /proc/irq/smp_affinity procfs entry on SMP
102  *
103  * Pad this out to 32 bytes for cache and indexing reasons.
104  */
105 struct irq_desc {
106         hw_irq_controller       *chip;
107         void                    *chip_data;
108         struct irqaction        *action;        /* IRQ action list */
109         unsigned int            status;         /* IRQ status */
110         unsigned int            depth;          /* nested irq disables */
111         unsigned int            irq_count;      /* For detecting broken IRQs */
112         unsigned int            irqs_unhandled;
113         spinlock_t              lock;
114 #ifdef CONFIG_SMP
115         cpumask_t               affinity;
116 #endif
117 #if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE)
118         cpumask_t               pending_mask;
119         unsigned int            move_irq;       /* need to re-target IRQ dest */
120 #endif
121 #ifdef CONFIG_PROC_FS
122         struct proc_dir_entry *dir;
123 #endif
124 } ____cacheline_aligned;
125
126 extern struct irq_desc irq_desc[NR_IRQS];
127
128 /*
129  * Migration helpers for obsolete names, they will go away:
130  */
131 typedef struct irq_desc         irq_desc_t;
132
133 /*
134  * Pick up the arch-dependent methods:
135  */
136 #include <asm/hw_irq.h>
137
138 extern int setup_irq(unsigned int irq, struct irqaction *new);
139
140 #ifdef CONFIG_GENERIC_HARDIRQS
141
142 #ifdef CONFIG_SMP
143 static inline void set_native_irq_info(int irq, cpumask_t mask)
144 {
145         irq_desc[irq].affinity = mask;
146 }
147 #else
148 static inline void set_native_irq_info(int irq, cpumask_t mask)
149 {
150 }
151 #endif
152
153 #ifdef CONFIG_SMP
154
155 #if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE)
156
157 void set_pending_irq(unsigned int irq, cpumask_t mask);
158 void move_native_irq(int irq);
159
160 #ifdef CONFIG_PCI_MSI
161 /*
162  * Wonder why these are dummies?
163  * For e.g the set_ioapic_affinity_vector() calls the set_ioapic_affinity_irq()
164  * counter part after translating the vector to irq info. We need to perform
165  * this operation on the real irq, when we dont use vector, i.e when
166  * pci_use_vector() is false.
167  */
168 static inline void move_irq(int irq)
169 {
170 }
171
172 static inline void set_irq_info(int irq, cpumask_t mask)
173 {
174 }
175
176 #else /* CONFIG_PCI_MSI */
177
178 static inline void move_irq(int irq)
179 {
180         move_native_irq(irq);
181 }
182
183 static inline void set_irq_info(int irq, cpumask_t mask)
184 {
185         set_native_irq_info(irq, mask);
186 }
187
188 #endif /* CONFIG_PCI_MSI */
189
190 #else /* CONFIG_GENERIC_PENDING_IRQ || CONFIG_IRQBALANCE */
191
192 static inline void move_irq(int irq)
193 {
194 }
195
196 static inline void move_native_irq(int irq)
197 {
198 }
199
200 static inline void set_pending_irq(unsigned int irq, cpumask_t mask)
201 {
202 }
203
204 static inline void set_irq_info(int irq, cpumask_t mask)
205 {
206         set_native_irq_info(irq, mask);
207 }
208
209 #endif /* CONFIG_GENERIC_PENDING_IRQ */
210
211 #else /* CONFIG_SMP */
212
213 #define move_irq(x)
214 #define move_native_irq(x)
215
216 #endif /* CONFIG_SMP */
217
218 #ifdef CONFIG_IRQBALANCE
219 extern void set_balance_irq_affinity(unsigned int irq, cpumask_t mask);
220 #else
221 static inline void set_balance_irq_affinity(unsigned int irq, cpumask_t mask)
222 {
223 }
224 #endif
225
226 #ifdef CONFIG_AUTO_IRQ_AFFINITY
227 extern int select_smp_affinity(unsigned int irq);
228 #else
229 static inline int select_smp_affinity(unsigned int irq)
230 {
231         return 1;
232 }
233 #endif
234
235 extern int no_irq_affinity;
236 extern int noirqdebug_setup(char *str);
237
238 extern irqreturn_t handle_IRQ_event(unsigned int irq, struct pt_regs *regs,
239                                     struct irqaction *action);
240 /*
241  * Explicit fastcall, because i386 4KSTACKS calls it from assembly:
242  */
243 extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs);
244
245 extern void note_interrupt(unsigned int irq, struct irq_desc *desc,
246                            int action_ret, struct pt_regs *regs);
247 extern int can_request_irq(unsigned int irq, unsigned long irqflags);
248
249 extern void init_irq_proc(void);
250
251 #endif /* CONFIG_GENERIC_HARDIRQS */
252
253 extern hw_irq_controller no_irq_type;  /* needed in every arch ? */
254
255 #endif /* !CONFIG_S390 */
256
257 #endif /* _LINUX_IRQ_H */