blob: cf417e51073627ff6184f15ddd3a78f7948419c7 [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
Grant Likely476eb492011-05-04 15:02:15 +100036struct irq_data;
37extern irq_hw_number_t irqd_to_hwirq(struct irq_data *d);
Olof Johansson35923f122007-06-04 14:47:04 +100038extern irq_hw_number_t virq_to_hw(unsigned int virq);
Benjamin Herrenschmidt0b05ac62011-04-04 13:46:58 +100039
Michael Ellerman40681b92006-08-02 11:13:50 +100040/**
Benjamin Herrenschmidt0ebfff12006-07-03 21:36:01 +100041 * irq_early_init - Init irq remapping subsystem
42 */
43extern void irq_early_init(void);
44
45static __inline__ int irq_canonicalize(int irq)
46{
47 return irq;
48}
49
Paul Mackerras1b923132005-10-10 22:54:57 +100050extern int distribute_irqs;
51
52struct irqaction;
53struct pt_regs;
54
Paul Mackerrasc6622f62006-02-24 10:06:59 +110055#define __ARCH_HAS_DO_SOFTIRQ
56
Kumar Galabcf0b082008-04-30 03:49:55 -050057#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
58/*
59 * Per-cpu stacks for handling critical, debug and machine check
60 * level interrupts.
61 */
62extern struct thread_info *critirq_ctx[NR_CPUS];
63extern struct thread_info *dbgirq_ctx[NR_CPUS];
64extern struct thread_info *mcheckirq_ctx[NR_CPUS];
65extern void exc_lvl_ctx_init(void);
66#else
67#define exc_lvl_ctx_init()
68#endif
69
Paul Mackerras1b923132005-10-10 22:54:57 +100070/*
71 * Per-cpu stacks for handling hard and soft interrupts.
72 */
73extern struct thread_info *hardirq_ctx[NR_CPUS];
74extern struct thread_info *softirq_ctx[NR_CPUS];
75
76extern void irq_ctx_init(void);
77extern void call_do_softirq(struct thread_info *tp);
David Howells7d12e782006-10-05 14:55:46 +010078extern int call_handle_irq(int irq, void *p1,
Benjamin Herrenschmidtb9e5b4e2006-07-03 19:32:51 +100079 struct thread_info *tp, void *func);
Paul Mackerrasf2783c12005-10-20 09:23:26 +100080extern void do_IRQ(struct pt_regs *regs);
81
Stuart Yoder6ec36b52011-05-19 08:54:26 -050082int irq_choose_cpu(const struct cpumask *mask);
83
Linus Torvalds1da177e2005-04-16 15:20:36 -070084#endif /* _ASM_IRQ_H */
85#endif /* __KERNEL__ */