blob: e648af92ced18b20384102912fbaeafc903ddfb0 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifdef __KERNEL__
Paul Mackerras1b923132005-10-10 22:54:57 +10002#ifndef _ASM_POWERPC_IRQ_H
3#define _ASM_POWERPC_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 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070011
Grant Likelybae1d8f2012-02-14 14:06:50 -070012#include <linux/irqdomain.h>
Paul Mackerras1b923132005-10-10 22:54:57 +100013#include <linux/threads.h>
Benjamin Herrenschmidt0ebfff12006-07-03 21:36:01 +100014#include <linux/list.h>
15#include <linux/radix-tree.h>
Paul Mackerras1b923132005-10-10 22:54:57 +100016
17#include <asm/types.h>
Arun Sharma600634972011-07-26 16:09:06 -070018#include <linux/atomic.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019
Benjamin Herrenschmidt0ebfff12006-07-03 21:36:01 +100020
Benjamin Herrenschmidt0ebfff12006-07-03 21:36:01 +100021/* Define a way to iterate across irqs. */
22#define for_each_irq(i) \
23 for ((i) = 0; (i) < NR_IRQS; ++(i))
24
25extern atomic_t ppc_n_lost_interrupts;
26
Benjamin Herrenschmidt0ebfff12006-07-03 21:36:01 +100027/* This number is used when no interrupt has been assigned */
28#define NO_IRQ (0)
29
Michael Ellerman551b81f2009-10-13 19:44:44 +000030/* Total number of virq in the platform */
31#define NR_IRQS CONFIG_NR_IRQS
Benjamin Herrenschmidt0ebfff12006-07-03 21:36:01 +100032
Michael Ellermancd015702009-10-13 19:45:03 +000033/* Same thing, used by the generic IRQ code */
34#define NR_IRQS_LEGACY NUM_ISA_INTERRUPTS
35
Olof Johansson35923f122007-06-04 14:47:04 +100036extern irq_hw_number_t virq_to_hw(unsigned int virq);
Benjamin Herrenschmidt0b05ac62011-04-04 13:46:58 +100037
Michael Ellerman40681b92006-08-02 11:13:50 +100038/**
Benjamin Herrenschmidt0ebfff12006-07-03 21:36:01 +100039 * irq_early_init - Init irq remapping subsystem
40 */
41extern void irq_early_init(void);
42
43static __inline__ int irq_canonicalize(int irq)
44{
45 return irq;
46}
47
Paul Mackerras1b923132005-10-10 22:54:57 +100048extern int distribute_irqs;
49
50struct irqaction;
51struct pt_regs;
52
Paul Mackerrasc6622f62006-02-24 10:06:59 +110053#define __ARCH_HAS_DO_SOFTIRQ
54
Kumar Galabcf0b082008-04-30 03:49:55 -050055#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
56/*
57 * Per-cpu stacks for handling critical, debug and machine check
58 * level interrupts.
59 */
60extern struct thread_info *critirq_ctx[NR_CPUS];
61extern struct thread_info *dbgirq_ctx[NR_CPUS];
62extern struct thread_info *mcheckirq_ctx[NR_CPUS];
63extern void exc_lvl_ctx_init(void);
64#else
65#define exc_lvl_ctx_init()
66#endif
67
Paul Mackerras1b923132005-10-10 22:54:57 +100068/*
69 * Per-cpu stacks for handling hard and soft interrupts.
70 */
71extern struct thread_info *hardirq_ctx[NR_CPUS];
72extern struct thread_info *softirq_ctx[NR_CPUS];
73
74extern void irq_ctx_init(void);
75extern void call_do_softirq(struct thread_info *tp);
David Howells7d12e782006-10-05 14:55:46 +010076extern int call_handle_irq(int irq, void *p1,
Benjamin Herrenschmidtb9e5b4e2006-07-03 19:32:51 +100077 struct thread_info *tp, void *func);
Paul Mackerrasf2783c12005-10-20 09:23:26 +100078extern void do_IRQ(struct pt_regs *regs);
79
Stuart Yoder6ec36b52011-05-19 08:54:26 -050080int irq_choose_cpu(const struct cpumask *mask);
81
Linus Torvalds1da177e2005-04-16 15:20:36 -070082#endif /* _ASM_IRQ_H */
83#endif /* __KERNEL__ */