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
44 * Interrupt controller descriptor. This is all we need
45 * to describe about the low-level hardware.
47 struct hw_interrupt_type {
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 int (*retrigger)(unsigned int irq);
58 /* Currently used only by UML, might disappear one day.*/
59 #ifdef CONFIG_IRQ_RELEASE_METHOD
60 void (*release)(unsigned int irq, void *dev_id);
64 typedef struct hw_interrupt_type hw_irq_controller;
66 struct proc_dir_entry;
69 * This is the "IRQ descriptor", which contains various information
70 * about the irq, including what kind of hardware handling it has,
71 * whether it is disabled etc etc.
73 * Pad this out to 32 bytes for cache and indexing reasons.
76 hw_irq_controller *chip;
78 struct irqaction *action; /* IRQ action list */
79 unsigned int status; /* IRQ status */
80 unsigned int depth; /* nested irq disables */
81 unsigned int irq_count; /* For detecting broken IRQs */
82 unsigned int irqs_unhandled;
87 #if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE)
88 cpumask_t pending_mask;
89 unsigned int move_irq; /* need to re-target IRQ dest */
92 struct proc_dir_entry *dir;
94 } ____cacheline_aligned;
96 extern struct irq_desc irq_desc[NR_IRQS];
99 * Migration helpers for obsolete names, they will go away:
101 typedef struct irq_desc irq_desc_t;
104 * Pick up the arch-dependent methods:
106 #include <asm/hw_irq.h>
108 extern int setup_irq(unsigned int irq, struct irqaction *new);
110 #ifdef CONFIG_GENERIC_HARDIRQS
113 static inline void set_native_irq_info(int irq, cpumask_t mask)
115 irq_desc[irq].affinity = mask;
118 static inline void set_native_irq_info(int irq, cpumask_t mask)
125 #if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE)
127 void set_pending_irq(unsigned int irq, cpumask_t mask);
128 void move_native_irq(int irq);
130 #ifdef CONFIG_PCI_MSI
132 * Wonder why these are dummies?
133 * For e.g the set_ioapic_affinity_vector() calls the set_ioapic_affinity_irq()
134 * counter part after translating the vector to irq info. We need to perform
135 * this operation on the real irq, when we dont use vector, i.e when
136 * pci_use_vector() is false.
138 static inline void move_irq(int irq)
142 static inline void set_irq_info(int irq, cpumask_t mask)
146 #else /* CONFIG_PCI_MSI */
148 static inline void move_irq(int irq)
150 move_native_irq(irq);
153 static inline void set_irq_info(int irq, cpumask_t mask)
155 set_native_irq_info(irq, mask);
158 #endif /* CONFIG_PCI_MSI */
160 #else /* CONFIG_GENERIC_PENDING_IRQ || CONFIG_IRQBALANCE */
162 static inline void move_irq(int irq)
166 static inline void move_native_irq(int irq)
170 static inline void set_pending_irq(unsigned int irq, cpumask_t mask)
174 static inline void set_irq_info(int irq, cpumask_t mask)
176 set_native_irq_info(irq, mask);
179 #endif /* CONFIG_GENERIC_PENDING_IRQ */
181 #else /* CONFIG_SMP */
184 #define move_native_irq(x)
186 #endif /* CONFIG_SMP */
188 #ifdef CONFIG_IRQBALANCE
189 extern void set_balance_irq_affinity(unsigned int irq, cpumask_t mask);
191 static inline void set_balance_irq_affinity(unsigned int irq, cpumask_t mask)
196 #ifdef CONFIG_AUTO_IRQ_AFFINITY
197 extern int select_smp_affinity(unsigned int irq);
199 static inline int select_smp_affinity(unsigned int irq)
205 extern int no_irq_affinity;
206 extern int noirqdebug_setup(char *str);
208 extern irqreturn_t handle_IRQ_event(unsigned int irq, struct pt_regs *regs,
209 struct irqaction *action);
211 * Explicit fastcall, because i386 4KSTACKS calls it from assembly:
213 extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs);
215 extern void note_interrupt(unsigned int irq, struct irq_desc *desc,
216 int action_ret, struct pt_regs *regs);
217 extern int can_request_irq(unsigned int irq, unsigned long irqflags);
219 extern void init_irq_proc(void);
221 #endif /* CONFIG_GENERIC_HARDIRQS */
223 extern hw_irq_controller no_irq_type; /* needed in every arch ? */
225 #endif /* !CONFIG_S390 */
227 #endif /* _LINUX_IRQ_H */