linux/arch/h8300/include/asm/irqflags.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 */
   2#ifndef _H8300_IRQFLAGS_H
   3#define _H8300_IRQFLAGS_H
   4
   5#ifdef CONFIG_CPU_H8300H
   6typedef unsigned char h8300flags;
   7
   8static inline h8300flags arch_local_save_flags(void)
   9{
  10        h8300flags flags;
  11
  12        __asm__ volatile ("stc ccr,%w0" : "=r" (flags));
  13        return flags;
  14}
  15
  16static inline void arch_local_irq_disable(void)
  17{
  18        __asm__ volatile ("orc  #0xc0,ccr");
  19}
  20
  21static inline void arch_local_irq_enable(void)
  22{
  23        __asm__ volatile ("andc #0x3f,ccr");
  24}
  25
  26static inline h8300flags arch_local_irq_save(void)
  27{
  28        h8300flags flags;
  29
  30        __asm__ volatile ("stc ccr,%w0\n\t"
  31                      "orc  #0xc0,ccr" : "=r" (flags));
  32        return flags;
  33}
  34
  35static inline void arch_local_irq_restore(h8300flags flags)
  36{
  37        __asm__ volatile ("ldc %w0,ccr" : : "r" (flags) : "cc");
  38}
  39
  40static inline int arch_irqs_disabled_flags(unsigned long flags)
  41{
  42        return (flags & 0xc0) == 0xc0;
  43}
  44#endif
  45#ifdef CONFIG_CPU_H8S
  46typedef unsigned short h8300flags;
  47
  48static inline h8300flags arch_local_save_flags(void)
  49{
  50        h8300flags flags;
  51
  52        __asm__ volatile ("stc ccr,%w0\n\tstc exr,%x0" : "=r" (flags));
  53        return flags;
  54}
  55
  56static inline void arch_local_irq_disable(void)
  57{
  58        __asm__ volatile ("orc #0x80,ccr\n\t");
  59}
  60
  61static inline void arch_local_irq_enable(void)
  62{
  63        __asm__ volatile ("andc #0x7f,ccr\n\t"
  64                      "andc #0xf0,exr\n\t");
  65}
  66
  67static inline h8300flags arch_local_irq_save(void)
  68{
  69        h8300flags flags;
  70
  71        __asm__ volatile ("stc ccr,%w0\n\t"
  72                      "stc exr,%x0\n\t"
  73                      "orc  #0x80,ccr\n\t"
  74                      : "=r" (flags));
  75        return flags;
  76}
  77
  78static inline void arch_local_irq_restore(h8300flags flags)
  79{
  80        __asm__ volatile ("ldc %w0,ccr\n\t"
  81                      "ldc %x0,exr"
  82                      : : "r" (flags) : "cc");
  83}
  84
  85static inline int arch_irqs_disabled_flags(h8300flags flags)
  86{
  87        return (flags & 0x0080) == 0x0080;
  88}
  89
  90#endif
  91
  92static inline int arch_irqs_disabled(void)
  93{
  94        return arch_irqs_disabled_flags(arch_local_save_flags());
  95}
  96
  97#endif /* _H8300_IRQFLAGS_H */
  98