entry-macro.S 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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/gic.h>
  11. .macro disable_fiq
  12. .endm
  13. /*
  14. * The interrupt numbering scheme is defined in the
  15. * interrupt controller spec. To wit:
  16. *
  17. * Interrupts 0-15 are IPI
  18. * 16-28 are reserved
  19. * 29-31 are local. We allow 30 to be used for the watchdog.
  20. * 32-1020 are global
  21. * 1021-1022 are reserved
  22. * 1023 is "spurious" (no interrupt)
  23. *
  24. * For now, we ignore all local interrupts so only return an interrupt if it's
  25. * between 30 and 1020. The test_for_ipi routine below will pick up on IPIs.
  26. *
  27. * A simple read from the controller will tell us the number of the highest
  28. * priority enabled interrupt. We then just need to check whether it is in the
  29. * valid range for an IRQ (30-1020 inclusive).
  30. */
  31. .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
  32. ldr \base, =IO_ADDRESS(REALVIEW_GIC_CPU_BASE)
  33. ldr \irqstat, [\base, #GIC_CPU_INTACK] /* bits 12-10 = src CPU, 9-0 = int # */
  34. ldr \tmp, =1021
  35. bic \irqnr, \irqstat, #0x1c00
  36. cmp \irqnr, #29
  37. cmpcc \irqnr, \irqnr
  38. cmpne \irqnr, \tmp
  39. cmpcs \irqnr, \irqnr
  40. .endm
  41. /* We assume that irqstat (the raw value of the IRQ acknowledge
  42. * register) is preserved from the macro above.
  43. * If there is an IPI, we immediately signal end of interrupt on the
  44. * controller, since this requires the original irqstat value which
  45. * we won't easily be able to recreate later.
  46. */
  47. .macro test_for_ipi, irqnr, irqstat, base, tmp
  48. bic \irqnr, \irqstat, #0x1c00
  49. cmp \irqnr, #16
  50. strcc \irqstat, [\base, #GIC_CPU_EOI]
  51. cmpcs \irqnr, \irqnr
  52. .endm
  53. /* As above, this assumes that irqstat and base are preserved.. */
  54. .macro test_for_ltirq, irqnr, irqstat, base, tmp
  55. bic \irqnr, \irqstat, #0x1c00
  56. mov \tmp, #0
  57. cmp \irqnr, #29
  58. moveq \tmp, #1
  59. streq \irqstat, [\base, #GIC_CPU_EOI]
  60. cmp \tmp, #0
  61. .endm