2008-07-18 04:55:51 +00:00
|
|
|
/*
|
2008-07-27 21:00:59 +00:00
|
|
|
* include/asm/irqflags.h
|
2008-07-18 04:55:51 +00:00
|
|
|
*
|
|
|
|
* IRQ flags handling
|
|
|
|
*
|
|
|
|
* This file gets included from lowlevel asm headers too, to provide
|
|
|
|
* wrapped versions of the local_irq_*() APIs, based on the
|
2010-10-07 13:08:55 +00:00
|
|
|
* arch_local_irq_*() functions from the lowlevel headers.
|
2008-07-18 04:55:51 +00:00
|
|
|
*/
|
|
|
|
#ifndef _ASM_IRQFLAGS_H
|
|
|
|
#define _ASM_IRQFLAGS_H
|
|
|
|
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
|
2010-10-07 13:08:55 +00:00
|
|
|
#include <linux/types.h>
|
2012-03-28 17:30:03 +00:00
|
|
|
#include <asm/psr.h>
|
2008-07-18 04:55:51 +00:00
|
|
|
|
2010-10-07 13:08:55 +00:00
|
|
|
extern void arch_local_irq_restore(unsigned long);
|
|
|
|
extern unsigned long arch_local_irq_save(void);
|
|
|
|
extern void arch_local_irq_enable(void);
|
|
|
|
|
2011-07-06 15:00:29 +00:00
|
|
|
static inline notrace unsigned long arch_local_save_flags(void)
|
2008-07-18 04:55:51 +00:00
|
|
|
{
|
2010-10-07 13:08:55 +00:00
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
asm volatile("rd %%psr, %0" : "=r" (flags));
|
|
|
|
return flags;
|
|
|
|
}
|
2008-07-18 04:55:51 +00:00
|
|
|
|
2011-07-06 15:00:29 +00:00
|
|
|
static inline notrace void arch_local_irq_disable(void)
|
2010-10-07 13:08:55 +00:00
|
|
|
{
|
|
|
|
arch_local_irq_save();
|
2008-07-18 04:55:51 +00:00
|
|
|
}
|
|
|
|
|
2011-07-06 15:00:29 +00:00
|
|
|
static inline notrace bool arch_irqs_disabled_flags(unsigned long flags)
|
2010-10-07 13:08:55 +00:00
|
|
|
{
|
|
|
|
return (flags & PSR_PIL) != 0;
|
|
|
|
}
|
2008-07-18 04:55:51 +00:00
|
|
|
|
2011-07-06 15:00:29 +00:00
|
|
|
static inline notrace bool arch_irqs_disabled(void)
|
2008-07-18 04:55:51 +00:00
|
|
|
{
|
2010-10-07 13:08:55 +00:00
|
|
|
return arch_irqs_disabled_flags(arch_local_save_flags());
|
2008-07-18 04:55:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* (__ASSEMBLY__) */
|
|
|
|
|
|
|
|
#endif /* !(_ASM_IRQFLAGS_H) */
|