aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/irqdesc.h
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2010-10-01 10:03:45 -0400
committerThomas Gleixner <tglx@linutronix.de>2010-10-12 10:39:04 -0400
commite144710b302525de5b90b9c3ba43562458d8957f (patch)
tree0a6ef61ccb4957512ebf4a1887ba3bc54e78f99e /include/linux/irqdesc.h
parentfe21221386e46b8e0f2cbd83559a29680c28473b (diff)
genirq: Distangle irq.h
Move irq_desc and internal functions out of irq.h Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/irqdesc.h')
-rw-r--r--include/linux/irqdesc.h171
1 files changed, 171 insertions, 0 deletions
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
new file mode 100644
index 000000000000..22e426fdd301
--- /dev/null
+++ b/include/linux/irqdesc.h
@@ -0,0 +1,171 @@
1#ifndef _LINUX_IRQDESC_H
2#define _LINUX_IRQDESC_H
3
4/*
5 * Core internal functions to deal with irq descriptors
6 *
7 * This include will move to kernel/irq once we cleaned up the tree.
8 * For now it's included from <linux/irq.h>
9 */
10
11struct proc_dir_entry;
12struct timer_rand_state;
13struct irq_2_iommu;
14/**
15 * struct irq_desc - interrupt descriptor
16 * @irq_data: per irq and chip data passed down to chip functions
17 * @timer_rand_state: pointer to timer rand state struct
18 * @kstat_irqs: irq stats per cpu
19 * @handle_irq: highlevel irq-events handler [if NULL, __do_IRQ()]
20 * @action: the irq action chain
21 * @status: status information
22 * @depth: disable-depth, for nested irq_disable() calls
23 * @wake_depth: enable depth, for multiple set_irq_wake() callers
24 * @irq_count: stats field to detect stalled irqs
25 * @last_unhandled: aging timer for unhandled count
26 * @irqs_unhandled: stats field for spurious unhandled interrupts
27 * @lock: locking for SMP
28 * @pending_mask: pending rebalanced interrupts
29 * @threads_active: number of irqaction threads currently running
30 * @wait_for_threads: wait queue for sync_irq to wait for threaded handlers
31 * @dir: /proc/irq/ procfs entry
32 * @name: flow handler name for /proc/interrupts output
33 */
34struct irq_desc {
35
36#ifdef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
37 struct irq_data irq_data;
38#else
39 /*
40 * This union will go away, once we fixed the direct access to
41 * irq_desc all over the place. The direct fields are a 1:1
42 * overlay of irq_data.
43 */
44 union {
45 struct irq_data irq_data;
46 struct {
47 unsigned int irq;
48 unsigned int node;
49 struct irq_chip *chip;
50 void *handler_data;
51 void *chip_data;
52 struct msi_desc *msi_desc;
53#ifdef CONFIG_SMP
54 cpumask_var_t affinity;
55#endif
56#ifdef CONFIG_INTR_REMAP
57 struct irq_2_iommu *irq_2_iommu;
58#endif
59 };
60 };
61#endif
62
63 struct timer_rand_state *timer_rand_state;
64 unsigned int *kstat_irqs;
65 irq_flow_handler_t handle_irq;
66 struct irqaction *action; /* IRQ action list */
67 unsigned int status; /* IRQ status */
68
69 unsigned int depth; /* nested irq disables */
70 unsigned int wake_depth; /* nested wake enables */
71 unsigned int irq_count; /* For detecting broken IRQs */
72 unsigned long last_unhandled; /* Aging timer for unhandled count */
73 unsigned int irqs_unhandled;
74 raw_spinlock_t lock;
75#ifdef CONFIG_SMP
76 const struct cpumask *affinity_hint;
77#ifdef CONFIG_GENERIC_PENDING_IRQ
78 cpumask_var_t pending_mask;
79#endif
80#endif
81 atomic_t threads_active;
82 wait_queue_head_t wait_for_threads;
83#ifdef CONFIG_PROC_FS
84 struct proc_dir_entry *dir;
85#endif
86 const char *name;
87} ____cacheline_internodealigned_in_smp;
88
89extern void arch_init_copy_chip_data(struct irq_desc *old_desc,
90 struct irq_desc *desc, int node);
91extern void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc);
92
93#ifndef CONFIG_SPARSE_IRQ
94extern struct irq_desc irq_desc[NR_IRQS];
95#endif
96
97#ifdef CONFIG_NUMA_IRQ_DESC
98extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int node);
99#else
100static inline struct irq_desc *move_irq_desc(struct irq_desc *desc, int node)
101{
102 return desc;
103}
104#endif
105
106extern struct irq_desc *irq_to_desc_alloc_node(unsigned int irq, int node);
107
108#ifdef CONFIG_GENERIC_HARDIRQS
109
110#define get_irq_desc_chip(desc) ((desc)->irq_data.chip)
111#define get_irq_desc_chip_data(desc) ((desc)->irq_data.chip_data)
112#define get_irq_desc_data(desc) ((desc)->irq_data.handler_data)
113#define get_irq_desc_msi(desc) ((desc)->irq_data.msi_desc)
114
115/*
116 * Monolithic do_IRQ implementation.
117 */
118#ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
119extern unsigned int __do_IRQ(unsigned int irq);
120#endif
121
122/*
123 * Architectures call this to let the generic IRQ layer
124 * handle an interrupt. If the descriptor is attached to an
125 * irqchip-style controller then we call the ->handle_irq() handler,
126 * and it calls __do_IRQ() if it's attached to an irqtype-style controller.
127 */
128static inline void generic_handle_irq_desc(unsigned int irq, struct irq_desc *desc)
129{
130#ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
131 desc->handle_irq(irq, desc);
132#else
133 if (likely(desc->handle_irq))
134 desc->handle_irq(irq, desc);
135 else
136 __do_IRQ(irq);
137#endif
138}
139
140static inline void generic_handle_irq(unsigned int irq)
141{
142 generic_handle_irq_desc(irq, irq_to_desc(irq));
143}
144
145/* Test to see if a driver has successfully requested an irq */
146static inline int irq_has_action(unsigned int irq)
147{
148 struct irq_desc *desc = irq_to_desc(irq);
149 return desc->action != NULL;
150}
151
152static inline int irq_balancing_disabled(unsigned int irq)
153{
154 struct irq_desc *desc;
155
156 desc = irq_to_desc(irq);
157 return desc->status & IRQ_NO_BALANCING_MASK;
158}
159
160/* caller has locked the irq_desc and both params are valid */
161static inline void __set_irq_handler_unlocked(int irq,
162 irq_flow_handler_t handler)
163{
164 struct irq_desc *desc;
165
166 desc = irq_to_desc(irq);
167 desc->handle_irq = handler;
168}
169#endif
170
171#endif