entry-macro.S 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * include/asm-arm/arch-s3c2410/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 <asm/hardware.h>
  20. #include <asm/arch/irqs.h>
  21. .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
  22. mov \base, #S3C24XX_VA_IRQ
  23. @@ try the interrupt offset register, since it is there
  24. ldr \irqstat, [ \base, #INTPND ]
  25. teq \irqstat, #0
  26. beq 1002f
  27. ldr \irqnr, [ \base, #INTOFFSET ]
  28. mov \tmp, #1
  29. tst \irqstat, \tmp, lsl \irqnr
  30. bne 1001f
  31. @@ the number specified is not a valid irq, so try
  32. @@ and work it out for ourselves
  33. mov \irqnr, #0 @@ start here
  34. @@ work out which irq (if any) we got
  35. movs \tmp, \irqstat, lsl#16
  36. addeq \irqnr, \irqnr, #16
  37. moveq \irqstat, \irqstat, lsr#16
  38. tst \irqstat, #0xff
  39. addeq \irqnr, \irqnr, #8
  40. moveq \irqstat, \irqstat, lsr#8
  41. tst \irqstat, #0xf
  42. addeq \irqnr, \irqnr, #4
  43. moveq \irqstat, \irqstat, lsr#4
  44. tst \irqstat, #0x3
  45. addeq \irqnr, \irqnr, #2
  46. moveq \irqstat, \irqstat, lsr#2
  47. tst \irqstat, #0x1
  48. addeq \irqnr, \irqnr, #1
  49. @@ we have the value
  50. 1001:
  51. adds \irqnr, \irqnr, #IRQ_EINT0
  52. 1002:
  53. @@ exit here, Z flag unset if IRQ
  54. .endm
  55. /* currently don't need an disable_fiq macro */
  56. .macro disable_fiq
  57. .endm