irqflags.h 1.1 KB

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