]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - kernel/irq/internals.h
genirq: Move IRQ_MASKED to core
[mirror_ubuntu-bionic-kernel.git] / kernel / irq / internals.h
CommitLineData
1da177e4
LT
1/*
2 * IRQ subsystem internal functions and variables:
dbec07ba
TG
3 *
4 * Do not ever include this file from anything else than
5 * kernel/irq/. Do not even think about using any information outside
6 * of this file for your non core code.
1da177e4 7 */
e144710b 8#include <linux/irqdesc.h>
1da177e4 9
c1ee6264
TG
10#ifdef CONFIG_SPARSE_IRQ
11# define IRQ_BITMAP_BITS (NR_IRQS + 8196)
12#else
13# define IRQ_BITMAP_BITS NR_IRQS
14#endif
15
009b4c3b 16#include "compat.h"
e6bea9c4
TG
17#include "settings.h"
18
dbec07ba
TG
19#define istate core_internal_state__do_not_mess_with_it
20
1da177e4
LT
21extern int noirqdebug;
22
1535dfac
TG
23/*
24 * Bits used by threaded handlers:
25 * IRQTF_RUNTHREAD - signals that the interrupt handler thread should run
26 * IRQTF_DIED - handler thread died
27 * IRQTF_WARNED - warning "IRQ_WAKE_THREAD w/o thread_fn" has been printed
28 * IRQTF_AFFINITY - irq thread is requested to adjust affinity
29 */
30enum {
31 IRQTF_RUNTHREAD,
32 IRQTF_DIED,
33 IRQTF_WARNED,
34 IRQTF_AFFINITY,
35};
36
bd062e76
TG
37/*
38 * Bit masks for desc->state
39 *
40 * IRQS_AUTODETECT - autodetection in progress
7acdd53e
TG
41 * IRQS_SPURIOUS_DISABLED - was disabled due to spurious interrupt
42 * detection
6954b75b 43 * IRQS_POLL_INPROGRESS - polling in progress
009b4c3b 44 * IRQS_INPROGRESS - Interrupt in progress
3d67baec 45 * IRQS_ONESHOT - irq is not unmasked in primary handler
163ef309
TG
46 * IRQS_REPLAY - irq is replayed
47 * IRQS_WAITING - irq is waiting
c1594b77 48 * IRQS_DISABLED - irq is disabled
2a0d6fb3 49 * IRQS_PENDING - irq is pending and replayed later
6e40262e 50 * IRQS_MASKED - irq is masked
bd062e76
TG
51 */
52enum {
53 IRQS_AUTODETECT = 0x00000001,
7acdd53e 54 IRQS_SPURIOUS_DISABLED = 0x00000002,
6954b75b 55 IRQS_POLL_INPROGRESS = 0x00000008,
009b4c3b 56 IRQS_INPROGRESS = 0x00000010,
3d67baec 57 IRQS_ONESHOT = 0x00000020,
163ef309
TG
58 IRQS_REPLAY = 0x00000040,
59 IRQS_WAITING = 0x00000080,
c1594b77 60 IRQS_DISABLED = 0x00000100,
2a0d6fb3 61 IRQS_PENDING = 0x00000200,
6e40262e 62 IRQS_MASKED = 0x00000400,
bd062e76
TG
63};
64
a77c4635
TG
65#define irq_data_to_desc(data) container_of(data, struct irq_desc, irq_data)
66
6a6de9ef
TG
67/* Set default functions for irq_chip structures: */
68extern void irq_chip_set_defaults(struct irq_chip *chip);
69
70/* Set default handler: */
71extern void compat_irq_chip_set_default_handler(struct irq_desc *desc);
72
0c5d1eb7
DB
73extern int __irq_set_trigger(struct irq_desc *desc, unsigned int irq,
74 unsigned long flags);
0a0c5168
RW
75extern void __disable_irq(struct irq_desc *desc, unsigned int irq, bool susp);
76extern void __enable_irq(struct irq_desc *desc, unsigned int irq, bool resume);
0c5d1eb7 77
46999238
TG
78extern int irq_startup(struct irq_desc *desc);
79extern void irq_shutdown(struct irq_desc *desc);
87923470
TG
80extern void irq_enable(struct irq_desc *desc);
81extern void irq_disable(struct irq_desc *desc);
46999238 82
85ac16d0 83extern void init_kstat_irqs(struct irq_desc *desc, int node, int nr);
0fa0ebbf 84
4912609f
TG
85irqreturn_t handle_irq_event_percpu(struct irq_desc *desc, struct irqaction *action);
86irqreturn_t handle_irq_event(struct irq_desc *desc);
87
e144710b
TG
88/* Resending of interrupts :*/
89void check_irq_resend(struct irq_desc *desc, unsigned int irq);
fe200ae4 90bool irq_wait_for_poll(struct irq_desc *desc);
e144710b 91
1da177e4 92#ifdef CONFIG_PROC_FS
2c6927a3 93extern void register_irq_proc(unsigned int irq, struct irq_desc *desc);
13bfe99e 94extern void unregister_irq_proc(unsigned int irq, struct irq_desc *desc);
1da177e4
LT
95extern void register_handler_proc(unsigned int irq, struct irqaction *action);
96extern void unregister_handler_proc(unsigned int irq, struct irqaction *action);
97#else
2c6927a3 98static inline void register_irq_proc(unsigned int irq, struct irq_desc *desc) { }
13bfe99e 99static inline void unregister_irq_proc(unsigned int irq, struct irq_desc *desc) { }
1da177e4
LT
100static inline void register_handler_proc(unsigned int irq,
101 struct irqaction *action) { }
102static inline void unregister_handler_proc(unsigned int irq,
103 struct irqaction *action) { }
104#endif
105
3b8249e7 106extern int irq_select_affinity_usr(unsigned int irq, struct cpumask *mask);
f6d87f4b 107
591d2fb0 108extern void irq_set_thread_affinity(struct irq_desc *desc);
57b150cc 109
70aedd24 110/* Inline functions for support of irq chips on slow busses */
3876ec9e 111static inline void chip_bus_lock(struct irq_desc *desc)
70aedd24 112{
3876ec9e
TG
113 if (unlikely(desc->irq_data.chip->irq_bus_lock))
114 desc->irq_data.chip->irq_bus_lock(&desc->irq_data);
70aedd24
TG
115}
116
3876ec9e 117static inline void chip_bus_sync_unlock(struct irq_desc *desc)
70aedd24 118{
3876ec9e
TG
119 if (unlikely(desc->irq_data.chip->irq_bus_sync_unlock))
120 desc->irq_data.chip->irq_bus_sync_unlock(&desc->irq_data);
70aedd24
TG
121}
122
43f77759
IM
123/*
124 * Debugging printout:
125 */
126
127#include <linux/kallsyms.h>
128
129#define P(f) if (desc->status & f) printk("%14s set\n", #f)
bd062e76 130#define PS(f) if (desc->istate & f) printk("%14s set\n", #f)
43f77759
IM
131
132static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
133{
134 printk("irq %d, desc: %p, depth: %d, count: %d, unhandled: %d\n",
135 irq, desc, desc->depth, desc->irq_count, desc->irqs_unhandled);
136 printk("->handle_irq(): %p, ", desc->handle_irq);
137 print_symbol("%s\n", (unsigned long)desc->handle_irq);
6b8ff312
TG
138 printk("->irq_data.chip(): %p, ", desc->irq_data.chip);
139 print_symbol("%s\n", (unsigned long)desc->irq_data.chip);
43f77759
IM
140 printk("->action(): %p\n", desc->action);
141 if (desc->action) {
142 printk("->action->handler(): %p, ", desc->action->handler);
143 print_symbol("%s\n", (unsigned long)desc->action->handler);
144 }
145
43f77759 146 P(IRQ_LEVEL);
43f77759
IM
147#ifdef CONFIG_IRQ_PER_CPU
148 P(IRQ_PER_CPU);
149#endif
150 P(IRQ_NOPROBE);
151 P(IRQ_NOREQUEST);
152 P(IRQ_NOAUTOEN);
bd062e76
TG
153
154 PS(IRQS_AUTODETECT);
009b4c3b 155 PS(IRQS_INPROGRESS);
163ef309
TG
156 PS(IRQS_REPLAY);
157 PS(IRQS_WAITING);
c1594b77 158 PS(IRQS_DISABLED);
2a0d6fb3 159 PS(IRQS_PENDING);
6e40262e 160 PS(IRQS_MASKED);
43f77759
IM
161}
162
163#undef P
bd062e76 164#undef PS