irqflags_32.h 1019 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. * arch_local_irq_*() functions from the lowlevel headers.
  9. */
  10. #ifndef _ASM_IRQFLAGS_H
  11. #define _ASM_IRQFLAGS_H
  12. #ifndef __ASSEMBLY__
  13. #include <linux/types.h>
  14. #include <asm/psr.h>
  15. void arch_local_irq_restore(unsigned long);
  16. unsigned long arch_local_irq_save(void);
  17. void arch_local_irq_enable(void);
  18. static inline notrace unsigned long arch_local_save_flags(void)
  19. {
  20. unsigned long flags;
  21. asm volatile("rd %%psr, %0" : "=r" (flags));
  22. return flags;
  23. }
  24. static inline notrace void arch_local_irq_disable(void)
  25. {
  26. arch_local_irq_save();
  27. }
  28. static inline notrace bool arch_irqs_disabled_flags(unsigned long flags)
  29. {
  30. return (flags & PSR_PIL) != 0;
  31. }
  32. static inline notrace bool arch_irqs_disabled(void)
  33. {
  34. return arch_irqs_disabled_flags(arch_local_save_flags());
  35. }
  36. #endif /* (__ASSEMBLY__) */
  37. #endif /* !(_ASM_IRQFLAGS_H) */