1e38a5272SGuo Ren /* SPDX-License-Identifier: GPL-2.0 */ 2e38a5272SGuo Ren 3e38a5272SGuo Ren #ifndef __ASM_CSKY_IRQFLAGS_H 4e38a5272SGuo Ren #define __ASM_CSKY_IRQFLAGS_H 5e38a5272SGuo Ren #include <abi/reg_ops.h> 6e38a5272SGuo Ren arch_local_irq_save(void)7e38a5272SGuo Renstatic inline unsigned long arch_local_irq_save(void) 8e38a5272SGuo Ren { 9e38a5272SGuo Ren unsigned long flags; 10e38a5272SGuo Ren 11e38a5272SGuo Ren flags = mfcr("psr"); 12e38a5272SGuo Ren asm volatile("psrclr ie\n":::"memory"); 13e38a5272SGuo Ren return flags; 14e38a5272SGuo Ren } 15e38a5272SGuo Ren #define arch_local_irq_save arch_local_irq_save 16e38a5272SGuo Ren arch_local_irq_enable(void)17e38a5272SGuo Renstatic inline void arch_local_irq_enable(void) 18e38a5272SGuo Ren { 19e38a5272SGuo Ren asm volatile("psrset ee, ie\n":::"memory"); 20e38a5272SGuo Ren } 21e38a5272SGuo Ren #define arch_local_irq_enable arch_local_irq_enable 22e38a5272SGuo Ren arch_local_irq_disable(void)23e38a5272SGuo Renstatic inline void arch_local_irq_disable(void) 24e38a5272SGuo Ren { 25e38a5272SGuo Ren asm volatile("psrclr ie\n":::"memory"); 26e38a5272SGuo Ren } 27e38a5272SGuo Ren #define arch_local_irq_disable arch_local_irq_disable 28e38a5272SGuo Ren arch_local_save_flags(void)29e38a5272SGuo Renstatic inline unsigned long arch_local_save_flags(void) 30e38a5272SGuo Ren { 31e38a5272SGuo Ren return mfcr("psr"); 32e38a5272SGuo Ren } 33e38a5272SGuo Ren #define arch_local_save_flags arch_local_save_flags 34e38a5272SGuo Ren arch_local_irq_restore(unsigned long flags)35e38a5272SGuo Renstatic inline void arch_local_irq_restore(unsigned long flags) 36e38a5272SGuo Ren { 37e38a5272SGuo Ren mtcr("psr", flags); 38e38a5272SGuo Ren } 39e38a5272SGuo Ren #define arch_local_irq_restore arch_local_irq_restore 40e38a5272SGuo Ren arch_irqs_disabled_flags(unsigned long flags)41e38a5272SGuo Renstatic inline int arch_irqs_disabled_flags(unsigned long flags) 42e38a5272SGuo Ren { 43e38a5272SGuo Ren return !(flags & (1<<6)); 44e38a5272SGuo Ren } 45e38a5272SGuo Ren #define arch_irqs_disabled_flags arch_irqs_disabled_flags 46e38a5272SGuo Ren 47e38a5272SGuo Ren #include <asm-generic/irqflags.h> 48e38a5272SGuo Ren 49e38a5272SGuo Ren #endif /* __ASM_CSKY_IRQFLAGS_H */ 50