settings.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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_NOTHREAD = IRQ_NOTHREAD,
  12. _IRQ_NOAUTOEN = IRQ_NOAUTOEN,
  13. _IRQ_MOVE_PCNTXT = IRQ_MOVE_PCNTXT,
  14. _IRQ_NO_BALANCING = IRQ_NO_BALANCING,
  15. _IRQ_NESTED_THREAD = IRQ_NESTED_THREAD,
  16. _IRQF_MODIFY_MASK = IRQF_MODIFY_MASK,
  17. };
  18. #define IRQ_PER_CPU GOT_YOU_MORON
  19. #define IRQ_NO_BALANCING GOT_YOU_MORON
  20. #define IRQ_LEVEL GOT_YOU_MORON
  21. #define IRQ_NOPROBE GOT_YOU_MORON
  22. #define IRQ_NOREQUEST GOT_YOU_MORON
  23. #define IRQ_NOTHREAD GOT_YOU_MORON
  24. #define IRQ_NOAUTOEN GOT_YOU_MORON
  25. #define IRQ_NESTED_THREAD GOT_YOU_MORON
  26. #undef IRQF_MODIFY_MASK
  27. #define IRQF_MODIFY_MASK GOT_YOU_MORON
  28. static inline void
  29. irq_settings_clr_and_set(struct irq_desc *desc, u32 clr, u32 set)
  30. {
  31. desc->status_use_accessors &= ~(clr & _IRQF_MODIFY_MASK);
  32. desc->status_use_accessors |= (set & _IRQF_MODIFY_MASK);
  33. }
  34. static inline bool irq_settings_is_per_cpu(struct irq_desc *desc)
  35. {
  36. return desc->status_use_accessors & _IRQ_PER_CPU;
  37. }
  38. static inline void irq_settings_set_per_cpu(struct irq_desc *desc)
  39. {
  40. desc->status_use_accessors |= _IRQ_PER_CPU;
  41. }
  42. static inline void irq_settings_set_no_balancing(struct irq_desc *desc)
  43. {
  44. desc->status_use_accessors |= _IRQ_NO_BALANCING;
  45. }
  46. static inline bool irq_settings_has_no_balance_set(struct irq_desc *desc)
  47. {
  48. return desc->status_use_accessors & _IRQ_NO_BALANCING;
  49. }
  50. static inline u32 irq_settings_get_trigger_mask(struct irq_desc *desc)
  51. {
  52. return desc->status_use_accessors & IRQ_TYPE_SENSE_MASK;
  53. }
  54. static inline void
  55. irq_settings_set_trigger_mask(struct irq_desc *desc, u32 mask)
  56. {
  57. desc->status_use_accessors &= ~IRQ_TYPE_SENSE_MASK;
  58. desc->status_use_accessors |= mask & IRQ_TYPE_SENSE_MASK;
  59. }
  60. static inline bool irq_settings_is_level(struct irq_desc *desc)
  61. {
  62. return desc->status_use_accessors & _IRQ_LEVEL;
  63. }
  64. static inline void irq_settings_clr_level(struct irq_desc *desc)
  65. {
  66. desc->status_use_accessors &= ~_IRQ_LEVEL;
  67. }
  68. static inline void irq_settings_set_level(struct irq_desc *desc)
  69. {
  70. desc->status_use_accessors |= _IRQ_LEVEL;
  71. }
  72. static inline bool irq_settings_can_request(struct irq_desc *desc)
  73. {
  74. return !(desc->status_use_accessors & _IRQ_NOREQUEST);
  75. }
  76. static inline void irq_settings_clr_norequest(struct irq_desc *desc)
  77. {
  78. desc->status_use_accessors &= ~_IRQ_NOREQUEST;
  79. }
  80. static inline void irq_settings_set_norequest(struct irq_desc *desc)
  81. {
  82. desc->status_use_accessors |= _IRQ_NOREQUEST;
  83. }
  84. static inline bool irq_settings_can_thread(struct irq_desc *desc)
  85. {
  86. return !(desc->status_use_accessors & _IRQ_NOTHREAD);
  87. }
  88. static inline void irq_settings_clr_nothread(struct irq_desc *desc)
  89. {
  90. desc->status_use_accessors &= ~_IRQ_NOTHREAD;
  91. }
  92. static inline void irq_settings_set_nothread(struct irq_desc *desc)
  93. {
  94. desc->status_use_accessors |= _IRQ_NOTHREAD;
  95. }
  96. static inline bool irq_settings_can_probe(struct irq_desc *desc)
  97. {
  98. return !(desc->status_use_accessors & _IRQ_NOPROBE);
  99. }
  100. static inline void irq_settings_clr_noprobe(struct irq_desc *desc)
  101. {
  102. desc->status_use_accessors &= ~_IRQ_NOPROBE;
  103. }
  104. static inline void irq_settings_set_noprobe(struct irq_desc *desc)
  105. {
  106. desc->status_use_accessors |= _IRQ_NOPROBE;
  107. }
  108. static inline bool irq_settings_can_move_pcntxt(struct irq_desc *desc)
  109. {
  110. return desc->status_use_accessors & _IRQ_MOVE_PCNTXT;
  111. }
  112. static inline bool irq_settings_can_autoenable(struct irq_desc *desc)
  113. {
  114. return !(desc->status_use_accessors & _IRQ_NOAUTOEN);
  115. }
  116. static inline bool irq_settings_is_nested_thread(struct irq_desc *desc)
  117. {
  118. return desc->status_use_accessors & _IRQ_NESTED_THREAD;
  119. }