entry-macro.S 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * Copyright (C) 2007 Lennert Buytenhek <buytenh@wantstofly.org>
  3. * Copyright 2004-2009 Freescale Semiconductor, Inc. All Rights Reserved.
  4. */
  5. /*
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #include <mach/hardware.h>
  11. #define AVIC_NIMASK 0x04
  12. @ this macro disables fast irq (not implemented)
  13. .macro disable_fiq
  14. .endm
  15. .macro get_irqnr_preamble, base, tmp
  16. #ifndef CONFIG_MXC_TZIC
  17. ldr \base, =avic_base
  18. ldr \base, [\base]
  19. #ifdef CONFIG_MXC_IRQ_PRIOR
  20. ldr r4, [\base, #AVIC_NIMASK]
  21. #endif
  22. #elif defined CONFIG_MXC_TZIC
  23. ldr \base, =tzic_base
  24. ldr \base, [\base]
  25. #endif /* CONFIG_MXC_TZIC */
  26. .endm
  27. .macro arch_ret_to_user, tmp1, tmp2
  28. .endm
  29. @ this macro checks which interrupt occured
  30. @ and returns its number in irqnr
  31. @ and returns if an interrupt occured in irqstat
  32. .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
  33. #ifndef CONFIG_MXC_TZIC
  34. @ Load offset & priority of the highest priority
  35. @ interrupt pending from AVIC_NIVECSR
  36. ldr \irqstat, [\base, #0x40]
  37. @ Shift to get the decoded IRQ number, using ASR so
  38. @ 'no interrupt pending' becomes 0xffffffff
  39. mov \irqnr, \irqstat, asr #16
  40. @ set zero flag if IRQ + 1 == 0
  41. adds \tmp, \irqnr, #1
  42. #ifdef CONFIG_MXC_IRQ_PRIOR
  43. bicne \tmp, \irqstat, #0xFFFFFFE0
  44. strne \tmp, [\base, #AVIC_NIMASK]
  45. streq r4, [\base, #AVIC_NIMASK]
  46. #endif
  47. #elif defined CONFIG_MXC_TZIC
  48. @ Load offset & priority of the highest priority
  49. @ interrupt pending.
  50. @ 0xD80 is HIPND0 register
  51. mov \irqnr, #0
  52. mov \irqstat, #0x0D80
  53. 1000:
  54. ldr \tmp, [\irqstat, \base]
  55. cmp \tmp, #0
  56. bne 1001f
  57. addeq \irqnr, \irqnr, #32
  58. addeq \irqstat, \irqstat, #4
  59. cmp \irqnr, #128
  60. blo 1000b
  61. b 2001f
  62. 1001: mov \irqstat, #1
  63. 1002: tst \tmp, \irqstat
  64. bne 2002f
  65. movs \tmp, \tmp, lsr #1
  66. addne \irqnr, \irqnr, #1
  67. bne 1002b
  68. 2001:
  69. mov \irqnr, #0
  70. 2002:
  71. movs \irqnr, \irqnr
  72. #endif
  73. .endm
  74. @ irq priority table (not used)
  75. .macro irq_prio_table
  76. .endm