Merge branches 'tracing/kmemtrace2' and 'tracing/ftrace' into tracing/urgent
[deliverable/linux.git] / arch / sparc / include / asm / irqflags_64.h
1 /*
2 * include/asm/irqflags.h
3 *
4 * IRQ flags handling
5 *
6 * This file gets included from lowlevel asm headers too, to provide
7 * wrapped versions of the local_irq_*() APIs, based on the
8 * raw_local_irq_*() functions from the lowlevel headers.
9 */
10 #ifndef _ASM_IRQFLAGS_H
11 #define _ASM_IRQFLAGS_H
12
13 #include <asm/pil.h>
14
15 #ifndef __ASSEMBLY__
16
17 static inline unsigned long __raw_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
29 #define raw_local_save_flags(flags) \
30 do { (flags) = __raw_local_save_flags(); } while (0)
31
32 static inline void raw_local_irq_restore(unsigned long flags)
33 {
34 __asm__ __volatile__(
35 "wrpr %0, %%pil"
36 : /* no output */
37 : "r" (flags)
38 : "memory"
39 );
40 }
41
42 static inline void raw_local_irq_disable(void)
43 {
44 __asm__ __volatile__(
45 "wrpr %0, %%pil"
46 : /* no outputs */
47 : "i" (PIL_NORMAL_MAX)
48 : "memory"
49 );
50 }
51
52 static inline void raw_local_irq_enable(void)
53 {
54 __asm__ __volatile__(
55 "wrpr 0, %%pil"
56 : /* no outputs */
57 : /* no inputs */
58 : "memory"
59 );
60 }
61
62 static inline int raw_irqs_disabled_flags(unsigned long flags)
63 {
64 return (flags > 0);
65 }
66
67 static inline int raw_irqs_disabled(void)
68 {
69 unsigned long flags = __raw_local_save_flags();
70
71 return raw_irqs_disabled_flags(flags);
72 }
73
74 /*
75 * For spinlocks, etc:
76 */
77 static inline unsigned long __raw_local_irq_save(void)
78 {
79 unsigned long flags = __raw_local_save_flags();
80
81 raw_local_irq_disable();
82
83 return flags;
84 }
85
86 #define raw_local_irq_save(flags) \
87 do { (flags) = __raw_local_irq_save(); } while (0)
88
89 #endif /* (__ASSEMBLY__) */
90
91 #endif /* !(_ASM_IRQFLAGS_H) */
This page took 0.033295 seconds and 5 git commands to generate.