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>
10 #ifndef _ASM_IA64_IRQFLAGS_H
11 #define _ASM_IA64_IRQFLAGS_H
14 #include <asm/kregs.h>
16 #ifdef CONFIG_IA64_DEBUG_IRQ
17 extern unsigned long last_cli_ip
;
18 static inline void arch_maybe_save_ip(unsigned long flags
)
20 if (flags
& IA64_PSR_I
)
21 last_cli_ip
= ia64_getreg(_IA64_REG_IP
);
24 #define arch_maybe_save_ip(flags) do {} while (0)
28 * - clearing psr.i is implicitly serialized (visible by next insn)
29 * - setting psr.i requires data serialization
30 * - we need a stop-bit before reading PSR because we sometimes
31 * write a floating-point register right before reading the PSR
32 * and that writes to PSR.mfl
35 static inline unsigned long arch_local_save_flags(void)
38 #ifdef CONFIG_PARAVIRT
39 return ia64_get_psr_i();
41 return ia64_getreg(_IA64_REG_PSR
);
45 static inline unsigned long arch_local_irq_save(void)
47 unsigned long flags
= arch_local_save_flags();
51 arch_maybe_save_ip(flags
);
55 static inline void arch_local_irq_disable(void)
57 #ifdef CONFIG_IA64_DEBUG_IRQ
58 arch_local_irq_save();
65 static inline void arch_local_irq_enable(void)
72 static inline void arch_local_irq_restore(unsigned long flags
)
74 #ifdef CONFIG_IA64_DEBUG_IRQ
75 unsigned long old_psr
= arch_local_save_flags();
77 ia64_intrin_local_irq_restore(flags
& IA64_PSR_I
);
78 arch_maybe_save_ip(old_psr
& ~flags
);
81 static inline bool arch_irqs_disabled_flags(unsigned long flags
)
83 return (flags
& IA64_PSR_I
) == 0;
86 static inline bool arch_irqs_disabled(void)
88 return arch_irqs_disabled_flags(arch_local_save_flags());
91 static inline void arch_safe_halt(void)
93 arch_local_irq_enable();
94 ia64_pal_halt_light(); /* PAL_HALT_LIGHT */
98 #endif /* _ASM_IA64_IRQFLAGS_H */