0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef _ASM_IRQFLAGS_H
0012 #define _ASM_IRQFLAGS_H
0013
0014 #include <asm/pil.h>
0015
0016 #ifndef __ASSEMBLY__
0017
0018 static inline notrace unsigned long arch_local_save_flags(void)
0019 {
0020 unsigned long flags;
0021
0022 __asm__ __volatile__(
0023 "rdpr %%pil, %0"
0024 : "=r" (flags)
0025 );
0026
0027 return flags;
0028 }
0029
0030 static inline notrace void arch_local_irq_restore(unsigned long flags)
0031 {
0032 __asm__ __volatile__(
0033 "wrpr %0, %%pil"
0034 :
0035 : "r" (flags)
0036 : "memory"
0037 );
0038 }
0039
0040 static inline notrace void arch_local_irq_disable(void)
0041 {
0042 __asm__ __volatile__(
0043 "wrpr %0, %%pil"
0044 :
0045 : "i" (PIL_NORMAL_MAX)
0046 : "memory"
0047 );
0048 }
0049
0050 static inline notrace void arch_local_irq_enable(void)
0051 {
0052 __asm__ __volatile__(
0053 "wrpr 0, %%pil"
0054 :
0055 :
0056 : "memory"
0057 );
0058 }
0059
0060 static inline notrace int arch_irqs_disabled_flags(unsigned long flags)
0061 {
0062 return (flags > 0);
0063 }
0064
0065 static inline notrace int arch_irqs_disabled(void)
0066 {
0067 return arch_irqs_disabled_flags(arch_local_save_flags());
0068 }
0069
0070 static inline notrace unsigned long arch_local_irq_save(void)
0071 {
0072 unsigned long flags, tmp;
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084 __asm__ __volatile__(
0085 "rdpr %%pil, %0\n\t"
0086 "or %0, %2, %1\n\t"
0087 "wrpr %1, 0x0, %%pil"
0088 : "=r" (flags), "=r" (tmp)
0089 : "i" (PIL_NORMAL_MAX)
0090 : "memory"
0091 );
0092
0093 return flags;
0094 }
0095
0096 #endif
0097
0098 #endif