entry-macro.S 2.4 KB

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