malta-irq.S 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. * Carsten Langgaard, carstenl@mips.com
  3. * Copyright (C) 1999, 2000 MIPS Technologies, Inc. All rights reserved.
  4. *
  5. * ########################################################################
  6. *
  7. * This program is free software; you can distribute it and/or modify it
  8. * under the terms of the GNU General Public License (Version 2) as
  9. * published by the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope it will be useful, but WITHOUT
  12. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  14. * for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program; if not, write to the Free Software Foundation, Inc.,
  18. * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
  19. *
  20. * ########################################################################
  21. *
  22. * Interrupt exception dispatch code.
  23. *
  24. */
  25. #include <linux/config.h>
  26. #include <asm/asm.h>
  27. #include <asm/mipsregs.h>
  28. #include <asm/regdef.h>
  29. #include <asm/stackframe.h>
  30. #include <asm/mips-boards/maltaint.h>
  31. /*
  32. * IRQs on the Malta board look basically (barring software IRQs which we
  33. * don't use at all and all external interrupt sources are combined together
  34. * on hardware interrupt 0 (MIPS IRQ 2)) like:
  35. *
  36. * MIPS IRQ Source
  37. * -------- ------
  38. * 0 Software (ignored)
  39. * 1 Software (ignored)
  40. * 2 Combined hardware interrupt (hw0)
  41. * 3 Hardware (ignored)
  42. * 4 Hardware (ignored)
  43. * 5 Hardware (ignored)
  44. * 6 Hardware (ignored)
  45. * 7 R4k timer (what we use)
  46. *
  47. * We handle the IRQ according to _our_ priority which is:
  48. *
  49. * Highest ---- R4k Timer
  50. * Lowest ---- Combined hardware interrupt
  51. *
  52. * then we just return, if multiple IRQs are pending then we will just take
  53. * another exception, big deal.
  54. */
  55. .text
  56. .set noreorder
  57. .set noat
  58. .align 5
  59. NESTED(mipsIRQ, PT_SIZE, sp)
  60. SAVE_ALL
  61. CLI
  62. .set at
  63. mfc0 s0, CP0_CAUSE # get irq bits
  64. mfc0 s1, CP0_STATUS # get irq mask
  65. andi s0, ST0_IM # CAUSE.CE may be non-zero!
  66. and s0, s1
  67. #if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
  68. .set mips32
  69. clz a0, s0
  70. .set mips0
  71. negu a0
  72. addu a0, 31-CAUSEB_IP
  73. bltz a0, spurious
  74. #else
  75. beqz s0, spurious
  76. li a0, 7
  77. and t0, s0, 0xf000
  78. sltiu t0, t0, 1
  79. sll t0, 2
  80. subu a0, t0
  81. sll s0, t0
  82. and t0, s0, 0xc000
  83. sltiu t0, t0, 1
  84. sll t0, 1
  85. subu a0, t0
  86. sll s0, t0
  87. and t0, s0, 0x8000
  88. sltiu t0, t0, 1
  89. # sll t0, 0
  90. subu a0, t0
  91. # sll s0, t0
  92. #endif
  93. li a1, MIPSCPU_INT_I8259A
  94. bne a0, a1, 1f
  95. addu a0, MIPSCPU_INT_BASE
  96. jal malta_hw0_irqdispatch
  97. move a0, sp
  98. j ret_from_irq
  99. nop
  100. 1:
  101. jal do_IRQ
  102. move a1, sp
  103. j ret_from_irq
  104. nop
  105. spurious:
  106. j spurious_interrupt
  107. nop
  108. END(mipsIRQ)