entry-macro.S 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * include/asm-arm/arch-realview/entry-macro.S
  3. *
  4. * Low-level IRQ helper macros for RealView platforms
  5. *
  6. * This file is licensed under the terms of the GNU General Public
  7. * License version 2. This program is licensed "as is" without any
  8. * warranty of any kind, whether express or implied.
  9. */
  10. #include <asm/hardware.h>
  11. #include <asm/hardware/gic.h>
  12. #include <asm/arch/board-eb.h>
  13. .macro disable_fiq
  14. .endm
  15. .macro get_irqnr_preamble, base, tmp
  16. #ifdef CONFIG_REALVIEW_MPCORE
  17. ldr \base, =IO_ADDRESS(REALVIEW_EB11MP_GIC_CPU_BASE)
  18. #else
  19. ldr \base, =IO_ADDRESS(REALVIEW_GIC_CPU_BASE)
  20. #endif
  21. .endm
  22. .macro arch_ret_to_user, tmp1, tmp2
  23. .endm
  24. /*
  25. * The interrupt numbering scheme is defined in the
  26. * interrupt controller spec. To wit:
  27. *
  28. * Interrupts 0-15 are IPI
  29. * 16-28 are reserved
  30. * 29-31 are local. We allow 30 to be used for the watchdog.
  31. * 32-1020 are global
  32. * 1021-1022 are reserved
  33. * 1023 is "spurious" (no interrupt)
  34. *
  35. * For now, we ignore all local interrupts so only return an interrupt if it's
  36. * between 30 and 1020. The test_for_ipi routine below will pick up on IPIs.
  37. *
  38. * A simple read from the controller will tell us the number of the highest
  39. * priority enabled interrupt. We then just need to check whether it is in the
  40. * valid range for an IRQ (30-1020 inclusive).
  41. */
  42. .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
  43. ldr \irqstat, [\base, #GIC_CPU_INTACK] /* bits 12-10 = src CPU, 9-0 = int # */
  44. ldr \tmp, =1021
  45. bic \irqnr, \irqstat, #0x1c00
  46. cmp \irqnr, #29
  47. cmpcc \irqnr, \irqnr
  48. cmpne \irqnr, \tmp
  49. cmpcs \irqnr, \irqnr
  50. .endm
  51. /* We assume that irqstat (the raw value of the IRQ acknowledge
  52. * register) is preserved from the macro above.
  53. * If there is an IPI, we immediately signal end of interrupt on the
  54. * controller, since this requires the original irqstat value which
  55. * we won't easily be able to recreate later.
  56. */
  57. .macro test_for_ipi, irqnr, irqstat, base, tmp
  58. bic \irqnr, \irqstat, #0x1c00
  59. cmp \irqnr, #16
  60. strcc \irqstat, [\base, #GIC_CPU_EOI]
  61. cmpcs \irqnr, \irqnr
  62. .endm
  63. /* As above, this assumes that irqstat and base are preserved.. */
  64. .macro test_for_ltirq, irqnr, irqstat, base, tmp
  65. bic \irqnr, \irqstat, #0x1c00
  66. mov \tmp, #0
  67. cmp \irqnr, #29
  68. moveq \tmp, #1
  69. streq \irqstat, [\base, #GIC_CPU_EOI]
  70. cmp \tmp, #0
  71. .endm