entry-macro-gic.S 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Copyright (C) 2010 Renesas Solutions Corp.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; version 2 of the License.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program; if not, write to the Free Software
  15. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  16. */
  17. #include <mach/hardware.h>
  18. #include <asm/hardware/gic.h>
  19. .macro disable_fiq
  20. .endm
  21. .macro get_irqnr_preamble, base, tmp
  22. ldr \base, =(0xf0000100)
  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
  38. * interrupt if it's between 30 and 1020. The test_for_ipi
  39. * routine below will pick up on IPIs.
  40. *
  41. * A simple read from the controller will tell us the number of
  42. * the highest priority enabled interrupt. We then just need to
  43. * check whether it is in the valid range for an IRQ (30-1020
  44. * inclusive).
  45. */
  46. .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
  47. ldr \irqstat, [\base, #GIC_CPU_INTACK]
  48. /* bits 12-10 = src CPU, 9-0 = int # */
  49. ldr \tmp, =1021
  50. bic \irqnr, \irqstat, #0x1c00
  51. cmp \irqnr, #29
  52. cmpcc \irqnr, \irqnr
  53. cmpne \irqnr, \tmp
  54. cmpcs \irqnr, \irqnr
  55. .endm
  56. /*
  57. * We assume that irqstat (the raw value of the IRQ acknowledge
  58. * register) is preserved from the macro above.
  59. * If there is an IPI, we immediately signal end of interrupt on the
  60. * controller, since this requires the original irqstat value which
  61. * we won't easily be able to recreate later.
  62. */
  63. .macro test_for_ipi, irqnr, irqstat, base, tmp
  64. bic \irqnr, \irqstat, #0x1c00
  65. cmp \irqnr, #16
  66. strcc \irqstat, [\base, #GIC_CPU_EOI]
  67. cmpcs \irqnr, \irqnr
  68. .endm
  69. /* As above, this assumes that irqstat and base are preserved.. */
  70. .macro test_for_ltirq, irqnr, irqstat, base, tmp
  71. bic \irqnr, \irqstat, #0x1c00
  72. mov \tmp, #0
  73. cmp \irqnr, #29
  74. moveq \tmp, #1
  75. streq \irqstat, [\base, #GIC_CPU_EOI]
  76. cmp \tmp, #0
  77. .endm