sead-irq.S 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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/seadint.h>
  31. /*
  32. * IRQs on the SEAD board look basically are combined together on hardware
  33. * interrupt 0 (MIPS IRQ 2)) like:
  34. *
  35. * MIPS IRQ Source
  36. * -------- ------
  37. * 0 Software (ignored)
  38. * 1 Software (ignored)
  39. * 2 UART0 (hw0)
  40. * 3 UART1 (hw1)
  41. * 4 Hardware (ignored)
  42. * 5 Hardware (ignored)
  43. * 6 Hardware (ignored)
  44. * 7 R4k timer (what we use)
  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. addu a0, MIPSCPU_INT_BASE
  93. jal do_IRQ
  94. move a1, sp
  95. j ret_from_irq
  96. nop
  97. spurious:
  98. j spurious_interrupt
  99. nop
  100. END(mipsIRQ)