Linux 5.7.6
[linux/fpc-iii.git] / arch / h8300 / include / asm / irqflags.h
blob48756b7f405e252c1e8a0925402d31fd3a71e19c
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _H8300_IRQFLAGS_H
3 #define _H8300_IRQFLAGS_H
5 #ifdef CONFIG_CPU_H8300H
6 typedef unsigned char h8300flags;
8 static inline h8300flags arch_local_save_flags(void)
10 h8300flags flags;
12 __asm__ volatile ("stc ccr,%w0" : "=r" (flags));
13 return flags;
16 static inline void arch_local_irq_disable(void)
18 __asm__ volatile ("orc #0xc0,ccr");
21 static inline void arch_local_irq_enable(void)
23 __asm__ volatile ("andc #0x3f,ccr");
26 static inline h8300flags arch_local_irq_save(void)
28 h8300flags flags;
30 __asm__ volatile ("stc ccr,%w0\n\t"
31 "orc #0xc0,ccr" : "=r" (flags));
32 return flags;
35 static inline void arch_local_irq_restore(h8300flags flags)
37 __asm__ volatile ("ldc %w0,ccr" : : "r" (flags) : "cc");
40 static inline int arch_irqs_disabled_flags(unsigned long flags)
42 return (flags & 0xc0) == 0xc0;
44 #endif
45 #ifdef CONFIG_CPU_H8S
46 typedef unsigned short h8300flags;
48 static inline h8300flags arch_local_save_flags(void)
50 h8300flags flags;
52 __asm__ volatile ("stc ccr,%w0\n\tstc exr,%x0" : "=r" (flags));
53 return flags;
56 static inline void arch_local_irq_disable(void)
58 __asm__ volatile ("orc #0x80,ccr\n\t");
61 static inline void arch_local_irq_enable(void)
63 __asm__ volatile ("andc #0x7f,ccr\n\t"
64 "andc #0xf0,exr\n\t");
67 static inline h8300flags arch_local_irq_save(void)
69 h8300flags flags;
71 __asm__ volatile ("stc ccr,%w0\n\t"
72 "stc exr,%x0\n\t"
73 "orc #0x80,ccr\n\t"
74 : "=r" (flags));
75 return flags;
78 static inline void arch_local_irq_restore(h8300flags flags)
80 __asm__ volatile ("ldc %w0,ccr\n\t"
81 "ldc %x0,exr"
82 : : "r" (flags) : "cc");
85 static inline int arch_irqs_disabled_flags(h8300flags flags)
87 return (flags & 0x0080) == 0x0080;
90 #endif
92 static inline int arch_irqs_disabled(void)
94 return arch_irqs_disabled_flags(arch_local_save_flags());
97 #endif /* _H8300_IRQFLAGS_H */