xref: /linux/arch/csky/include/asm/irqflags.h (revision e7d759f31ca295d589f7420719c311870bb3166f)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 
3 #ifndef __ASM_CSKY_IRQFLAGS_H
4 #define __ASM_CSKY_IRQFLAGS_H
5 #include <abi/reg_ops.h>
6 
7 static inline unsigned long arch_local_irq_save(void)
8 {
9 	unsigned long flags;
10 
11 	flags = mfcr("psr");
12 	asm volatile("psrclr ie\n":::"memory");
13 	return flags;
14 }
15 #define arch_local_irq_save arch_local_irq_save
16 
17 static inline void arch_local_irq_enable(void)
18 {
19 	asm volatile("psrset ee, ie\n":::"memory");
20 }
21 #define arch_local_irq_enable arch_local_irq_enable
22 
23 static inline void arch_local_irq_disable(void)
24 {
25 	asm volatile("psrclr ie\n":::"memory");
26 }
27 #define arch_local_irq_disable arch_local_irq_disable
28 
29 static inline unsigned long arch_local_save_flags(void)
30 {
31 	return mfcr("psr");
32 }
33 #define arch_local_save_flags arch_local_save_flags
34 
35 static inline void arch_local_irq_restore(unsigned long flags)
36 {
37 	mtcr("psr", flags);
38 }
39 #define arch_local_irq_restore arch_local_irq_restore
40 
41 static inline int arch_irqs_disabled_flags(unsigned long flags)
42 {
43 	return !(flags & (1<<6));
44 }
45 #define arch_irqs_disabled_flags arch_irqs_disabled_flags
46 
47 #include <asm-generic/irqflags.h>
48 
49 #endif /* __ASM_CSKY_IRQFLAGS_H */
50