entry-macro.S 2.3 KB

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