irq.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  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. #include <linux/linkage.h>
  12. #include <linux/smp.h>
  13. #include <linux/irqdomain.h>
  14. #include <asm/mipsmtregs.h>
  15. #include <irq.h>
  16. #define IRQ_STACK_SIZE THREAD_SIZE
  17. #define IRQ_STACK_START (IRQ_STACK_SIZE - 16)
  18. extern void *irq_stack[NR_CPUS];
  19. /*
  20. * The highest address on the IRQ stack contains a dummy frame put down in
  21. * genex.S (handle_int & except_vec_vi_handler) which is structured as follows:
  22. *
  23. * top ------------
  24. * | task sp | <- irq_stack[cpu] + IRQ_STACK_START
  25. * ------------
  26. * | | <- First frame of IRQ context
  27. * ------------
  28. *
  29. * task sp holds a copy of the task stack pointer where the struct pt_regs
  30. * from exception entry can be found.
  31. */
  32. static inline bool on_irq_stack(int cpu, unsigned long sp)
  33. {
  34. unsigned long low = (unsigned long)irq_stack[cpu];
  35. unsigned long high = low + IRQ_STACK_SIZE;
  36. return (low <= sp && sp <= high);
  37. }
  38. #ifdef CONFIG_I8259
  39. static inline int irq_canonicalize(int irq)
  40. {
  41. return ((irq == I8259A_IRQ_BASE + 2) ? I8259A_IRQ_BASE + 9 : irq);
  42. }
  43. #else
  44. #define irq_canonicalize(irq) (irq) /* Sane hardware, sane code ... */
  45. #endif
  46. asmlinkage void plat_irq_dispatch(void);
  47. extern void do_IRQ(unsigned int irq);
  48. extern void arch_init_irq(void);
  49. extern void spurious_interrupt(void);
  50. extern int allocate_irqno(void);
  51. extern void alloc_legacy_irqno(void);
  52. extern void free_irqno(unsigned int irq);
  53. /*
  54. * Before R2 the timer and performance counter interrupts were both fixed to
  55. * IE7. Since R2 their number has to be read from the c0_intctl register.
  56. */
  57. #define CP0_LEGACY_COMPARE_IRQ 7
  58. #define CP0_LEGACY_PERFCNT_IRQ 7
  59. extern int cp0_compare_irq;
  60. extern int cp0_compare_irq_shift;
  61. extern int cp0_perfcount_irq;
  62. extern int cp0_fdc_irq;
  63. extern int get_c0_fdc_int(void);
  64. void arch_trigger_cpumask_backtrace(const struct cpumask *mask,
  65. bool exclude_self);
  66. #define arch_trigger_cpumask_backtrace arch_trigger_cpumask_backtrace
  67. #endif /* _ASM_IRQ_H */