entry-macro.S 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. * include/asm-arm/arch-pnx4008/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_and_base, irqnr, irqstat, base, tmp
  26. /* decode the MIC interrupt numbers */
  27. ldr \base, =IO_ADDRESS(PNX4008_INTCTRLMIC_BASE)
  28. ldr \irqstat, [\base, #INTRC_STAT]
  29. cmp \irqstat,#1<<16
  30. movhs \irqnr,#16
  31. movlo \irqnr,#0
  32. movhs \irqstat,\irqstat,lsr#16
  33. cmp \irqstat,#1<<8
  34. addhs \irqnr,\irqnr,#8
  35. movhs \irqstat,\irqstat,lsr#8
  36. cmp \irqstat,#1<<4
  37. addhs \irqnr,\irqnr,#4
  38. movhs \irqstat,\irqstat,lsr#4
  39. cmp \irqstat,#1<<2
  40. addhs \irqnr,\irqnr,#2
  41. movhs \irqstat,\irqstat,lsr#2
  42. cmp \irqstat,#1<<1
  43. addhs \irqnr,\irqnr,#1
  44. /* was there an interrupt ? if not then drop out with EQ status */
  45. teq \irqstat,#0
  46. beq 1003f
  47. /* and now check for extended IRQ reasons */
  48. cmp \irqnr,#1
  49. bls 1003f
  50. cmp \irqnr,#30
  51. blo 1002f
  52. /* IRQ 31,30 : High priority cascade IRQ handle */
  53. /* read the correct SIC */
  54. /* decoding status after compare : eq is 30 (SIC1) , ne is 31 (SIC2) */
  55. /* set the base IRQ number */
  56. ldreq \base, =IO_ADDRESS(PNX4008_INTCTRLSIC1_BASE)
  57. moveq \irqnr,#SIC1_BASE_INT
  58. ldrne \base, =IO_ADDRESS(PNX4008_INTCTRLSIC2_BASE)
  59. movne \irqnr,#SIC2_BASE_INT
  60. ldr \irqstat, [\base, #INTRC_STAT]
  61. ldr \tmp, [\base, #INTRC_TYPE]
  62. /* and with inverted mask : low priority interrupts */
  63. and \irqstat,\irqstat,\tmp
  64. b 1004f
  65. 1003:
  66. /* IRQ 1,0 : Low priority cascade IRQ handle */
  67. /* read the correct SIC */
  68. /* decoding status after compare : eq is 1 (SIC2) , ne is 0 (SIC1)*/
  69. /* read the correct SIC */
  70. /* set the base IRQ number */
  71. ldrne \base, =IO_ADDRESS(PNX4008_INTCTRLSIC1_BASE)
  72. movne \irqnr,#SIC1_BASE_INT
  73. ldreq \base, =IO_ADDRESS(PNX4008_INTCTRLSIC2_BASE)
  74. moveq \irqnr,#SIC2_BASE_INT
  75. ldr \irqstat, [\base, #INTRC_STAT]
  76. ldr \tmp, [\base, #INTRC_TYPE]
  77. /* and with inverted mask : low priority interrupts */
  78. bic \irqstat,\irqstat,\tmp
  79. 1004:
  80. cmp \irqstat,#1<<16
  81. addhs \irqnr,\irqnr,#16
  82. movhs \irqstat,\irqstat,lsr#16
  83. cmp \irqstat,#1<<8
  84. addhs \irqnr,\irqnr,#8
  85. movhs \irqstat,\irqstat,lsr#8
  86. cmp \irqstat,#1<<4
  87. addhs \irqnr,\irqnr,#4
  88. movhs \irqstat,\irqstat,lsr#4
  89. cmp \irqstat,#1<<2
  90. addhs \irqnr,\irqnr,#2
  91. movhs \irqstat,\irqstat,lsr#2
  92. cmp \irqstat,#1<<1
  93. addhs \irqnr,\irqnr,#1
  94. /* is irqstat not zero */
  95. 1002:
  96. /* we assert that irqstat is not equal to zero and return ne status if true*/
  97. teq \irqstat,#0
  98. 1003:
  99. .endm
  100. .macro irq_prio_table
  101. .endm