entry-macro.S 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * arch/arm/mach-pnx4008/include/mach/entry-macro.S
  3. *
  4. * Low-level IRQ helper macros for PNX4008-based platforms
  5. *
  6. * 2005-2006 (c) MontaVista Software, Inc.
  7. * Author: Vitaly Wool <vwool@ru.mvista.com>
  8. * This file is licensed under the terms of the GNU General Public
  9. * License version 2. This program is licensed "as is" without any
  10. * warranty of any kind, whether express or implied.
  11. */
  12. #include "platform.h"
  13. #define IO_BASE 0xF0000000
  14. #define IO_ADDRESS(x) (((((x) & 0xff000000) >> 4) | ((x) & 0xfffff)) | IO_BASE)
  15. #define INTRC_MASK 0x00
  16. #define INTRC_RAW_STAT 0x04
  17. #define INTRC_STAT 0x08
  18. #define INTRC_POLAR 0x0C
  19. #define INTRC_ACT_TYPE 0x10
  20. #define INTRC_TYPE 0x14
  21. #define SIC1_BASE_INT 32
  22. #define SIC2_BASE_INT 64
  23. .macro disable_fiq
  24. .endm
  25. .macro get_irqnr_preamble, base, tmp
  26. .endm
  27. .macro arch_ret_to_user, tmp1, tmp2
  28. .endm
  29. .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
  30. /* decode the MIC interrupt numbers */
  31. ldr \base, =IO_ADDRESS(PNX4008_INTCTRLMIC_BASE)
  32. ldr \irqstat, [\base, #INTRC_STAT]
  33. cmp \irqstat,#1<<16
  34. movhs \irqnr,#16
  35. movlo \irqnr,#0
  36. movhs \irqstat,\irqstat,lsr#16
  37. cmp \irqstat,#1<<8
  38. addhs \irqnr,\irqnr,#8
  39. movhs \irqstat,\irqstat,lsr#8
  40. cmp \irqstat,#1<<4
  41. addhs \irqnr,\irqnr,#4
  42. movhs \irqstat,\irqstat,lsr#4
  43. cmp \irqstat,#1<<2
  44. addhs \irqnr,\irqnr,#2
  45. movhs \irqstat,\irqstat,lsr#2
  46. cmp \irqstat,#1<<1
  47. addhs \irqnr,\irqnr,#1
  48. /* was there an interrupt ? if not then drop out with EQ status */
  49. teq \irqstat,#0
  50. beq 1003f
  51. /* and now check for extended IRQ reasons */
  52. cmp \irqnr,#1
  53. bls 1003f
  54. cmp \irqnr,#30
  55. blo 1002f
  56. /* IRQ 31,30 : High priority cascade IRQ handle */
  57. /* read the correct SIC */
  58. /* decoding status after compare : eq is 30 (SIC1) , ne is 31 (SIC2) */
  59. /* set the base IRQ number */
  60. ldreq \base, =IO_ADDRESS(PNX4008_INTCTRLSIC1_BASE)
  61. moveq \irqnr,#SIC1_BASE_INT
  62. ldrne \base, =IO_ADDRESS(PNX4008_INTCTRLSIC2_BASE)
  63. movne \irqnr,#SIC2_BASE_INT
  64. ldr \irqstat, [\base, #INTRC_STAT]
  65. ldr \tmp, [\base, #INTRC_TYPE]
  66. /* and with inverted mask : low priority interrupts */
  67. and \irqstat,\irqstat,\tmp
  68. b 1004f
  69. 1003:
  70. /* IRQ 1,0 : Low priority cascade IRQ handle */
  71. /* read the correct SIC */
  72. /* decoding status after compare : eq is 1 (SIC2) , ne is 0 (SIC1)*/
  73. /* read the correct SIC */
  74. /* set the base IRQ number */
  75. ldrne \base, =IO_ADDRESS(PNX4008_INTCTRLSIC1_BASE)
  76. movne \irqnr,#SIC1_BASE_INT
  77. ldreq \base, =IO_ADDRESS(PNX4008_INTCTRLSIC2_BASE)
  78. moveq \irqnr,#SIC2_BASE_INT
  79. ldr \irqstat, [\base, #INTRC_STAT]
  80. ldr \tmp, [\base, #INTRC_TYPE]
  81. /* and with inverted mask : low priority interrupts */
  82. bic \irqstat,\irqstat,\tmp
  83. 1004:
  84. cmp \irqstat,#1<<16
  85. addhs \irqnr,\irqnr,#16
  86. movhs \irqstat,\irqstat,lsr#16
  87. cmp \irqstat,#1<<8
  88. addhs \irqnr,\irqnr,#8
  89. movhs \irqstat,\irqstat,lsr#8
  90. cmp \irqstat,#1<<4
  91. addhs \irqnr,\irqnr,#4
  92. movhs \irqstat,\irqstat,lsr#4
  93. cmp \irqstat,#1<<2
  94. addhs \irqnr,\irqnr,#2
  95. movhs \irqstat,\irqstat,lsr#2
  96. cmp \irqstat,#1<<1
  97. addhs \irqnr,\irqnr,#1
  98. /* is irqstat not zero */
  99. 1002:
  100. /* we assert that irqstat is not equal to zero and return ne status if true*/
  101. teq \irqstat,#0
  102. 1003:
  103. .endm
  104. .macro irq_prio_table
  105. .endm