int-handler.S 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*
  2. * Copyright 2002 Momentum Computer Inc.
  3. * Author: Matthew Dharm <mdharm@momenco.com>
  4. *
  5. * Copyright 2001 MontaVista Software Inc.
  6. * Author: jsun@mvista.com or jsun@junsun.net
  7. *
  8. * Copyright 2004 PMC-Sierra
  9. * Author: Manish Lachwani (lachwani@pmc-sierra.com)
  10. *
  11. * Copyright (C) 2004 MontaVista Software Inc.
  12. * Author: Manish Lachwani, mlachwani@mvista.com
  13. *
  14. * First-level interrupt dispatcher for Ocelot-3 board.
  15. *
  16. * This program is free software; you can redistribute it and/or modify it
  17. * under the terms of the GNU General Public License as published by the
  18. * Free Software Foundation; either version 2 of the License, or (at your
  19. * option) any later version.
  20. */
  21. #include <asm/asm.h>
  22. #include <asm/mipsregs.h>
  23. #include <asm/addrspace.h>
  24. #include <asm/regdef.h>
  25. #include <asm/stackframe.h>
  26. /*
  27. * First level interrupt dispatcher for Ocelot-3 board
  28. */
  29. .align 5
  30. NESTED(ocelot3_handle_int, PT_SIZE, sp)
  31. SAVE_ALL
  32. CLI
  33. .set at
  34. mfc0 t0, CP0_CAUSE
  35. mfc0 t2, CP0_STATUS
  36. and t0, t2
  37. andi t1, t0, STATUSF_IP0 /* sw0 software interrupt (IRQ0) */
  38. bnez t1, ll_sw0_irq
  39. andi t1, t0, STATUSF_IP1 /* sw1 software interrupt (IRQ1) */
  40. bnez t1, ll_sw1_irq
  41. andi t1, t0, STATUSF_IP2 /* int0 hardware line (IRQ2) */
  42. bnez t1, ll_pci0slot1_irq
  43. andi t1, t0, STATUSF_IP3 /* int1 hardware line (IRQ3) */
  44. bnez t1, ll_pci0slot2_irq
  45. andi t1, t0, STATUSF_IP4 /* int2 hardware line (IRQ4) */
  46. bnez t1, ll_pci1slot1_irq
  47. andi t1, t0, STATUSF_IP5 /* int3 hardware line (IRQ5) */
  48. bnez t1, ll_pci1slot2_irq
  49. andi t1, t0, STATUSF_IP6 /* int4 hardware line (IRQ6) */
  50. bnez t1, ll_uart_irq
  51. andi t1, t0, STATUSF_IP7 /* cpu timer (IRQ7) */
  52. bnez t1, ll_cputimer_irq
  53. /* now look at extended interrupts */
  54. mfc0 t0, CP0_CAUSE
  55. cfc0 t1, CP0_S1_INTCONTROL
  56. /* shift the mask 8 bits left to line up the bits */
  57. sll t2, t1, 8
  58. and t0, t2
  59. srl t0, t0, 16
  60. andi t1, t0, STATUSF_IP8 /* int6 hardware line (IRQ9) */
  61. bnez t1, ll_mv64340_decode_irq
  62. .set reorder
  63. /* wrong alarm or masked ... */
  64. jal spurious_interrupt
  65. nop
  66. j ret_from_irq
  67. nop
  68. END(ocelot3_handle_int)
  69. .align 5
  70. ll_sw0_irq:
  71. li a0, 0 /* IRQ 1 */
  72. move a1, sp
  73. jal do_IRQ
  74. j ret_from_irq
  75. ll_sw1_irq:
  76. li a0, 1 /* IRQ 2 */
  77. move a1, sp
  78. jal do_IRQ
  79. j ret_from_irq
  80. ll_pci0slot1_irq:
  81. li a0, 2 /* IRQ 3 */
  82. move a1, sp
  83. jal do_IRQ
  84. j ret_from_irq
  85. ll_pci0slot2_irq:
  86. li a0, 3 /* IRQ 4 */
  87. move a1, sp
  88. jal do_IRQ
  89. j ret_from_irq
  90. ll_pci1slot1_irq:
  91. li a0, 4 /* IRQ 5 */
  92. move a1, sp
  93. jal do_IRQ
  94. j ret_from_irq
  95. ll_pci1slot2_irq:
  96. li a0, 5 /* IRQ 6 */
  97. move a1, sp
  98. jal do_IRQ
  99. j ret_from_irq
  100. ll_uart_irq:
  101. li a0, 6 /* IRQ 7 */
  102. move a1, sp
  103. jal do_IRQ
  104. j ret_from_irq
  105. ll_cputimer_irq:
  106. li a0, 7 /* IRQ 8 */
  107. move a1, sp
  108. jal do_IRQ
  109. j ret_from_irq
  110. ll_mv64340_decode_irq:
  111. move a0, sp
  112. jal ll_mv64340_irq
  113. j ret_from_irq