entry-macro.S 2.3 KB

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