entry-macro.S 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * arch/arm/mach-s3c2410/include/mach/entry-macro.S
  3. *
  4. * Low-level IRQ helper macros for S3C2410-based platforms
  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. /* We have a problem that the INTOFFSET register does not always
  11. * show one interrupt. Occasionally we get two interrupts through
  12. * the prioritiser, and this causes the INTOFFSET register to show
  13. * what looks like the logical-or of the two interrupt numbers.
  14. *
  15. * Thanks to Klaus, Shannon, et al for helping to debug this problem
  16. */
  17. #define INTPND (0x10)
  18. #define INTOFFSET (0x14)
  19. #include <mach/hardware.h>
  20. #include <asm/irq.h>
  21. .macro get_irqnr_preamble, base, tmp
  22. .endm
  23. .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
  24. mov \base, #S3C24XX_VA_IRQ
  25. @@ try the interrupt offset register, since it is there
  26. ldr \irqstat, [ \base, #INTPND ]
  27. teq \irqstat, #0
  28. beq 1002f
  29. ldr \irqnr, [ \base, #INTOFFSET ]
  30. mov \tmp, #1
  31. tst \irqstat, \tmp, lsl \irqnr
  32. bne 1001f
  33. @@ the number specified is not a valid irq, so try
  34. @@ and work it out for ourselves
  35. mov \irqnr, #0 @@ start here
  36. @@ work out which irq (if any) we got
  37. movs \tmp, \irqstat, lsl#16
  38. addeq \irqnr, \irqnr, #16
  39. moveq \irqstat, \irqstat, lsr#16
  40. tst \irqstat, #0xff
  41. addeq \irqnr, \irqnr, #8
  42. moveq \irqstat, \irqstat, lsr#8
  43. tst \irqstat, #0xf
  44. addeq \irqnr, \irqnr, #4
  45. moveq \irqstat, \irqstat, lsr#4
  46. tst \irqstat, #0x3
  47. addeq \irqnr, \irqnr, #2
  48. moveq \irqstat, \irqstat, lsr#2
  49. tst \irqstat, #0x1
  50. addeq \irqnr, \irqnr, #1
  51. @@ we have the value
  52. 1001:
  53. adds \irqnr, \irqnr, #IRQ_EINT0
  54. 1002:
  55. @@ exit here, Z flag unset if IRQ
  56. .endm