entry-macro.S 2.2 KB

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