irqflags.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __PARISC_IRQFLAGS_H
  3. #define __PARISC_IRQFLAGS_H
  4. #include <linux/types.h>
  5. #include <asm/psw.h>
  6. static inline unsigned long arch_local_save_flags(void)
  7. {
  8. unsigned long flags;
  9. asm volatile("ssm 0, %0" : "=r" (flags) : : "memory");
  10. return flags;
  11. }
  12. static inline void arch_local_irq_disable(void)
  13. {
  14. asm volatile("rsm %0,%%r0\n" : : "i" (PSW_I) : "memory");
  15. }
  16. static inline void arch_local_irq_enable(void)
  17. {
  18. asm volatile("ssm %0,%%r0\n" : : "i" (PSW_I) : "memory");
  19. }
  20. static inline unsigned long arch_local_irq_save(void)
  21. {
  22. unsigned long flags;
  23. asm volatile("rsm %1,%0" : "=r" (flags) : "i" (PSW_I) : "memory");
  24. return flags;
  25. }
  26. static inline void arch_local_irq_restore(unsigned long flags)
  27. {
  28. asm volatile("mtsm %0" : : "r" (flags) : "memory");
  29. }
  30. static inline bool arch_irqs_disabled_flags(unsigned long flags)
  31. {
  32. return (flags & PSW_I) == 0;
  33. }
  34. static inline bool arch_irqs_disabled(void)
  35. {
  36. return arch_irqs_disabled_flags(arch_local_save_flags());
  37. }
  38. #endif /* __PARISC_IRQFLAGS_H */