These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / arch / h8300 / include / asm / irqflags.h
1 #ifndef _H8300_IRQFLAGS_H
2 #define _H8300_IRQFLAGS_H
3
4 #ifdef CONFIG_CPU_H8300H
5 typedef unsigned char h8300flags;
6
7 static inline h8300flags arch_local_save_flags(void)
8 {
9         h8300flags flags;
10
11         __asm__ volatile ("stc ccr,%w0" : "=r" (flags));
12         return flags;
13 }
14
15 static inline void arch_local_irq_disable(void)
16 {
17         __asm__ volatile ("orc  #0xc0,ccr");
18 }
19
20 static inline void arch_local_irq_enable(void)
21 {
22         __asm__ volatile ("andc #0x3f,ccr");
23 }
24
25 static inline h8300flags arch_local_irq_save(void)
26 {
27         h8300flags flags;
28
29         __asm__ volatile ("stc ccr,%w0\n\t"
30                       "orc  #0xc0,ccr" : "=r" (flags));
31         return flags;
32 }
33
34 static inline void arch_local_irq_restore(h8300flags flags)
35 {
36         __asm__ volatile ("ldc %w0,ccr" : : "r" (flags) : "cc");
37 }
38
39 static inline int arch_irqs_disabled_flags(unsigned long flags)
40 {
41         return (flags & 0xc0) == 0xc0;
42 }
43 #endif
44 #ifdef CONFIG_CPU_H8S
45 typedef unsigned short h8300flags;
46
47 static inline h8300flags arch_local_save_flags(void)
48 {
49         h8300flags flags;
50
51         __asm__ volatile ("stc ccr,%w0\n\tstc exr,%x0" : "=r" (flags));
52         return flags;
53 }
54
55 static inline void arch_local_irq_disable(void)
56 {
57         __asm__ volatile ("orc #0x80,ccr\n\t");
58 }
59
60 static inline void arch_local_irq_enable(void)
61 {
62         __asm__ volatile ("andc #0x7f,ccr\n\t"
63                       "andc #0xf0,exr\n\t");
64 }
65
66 static inline h8300flags arch_local_irq_save(void)
67 {
68         h8300flags flags;
69
70         __asm__ volatile ("stc ccr,%w0\n\t"
71                       "stc exr,%x0\n\t"
72                       "orc  #0x80,ccr\n\t"
73                       : "=r" (flags));
74         return flags;
75 }
76
77 static inline void arch_local_irq_restore(h8300flags flags)
78 {
79         __asm__ volatile ("ldc %w0,ccr\n\t"
80                       "ldc %x0,exr"
81                       : : "r" (flags) : "cc");
82 }
83
84 static inline int arch_irqs_disabled_flags(h8300flags flags)
85 {
86         return (flags & 0x0080) == 0x0080;
87 }
88
89 #endif
90
91 static inline int arch_irqs_disabled(void)
92 {
93         return arch_irqs_disabled_flags(arch_local_save_flags());
94 }
95
96 #endif /* _H8300_IRQFLAGS_H */