atlas-irq.S 2.9 KB

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