Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * linux/include/asm-arm/mach/irq.h | |
3 | * | |
4 | * Copyright (C) 1995-2000 Russell King. | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License version 2 as | |
8 | * published by the Free Software Foundation. | |
9 | */ | |
10 | #ifndef __ASM_ARM_MACH_IRQ_H | |
11 | #define __ASM_ARM_MACH_IRQ_H | |
12 | ||
13 | struct irqdesc; | |
14 | struct pt_regs; | |
15 | struct seq_file; | |
16 | ||
17 | typedef void (*irq_handler_t)(unsigned int, struct irqdesc *, struct pt_regs *); | |
18 | typedef void (*irq_control_t)(unsigned int); | |
19 | ||
20 | struct irqchip { | |
21 | /* | |
22 | * Acknowledge the IRQ. | |
23 | * If this is a level-based IRQ, then it is expected to mask the IRQ | |
24 | * as well. | |
25 | */ | |
26 | void (*ack)(unsigned int); | |
27 | /* | |
28 | * Mask the IRQ in hardware. | |
29 | */ | |
30 | void (*mask)(unsigned int); | |
31 | /* | |
32 | * Unmask the IRQ in hardware. | |
33 | */ | |
34 | void (*unmask)(unsigned int); | |
35 | /* | |
36 | * Ask the hardware to re-trigger the IRQ. | |
37 | * Note: This method _must_ _not_ call the interrupt handler. | |
38 | * If you are unable to retrigger the interrupt, do not | |
39 | * provide a function, or if you do, return non-zero. | |
40 | */ | |
41 | int (*retrigger)(unsigned int); | |
42 | /* | |
43 | * Set the type of the IRQ. | |
44 | */ | |
7801907b | 45 | int (*set_type)(unsigned int, unsigned int); |
1da177e4 LT |
46 | /* |
47 | * Set wakeup-enable on the selected IRQ | |
48 | */ | |
7801907b | 49 | int (*set_wake)(unsigned int, unsigned int); |
1da177e4 LT |
50 | |
51 | #ifdef CONFIG_SMP | |
52 | /* | |
53 | * Route an interrupt to a CPU | |
54 | */ | |
55 | void (*set_cpu)(struct irqdesc *desc, unsigned int irq, unsigned int cpu); | |
56 | #endif | |
57 | }; | |
58 | ||
59 | struct irqdesc { | |
60 | irq_handler_t handle; | |
61 | struct irqchip *chip; | |
62 | struct irqaction *action; | |
63 | struct list_head pend; | |
54815366 | 64 | void __iomem *base; |
1da177e4 LT |
65 | void *data; |
66 | unsigned int disable_depth; | |
67 | ||
68 | unsigned int triggered: 1; /* IRQ has occurred */ | |
69 | unsigned int running : 1; /* IRQ is running */ | |
70 | unsigned int pending : 1; /* IRQ is pending */ | |
71 | unsigned int probing : 1; /* IRQ in use for a probe */ | |
72 | unsigned int probe_ok : 1; /* IRQ can be used for probe */ | |
73 | unsigned int valid : 1; /* IRQ claimable */ | |
74 | unsigned int noautoenable : 1; /* don't automatically enable IRQ */ | |
75 | unsigned int unused :25; | |
76 | ||
bec1b819 | 77 | unsigned int irqs_unhandled; |
1da177e4 LT |
78 | struct proc_dir_entry *procdir; |
79 | ||
80 | #ifdef CONFIG_SMP | |
81 | cpumask_t affinity; | |
82 | unsigned int cpu; | |
83 | #endif | |
84 | ||
85 | /* | |
86 | * IRQ lock detection | |
87 | */ | |
88 | unsigned int lck_cnt; | |
89 | unsigned int lck_pc; | |
90 | unsigned int lck_jif; | |
91 | }; | |
92 | ||
93 | extern struct irqdesc irq_desc[]; | |
94 | ||
664399e1 RK |
95 | /* |
96 | * Helpful inline function for calling irq descriptor handlers. | |
97 | */ | |
98 | static inline void desc_handle_irq(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs) | |
99 | { | |
100 | desc->handle(irq, desc, regs); | |
101 | } | |
102 | ||
1da177e4 LT |
103 | /* |
104 | * This is internal. Do not use it. | |
105 | */ | |
106 | extern void (*init_arch_irq)(void); | |
107 | extern void init_FIQ(void); | |
108 | extern int show_fiq_list(struct seq_file *, void *); | |
109 | void __set_irq_handler(unsigned int irq, irq_handler_t, int); | |
110 | ||
111 | /* | |
112 | * External stuff. | |
113 | */ | |
114 | #define set_irq_handler(irq,handler) __set_irq_handler(irq,handler,0) | |
115 | #define set_irq_chained_handler(irq,handler) __set_irq_handler(irq,handler,1) | |
116 | #define set_irq_data(irq,d) do { irq_desc[irq].data = d; } while (0) | |
54815366 RK |
117 | #define set_irq_chipdata(irq,d) do { irq_desc[irq].base = d; } while (0) |
118 | #define get_irq_chipdata(irq) (irq_desc[irq].base) | |
1da177e4 LT |
119 | |
120 | void set_irq_chip(unsigned int irq, struct irqchip *); | |
121 | void set_irq_flags(unsigned int irq, unsigned int flags); | |
122 | ||
123 | #define IRQF_VALID (1 << 0) | |
124 | #define IRQF_PROBE (1 << 1) | |
125 | #define IRQF_NOAUTOEN (1 << 2) | |
126 | ||
127 | /* | |
128 | * Built-in IRQ handlers. | |
129 | */ | |
130 | void do_level_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs); | |
131 | void do_edge_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs); | |
132 | void do_simple_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs); | |
133 | void do_bad_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs); | |
134 | void dummy_mask_unmask_irq(unsigned int irq); | |
135 | ||
136 | #endif |