irq.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 <asm/mipsmtregs.h>
  13. #include <irq.h>
  14. #ifdef CONFIG_I8259
  15. static inline int irq_canonicalize(int irq)
  16. {
  17. return ((irq == I8259A_IRQ_BASE + 2) ? I8259A_IRQ_BASE + 9 : irq);
  18. }
  19. #else
  20. #define irq_canonicalize(irq) (irq) /* Sane hardware, sane code ... */
  21. #endif
  22. #ifdef CONFIG_MIPS_MT_SMTC
  23. struct irqaction;
  24. extern unsigned long irq_hwmask[];
  25. extern int setup_irq_smtc(unsigned int irq, struct irqaction * new,
  26. unsigned long hwmask);
  27. static inline void smtc_im_ack_irq(unsigned int irq)
  28. {
  29. if (irq_hwmask[irq] & ST0_IM)
  30. set_c0_status(irq_hwmask[irq] & ST0_IM);
  31. }
  32. #else
  33. static inline void smtc_im_ack_irq(unsigned int irq)
  34. {
  35. }
  36. #endif /* CONFIG_MIPS_MT_SMTC */
  37. #ifdef CONFIG_MIPS_MT_SMTC_IM_BACKSTOP
  38. /*
  39. * Clear interrupt mask handling "backstop" if irq_hwmask
  40. * entry so indicates. This implies that the ack() or end()
  41. * functions will take over re-enabling the low-level mask.
  42. * Otherwise it will be done on return from exception.
  43. */
  44. #define __DO_IRQ_SMTC_HOOK(irq) \
  45. do { \
  46. if (irq_hwmask[irq] & 0x0000ff00) \
  47. write_c0_tccontext(read_c0_tccontext() & \
  48. ~(irq_hwmask[irq] & 0x0000ff00)); \
  49. } while (0)
  50. #else
  51. #define __DO_IRQ_SMTC_HOOK(irq) do { } while (0)
  52. #endif
  53. /*
  54. * do_IRQ handles all normal device IRQ's (the special
  55. * SMP cross-CPU interrupts have their own specific
  56. * handlers).
  57. *
  58. * Ideally there should be away to get this into kernel/irq/handle.c to
  59. * avoid the overhead of a call for just a tiny function ...
  60. */
  61. #define do_IRQ(irq) \
  62. do { \
  63. irq_enter(); \
  64. __DO_IRQ_SMTC_HOOK(irq); \
  65. generic_handle_irq(irq); \
  66. irq_exit(); \
  67. } while (0)
  68. extern void arch_init_irq(void);
  69. extern void spurious_interrupt(void);
  70. extern int allocate_irqno(void);
  71. extern void alloc_legacy_irqno(void);
  72. extern void free_irqno(unsigned int irq);
  73. /*
  74. * Before R2 the timer and performance counter interrupts were both fixed to
  75. * IE7. Since R2 their number has to be read from the c0_intctl register.
  76. */
  77. #define CP0_LEGACY_COMPARE_IRQ 7
  78. extern int cp0_compare_irq;
  79. extern int cp0_perfcount_irq;
  80. #endif /* _ASM_IRQ_H */