diff options
Diffstat (limited to 'kernel/irq/settings.h')
| -rw-r--r-- | kernel/irq/settings.h | 138 |
1 files changed, 138 insertions, 0 deletions
diff --git a/kernel/irq/settings.h b/kernel/irq/settings.h new file mode 100644 index 00000000000..0227ad35827 --- /dev/null +++ b/kernel/irq/settings.h | |||
| @@ -0,0 +1,138 @@ | |||
| 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 | |||
| 18 | #define IRQ_INPROGRESS GOT_YOU_MORON | ||
| 19 | #define IRQ_REPLAY GOT_YOU_MORON | ||
| 20 | #define IRQ_WAITING GOT_YOU_MORON | ||
| 21 | #define IRQ_DISABLED GOT_YOU_MORON | ||
| 22 | #define IRQ_PENDING GOT_YOU_MORON | ||
| 23 | #define IRQ_MASKED GOT_YOU_MORON | ||
| 24 | #define IRQ_WAKEUP GOT_YOU_MORON | ||
| 25 | #define IRQ_MOVE_PENDING GOT_YOU_MORON | ||
| 26 | #define IRQ_PER_CPU GOT_YOU_MORON | ||
| 27 | #define IRQ_NO_BALANCING GOT_YOU_MORON | ||
| 28 | #define IRQ_AFFINITY_SET GOT_YOU_MORON | ||
| 29 | #define IRQ_LEVEL GOT_YOU_MORON | ||
| 30 | #define IRQ_NOPROBE GOT_YOU_MORON | ||
| 31 | #define IRQ_NOREQUEST GOT_YOU_MORON | ||
| 32 | #define IRQ_NOAUTOEN GOT_YOU_MORON | ||
| 33 | #define IRQ_NESTED_THREAD GOT_YOU_MORON | ||
| 34 | #undef IRQF_MODIFY_MASK | ||
| 35 | #define IRQF_MODIFY_MASK GOT_YOU_MORON | ||
| 36 | |||
| 37 | static inline void | ||
| 38 | irq_settings_clr_and_set(struct irq_desc *desc, u32 clr, u32 set) | ||
| 39 | { | ||
| 40 | desc->status &= ~(clr & _IRQF_MODIFY_MASK); | ||
| 41 | desc->status |= (set & _IRQF_MODIFY_MASK); | ||
| 42 | } | ||
| 43 | |||
| 44 | static inline bool irq_settings_is_per_cpu(struct irq_desc *desc) | ||
| 45 | { | ||
| 46 | return desc->status & _IRQ_PER_CPU; | ||
| 47 | } | ||
| 48 | |||
| 49 | static inline void irq_settings_set_per_cpu(struct irq_desc *desc) | ||
| 50 | { | ||
| 51 | desc->status |= _IRQ_PER_CPU; | ||
| 52 | } | ||
| 53 | |||
| 54 | static inline void irq_settings_set_no_balancing(struct irq_desc *desc) | ||
| 55 | { | ||
| 56 | desc->status |= _IRQ_NO_BALANCING; | ||
| 57 | } | ||
| 58 | |||
| 59 | static inline bool irq_settings_has_no_balance_set(struct irq_desc *desc) | ||
| 60 | { | ||
| 61 | return desc->status & _IRQ_NO_BALANCING; | ||
| 62 | } | ||
| 63 | |||
| 64 | static inline u32 irq_settings_get_trigger_mask(struct irq_desc *desc) | ||
| 65 | { | ||
| 66 | return desc->status & IRQ_TYPE_SENSE_MASK; | ||
| 67 | } | ||
| 68 | |||
| 69 | static inline void | ||
| 70 | irq_settings_set_trigger_mask(struct irq_desc *desc, u32 mask) | ||
| 71 | { | ||
| 72 | desc->status &= ~IRQ_TYPE_SENSE_MASK; | ||
| 73 | desc->status |= mask & IRQ_TYPE_SENSE_MASK; | ||
| 74 | } | ||
| 75 | |||
| 76 | static inline bool irq_settings_is_level(struct irq_desc *desc) | ||
| 77 | { | ||
| 78 | return desc->status & _IRQ_LEVEL; | ||
| 79 | } | ||
| 80 | |||
| 81 | static inline void irq_settings_clr_level(struct irq_desc *desc) | ||
| 82 | { | ||
| 83 | desc->status &= ~_IRQ_LEVEL; | ||
| 84 | } | ||
| 85 | |||
| 86 | static inline void irq_settings_set_level(struct irq_desc *desc) | ||
| 87 | { | ||
| 88 | desc->status |= _IRQ_LEVEL; | ||
| 89 | } | ||
| 90 | |||
| 91 | static inline bool irq_settings_can_request(struct irq_desc *desc) | ||
| 92 | { | ||
| 93 | return !(desc->status & _IRQ_NOREQUEST); | ||
| 94 | } | ||
| 95 | |||
| 96 | static inline void irq_settings_clr_norequest(struct irq_desc *desc) | ||
| 97 | { | ||
| 98 | desc->status &= ~_IRQ_NOREQUEST; | ||
| 99 | } | ||
| 100 | |||
| 101 | static inline void irq_settings_set_norequest(struct irq_desc *desc) | ||
| 102 | { | ||
| 103 | desc->status |= _IRQ_NOREQUEST; | ||
| 104 | } | ||
| 105 | |||
| 106 | static inline bool irq_settings_can_probe(struct irq_desc *desc) | ||
| 107 | { | ||
| 108 | return !(desc->status & _IRQ_NOPROBE); | ||
| 109 | } | ||
| 110 | |||
| 111 | static inline void irq_settings_clr_noprobe(struct irq_desc *desc) | ||
| 112 | { | ||
| 113 | desc->status &= ~_IRQ_NOPROBE; | ||
| 114 | } | ||
| 115 | |||
| 116 | static inline void irq_settings_set_noprobe(struct irq_desc *desc) | ||
| 117 | { | ||
| 118 | desc->status |= _IRQ_NOPROBE; | ||
| 119 | } | ||
| 120 | |||
| 121 | static inline bool irq_settings_can_move_pcntxt(struct irq_desc *desc) | ||
| 122 | { | ||
| 123 | return desc->status & _IRQ_MOVE_PCNTXT; | ||
| 124 | } | ||
| 125 | |||
| 126 | static inline bool irq_settings_can_autoenable(struct irq_desc *desc) | ||
| 127 | { | ||
| 128 | return !(desc->status & _IRQ_NOAUTOEN); | ||
| 129 | } | ||
| 130 | |||
| 131 | static inline bool irq_settings_is_nested_thread(struct irq_desc *desc) | ||
| 132 | { | ||
| 133 | return desc->status & _IRQ_NESTED_THREAD; | ||
| 134 | } | ||
| 135 | |||
| 136 | /* Nothing should touch desc->status from now on */ | ||
| 137 | #undef status | ||
| 138 | #define status USE_THE_PROPER_WRAPPERS_YOU_MORON | ||
