diff options
Diffstat (limited to 'arch/ia64/include')
| -rw-r--r-- | arch/ia64/include/asm/irqflags.h | 94 | ||||
| -rw-r--r-- | arch/ia64/include/asm/system.h | 76 |
2 files changed, 94 insertions, 76 deletions
diff --git a/arch/ia64/include/asm/irqflags.h b/arch/ia64/include/asm/irqflags.h new file mode 100644 index 000000000000..f82d6be2ecd2 --- /dev/null +++ b/arch/ia64/include/asm/irqflags.h | |||
| @@ -0,0 +1,94 @@ | |||
| 1 | /* | ||
| 2 | * IRQ flags defines. | ||
| 3 | * | ||
| 4 | * Copyright (C) 1998-2003 Hewlett-Packard Co | ||
| 5 | * David Mosberger-Tang <davidm@hpl.hp.com> | ||
| 6 | * Copyright (C) 1999 Asit Mallick <asit.k.mallick@intel.com> | ||
| 7 | * Copyright (C) 1999 Don Dugger <don.dugger@intel.com> | ||
| 8 | */ | ||
| 9 | |||
| 10 | #ifndef _ASM_IA64_IRQFLAGS_H | ||
| 11 | #define _ASM_IA64_IRQFLAGS_H | ||
| 12 | |||
| 13 | #ifdef CONFIG_IA64_DEBUG_IRQ | ||
| 14 | extern unsigned long last_cli_ip; | ||
| 15 | static inline void arch_maybe_save_ip(unsigned long flags) | ||
| 16 | { | ||
| 17 | if (flags & IA64_PSR_I) | ||
| 18 | last_cli_ip = ia64_getreg(_IA64_REG_IP); | ||
| 19 | } | ||
| 20 | #else | ||
| 21 | #define arch_maybe_save_ip(flags) do {} while (0) | ||
| 22 | #endif | ||
| 23 | |||
| 24 | /* | ||
| 25 | * - clearing psr.i is implicitly serialized (visible by next insn) | ||
| 26 | * - setting psr.i requires data serialization | ||
| 27 | * - we need a stop-bit before reading PSR because we sometimes | ||
| 28 | * write a floating-point register right before reading the PSR | ||
| 29 | * and that writes to PSR.mfl | ||
| 30 | */ | ||
| 31 | |||
| 32 | static inline unsigned long arch_local_save_flags(void) | ||
| 33 | { | ||
| 34 | ia64_stop(); | ||
| 35 | #ifdef CONFIG_PARAVIRT | ||
| 36 | return ia64_get_psr_i(); | ||
| 37 | #else | ||
| 38 | return ia64_getreg(_IA64_REG_PSR); | ||
| 39 | #endif | ||
| 40 | } | ||
| 41 | |||
| 42 | static inline unsigned long arch_local_irq_save(void) | ||
| 43 | { | ||
| 44 | unsigned long flags = arch_local_save_flags(); | ||
| 45 | |||
| 46 | ia64_stop(); | ||
| 47 | ia64_rsm(IA64_PSR_I); | ||
| 48 | arch_maybe_save_ip(flags); | ||
| 49 | return flags; | ||
| 50 | } | ||
| 51 | |||
| 52 | static inline void arch_local_irq_disable(void) | ||
| 53 | { | ||
| 54 | #ifdef CONFIG_IA64_DEBUG_IRQ | ||
| 55 | arch_local_irq_save(); | ||
| 56 | #else | ||
| 57 | ia64_stop(); | ||
| 58 | ia64_rsm(IA64_PSR_I); | ||
| 59 | #endif | ||
| 60 | } | ||
| 61 | |||
| 62 | static inline void arch_local_irq_enable(void) | ||
| 63 | { | ||
| 64 | ia64_stop(); | ||
| 65 | ia64_ssm(IA64_PSR_I); | ||
| 66 | ia64_srlz_d(); | ||
| 67 | } | ||
| 68 | |||
| 69 | static inline void arch_local_irq_restore(unsigned long flags) | ||
| 70 | { | ||
| 71 | #ifdef CONFIG_IA64_DEBUG_IRQ | ||
| 72 | unsigned long old_psr = arch_local_save_flags(); | ||
| 73 | #endif | ||
| 74 | ia64_intrin_local_irq_restore(flags & IA64_PSR_I); | ||
| 75 | arch_maybe_save_ip(old_psr & ~flags); | ||
| 76 | } | ||
| 77 | |||
| 78 | static inline bool arch_irqs_disabled_flags(unsigned long flags) | ||
| 79 | { | ||
| 80 | return (flags & IA64_PSR_I) == 0; | ||
| 81 | } | ||
| 82 | |||
| 83 | static inline bool arch_irqs_disabled(void) | ||
| 84 | { | ||
| 85 | return arch_irqs_disabled_flags(arch_local_save_flags()); | ||
| 86 | } | ||
| 87 | |||
| 88 | static inline void arch_safe_halt(void) | ||
| 89 | { | ||
| 90 | ia64_pal_halt_light(); /* PAL_HALT_LIGHT */ | ||
| 91 | } | ||
| 92 | |||
| 93 | |||
| 94 | #endif /* _ASM_IA64_IRQFLAGS_H */ | ||
diff --git a/arch/ia64/include/asm/system.h b/arch/ia64/include/asm/system.h index 9f342a574ce8..2feb7f64c035 100644 --- a/arch/ia64/include/asm/system.h +++ b/arch/ia64/include/asm/system.h | |||
| @@ -107,87 +107,11 @@ extern struct ia64_boot_param { | |||
| 107 | */ | 107 | */ |
| 108 | #define set_mb(var, value) do { (var) = (value); mb(); } while (0) | 108 | #define set_mb(var, value) do { (var) = (value); mb(); } while (0) |
| 109 | 109 | ||
| 110 | #define safe_halt() ia64_pal_halt_light() /* PAL_HALT_LIGHT */ | ||
| 111 | |||
| 112 | /* | 110 | /* |
| 113 | * The group barrier in front of the rsm & ssm are necessary to ensure | 111 | * The group barrier in front of the rsm & ssm are necessary to ensure |
| 114 | * that none of the previous instructions in the same group are | 112 | * that none of the previous instructions in the same group are |
| 115 | * affected by the rsm/ssm. | 113 | * affected by the rsm/ssm. |
| 116 | */ | 114 | */ |
| 117 | /* For spinlocks etc */ | ||
| 118 | |||
| 119 | /* | ||
| 120 | * - clearing psr.i is implicitly serialized (visible by next insn) | ||
| 121 | * - setting psr.i requires data serialization | ||
| 122 | * - we need a stop-bit before reading PSR because we sometimes | ||
| 123 | * write a floating-point register right before reading the PSR | ||
| 124 | * and that writes to PSR.mfl | ||
| 125 | */ | ||
| 126 | #ifdef CONFIG_PARAVIRT | ||
| 127 | #define __local_save_flags() ia64_get_psr_i() | ||
| 128 | #else | ||
| 129 | #define __local_save_flags() ia64_getreg(_IA64_REG_PSR) | ||
| 130 | #endif | ||
| 131 | |||
| 132 | #define __local_irq_save(x) \ | ||
| 133 | do { \ | ||
| 134 | ia64_stop(); \ | ||
| 135 | (x) = __local_save_flags(); \ | ||
| 136 | ia64_stop(); \ | ||
| 137 | ia64_rsm(IA64_PSR_I); \ | ||
| 138 | } while (0) | ||
| 139 | |||
| 140 | #define __local_irq_disable() \ | ||
| 141 | do { \ | ||
| 142 | ia64_stop(); \ | ||
| 143 | ia64_rsm(IA64_PSR_I); \ | ||
| 144 | } while (0) | ||
| 145 | |||
| 146 | #define __local_irq_restore(x) ia64_intrin_local_irq_restore((x) & IA64_PSR_I) | ||
| 147 | |||
| 148 | #ifdef CONFIG_IA64_DEBUG_IRQ | ||
| 149 | |||
| 150 | extern unsigned long last_cli_ip; | ||
| 151 | |||
| 152 | # define __save_ip() last_cli_ip = ia64_getreg(_IA64_REG_IP) | ||
| 153 | |||
| 154 | # define local_irq_save(x) \ | ||
| 155 | do { \ | ||
| 156 | unsigned long __psr; \ | ||
| 157 | \ | ||
| 158 | __local_irq_save(__psr); \ | ||
| 159 | if (__psr & IA64_PSR_I) \ | ||
| 160 | __save_ip(); \ | ||
| 161 | (x) = __psr; \ | ||
| 162 | } while (0) | ||
| 163 | |||
| 164 | # define local_irq_disable() do { unsigned long __x; local_irq_save(__x); } while (0) | ||
| 165 | |||
| 166 | # define local_irq_restore(x) \ | ||
| 167 | do { \ | ||
| 168 | unsigned long __old_psr, __psr = (x); \ | ||
| 169 | \ | ||
| 170 | local_save_flags(__old_psr); \ | ||
| 171 | __local_irq_restore(__psr); \ | ||
| 172 | if ((__old_psr & IA64_PSR_I) && !(__psr & IA64_PSR_I)) \ | ||
| 173 | __save_ip(); \ | ||
| 174 | } while (0) | ||
| 175 | |||
| 176 | #else /* !CONFIG_IA64_DEBUG_IRQ */ | ||
| 177 | # define local_irq_save(x) __local_irq_save(x) | ||
| 178 | # define local_irq_disable() __local_irq_disable() | ||
| 179 | # define local_irq_restore(x) __local_irq_restore(x) | ||
| 180 | #endif /* !CONFIG_IA64_DEBUG_IRQ */ | ||
| 181 | |||
| 182 | #define local_irq_enable() ({ ia64_stop(); ia64_ssm(IA64_PSR_I); ia64_srlz_d(); }) | ||
| 183 | #define local_save_flags(flags) ({ ia64_stop(); (flags) = __local_save_flags(); }) | ||
| 184 | |||
| 185 | #define irqs_disabled() \ | ||
| 186 | ({ \ | ||
| 187 | unsigned long __ia64_id_flags; \ | ||
| 188 | local_save_flags(__ia64_id_flags); \ | ||
| 189 | (__ia64_id_flags & IA64_PSR_I) == 0; \ | ||
| 190 | }) | ||
| 191 | 115 | ||
| 192 | #ifdef __KERNEL__ | 116 | #ifdef __KERNEL__ |
| 193 | 117 | ||
