blob: 956db6e201d1877ca6f6b3f8d48fc9ecd6799396 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994 by Waldorf GMBH, written by Ralf Baechle
7 * Copyright (C) 1995, 96, 97, 98, 99, 2000, 01, 02, 03 by Ralf Baechle
8 */
9#ifndef _ASM_IRQ_H
10#define _ASM_IRQ_H
11
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <linux/linkage.h>
Ralf Baechle631330f2009-06-19 14:05:26 +010013#include <linux/smp.h>
Grant Likelyabd23632012-02-24 08:07:06 -070014#include <linux/irqdomain.h>
Ralf Baechle41c594a2006-04-05 09:45:45 +010015
16#include <asm/mipsmtregs.h>
17
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#include <irq.h>
19
Matt Redfearnfe8bd182016-12-19 14:20:56 +000020#define IRQ_STACK_SIZE THREAD_SIZE
21
22extern void *irq_stack[NR_CPUS];
23
24static inline bool on_irq_stack(int cpu, unsigned long sp)
25{
26 unsigned long low = (unsigned long)irq_stack[cpu];
27 unsigned long high = low + IRQ_STACK_SIZE;
28
29 return (low <= sp && sp <= high);
30}
31
Linus Torvalds1da177e2005-04-16 15:20:36 -070032#ifdef CONFIG_I8259
33static inline int irq_canonicalize(int irq)
34{
Atsushi Nemoto2fa79372007-01-14 23:41:42 +090035 return ((irq == I8259A_IRQ_BASE + 2) ? I8259A_IRQ_BASE + 9 : irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -070036}
37#else
38#define irq_canonicalize(irq) (irq) /* Sane hardware, sane code ... */
39#endif
40
Sergey Ryazanov950e97c2014-08-14 02:09:36 +040041asmlinkage void plat_irq_dispatch(void);
42
Wu Zhangjin8f99a162009-11-20 20:34:33 +080043extern void do_IRQ(unsigned int irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -070044
Linus Torvalds1da177e2005-04-16 15:20:36 -070045extern void arch_init_irq(void);
Ralf Baechle937a8012006-10-07 19:44:33 +010046extern void spurious_interrupt(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070047
Ralf Baechle4a4cf772006-11-06 17:41:06 +000048extern int allocate_irqno(void);
49extern void alloc_legacy_irqno(void);
50extern void free_irqno(unsigned int irq);
51
Ralf Baechle3b1d4ed2007-06-20 22:27:10 +010052/*
53 * Before R2 the timer and performance counter interrupts were both fixed to
Ralf Baechle70342282013-01-22 12:59:30 +010054 * IE7. Since R2 their number has to be read from the c0_intctl register.
Ralf Baechle3b1d4ed2007-06-20 22:27:10 +010055 */
56#define CP0_LEGACY_COMPARE_IRQ 7
Ralf Baechlec6a4ebb2012-07-06 23:56:00 +020057#define CP0_LEGACY_PERFCNT_IRQ 7
Ralf Baechle3b1d4ed2007-06-20 22:27:10 +010058
59extern int cp0_compare_irq;
David VomLehn010c1082009-12-21 17:49:22 -080060extern int cp0_compare_irq_shift;
Ralf Baechle3b1d4ed2007-06-20 22:27:10 +010061extern int cp0_perfcount_irq;
James Hogan8f7ff022015-01-29 11:14:07 +000062extern int cp0_fdc_irq;
63
Bjorn Helgaas770847b2015-07-12 18:11:46 -050064extern int get_c0_fdc_int(void);
Ralf Baechle3b1d4ed2007-06-20 22:27:10 +010065
Chris Metcalf9a01c3e2016-10-07 17:02:45 -070066void arch_trigger_cpumask_backtrace(const struct cpumask *mask,
67 bool exclude_self);
68#define arch_trigger_cpumask_backtrace arch_trigger_cpumask_backtrace
Eunbong Song856839b2014-10-22 06:39:56 +000069
Linus Torvalds1da177e2005-04-16 15:20:36 -070070#endif /* _ASM_IRQ_H */