aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/include/asm/irqflags.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/blackfin/include/asm/irqflags.h')
-rw-r--r--arch/blackfin/include/asm/irqflags.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/arch/blackfin/include/asm/irqflags.h b/arch/blackfin/include/asm/irqflags.h
new file mode 100644
index 000000000000..139cba4651b1
--- /dev/null
+++ b/arch/blackfin/include/asm/irqflags.h
@@ -0,0 +1,63 @@
1/*
2 * interface to Blackfin CEC
3 *
4 * Copyright 2009 Analog Devices Inc.
5 * Licensed under the GPL-2 or later.
6 */
7
8#ifndef __ASM_BFIN_IRQFLAGS_H__
9#define __ASM_BFIN_IRQFLAGS_H__
10
11#ifdef CONFIG_SMP
12# include <asm/pda.h>
13# include <asm/processor.h>
14/* Forward decl needed due to cdef inter dependencies */
15static 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
19extern unsigned long bfin_irq_flags;
20#endif
21
22static inline void bfin_sti(unsigned long flags)
23{
24 asm volatile("sti %0;" : : "d" (flags));
25}
26
27static inline unsigned long bfin_cli(void)
28{
29 unsigned long flags;
30 asm volatile("cli %0;" : "=d" (flags));
31 return flags;
32}
33
34static inline void raw_local_irq_disable(void)
35{
36 bfin_cli();
37}
38static inline void raw_local_irq_enable(void)
39{
40 bfin_sti(bfin_irq_flags);
41}
42
43#define raw_local_save_flags(flags) do { (flags) = bfin_read_IMASK(); } while (0)
44
45#define raw_irqs_disabled_flags(flags) (((flags) & ~0x3f) == 0)
46
47static inline void raw_local_irq_restore(unsigned long flags)
48{
49 if (!raw_irqs_disabled_flags(flags))
50 raw_local_irq_enable();
51}
52
53static inline unsigned long __raw_local_irq_save(void)
54{
55 unsigned long flags = bfin_cli();
56#ifdef CONFIG_DEBUG_HWERR
57 bfin_sti(0x3f);
58#endif
59 return flags;
60}
61#define raw_local_irq_save(flags) do { (flags) = __raw_local_irq_save(); } while (0)
62
63#endif