entry-macro.S 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * arch/arm/mach-spear6xx/include/mach/entry-macro.S
  3. *
  4. * Low-level IRQ helper macros for SPEAr6xx machine family
  5. *
  6. * Copyright (C) 2009 ST Microelectronics
  7. * Rajeev Kumar<rajeev-dlh.kumar@st.com>
  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 <asm/hardware/vic.h>
  14. #include <mach/hardware.h>
  15. .macro disable_fiq
  16. .endm
  17. .macro get_irqnr_preamble, base, tmp
  18. .endm
  19. .macro arch_ret_to_user, tmp1, tmp2
  20. .endm
  21. .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
  22. ldr \base, =VA_SPEAR6XX_CPU_VIC_PRI_BASE
  23. ldr \irqstat, [\base, #VIC_IRQ_STATUS] @ get status
  24. mov \irqnr, #0
  25. teq \irqstat, #0
  26. bne 1001f
  27. ldr \base, =VA_SPEAR6XX_CPU_VIC_SEC_BASE
  28. ldr \irqstat, [\base, #VIC_IRQ_STATUS] @ get status
  29. teq \irqstat, #0
  30. beq 1002f @ this will set/reset
  31. @ zero register
  32. mov \irqnr, #32
  33. 1001:
  34. /*
  35. * Following code will find bit position of least significang
  36. * bit set in irqstat, using following equation
  37. * least significant bit set in n = (n & ~(n-1))
  38. */
  39. sub \tmp, \irqstat, #1 @ tmp = irqstat - 1
  40. mvn \tmp, \tmp @ tmp = ~tmp
  41. and \irqstat, \irqstat, \tmp @ irqstat &= tmp
  42. /* Now, irqstat is = bit no. of 1st bit set in vic irq status */
  43. clz \tmp, \irqstat @ tmp = leading zeros
  44. rsb \tmp, \tmp, #0x1F @ tmp = 32 - tmp - 1
  45. add \irqnr, \irqnr, \tmp
  46. 1002: /* EQ will be set if no irqs pending */
  47. .endm