[PATCH] genirq: doc: comment include/linux/irq.h structures
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / linux / irq.h
blobb2688157b51bff9ebe71cd0dabf37649a8564e09
1 #ifndef _LINUX_IRQ_H
2 #define _LINUX_IRQ_H
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.
9 * Thanks. --rmk
12 #include <linux/smp.h>
14 #ifndef CONFIG_S390
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>
22 #include <asm/irq.h>
23 #include <asm/ptrace.h>
26 * IRQ line status.
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
43 /**
44 * struct hw_interrupt_type - hardware interrupt type descriptor
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
63 * @release: release function solely used by UML
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);
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
82 typedef struct hw_interrupt_type hw_irq_controller;
84 struct proc_dir_entry;
86 /**
87 * struct irq_desc - interrupt descriptor
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
103 * Pad this out to 32 bytes for cache and indexing reasons.
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;
126 extern struct irq_desc irq_desc[NR_IRQS];
129 * Migration helpers for obsolete names, they will go away:
131 typedef struct irq_desc irq_desc_t;
134 * Pick up the arch-dependent methods:
136 #include <asm/hw_irq.h>
138 extern int setup_irq(unsigned int irq, struct irqaction *new);
140 #ifdef CONFIG_GENERIC_HARDIRQS
142 #ifdef CONFIG_SMP
143 static inline void set_native_irq_info(int irq, cpumask_t mask)
145 irq_desc[irq].affinity = mask;
147 #else
148 static inline void set_native_irq_info(int irq, cpumask_t mask)
151 #endif
153 #ifdef CONFIG_SMP
155 #if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE)
157 void set_pending_irq(unsigned int irq, cpumask_t mask);
158 void move_native_irq(int irq);
160 #ifdef CONFIG_PCI_MSI
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.
168 static inline void move_irq(int irq)
172 static inline void set_irq_info(int irq, cpumask_t mask)
176 #else /* CONFIG_PCI_MSI */
178 static inline void move_irq(int irq)
180 move_native_irq(irq);
183 static inline void set_irq_info(int irq, cpumask_t mask)
185 set_native_irq_info(irq, mask);
188 #endif /* CONFIG_PCI_MSI */
190 #else /* CONFIG_GENERIC_PENDING_IRQ || CONFIG_IRQBALANCE */
192 static inline void move_irq(int irq)
196 static inline void move_native_irq(int irq)
200 static inline void set_pending_irq(unsigned int irq, cpumask_t mask)
204 static inline void set_irq_info(int irq, cpumask_t mask)
206 set_native_irq_info(irq, mask);
209 #endif /* CONFIG_GENERIC_PENDING_IRQ */
211 #else /* CONFIG_SMP */
213 #define move_irq(x)
214 #define move_native_irq(x)
216 #endif /* CONFIG_SMP */
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)
224 #endif
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)
231 return 1;
233 #endif
235 extern int no_irq_affinity;
236 extern int noirqdebug_setup(char *str);
238 extern irqreturn_t handle_IRQ_event(unsigned int irq, struct pt_regs *regs,
239 struct irqaction *action);
241 * Explicit fastcall, because i386 4KSTACKS calls it from assembly:
243 extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs);
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);
249 extern void init_irq_proc(void);
251 #endif /* CONFIG_GENERIC_HARDIRQS */
253 extern hw_irq_controller no_irq_type; /* needed in every arch ? */
255 #endif /* !CONFIG_S390 */
257 #endif /* _LINUX_IRQ_H */