irqflags.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #ifndef _M68K_IRQFLAGS_H
  2. #define _M68K_IRQFLAGS_H
  3. #include <linux/types.h>
  4. #ifdef CONFIG_MMU
  5. #include <linux/preempt_mask.h>
  6. #endif
  7. #include <linux/preempt.h>
  8. #include <asm/thread_info.h>
  9. #include <asm/entry.h>
  10. static inline unsigned long arch_local_save_flags(void)
  11. {
  12. unsigned long flags;
  13. asm volatile ("movew %%sr,%0" : "=d" (flags) : : "memory");
  14. return flags;
  15. }
  16. static inline void arch_local_irq_disable(void)
  17. {
  18. #ifdef CONFIG_COLDFIRE
  19. asm volatile (
  20. "move %/sr,%%d0 \n\t"
  21. "ori.l #0x0700,%%d0 \n\t"
  22. "move %%d0,%/sr \n"
  23. : /* no outputs */
  24. :
  25. : "cc", "%d0", "memory");
  26. #else
  27. asm volatile ("oriw #0x0700,%%sr" : : : "memory");
  28. #endif
  29. }
  30. static inline void arch_local_irq_enable(void)
  31. {
  32. #if defined(CONFIG_COLDFIRE)
  33. asm volatile (
  34. "move %/sr,%%d0 \n\t"
  35. "andi.l #0xf8ff,%%d0 \n\t"
  36. "move %%d0,%/sr \n"
  37. : /* no outputs */
  38. :
  39. : "cc", "%d0", "memory");
  40. #else
  41. # if defined(CONFIG_MMU)
  42. if (MACH_IS_Q40 || !hardirq_count())
  43. # endif
  44. asm volatile (
  45. "andiw %0,%%sr"
  46. :
  47. : "i" (ALLOWINT)
  48. : "memory");
  49. #endif
  50. }
  51. static inline unsigned long arch_local_irq_save(void)
  52. {
  53. unsigned long flags = arch_local_save_flags();
  54. arch_local_irq_disable();
  55. return flags;
  56. }
  57. static inline void arch_local_irq_restore(unsigned long flags)
  58. {
  59. asm volatile ("movew %0,%%sr" : : "d" (flags) : "memory");
  60. }
  61. static inline bool arch_irqs_disabled_flags(unsigned long flags)
  62. {
  63. if (MACH_IS_ATARI) {
  64. /* Ignore HSYNC = ipl 2 on Atari */
  65. return (flags & ~(ALLOWINT | 0x200)) != 0;
  66. }
  67. return (flags & ~ALLOWINT) != 0;
  68. }
  69. static inline bool arch_irqs_disabled(void)
  70. {
  71. return arch_irqs_disabled_flags(arch_local_save_flags());
  72. }
  73. #endif /* _M68K_IRQFLAGS_H */