blob: ddd1c918103bcc347c6a350d28d213ba314a90d9 [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
Matt Redfearndb8466c2017-03-21 14:52:25 +000021#define IRQ_STACK_START (IRQ_STACK_SIZE - sizeof(unsigned long))
Matt Redfearnfe8bd182016-12-19 14:20:56 +000022
23extern void *irq_stack[NR_CPUS];
24
Matt Redfearndb8466c2017-03-21 14:52:25 +000025/*
26 * The highest address on the IRQ stack contains a dummy frame put down in
27 * genex.S (handle_int & except_vec_vi_handler) which is structured as follows:
28 *
29 * top ------------
30 * | task sp | <- irq_stack[cpu] + IRQ_STACK_START
31 * ------------
32 * | | <- First frame of IRQ context
33 * ------------
34 *
35 * task sp holds a copy of the task stack pointer where the struct pt_regs
36 * from exception entry can be found.
37 */
38
Matt Redfearnfe8bd182016-12-19 14:20:56 +000039static inline bool on_irq_stack(int cpu, unsigned long sp)
40{
41 unsigned long low = (unsigned long)irq_stack[cpu];
42 unsigned long high = low + IRQ_STACK_SIZE;
43
44 return (low <= sp && sp <= high);
45}
46
Linus Torvalds1da177e2005-04-16 15:20:36 -070047#ifdef CONFIG_I8259
48static inline int irq_canonicalize(int irq)
49{
Atsushi Nemoto2fa79372007-01-14 23:41:42 +090050 return ((irq == I8259A_IRQ_BASE + 2) ? I8259A_IRQ_BASE + 9 : irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -070051}
52#else
53#define irq_canonicalize(irq) (irq) /* Sane hardware, sane code ... */
54#endif
55
Sergey Ryazanov950e97c2014-08-14 02:09:36 +040056asmlinkage void plat_irq_dispatch(void);
57
Wu Zhangjin8f99a162009-11-20 20:34:33 +080058extern void do_IRQ(unsigned int irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -070059
Linus Torvalds1da177e2005-04-16 15:20:36 -070060extern void arch_init_irq(void);
Ralf Baechle937a8012006-10-07 19:44:33 +010061extern void spurious_interrupt(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070062
Ralf Baechle4a4cf772006-11-06 17:41:06 +000063extern int allocate_irqno(void);
64extern void alloc_legacy_irqno(void);
65extern void free_irqno(unsigned int irq);
66
Ralf Baechle3b1d4ed2007-06-20 22:27:10 +010067/*
68 * Before R2 the timer and performance counter interrupts were both fixed to
Ralf Baechle70342282013-01-22 12:59:30 +010069 * IE7. Since R2 their number has to be read from the c0_intctl register.
Ralf Baechle3b1d4ed2007-06-20 22:27:10 +010070 */
71#define CP0_LEGACY_COMPARE_IRQ 7
Ralf Baechlec6a4ebb2012-07-06 23:56:00 +020072#define CP0_LEGACY_PERFCNT_IRQ 7
Ralf Baechle3b1d4ed2007-06-20 22:27:10 +010073
74extern int cp0_compare_irq;
David VomLehn010c1082009-12-21 17:49:22 -080075extern int cp0_compare_irq_shift;
Ralf Baechle3b1d4ed2007-06-20 22:27:10 +010076extern int cp0_perfcount_irq;
James Hogan8f7ff022015-01-29 11:14:07 +000077extern int cp0_fdc_irq;
78
Bjorn Helgaas770847b2015-07-12 18:11:46 -050079extern int get_c0_fdc_int(void);
Ralf Baechle3b1d4ed2007-06-20 22:27:10 +010080
Chris Metcalf9a01c3e2016-10-07 17:02:45 -070081void arch_trigger_cpumask_backtrace(const struct cpumask *mask,
82 bool exclude_self);
83#define arch_trigger_cpumask_backtrace arch_trigger_cpumask_backtrace
Eunbong Song856839b2014-10-22 06:39:56 +000084
Linus Torvalds1da177e2005-04-16 15:20:36 -070085#endif /* _ASM_IRQ_H */