irqflags_32.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * include/asm/irqflags.h
  3. *
  4. * IRQ flags handling
  5. *
  6. * This file gets included from lowlevel asm headers too, to provide
  7. * wrapped versions of the local_irq_*() APIs, based on the
  8. * raw_local_irq_*() functions from the lowlevel headers.
  9. */
  10. #ifndef _ASM_IRQFLAGS_H
  11. #define _ASM_IRQFLAGS_H
  12. #ifndef __ASSEMBLY__
  13. extern void raw_local_irq_restore(unsigned long);
  14. extern unsigned long __raw_local_irq_save(void);
  15. extern void raw_local_irq_enable(void);
  16. static inline unsigned long getipl(void)
  17. {
  18. unsigned long retval;
  19. __asm__ __volatile__("rd %%psr, %0" : "=r" (retval));
  20. return retval;
  21. }
  22. #define raw_local_save_flags(flags) ((flags) = getipl())
  23. #define raw_local_irq_save(flags) ((flags) = __raw_local_irq_save())
  24. #define raw_local_irq_disable() ((void) __raw_local_irq_save())
  25. #define raw_irqs_disabled() ((getipl() & PSR_PIL) != 0)
  26. static inline int raw_irqs_disabled_flags(unsigned long flags)
  27. {
  28. return ((flags & PSR_PIL) != 0);
  29. }
  30. #endif /* (__ASSEMBLY__) */
  31. #endif /* !(_ASM_IRQFLAGS_H) */