entry-macro.S 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. * Copyright (C) 2008 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 <mach/irqs.h>
  19. .macro disable_fiq
  20. .endm
  21. #if !defined(CONFIG_ARCH_SH73A0)
  22. .macro get_irqnr_preamble, base, tmp
  23. ldr \base, =INTFLGA
  24. .endm
  25. .macro arch_ret_to_user, tmp1, tmp2
  26. .endm
  27. .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
  28. ldr \irqnr, [\base]
  29. cmp \irqnr, #0
  30. beq 1000f
  31. /* intevt to irq number */
  32. lsr \irqnr, \irqnr, #0x5
  33. subs \irqnr, \irqnr, #16
  34. 1000:
  35. .endm
  36. #else
  37. /*
  38. * arch/arm/mach-realview/include/mach/entry-macro.S
  39. *
  40. * Low-level IRQ helper macros for RealView platforms
  41. *
  42. * This file is licensed under the terms of the GNU General Public
  43. * License version 2. This program is licensed "as is" without any
  44. * warranty of any kind, whether express or implied.
  45. */
  46. #include <asm/hardware/gic.h>
  47. .macro get_irqnr_preamble, base, tmp
  48. ldr \base, =(0xf0000100)
  49. .endm
  50. .macro arch_ret_to_user, tmp1, tmp2
  51. .endm
  52. /*
  53. * The interrupt numbering scheme is defined in the
  54. * interrupt controller spec. To wit:
  55. *
  56. * Interrupts 0-15 are IPI
  57. * 16-28 are reserved
  58. * 29-31 are local. We allow 30 to be used for the watchdog.
  59. * 32-1020 are global
  60. * 1021-1022 are reserved
  61. * 1023 is "spurious" (no interrupt)
  62. *
  63. * For now, we ignore all local interrupts so only return an interrupt if it's
  64. * between 30 and 1020. The test_for_ipi routine below will pick up on IPIs.
  65. *
  66. * A simple read from the controller will tell us the number of the highest
  67. * priority enabled interrupt. We then just need to check whether it is in the
  68. * valid range for an IRQ (30-1020 inclusive).
  69. */
  70. .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
  71. ldr \irqstat, [\base, #GIC_CPU_INTACK]
  72. /* bits 12-10 = src CPU, 9-0 = int # */
  73. ldr \tmp, =1021
  74. bic \irqnr, \irqstat, #0x1c00
  75. cmp \irqnr, #29
  76. cmpcc \irqnr, \irqnr
  77. cmpne \irqnr, \tmp
  78. cmpcs \irqnr, \irqnr
  79. .endm
  80. /* We assume that irqstat (the raw value of the IRQ acknowledge
  81. * register) is preserved from the macro above.
  82. * If there is an IPI, we immediately signal end of interrupt on the
  83. * controller, since this requires the original irqstat value which
  84. * we won't easily be able to recreate later.
  85. */
  86. .macro test_for_ipi, irqnr, irqstat, base, tmp
  87. bic \irqnr, \irqstat, #0x1c00
  88. cmp \irqnr, #16
  89. strcc \irqstat, [\base, #GIC_CPU_EOI]
  90. cmpcs \irqnr, \irqnr
  91. .endm
  92. /* As above, this assumes that irqstat and base are preserved.. */
  93. .macro test_for_ltirq, irqnr, irqstat, base, tmp
  94. bic \irqnr, \irqstat, #0x1c00
  95. mov \tmp, #0
  96. cmp \irqnr, #29
  97. moveq \tmp, #1
  98. streq \irqstat, [\base, #GIC_CPU_EOI]
  99. cmp \tmp, #0
  100. .endm
  101. #endif