int-handler.S 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * FILE NAME
  3. * arch/mips/vr41xx/common/int-handler.S
  4. *
  5. * BRIEF MODULE DESCRIPTION
  6. * Interrupt dispatcher for the NEC VR4100 series.
  7. *
  8. * Author: Yoichi Yuasa
  9. * yyuasa@mvista.com or source@mvista.com
  10. *
  11. * Copyright 2001 MontaVista Software Inc.
  12. *
  13. * This program is free software; you can redistribute it and/or modify it
  14. * under the terms of the GNU General Public License as published by the
  15. * Free Software Foundation; either version 2 of the License, or (at your
  16. * option) any later version.
  17. *
  18. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  19. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  20. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  21. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  22. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  23. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  24. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  25. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
  26. * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  27. * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. *
  29. * You should have received a copy of the GNU General Public License along
  30. * with this program; if not, write to the Free Software Foundation, Inc.,
  31. * 675 Mass Ave, Cambridge, MA 02139, USA.
  32. */
  33. /*
  34. * Changes:
  35. * MontaVista Software Inc. <yyuasa@mvista.com> or <source@mvista.com>
  36. * - New creation, NEC VR4100 series are supported.
  37. *
  38. * Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
  39. * - Coped with INTASSIGN of NEC VR4133.
  40. */
  41. #include <asm/asm.h>
  42. #include <asm/regdef.h>
  43. #include <asm/mipsregs.h>
  44. #include <asm/stackframe.h>
  45. .text
  46. .set noreorder
  47. .align 5
  48. NESTED(vr41xx_handle_interrupt, PT_SIZE, ra)
  49. .set noat
  50. SAVE_ALL
  51. CLI
  52. .set at
  53. .set noreorder
  54. /*
  55. * Get the pending interrupts
  56. */
  57. mfc0 t0, CP0_CAUSE
  58. mfc0 t1, CP0_STATUS
  59. andi t0, 0xff00
  60. and t0, t0, t1
  61. andi t1, t0, CAUSEF_IP7 # MIPS timer interrupt
  62. bnez t1, handle_irq
  63. li a0, 7
  64. andi t1, t0, 0x7800 # check for Int1-4
  65. beqz t1, 1f
  66. andi t1, t0, CAUSEF_IP3 # check for Int1
  67. bnez t1, handle_int
  68. li a0, 3
  69. andi t1, t0, CAUSEF_IP4 # check for Int2
  70. bnez t1, handle_int
  71. li a0, 4
  72. andi t1, t0, CAUSEF_IP5 # check for Int3
  73. bnez t1, handle_int
  74. li a0, 5
  75. andi t1, t0, CAUSEF_IP6 # check for Int4
  76. bnez t1, handle_int
  77. li a0, 6
  78. 1:
  79. andi t1, t0, CAUSEF_IP2 # check for Int0
  80. bnez t1, handle_int
  81. li a0, 2
  82. andi t1, t0, CAUSEF_IP0 # check for IP0
  83. bnez t1, handle_irq
  84. li a0, 0
  85. andi t1, t0, CAUSEF_IP1 # check for IP1
  86. bnez t1, handle_irq
  87. li a0, 1
  88. j spurious_interrupt
  89. nop
  90. handle_int:
  91. jal irq_dispatch
  92. move a1, sp
  93. j ret_from_irq
  94. nop
  95. handle_irq:
  96. jal do_IRQ
  97. move a1, sp
  98. j ret_from_irq
  99. END(vr41xx_handle_interrupt)