2008-07-18 12:55:51 +08:00
|
|
|
/*
|
2008-07-28 05:00:59 +08:00
|
|
|
* include/asm/irqflags.h
|
2008-07-18 12:55:51 +08: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 21:08:55 +08:00
|
|
|
* arch_local_irq_*() functions from the lowlevel headers.
|
2008-07-18 12:55:51 +08:00
|
|
|
*/
|
|
|
|
#ifndef _ASM_IRQFLAGS_H
|
|
|
|
#define _ASM_IRQFLAGS_H
|
|
|
|
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
|
2010-10-07 21:08:55 +08:00
|
|
|
#include <linux/types.h>
|
2012-03-29 01:30:03 +08:00
|
|
|
#include <asm/psr.h>
|
2008-07-18 12:55:51 +08:00
|
|
|
|
2014-05-17 05:25:50 +08:00
|
|
|
void arch_local_irq_restore(unsigned long);
|
|
|
|
unsigned long arch_local_irq_save(void);
|
|
|
|
void arch_local_irq_enable(void);
|
2010-10-07 21:08:55 +08:00
|
|
|
|
2011-07-06 23:00:29 +08:00
|
|
|
static inline notrace unsigned long arch_local_save_flags(void)
|
2008-07-18 12:55:51 +08:00
|
|
|
{
|
2010-10-07 21:08:55 +08:00
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
asm volatile("rd %%psr, %0" : "=r" (flags));
|
|
|
|
return flags;
|
|
|
|
}
|
2008-07-18 12:55:51 +08:00
|
|
|
|
2011-07-06 23:00:29 +08:00
|
|
|
static inline notrace void arch_local_irq_disable(void)
|
2010-10-07 21:08:55 +08:00
|
|
|
{
|
|
|
|
arch_local_irq_save();
|
2008-07-18 12:55:51 +08:00
|
|
|
}
|
|
|
|
|
2011-07-06 23:00:29 +08:00
|
|
|
static inline notrace bool arch_irqs_disabled_flags(unsigned long flags)
|
2010-10-07 21:08:55 +08:00
|
|
|
{
|
|
|
|
return (flags & PSR_PIL) != 0;
|
|
|
|
}
|
2008-07-18 12:55:51 +08:00
|
|
|
|
2011-07-06 23:00:29 +08:00
|
|
|
static inline notrace bool arch_irqs_disabled(void)
|
2008-07-18 12:55:51 +08:00
|
|
|
{
|
2010-10-07 21:08:55 +08:00
|
|
|
return arch_irqs_disabled_flags(arch_local_save_flags());
|
2008-07-18 12:55:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* (__ASSEMBLY__) */
|
|
|
|
|
|
|
|
#endif /* !(_ASM_IRQFLAGS_H) */
|