int-handler.S 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * Copyright 2001 MontaVista Software Inc.
  3. * Author: jsun@mvista.com or jsun@junsun.net
  4. *
  5. * First-level interrupt dispatcher for ddb5476
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation; either version 2 of the License, or (at your
  10. * option) any later version.
  11. */
  12. #include <asm/asm.h>
  13. #include <asm/mipsregs.h>
  14. #include <asm/addrspace.h>
  15. #include <asm/regdef.h>
  16. #include <asm/stackframe.h>
  17. #include <asm/ddb5xxx/ddb5476.h>
  18. /*
  19. * first level interrupt dispatcher for ocelot board -
  20. * We check for the timer first, then check PCI ints A and D.
  21. * Then check for serial IRQ and fall through.
  22. */
  23. .align 5
  24. NESTED(ddb5476_handle_int, PT_SIZE, sp)
  25. SAVE_ALL
  26. CLI
  27. .set at
  28. .set noreorder
  29. mfc0 t0, CP0_CAUSE
  30. mfc0 t2, CP0_STATUS
  31. and t0, t2
  32. andi t1, t0, STATUSF_IP7 /* cpu timer */
  33. bnez t1, ll_cpu_ip7
  34. andi t1, t0, STATUSF_IP2 /* vrc5476 & i8259 */
  35. bnez t1, ll_cpu_ip2
  36. andi t1, t0, STATUSF_IP3
  37. bnez t1, ll_cpu_ip3
  38. andi t1, t0, STATUSF_IP4
  39. bnez t1, ll_cpu_ip4
  40. andi t1, t0, STATUSF_IP5
  41. bnez t1, ll_cpu_ip5
  42. andi t1, t0, STATUSF_IP6
  43. bnez t1, ll_cpu_ip6
  44. andi t1, t0, STATUSF_IP0 /* software int 0 */
  45. bnez t1, ll_cpu_ip0
  46. andi t1, t0, STATUSF_IP1 /* software int 1 */
  47. bnez t1, ll_cpu_ip1
  48. nop
  49. .set reorder
  50. /* wrong alarm or masked ... */
  51. // j spurious_interrupt
  52. move a0, sp
  53. jal vrc5476_irq_dispatch
  54. j ret_from_irq
  55. nop
  56. .align 5
  57. ll_cpu_ip0:
  58. li a0, CPU_IRQ_BASE + 0
  59. move a1, sp
  60. jal do_IRQ
  61. j ret_from_irq
  62. ll_cpu_ip1:
  63. li a0, CPU_IRQ_BASE + 1
  64. move a1, sp
  65. jal do_IRQ
  66. j ret_from_irq
  67. ll_cpu_ip2: /* jump to second-level dispatching */
  68. move a0, sp
  69. jal vrc5476_irq_dispatch
  70. j ret_from_irq
  71. ll_cpu_ip3:
  72. li a0, CPU_IRQ_BASE + 3
  73. move a1, sp
  74. jal do_IRQ
  75. j ret_from_irq
  76. ll_cpu_ip4:
  77. li a0, CPU_IRQ_BASE + 4
  78. move a1, sp
  79. jal do_IRQ
  80. j ret_from_irq
  81. ll_cpu_ip5:
  82. li a0, CPU_IRQ_BASE + 5
  83. move a1, sp
  84. jal do_IRQ
  85. j ret_from_irq
  86. ll_cpu_ip6:
  87. li a0, CPU_IRQ_BASE + 6
  88. move a1, sp
  89. jal do_IRQ
  90. j ret_from_irq
  91. ll_cpu_ip7:
  92. li a0, CPU_IRQ_BASE + 7
  93. move a1, sp
  94. jal do_IRQ
  95. j ret_from_irq
  96. END(ddb5476_handle_int)