5 * Please do not include this file in generic code. There is currently
6 * no requirement for any architecture to implement anything held
12 #include <linux/smp.h>
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>
23 #include <asm/ptrace.h>
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)
40 # define CHECK_IRQ_PER_CPU(var) 0
43 #define IRQ_NOPROBE 512 /* IRQ is not valid for probing */
44 #define IRQ_NOREQUEST 1024 /* IRQ cannot be requested */
46 * struct hw_interrupt_type - hardware interrupt type descriptor
48 * @name: name for /proc/interrupts
49 * @startup: start up the interrupt (defaults to ->enable if NULL)
50 * @shutdown: shut down the interrupt (defaults to ->disable if NULL)
51 * @enable: enable the interrupt (defaults to chip->unmask if NULL)
52 * @disable: disable the interrupt (defaults to chip->mask if NULL)
53 * @handle_irq: irq flow handler called from the arch IRQ glue code
54 * @ack: start of a new interrupt
55 * @mask: mask an interrupt source
56 * @mask_ack: ack and mask an interrupt source
57 * @unmask: unmask an interrupt source
58 * @hold: same interrupt while the handler is running
59 * @end: end of interrupt
60 * @set_affinity: set the CPU affinity on SMP machines
61 * @retrigger: resend an IRQ to the CPU
62 * @set_type: set the flow type (IRQ_TYPE_LEVEL/etc.) of an IRQ
63 * @set_wake: enable/disable power-management wake-on of an IRQ
65 * @release: release function solely used by UML
67 struct hw_interrupt_type
{
69 unsigned int (*startup
)(unsigned int irq
);
70 void (*shutdown
)(unsigned int irq
);
71 void (*enable
)(unsigned int irq
);
72 void (*disable
)(unsigned int irq
);
73 void (*ack
)(unsigned int irq
);
74 void (*end
)(unsigned int irq
);
75 void (*set_affinity
)(unsigned int irq
, cpumask_t dest
);
76 int (*retrigger
)(unsigned int irq
);
78 /* Currently used only by UML, might disappear one day.*/
79 #ifdef CONFIG_IRQ_RELEASE_METHOD
80 void (*release
)(unsigned int irq
, void *dev_id
);
84 typedef struct hw_interrupt_type hw_irq_controller
;
86 struct proc_dir_entry
;
89 * struct irq_desc - interrupt descriptor
91 * @handler: interrupt type dependent handler functions
92 * @handler_data: data for the type handlers
93 * @action: the irq action chain
94 * @status: status information
95 * @depth: disable-depth, for nested irq_disable() calls
96 * @irq_count: stats field to detect stalled irqs
97 * @irqs_unhandled: stats field for spurious unhandled interrupts
98 * @lock: locking for SMP
99 * @affinity: IRQ affinity on SMP
100 * @pending_mask: pending rebalanced interrupts
101 * @move_irq: need to re-target IRQ destination
102 * @dir: /proc/irq/ procfs entry
103 * @affinity_entry: /proc/irq/smp_affinity procfs entry on SMP
105 * Pad this out to 32 bytes for cache and indexing reasons.
108 hw_irq_controller
*chip
;
110 struct irqaction
*action
; /* IRQ action list */
111 unsigned int status
; /* IRQ status */
112 unsigned int depth
; /* nested irq disables */
113 unsigned int irq_count
; /* For detecting broken IRQs */
114 unsigned int irqs_unhandled
;
119 #if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE)
120 cpumask_t pending_mask
;
121 unsigned int move_irq
; /* need to re-target IRQ dest */
123 #ifdef CONFIG_PROC_FS
124 struct proc_dir_entry
*dir
;
126 } ____cacheline_aligned
;
128 extern struct irq_desc irq_desc
[NR_IRQS
];
131 * Migration helpers for obsolete names, they will go away:
133 typedef struct irq_desc irq_desc_t
;
136 * Pick up the arch-dependent methods:
138 #include <asm/hw_irq.h>
140 extern int setup_irq(unsigned int irq
, struct irqaction
*new);
142 #ifdef CONFIG_GENERIC_HARDIRQS
145 static inline void set_native_irq_info(int irq
, cpumask_t mask
)
147 irq_desc
[irq
].affinity
= mask
;
150 static inline void set_native_irq_info(int irq
, cpumask_t mask
)
157 #if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE)
159 void set_pending_irq(unsigned int irq
, cpumask_t mask
);
160 void move_native_irq(int irq
);
162 #ifdef CONFIG_PCI_MSI
164 * Wonder why these are dummies?
165 * For e.g the set_ioapic_affinity_vector() calls the set_ioapic_affinity_irq()
166 * counter part after translating the vector to irq info. We need to perform
167 * this operation on the real irq, when we dont use vector, i.e when
168 * pci_use_vector() is false.
170 static inline void move_irq(int irq
)
174 static inline void set_irq_info(int irq
, cpumask_t mask
)
178 #else /* CONFIG_PCI_MSI */
180 static inline void move_irq(int irq
)
182 move_native_irq(irq
);
185 static inline void set_irq_info(int irq
, cpumask_t mask
)
187 set_native_irq_info(irq
, mask
);
190 #endif /* CONFIG_PCI_MSI */
192 #else /* CONFIG_GENERIC_PENDING_IRQ || CONFIG_IRQBALANCE */
194 static inline void move_irq(int irq
)
198 static inline void move_native_irq(int irq
)
202 static inline void set_pending_irq(unsigned int irq
, cpumask_t mask
)
206 static inline void set_irq_info(int irq
, cpumask_t mask
)
208 set_native_irq_info(irq
, mask
);
211 #endif /* CONFIG_GENERIC_PENDING_IRQ */
213 #else /* CONFIG_SMP */
216 #define move_native_irq(x)
218 #endif /* CONFIG_SMP */
220 #ifdef CONFIG_IRQBALANCE
221 extern void set_balance_irq_affinity(unsigned int irq
, cpumask_t mask
);
223 static inline void set_balance_irq_affinity(unsigned int irq
, cpumask_t mask
)
228 #ifdef CONFIG_AUTO_IRQ_AFFINITY
229 extern int select_smp_affinity(unsigned int irq
);
231 static inline int select_smp_affinity(unsigned int irq
)
237 extern int no_irq_affinity
;
238 extern int noirqdebug_setup(char *str
);
240 extern irqreturn_t
handle_IRQ_event(unsigned int irq
, struct pt_regs
*regs
,
241 struct irqaction
*action
);
243 * Explicit fastcall, because i386 4KSTACKS calls it from assembly:
245 extern fastcall
unsigned int __do_IRQ(unsigned int irq
, struct pt_regs
*regs
);
247 extern void note_interrupt(unsigned int irq
, struct irq_desc
*desc
,
248 int action_ret
, struct pt_regs
*regs
);
249 extern int can_request_irq(unsigned int irq
, unsigned long irqflags
);
251 /* Resending of interrupts :*/
252 void check_irq_resend(struct irq_desc
*desc
, unsigned int irq
);
254 extern void init_irq_proc(void);
256 #endif /* CONFIG_GENERIC_HARDIRQS */
258 extern hw_irq_controller no_irq_type
; /* needed in every arch ? */
260 #endif /* !CONFIG_S390 */
262 #endif /* _LINUX_IRQ_H */