x86: add copies of some headers to convert to asm-generic
[linux/fpc-iii.git] / arch / blackfin / include / asm / irqflags.h
blob139cba4651b1480932033d6b264ee026e4c9214d
1 /*
2 * interface to Blackfin CEC
4 * Copyright 2009 Analog Devices Inc.
5 * Licensed under the GPL-2 or later.
6 */
8 #ifndef __ASM_BFIN_IRQFLAGS_H__
9 #define __ASM_BFIN_IRQFLAGS_H__
11 #ifdef CONFIG_SMP
12 # include <asm/pda.h>
13 # include <asm/processor.h>
14 /* Forward decl needed due to cdef inter dependencies */
15 static inline uint32_t __pure bfin_dspid(void);
16 # define blackfin_core_id() (bfin_dspid() & 0xff)
17 # define bfin_irq_flags cpu_pda[blackfin_core_id()].imask
18 #else
19 extern unsigned long bfin_irq_flags;
20 #endif
22 static inline void bfin_sti(unsigned long flags)
24 asm volatile("sti %0;" : : "d" (flags));
27 static inline unsigned long bfin_cli(void)
29 unsigned long flags;
30 asm volatile("cli %0;" : "=d" (flags));
31 return flags;
34 static inline void raw_local_irq_disable(void)
36 bfin_cli();
38 static inline void raw_local_irq_enable(void)
40 bfin_sti(bfin_irq_flags);
43 #define raw_local_save_flags(flags) do { (flags) = bfin_read_IMASK(); } while (0)
45 #define raw_irqs_disabled_flags(flags) (((flags) & ~0x3f) == 0)
47 static inline void raw_local_irq_restore(unsigned long flags)
49 if (!raw_irqs_disabled_flags(flags))
50 raw_local_irq_enable();
53 static inline unsigned long __raw_local_irq_save(void)
55 unsigned long flags = bfin_cli();
56 #ifdef CONFIG_DEBUG_HWERR
57 bfin_sti(0x3f);
58 #endif
59 return flags;
61 #define raw_local_irq_save(flags) do { (flags) = __raw_local_irq_save(); } while (0)
63 #endif