xref: /openbmc/linux/kernel/irq/settings.h (revision 876dbd4cc1b35c1a4cb96a2be1d43ea0eabce3b4)
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_NO_BALANCING	= IRQ_NO_BALANCING,
10 	_IRQF_MODIFY_MASK	= IRQF_MODIFY_MASK,
11 };
12 
13 #undef IRQ_INPROGRESS
14 #define IRQ_INPROGRESS		GOT_YOU_MORON
15 #undef IRQ_REPLAY
16 #define IRQ_REPLAY		GOT_YOU_MORON
17 #undef IRQ_WAITING
18 #define IRQ_WAITING		GOT_YOU_MORON
19 #undef IRQ_DISABLED
20 #define IRQ_DISABLED		GOT_YOU_MORON
21 #undef IRQ_PENDING
22 #define IRQ_PENDING		GOT_YOU_MORON
23 #undef IRQ_MASKED
24 #define IRQ_MASKED		GOT_YOU_MORON
25 #undef IRQ_WAKEUP
26 #define IRQ_WAKEUP		GOT_YOU_MORON
27 #undef IRQ_MOVE_PENDING
28 #define IRQ_MOVE_PENDING	GOT_YOU_MORON
29 #undef IRQ_PER_CPU
30 #define IRQ_PER_CPU		GOT_YOU_MORON
31 #undef IRQ_NO_BALANCING
32 #define IRQ_NO_BALANCING	GOT_YOU_MORON
33 #undef IRQ_AFFINITY_SET
34 #define IRQ_AFFINITY_SET	GOT_YOU_MORON
35 #undef IRQ_LEVEL
36 #define IRQ_LEVEL		GOT_YOU_MORON
37 #undef IRQF_MODIFY_MASK
38 #define IRQF_MODIFY_MASK	GOT_YOU_MORON
39 
40 static inline void
41 irq_settings_clr_and_set(struct irq_desc *desc, u32 clr, u32 set)
42 {
43 	desc->status &= ~(clr & _IRQF_MODIFY_MASK);
44 	desc->status |= (set & _IRQF_MODIFY_MASK);
45 }
46 
47 static inline bool irq_settings_is_per_cpu(struct irq_desc *desc)
48 {
49 	return desc->status & _IRQ_PER_CPU;
50 }
51 
52 static inline void irq_settings_set_per_cpu(struct irq_desc *desc)
53 {
54 	desc->status |= _IRQ_PER_CPU;
55 }
56 
57 static inline void irq_settings_set_no_balancing(struct irq_desc *desc)
58 {
59 	desc->status |= _IRQ_NO_BALANCING;
60 }
61 
62 static inline bool irq_settings_has_no_balance_set(struct irq_desc *desc)
63 {
64 	return desc->status & _IRQ_NO_BALANCING;
65 }
66 
67 static inline u32 irq_settings_get_trigger_mask(struct irq_desc *desc)
68 {
69 	return desc->status & IRQ_TYPE_SENSE_MASK;
70 }
71 
72 static inline void
73 irq_settings_set_trigger_mask(struct irq_desc *desc, u32 mask)
74 {
75 	desc->status &= ~IRQ_TYPE_SENSE_MASK;
76 	desc->status |= mask & IRQ_TYPE_SENSE_MASK;
77 }
78 
79 static inline bool irq_settings_is_level(struct irq_desc *desc)
80 {
81 	return desc->status & _IRQ_LEVEL;
82 }
83 
84 static inline void irq_settings_clr_level(struct irq_desc *desc)
85 {
86 	desc->status &= ~_IRQ_LEVEL;
87 }
88 
89 static inline void irq_settings_set_level(struct irq_desc *desc)
90 {
91 	desc->status |= _IRQ_LEVEL;
92 }
93