entry-macro.S 1.9 KB

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