Path: blob/master/arch/m32r/include/asm/irqflags.h
10818 views
/*1* This file is subject to the terms and conditions of the GNU General Public2* License. See the file "COPYING" in the main directory of this archive3* for more details.4*5* Copyright (C) 2001 Hiroyuki Kondo, Hirokazu Takata, and Hitoshi Yamamoto6* Copyright (C) 2004, 2006 Hirokazu Takata <takata at linux-m32r.org>7*/89#ifndef _ASM_M32R_IRQFLAGS_H10#define _ASM_M32R_IRQFLAGS_H1112#include <linux/types.h>1314static inline unsigned long arch_local_save_flags(void)15{16unsigned long flags;17asm volatile("mvfc %0,psw" : "=r"(flags));18return flags;19}2021static inline void arch_local_irq_disable(void)22{23#if !defined(CONFIG_CHIP_M32102) && !defined(CONFIG_CHIP_M32104)24asm volatile (25"clrpsw #0x40 -> nop"26: : : "memory");27#else28unsigned long tmpreg0, tmpreg1;29asm volatile (30"ld24 %0, #0 ; Use 32-bit insn. \n\t"31"mvfc %1, psw ; No interrupt can be accepted here. \n\t"32"mvtc %0, psw \n\t"33"and3 %0, %1, #0xffbf \n\t"34"mvtc %0, psw \n\t"35: "=&r" (tmpreg0), "=&r" (tmpreg1)36:37: "cbit", "memory");38#endif39}4041static inline void arch_local_irq_enable(void)42{43#if !defined(CONFIG_CHIP_M32102) && !defined(CONFIG_CHIP_M32104)44asm volatile (45"setpsw #0x40 -> nop"46: : : "memory");47#else48unsigned long tmpreg;49asm volatile (50"mvfc %0, psw; \n\t"51"or3 %0, %0, #0x0040; \n\t"52"mvtc %0, psw; \n\t"53: "=&r" (tmpreg)54:55: "cbit", "memory");56#endif57}5859static inline unsigned long arch_local_irq_save(void)60{61unsigned long flags;6263#if !(defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_M32104))64asm volatile (65"mvfc %0, psw; \n\t"66"clrpsw #0x40 -> nop; \n\t"67: "=r" (flags)68:69: "memory");70#else71unsigned long tmpreg;72asm volatile (73"ld24 %1, #0 \n\t"74"mvfc %0, psw \n\t"75"mvtc %1, psw \n\t"76"and3 %1, %0, #0xffbf \n\t"77"mvtc %1, psw \n\t"78: "=r" (flags), "=&r" (tmpreg)79:80: "cbit", "memory");81#endif82return flags;83}8485static inline void arch_local_irq_restore(unsigned long flags)86{87asm volatile("mvtc %0,psw"88:89: "r" (flags)90: "cbit", "memory");91}9293static inline bool arch_irqs_disabled_flags(unsigned long flags)94{95return !(flags & 0x40);96}9798static inline bool arch_irqs_disabled(void)99{100return arch_irqs_disabled_flags(arch_local_save_flags());101}102103#endif /* _ASM_M32R_IRQFLAGS_H */104105106