entry-macro.S 1.8 KB

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