First Support on Ginger and OMAP TI
[linux-ginger.git] / arch / score / include / asm / irqflags.h
blob690a6cae729416807b5120d20d45beb047487ffe
1 #ifndef _ASM_SCORE_IRQFLAGS_H
2 #define _ASM_SCORE_IRQFLAGS_H
4 #ifndef __ASSEMBLY__
6 #define raw_local_irq_save(x) \
7 { \
8 __asm__ __volatile__( \
9 "mfcr r8, cr0;" \
10 "li r9, 0xfffffffe;" \
11 "nop;" \
12 "mv %0, r8;" \
13 "and r8, r8, r9;" \
14 "mtcr r8, cr0;" \
15 "nop;" \
16 "nop;" \
17 "nop;" \
18 "nop;" \
19 "nop;" \
20 : "=r" (x) \
21 : \
22 : "r8", "r9" \
23 ); \
26 #define raw_local_irq_restore(x) \
27 { \
28 __asm__ __volatile__( \
29 "mfcr r8, cr0;" \
30 "ldi r9, 0x1;" \
31 "and %0, %0, r9;" \
32 "or r8, r8, %0;" \
33 "mtcr r8, cr0;" \
34 "nop;" \
35 "nop;" \
36 "nop;" \
37 "nop;" \
38 "nop;" \
39 : \
40 : "r"(x) \
41 : "r8", "r9" \
42 ); \
45 #define raw_local_irq_enable(void) \
46 { \
47 __asm__ __volatile__( \
48 "mfcr\tr8,cr0;" \
49 "nop;" \
50 "nop;" \
51 "ori\tr8,0x1;" \
52 "mtcr\tr8,cr0;" \
53 "nop;" \
54 "nop;" \
55 "nop;" \
56 "nop;" \
57 "nop;" \
58 : \
59 : \
60 : "r8"); \
63 #define raw_local_irq_disable(void) \
64 { \
65 __asm__ __volatile__( \
66 "mfcr\tr8,cr0;" \
67 "nop;" \
68 "nop;" \
69 "srli\tr8,r8,1;" \
70 "slli\tr8,r8,1;" \
71 "mtcr\tr8,cr0;" \
72 "nop;" \
73 "nop;" \
74 "nop;" \
75 "nop;" \
76 "nop;" \
77 : \
78 : \
79 : "r8"); \
82 #define raw_local_save_flags(x) \
83 { \
84 __asm__ __volatile__( \
85 "mfcr r8, cr0;" \
86 "nop;" \
87 "nop;" \
88 "mv %0, r8;" \
89 "nop;" \
90 "nop;" \
91 "nop;" \
92 "nop;" \
93 "nop;" \
94 "ldi r9, 0x1;" \
95 "and %0, %0, r9;" \
96 : "=r" (x) \
97 : \
98 : "r8", "r9" \
99 ); \
102 static inline int raw_irqs_disabled_flags(unsigned long flags)
104 return !(flags & 1);
107 #endif
109 #endif /* _ASM_SCORE_IRQFLAGS_H */