entry-macro.S 1.3 KB

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