[SPARC64]: Kill pbm->pci_first_slot.
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / asm-avr32 / irqflags.h
blob93570daac38ac47360bc16868be7eb6ada8fbaa8
1 /*
2 * Copyright (C) 2004-2006 Atmel Corporation
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8 #ifndef __ASM_AVR32_IRQFLAGS_H
9 #define __ASM_AVR32_IRQFLAGS_H
11 #include <asm/sysreg.h>
13 static inline unsigned long __raw_local_save_flags(void)
15 return sysreg_read(SR);
18 #define raw_local_save_flags(x) \
19 do { (x) = __raw_local_save_flags(); } while (0)
22 * This will restore ALL status register flags, not only the interrupt
23 * mask flag.
25 * The empty asm statement informs the compiler of this fact while
26 * also serving as a barrier.
28 static inline void raw_local_irq_restore(unsigned long flags)
30 sysreg_write(SR, flags);
31 asm volatile("" : : : "memory", "cc");
34 static inline void raw_local_irq_disable(void)
36 asm volatile("ssrf %0" : : "n"(SYSREG_GM_OFFSET) : "memory");
39 static inline void raw_local_irq_enable(void)
41 asm volatile("csrf %0" : : "n"(SYSREG_GM_OFFSET) : "memory");
44 static inline int raw_irqs_disabled_flags(unsigned long flags)
46 return (flags & SYSREG_BIT(GM)) != 0;
49 static inline int raw_irqs_disabled(void)
51 unsigned long flags = __raw_local_save_flags();
53 return raw_irqs_disabled_flags(flags);
56 static inline unsigned long __raw_local_irq_save(void)
58 unsigned long flags = __raw_local_save_flags();
60 raw_local_irq_disable();
62 return flags;
65 #define raw_local_irq_save(flags) \
66 do { (flags) = __raw_local_irq_save(); } while (0)
68 #endif /* __ASM_AVR32_IRQFLAGS_H */