settings.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /*
  2. * Internal header to deal with irq_desc->status which will be renamed
  3. * to irq_desc->settings.
  4. */
  5. enum {
  6. _IRQ_DEFAULT_INIT_FLAGS = IRQ_DEFAULT_INIT_FLAGS,
  7. _IRQ_PER_CPU = IRQ_PER_CPU,
  8. _IRQ_LEVEL = IRQ_LEVEL,
  9. _IRQ_NOPROBE = IRQ_NOPROBE,
  10. _IRQ_NOREQUEST = IRQ_NOREQUEST,
  11. _IRQ_NOAUTOEN = IRQ_NOAUTOEN,
  12. _IRQ_MOVE_PCNTXT = IRQ_MOVE_PCNTXT,
  13. _IRQ_NO_BALANCING = IRQ_NO_BALANCING,
  14. _IRQ_NESTED_THREAD = IRQ_NESTED_THREAD,
  15. _IRQF_MODIFY_MASK = IRQF_MODIFY_MASK,
  16. };
  17. #undef IRQ_INPROGRESS
  18. #define IRQ_INPROGRESS GOT_YOU_MORON
  19. #undef IRQ_REPLAY
  20. #define IRQ_REPLAY GOT_YOU_MORON
  21. #undef IRQ_WAITING
  22. #define IRQ_WAITING GOT_YOU_MORON
  23. #undef IRQ_DISABLED
  24. #define IRQ_DISABLED GOT_YOU_MORON
  25. #undef IRQ_PENDING
  26. #define IRQ_PENDING GOT_YOU_MORON
  27. #undef IRQ_MASKED
  28. #define IRQ_MASKED GOT_YOU_MORON
  29. #undef IRQ_WAKEUP
  30. #define IRQ_WAKEUP GOT_YOU_MORON
  31. #undef IRQ_MOVE_PENDING
  32. #define IRQ_MOVE_PENDING GOT_YOU_MORON
  33. #undef IRQ_PER_CPU
  34. #define IRQ_PER_CPU GOT_YOU_MORON
  35. #undef IRQ_NO_BALANCING
  36. #define IRQ_NO_BALANCING GOT_YOU_MORON
  37. #undef IRQ_AFFINITY_SET
  38. #define IRQ_AFFINITY_SET GOT_YOU_MORON
  39. #undef IRQ_LEVEL
  40. #define IRQ_LEVEL GOT_YOU_MORON
  41. #undef IRQ_NOPROBE
  42. #define IRQ_NOPROBE GOT_YOU_MORON
  43. #undef IRQ_NOREQUEST
  44. #define IRQ_NOREQUEST GOT_YOU_MORON
  45. #undef IRQ_NOAUTOEN
  46. #define IRQ_NOAUTOEN GOT_YOU_MORON
  47. #undef IRQ_NESTED_THREAD
  48. #define IRQ_NESTED_THREAD GOT_YOU_MORON
  49. #undef IRQF_MODIFY_MASK
  50. #define IRQF_MODIFY_MASK GOT_YOU_MORON
  51. static inline void
  52. irq_settings_clr_and_set(struct irq_desc *desc, u32 clr, u32 set)
  53. {
  54. desc->status &= ~(clr & _IRQF_MODIFY_MASK);
  55. desc->status |= (set & _IRQF_MODIFY_MASK);
  56. }
  57. static inline bool irq_settings_is_per_cpu(struct irq_desc *desc)
  58. {
  59. return desc->status & _IRQ_PER_CPU;
  60. }
  61. static inline void irq_settings_set_per_cpu(struct irq_desc *desc)
  62. {
  63. desc->status |= _IRQ_PER_CPU;
  64. }
  65. static inline void irq_settings_set_no_balancing(struct irq_desc *desc)
  66. {
  67. desc->status |= _IRQ_NO_BALANCING;
  68. }
  69. static inline bool irq_settings_has_no_balance_set(struct irq_desc *desc)
  70. {
  71. return desc->status & _IRQ_NO_BALANCING;
  72. }
  73. static inline u32 irq_settings_get_trigger_mask(struct irq_desc *desc)
  74. {
  75. return desc->status & IRQ_TYPE_SENSE_MASK;
  76. }
  77. static inline void
  78. irq_settings_set_trigger_mask(struct irq_desc *desc, u32 mask)
  79. {
  80. desc->status &= ~IRQ_TYPE_SENSE_MASK;
  81. desc->status |= mask & IRQ_TYPE_SENSE_MASK;
  82. }
  83. static inline bool irq_settings_is_level(struct irq_desc *desc)
  84. {
  85. return desc->status & _IRQ_LEVEL;
  86. }
  87. static inline void irq_settings_clr_level(struct irq_desc *desc)
  88. {
  89. desc->status &= ~_IRQ_LEVEL;
  90. }
  91. static inline void irq_settings_set_level(struct irq_desc *desc)
  92. {
  93. desc->status |= _IRQ_LEVEL;
  94. }
  95. static inline bool irq_settings_can_request(struct irq_desc *desc)
  96. {
  97. return !(desc->status & _IRQ_NOREQUEST);
  98. }
  99. static inline void irq_settings_clr_norequest(struct irq_desc *desc)
  100. {
  101. desc->status &= ~_IRQ_NOREQUEST;
  102. }
  103. static inline void irq_settings_set_norequest(struct irq_desc *desc)
  104. {
  105. desc->status |= _IRQ_NOREQUEST;
  106. }
  107. static inline bool irq_settings_can_probe(struct irq_desc *desc)
  108. {
  109. return !(desc->status & _IRQ_NOPROBE);
  110. }
  111. static inline void irq_settings_clr_noprobe(struct irq_desc *desc)
  112. {
  113. desc->status &= ~_IRQ_NOPROBE;
  114. }
  115. static inline void irq_settings_set_noprobe(struct irq_desc *desc)
  116. {
  117. desc->status |= _IRQ_NOPROBE;
  118. }
  119. static inline bool irq_settings_can_move_pcntxt(struct irq_desc *desc)
  120. {
  121. return desc->status & _IRQ_MOVE_PCNTXT;
  122. }
  123. static inline bool irq_settings_can_autoenable(struct irq_desc *desc)
  124. {
  125. return !(desc->status & _IRQ_NOAUTOEN);
  126. }
  127. static inline bool irq_settings_is_nested_thread(struct irq_desc *desc)
  128. {
  129. return desc->status & _IRQ_NESTED_THREAD;
  130. }
  131. /* Nothing should touch desc->status from now on */
  132. #define status USE_THE_PROPER_WRAPPERS_YOU_MORON