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.
12 #include <linux/config.h>
13 #include <linux/threads.h>
16 * Maximum number of interrupt sources that we can handle.
20 /* this number is used when no interrupt has been assigned */
24 * These constants are used for passing information about interrupt
25 * signal polarity and level/edge sensing to the low-level PIC chip
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 */
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 */
37 * IRQ line status macro IRQ_PER_CPU is used
39 #define ARCH_HAS_IRQ_PER_CPU
41 #define get_irq_desc(irq) (&irq_desc[(irq)])
43 /* Define a way to iterate across irqs. */
44 #define for_each_irq(i) \
45 for ((i) = 0; (i) < NR_IRQS; ++(i))
47 /* Interrupt numbers are virtual in case they are sparsely
48 * distributed by the hardware.
50 extern unsigned int virt_irq_to_real_map
[NR_IRQS
];
52 /* Create a mapping for a real_irq if it doesn't already exist.
53 * Return the virtual irq as a convenience.
55 int virt_irq_create_mapping(unsigned int real_irq
);
56 void virt_irq_init(void);
58 static inline unsigned int virt_irq_to_real(unsigned int virt_irq
)
60 return virt_irq_to_real_map
[virt_irq
];
63 extern unsigned int real_irq_to_virt_slowpath(unsigned int real_irq
);
66 * Because many systems have two overlapping names spaces for
67 * interrupts (ISA and XICS for example), and the ISA interrupts
68 * have historically not been easy to renumber, we allow ISA
69 * interrupts to take values 0 - 15, and shift up the remaining
72 #define NUM_ISA_INTERRUPTS 0x10
73 extern int __irq_offset_value
;
75 static inline int irq_offset_up(int irq
)
77 return(irq
+ __irq_offset_value
);
80 static inline int irq_offset_down(int irq
)
82 return(irq
- __irq_offset_value
);
85 static inline int irq_offset_value(void)
87 return __irq_offset_value
;
90 static __inline__
int irq_canonicalize(int irq
)
95 extern int distribute_irqs
;
100 #ifdef CONFIG_IRQSTACKS
102 * Per-cpu stacks for handling hard and soft interrupts.
104 extern struct thread_info
*hardirq_ctx
[NR_CPUS
];
105 extern struct thread_info
*softirq_ctx
[NR_CPUS
];
107 extern void irq_ctx_init(void);
108 extern void call_do_softirq(struct thread_info
*tp
);
109 extern int call_handle_IRQ_event(int irq
, struct pt_regs
*regs
,
110 struct irqaction
*action
, struct thread_info
*tp
);
112 #define __ARCH_HAS_DO_SOFTIRQ
115 #define irq_ctx_init()
117 #endif /* CONFIG_IRQSTACKS */
119 #endif /* _ASM_IRQ_H */
120 #endif /* __KERNEL__ */