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; arch_maybe_save_ip(unsigned long flags)15static 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 arch_local_save_flags(void)32static 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 arch_local_irq_save(void)42static 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 arch_local_irq_disable(void)52static 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 arch_local_irq_enable(void)62static inline void arch_local_irq_enable(void) 63 { 64 ia64_stop(); 65 ia64_ssm(IA64_PSR_I); 66 ia64_srlz_d(); 67 } 68 arch_local_irq_restore(unsigned long flags)69static 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 arch_irqs_disabled_flags(unsigned long flags)78static inline bool arch_irqs_disabled_flags(unsigned long flags) 79 { 80 return (flags & IA64_PSR_I) == 0; 81 } 82 arch_irqs_disabled(void)83static inline bool arch_irqs_disabled(void) 84 { 85 return arch_irqs_disabled_flags(arch_local_save_flags()); 86 } 87 arch_safe_halt(void)88static inline void arch_safe_halt(void) 89 { 90 ia64_pal_halt_light(); /* PAL_HALT_LIGHT */ 91 } 92 93 94 #endif /* _ASM_IA64_IRQFLAGS_H */ 95