int-handler.S 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. j spurious_interrupt
  65. nop
  66. END(ocelot3_handle_int)
  67. .align 5
  68. ll_sw0_irq:
  69. li a0, 0 /* IRQ 1 */
  70. move a1, sp
  71. jal do_IRQ
  72. j ret_from_irq
  73. ll_sw1_irq:
  74. li a0, 1 /* IRQ 2 */
  75. move a1, sp
  76. jal do_IRQ
  77. j ret_from_irq
  78. ll_pci0slot1_irq:
  79. li a0, 2 /* IRQ 3 */
  80. move a1, sp
  81. jal do_IRQ
  82. j ret_from_irq
  83. ll_pci0slot2_irq:
  84. li a0, 3 /* IRQ 4 */
  85. move a1, sp
  86. jal do_IRQ
  87. j ret_from_irq
  88. ll_pci1slot1_irq:
  89. li a0, 4 /* IRQ 5 */
  90. move a1, sp
  91. jal do_IRQ
  92. j ret_from_irq
  93. ll_pci1slot2_irq:
  94. li a0, 5 /* IRQ 6 */
  95. move a1, sp
  96. jal do_IRQ
  97. j ret_from_irq
  98. ll_uart_irq:
  99. li a0, 6 /* IRQ 7 */
  100. move a1, sp
  101. jal do_IRQ
  102. j ret_from_irq
  103. ll_cputimer_irq:
  104. li a0, 7 /* IRQ 8 */
  105. move a1, sp
  106. jal do_IRQ
  107. j ret_from_irq
  108. ll_mv64340_decode_irq:
  109. move a0, sp
  110. jal ll_mv64340_irq
  111. j ret_from_irq