1
2
3
4
5
6
7
8
9
10#ifndef _ASM_IRQFLAGS_H
11#define _ASM_IRQFLAGS_H
12
13#include <asm/pil.h>
14
15#ifndef __ASSEMBLY__
16
17static inline notrace unsigned long arch_local_save_flags(void)
18{
19 unsigned long flags;
20
21 __asm__ __volatile__(
22 "rdpr %%pil, %0"
23 : "=r" (flags)
24 );
25
26 return flags;
27}
28
29static inline notrace void arch_local_irq_restore(unsigned long flags)
30{
31 __asm__ __volatile__(
32 "wrpr %0, %%pil"
33 :
34 : "r" (flags)
35 : "memory"
36 );
37}
38
39static inline notrace void arch_local_irq_disable(void)
40{
41 __asm__ __volatile__(
42 "wrpr %0, %%pil"
43 :
44 : "i" (PIL_NORMAL_MAX)
45 : "memory"
46 );
47}
48
49static inline notrace void arch_local_irq_enable(void)
50{
51 __asm__ __volatile__(
52 "wrpr 0, %%pil"
53 :
54 :
55 : "memory"
56 );
57}
58
59static inline notrace int arch_irqs_disabled_flags(unsigned long flags)
60{
61 return (flags > 0);
62}
63
64static inline notrace int arch_irqs_disabled(void)
65{
66 return arch_irqs_disabled_flags(arch_local_save_flags());
67}
68
69static inline notrace unsigned long arch_local_irq_save(void)
70{
71 unsigned long flags, tmp;
72
73
74
75
76
77
78
79
80
81
82
83 __asm__ __volatile__(
84 "rdpr %%pil, %0\n\t"
85 "or %0, %2, %1\n\t"
86 "wrpr %1, 0x0, %%pil"
87 : "=r" (flags), "=r" (tmp)
88 : "i" (PIL_NORMAL_MAX)
89 : "memory"
90 );
91
92 return flags;
93}
94
95#endif
96
97#endif
98