Path: blob/master/arch/microblaze/include/asm/irqflags.h
15126 views
/*1* Copyright (C) 2006 Atmark Techno, Inc.2*3* This file is subject to the terms and conditions of the GNU General Public4* License. See the file "COPYING" in the main directory of this archive5* for more details.6*/78#ifndef _ASM_MICROBLAZE_IRQFLAGS_H9#define _ASM_MICROBLAZE_IRQFLAGS_H1011#include <linux/types.h>12#include <asm/registers.h>1314#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR1516static inline unsigned long arch_local_irq_save(void)17{18unsigned long flags;19asm volatile(" msrclr %0, %1 \n"20" nop \n"21: "=r"(flags)22: "i"(MSR_IE)23: "memory");24return flags;25}2627static inline void arch_local_irq_disable(void)28{29/* this uses r0 without declaring it - is that correct? */30asm volatile(" msrclr r0, %0 \n"31" nop \n"32:33: "i"(MSR_IE)34: "memory");35}3637static inline void arch_local_irq_enable(void)38{39/* this uses r0 without declaring it - is that correct? */40asm volatile(" msrset r0, %0 \n"41" nop \n"42:43: "i"(MSR_IE)44: "memory");45}4647#else /* !CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */4849static inline unsigned long arch_local_irq_save(void)50{51unsigned long flags, tmp;52asm volatile (" mfs %0, rmsr \n"53" nop \n"54" andi %1, %0, %2 \n"55" mts rmsr, %1 \n"56" nop \n"57: "=r"(flags), "=r"(tmp)58: "i"(~MSR_IE)59: "memory");60return flags;61}6263static inline void arch_local_irq_disable(void)64{65unsigned long tmp;66asm volatile(" mfs %0, rmsr \n"67" nop \n"68" andi %0, %0, %1 \n"69" mts rmsr, %0 \n"70" nop \n"71: "=r"(tmp)72: "i"(~MSR_IE)73: "memory");74}7576static inline void arch_local_irq_enable(void)77{78unsigned long tmp;79asm volatile(" mfs %0, rmsr \n"80" nop \n"81" ori %0, %0, %1 \n"82" mts rmsr, %0 \n"83" nop \n"84: "=r"(tmp)85: "i"(MSR_IE)86: "memory");87}8889#endif /* CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */9091static inline unsigned long arch_local_save_flags(void)92{93unsigned long flags;94asm volatile(" mfs %0, rmsr \n"95" nop \n"96: "=r"(flags)97:98: "memory");99return flags;100}101102static inline void arch_local_irq_restore(unsigned long flags)103{104asm volatile(" mts rmsr, %0 \n"105" nop \n"106:107: "r"(flags)108: "memory");109}110111static inline bool arch_irqs_disabled_flags(unsigned long flags)112{113return (flags & MSR_IE) == 0;114}115116static inline bool arch_irqs_disabled(void)117{118return arch_irqs_disabled_flags(arch_local_save_flags());119}120121#endif /* _ASM_MICROBLAZE_IRQFLAGS_H */122123124