]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | #ifdef __KERNEL__ |
2 | #ifndef _ASM_IRQ_H | |
3 | #define _ASM_IRQ_H | |
4 | ||
5 | /* | |
6 | * This program is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the GNU General Public License | |
8 | * as published by the Free Software Foundation; either version | |
9 | * 2 of the License, or (at your option) any later version. | |
10 | */ | |
11 | ||
12 | #include <linux/config.h> | |
13 | #include <linux/threads.h> | |
14 | ||
15 | /* | |
16 | * Maximum number of interrupt sources that we can handle. | |
17 | */ | |
18 | #define NR_IRQS 512 | |
19 | ||
20 | /* this number is used when no interrupt has been assigned */ | |
21 | #define NO_IRQ (-1) | |
22 | ||
23 | /* | |
24 | * These constants are used for passing information about interrupt | |
25 | * signal polarity and level/edge sensing to the low-level PIC chip | |
26 | * drivers. | |
27 | */ | |
28 | #define IRQ_SENSE_MASK 0x1 | |
29 | #define IRQ_SENSE_LEVEL 0x1 /* interrupt on active level */ | |
30 | #define IRQ_SENSE_EDGE 0x0 /* interrupt triggered by edge */ | |
31 | ||
32 | #define IRQ_POLARITY_MASK 0x2 | |
33 | #define IRQ_POLARITY_POSITIVE 0x2 /* high level or low->high edge */ | |
34 | #define IRQ_POLARITY_NEGATIVE 0x0 /* low level or high->low edge */ | |
35 | ||
36 | #define get_irq_desc(irq) (&irq_desc[(irq)]) | |
37 | ||
38 | /* Define a way to iterate across irqs. */ | |
39 | #define for_each_irq(i) \ | |
40 | for ((i) = 0; (i) < NR_IRQS; ++(i)) | |
41 | ||
42 | /* Interrupt numbers are virtual in case they are sparsely | |
43 | * distributed by the hardware. | |
44 | */ | |
45 | extern unsigned int virt_irq_to_real_map[NR_IRQS]; | |
46 | ||
47 | /* Create a mapping for a real_irq if it doesn't already exist. | |
48 | * Return the virtual irq as a convenience. | |
49 | */ | |
50 | int virt_irq_create_mapping(unsigned int real_irq); | |
51 | void virt_irq_init(void); | |
52 | ||
53 | static inline unsigned int virt_irq_to_real(unsigned int virt_irq) | |
54 | { | |
55 | return virt_irq_to_real_map[virt_irq]; | |
56 | } | |
57 | ||
58 | extern unsigned int real_irq_to_virt_slowpath(unsigned int real_irq); | |
59 | ||
60 | /* | |
61 | * Because many systems have two overlapping names spaces for | |
62 | * interrupts (ISA and XICS for example), and the ISA interrupts | |
63 | * have historically not been easy to renumber, we allow ISA | |
64 | * interrupts to take values 0 - 15, and shift up the remaining | |
65 | * interrupts by 0x10. | |
66 | */ | |
67 | #define NUM_ISA_INTERRUPTS 0x10 | |
68 | extern int __irq_offset_value; | |
69 | ||
70 | static inline int irq_offset_up(int irq) | |
71 | { | |
72 | return(irq + __irq_offset_value); | |
73 | } | |
74 | ||
75 | static inline int irq_offset_down(int irq) | |
76 | { | |
77 | return(irq - __irq_offset_value); | |
78 | } | |
79 | ||
80 | static inline int irq_offset_value(void) | |
81 | { | |
82 | return __irq_offset_value; | |
83 | } | |
84 | ||
85 | static __inline__ int irq_canonicalize(int irq) | |
86 | { | |
87 | return irq; | |
88 | } | |
89 | ||
90 | extern int distribute_irqs; | |
91 | ||
92 | struct irqaction; | |
93 | struct pt_regs; | |
94 | ||
95 | #ifdef CONFIG_IRQSTACKS | |
96 | /* | |
97 | * Per-cpu stacks for handling hard and soft interrupts. | |
98 | */ | |
99 | extern struct thread_info *hardirq_ctx[NR_CPUS]; | |
100 | extern struct thread_info *softirq_ctx[NR_CPUS]; | |
101 | ||
102 | extern void irq_ctx_init(void); | |
103 | extern void call_do_softirq(struct thread_info *tp); | |
104 | extern int call_handle_IRQ_event(int irq, struct pt_regs *regs, | |
105 | struct irqaction *action, struct thread_info *tp); | |
106 | ||
107 | #define __ARCH_HAS_DO_SOFTIRQ | |
108 | ||
109 | #else | |
110 | #define irq_ctx_init() | |
111 | ||
112 | #endif /* CONFIG_IRQSTACKS */ | |
113 | ||
114 | #endif /* _ASM_IRQ_H */ | |
115 | #endif /* __KERNEL__ */ |