diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-06-08 12:49:48 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-06-13 07:20:13 -0400 |
commit | 8f86001f76609f70bfcce34e7e2a11860e012ace (patch) | |
tree | 714bb31a2e54ceabfc750a1a1e556cc1ff60abff /arch/blackfin/include/asm/irqflags.h | |
parent | 538067c822e2512d9a165c71c0c5722168470304 (diff) | |
download | linux-8f86001f76609f70bfcce34e7e2a11860e012ace.tar.gz linux-8f86001f76609f70bfcce34e7e2a11860e012ace.tar.bz2 linux-8f86001f76609f70bfcce34e7e2a11860e012ace.zip |
Blackfin: add support for irqflags
This converts the irq handling in the Blackfin arch from the old irq.h /
system.h method to the new irqflags.h. A stepping stone on the way to
other tracing functionality.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin/include/asm/irqflags.h')
-rw-r--r-- | arch/blackfin/include/asm/irqflags.h | 63 |
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 @@ +/* + * interface to Blackfin CEC + * + * Copyright 2009 Analog Devices Inc. + * Licensed under the GPL-2 or later. + */ + +#ifndef __ASM_BFIN_IRQFLAGS_H__ +#define __ASM_BFIN_IRQFLAGS_H__ + +#ifdef CONFIG_SMP +# include <asm/pda.h> +# include <asm/processor.h> +/* Forward decl needed due to cdef inter dependencies */ +static inline uint32_t __pure bfin_dspid(void); +# define blackfin_core_id() (bfin_dspid() & 0xff) +# define bfin_irq_flags cpu_pda[blackfin_core_id()].imask +#else +extern unsigned long bfin_irq_flags; +#endif + +static inline void bfin_sti(unsigned long flags) +{ + asm volatile("sti %0;" : : "d" (flags)); +} + +static inline unsigned long bfin_cli(void) +{ + unsigned long flags; + asm volatile("cli %0;" : "=d" (flags)); + return flags; +} + +static inline void raw_local_irq_disable(void) +{ + bfin_cli(); +} +static inline void raw_local_irq_enable(void) +{ + bfin_sti(bfin_irq_flags); +} + +#define raw_local_save_flags(flags) do { (flags) = bfin_read_IMASK(); } while (0) + +#define raw_irqs_disabled_flags(flags) (((flags) & ~0x3f) == 0) + +static inline void raw_local_irq_restore(unsigned long flags) +{ + if (!raw_irqs_disabled_flags(flags)) + raw_local_irq_enable(); +} + +static inline unsigned long __raw_local_irq_save(void) +{ + unsigned long flags = bfin_cli(); +#ifdef CONFIG_DEBUG_HWERR + bfin_sti(0x3f); +#endif + return flags; +} +#define raw_local_irq_save(flags) do { (flags) = __raw_local_irq_save(); } while (0) + +#endif |