entry-macro-qgic.S 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * Low-level IRQ helper macros
  3. *
  4. * Copyright (c) 2010, Code Aurora Forum. All rights reserved.
  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 <mach/hardware.h>
  11. #include <asm/hardware/gic.h>
  12. .macro disable_fiq
  13. .endm
  14. .macro get_irqnr_preamble, base, tmp
  15. ldr \base, =gic_cpu_base_addr
  16. ldr \base, [\base]
  17. .endm
  18. .macro arch_ret_to_user, tmp1, tmp2
  19. .endm
  20. /*
  21. * The interrupt numbering scheme is defined in the
  22. * interrupt controller spec. To wit:
  23. *
  24. * Migrated the code from ARM MP port to be more consistent
  25. * with interrupt processing , the following still holds true
  26. * however, all interrupts are treated the same regardless of
  27. * if they are local IPI or PPI
  28. *
  29. * Interrupts 0-15 are IPI
  30. * 16-31 are PPI
  31. * (16-18 are the timers)
  32. * 32-1020 are global
  33. * 1021-1022 are reserved
  34. * 1023 is "spurious" (no interrupt)
  35. *
  36. * A simple read from the controller will tell us the number of the
  37. * highest priority enabled interrupt. We then just need to check
  38. * whether it is in the valid range for an IRQ (0-1020 inclusive).
  39. *
  40. * Base ARM code assumes that the local (private) peripheral interrupts
  41. * are not valid, we treat them differently, in that the privates are
  42. * handled like normal shared interrupts with the exception that only
  43. * one processor can register the interrupt and the handler must be
  44. * the same for all processors.
  45. */
  46. .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
  47. ldr \irqstat, [\base, #GIC_CPU_INTACK] /* bits 12-10 =srcCPU,
  48. 9-0 =int # */
  49. bic \irqnr, \irqstat, #0x1c00 @mask src
  50. cmp \irqnr, #15
  51. ldr \tmp, =1021
  52. cmpcc \irqnr, \irqnr
  53. cmpne \irqnr, \tmp
  54. cmpcs \irqnr, \irqnr
  55. .endm
  56. /* We assume that irqstat (the raw value of the IRQ acknowledge
  57. * register) is preserved from the macro above.
  58. * If there is an IPI, we immediately signal end of interrupt on the
  59. * controller, since this requires the original irqstat value which
  60. * we won't easily be able to recreate later.
  61. */
  62. .macro test_for_ipi, irqnr, irqstat, base, tmp
  63. bic \irqnr, \irqstat, #0x1c00
  64. cmp \irqnr, #16
  65. strcc \irqstat, [\base, #GIC_CPU_EOI]
  66. cmpcs \irqnr, \irqnr
  67. .endm
  68. /* As above, this assumes that irqstat and base are preserved.. */
  69. .macro test_for_ltirq, irqnr, irqstat, base, tmp
  70. bic \irqnr, \irqstat, #0x1c00
  71. mov \tmp, #0
  72. cmp \irqnr, #16
  73. moveq \tmp, #1
  74. streq \irqstat, [\base, #GIC_CPU_EOI]
  75. cmp \tmp, #0
  76. .endm