tx4927_irq_handler.S 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * linux/arch/mips/tx4927/common/tx4927_irq_handler.S
  3. *
  4. * Primary interrupt handler for tx4927 based systems
  5. *
  6. * Author: MontaVista Software, Inc.
  7. * Author: jsun@mvista.com or jsun@junsun.net
  8. * source@mvista.com
  9. *
  10. * Copyright 2001-2002 MontaVista Software Inc.
  11. *
  12. * This program is free software; you can redistribute it and/or modify it
  13. * under the terms of the GNU General Public License as published by the
  14. * Free Software Foundation; either version 2 of the License, or (at your
  15. * option) any later version.
  16. *
  17. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  18. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  19. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  20. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  21. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  22. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  23. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  24. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
  25. * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  26. * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. *
  28. * You should have received a copy of the GNU General Public License along
  29. * with this program; if not, write to the Free Software Foundation, Inc.,
  30. * 675 Mass Ave, Cambridge, MA 02139, USA.
  31. */
  32. #include <asm/asm.h>
  33. #include <asm/mipsregs.h>
  34. #include <asm/addrspace.h>
  35. #include <asm/regdef.h>
  36. #include <asm/stackframe.h>
  37. #include <asm/tx4927/tx4927.h>
  38. .align 5
  39. NESTED(tx4927_irq_handler, PT_SIZE, sp)
  40. SAVE_ALL
  41. CLI
  42. .set at
  43. mfc0 t0, CP0_CAUSE
  44. mfc0 t1, CP0_STATUS
  45. and t0, t1
  46. andi t1, t0, STATUSF_IP7 /* cpu timer */
  47. bnez t1, ll_ip7
  48. /* IP6..IP3 multiplexed -- do not use */
  49. andi t1, t0, STATUSF_IP2 /* tx4927 pic */
  50. bnez t1, ll_ip2
  51. andi t1, t0, STATUSF_IP0 /* user line 0 */
  52. bnez t1, ll_ip0
  53. andi t1, t0, STATUSF_IP1 /* user line 1 */
  54. bnez t1, ll_ip1
  55. .set reorder
  56. /* wrong alarm or masked ... */
  57. j spurious_interrupt
  58. nop
  59. END(tx4927_irq_handler)
  60. .align 5
  61. ll_ip7:
  62. li a0, TX4927_IRQ_CPU_TIMER
  63. move a1, sp
  64. jal do_IRQ
  65. j ret_from_irq
  66. ll_ip2:
  67. jal tx4927_irq_nested
  68. nop
  69. beqz v0, goto_spurious_interrupt
  70. nop
  71. move a0, v0
  72. move a1, sp
  73. jal do_IRQ
  74. j ret_from_irq
  75. goto_spurious_interrupt:
  76. j spurious_interrupt
  77. nop
  78. ll_ip1:
  79. li a0, TX4927_IRQ_USER1
  80. move a1, sp
  81. jal do_IRQ
  82. j ret_from_irq
  83. ll_ip0:
  84. li a0, TX4927_IRQ_USER0
  85. move a1, sp
  86. jal do_IRQ
  87. j ret_from_irq