irqflags.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ALPHA_IRQFLAGS_H
  3. #define __ALPHA_IRQFLAGS_H
  4. #include <asm/pal.h>
  5. #define IPL_MIN 0
  6. #define IPL_SW0 1
  7. #define IPL_SW1 2
  8. #define IPL_DEV0 3
  9. #define IPL_DEV1 4
  10. #define IPL_TIMER 5
  11. #define IPL_PERF 6
  12. #define IPL_POWERFAIL 6
  13. #define IPL_MCHECK 7
  14. #define IPL_MAX 7
  15. #ifdef CONFIG_ALPHA_BROKEN_IRQ_MASK
  16. #undef IPL_MIN
  17. #define IPL_MIN __min_ipl
  18. extern int __min_ipl;
  19. #endif
  20. #define getipl() (rdps() & 7)
  21. #define setipl(ipl) ((void) swpipl(ipl))
  22. static inline unsigned long arch_local_save_flags(void)
  23. {
  24. return rdps();
  25. }
  26. static inline void arch_local_irq_disable(void)
  27. {
  28. setipl(IPL_MAX);
  29. barrier();
  30. }
  31. static inline unsigned long arch_local_irq_save(void)
  32. {
  33. unsigned long flags = swpipl(IPL_MAX);
  34. barrier();
  35. return flags;
  36. }
  37. static inline void arch_local_irq_enable(void)
  38. {
  39. barrier();
  40. setipl(IPL_MIN);
  41. }
  42. static inline void arch_local_irq_restore(unsigned long flags)
  43. {
  44. barrier();
  45. setipl(flags);
  46. barrier();
  47. }
  48. static inline bool arch_irqs_disabled_flags(unsigned long flags)
  49. {
  50. return flags == IPL_MAX;
  51. }
  52. static inline bool arch_irqs_disabled(void)
  53. {
  54. return arch_irqs_disabled_flags(getipl());
  55. }
  56. #endif /* __ALPHA_IRQFLAGS_H */