2009-03-27 07:25:35 -06:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2006 Atmark Techno, Inc.
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
|
|
* for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _ASM_MICROBLAZE_IRQFLAGS_H
|
|
|
|
#define _ASM_MICROBLAZE_IRQFLAGS_H
|
|
|
|
|
|
|
|
#include <linux/irqflags.h>
|
2009-10-30 05:26:53 -06:00
|
|
|
#include <asm/registers.h>
|
2009-03-27 07:25:35 -06:00
|
|
|
|
|
|
|
# if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
|
|
|
|
|
2009-10-30 05:26:53 -06:00
|
|
|
# define raw_local_irq_save(flags) \
|
2009-03-27 07:25:35 -06:00
|
|
|
do { \
|
2009-10-30 05:26:53 -06:00
|
|
|
asm volatile (" msrclr %0, %1; \
|
|
|
|
nop;" \
|
2009-03-27 07:25:35 -06:00
|
|
|
: "=r"(flags) \
|
|
|
|
: "i"(MSR_IE) \
|
|
|
|
: "memory"); \
|
|
|
|
} while (0)
|
|
|
|
|
2009-10-30 05:26:53 -06:00
|
|
|
# define raw_local_irq_disable() \
|
|
|
|
do { \
|
|
|
|
asm volatile (" msrclr r0, %0; \
|
|
|
|
nop;" \
|
|
|
|
: \
|
|
|
|
: "i"(MSR_IE) \
|
|
|
|
: "memory"); \
|
2009-03-27 07:25:35 -06:00
|
|
|
} while (0)
|
|
|
|
|
2009-10-30 05:26:53 -06:00
|
|
|
# define raw_local_irq_enable() \
|
|
|
|
do { \
|
|
|
|
asm volatile (" msrset r0, %0; \
|
|
|
|
nop;" \
|
|
|
|
: \
|
|
|
|
: "i"(MSR_IE) \
|
|
|
|
: "memory"); \
|
2009-03-27 07:25:35 -06:00
|
|
|
} while (0)
|
|
|
|
|
|
|
|
# else /* CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR == 0 */
|
|
|
|
|
2009-10-30 05:26:53 -06:00
|
|
|
# define raw_local_irq_save(flags) \
|
2009-03-27 07:25:35 -06:00
|
|
|
do { \
|
|
|
|
register unsigned tmp; \
|
2009-10-30 05:26:53 -06:00
|
|
|
asm volatile (" mfs %0, rmsr; \
|
|
|
|
nop; \
|
|
|
|
andi %1, %0, %2; \
|
|
|
|
mts rmsr, %1; \
|
|
|
|
nop;" \
|
2009-03-27 07:25:35 -06:00
|
|
|
: "=r"(flags), "=r" (tmp) \
|
|
|
|
: "i"(~MSR_IE) \
|
|
|
|
: "memory"); \
|
|
|
|
} while (0)
|
|
|
|
|
2009-10-30 05:26:53 -06:00
|
|
|
# define raw_local_irq_disable() \
|
2009-03-27 07:25:35 -06:00
|
|
|
do { \
|
|
|
|
register unsigned tmp; \
|
2009-10-30 05:26:53 -06:00
|
|
|
asm volatile (" mfs %0, rmsr; \
|
|
|
|
nop; \
|
|
|
|
andi %0, %0, %1; \
|
|
|
|
mts rmsr, %0; \
|
|
|
|
nop;" \
|
2009-03-27 07:25:35 -06:00
|
|
|
: "=r"(tmp) \
|
|
|
|
: "i"(~MSR_IE) \
|
|
|
|
: "memory"); \
|
|
|
|
} while (0)
|
|
|
|
|
2009-10-30 05:26:53 -06:00
|
|
|
# define raw_local_irq_enable() \
|
2009-03-27 07:25:35 -06:00
|
|
|
do { \
|
|
|
|
register unsigned tmp; \
|
2009-10-30 05:26:53 -06:00
|
|
|
asm volatile (" mfs %0, rmsr; \
|
|
|
|
nop; \
|
|
|
|
ori %0, %0, %1; \
|
|
|
|
mts rmsr, %0; \
|
|
|
|
nop;" \
|
2009-03-27 07:25:35 -06:00
|
|
|
: "=r"(tmp) \
|
|
|
|
: "i"(MSR_IE) \
|
|
|
|
: "memory"); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
# endif /* CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */
|
|
|
|
|
2009-10-30 05:26:53 -06:00
|
|
|
#define raw_local_irq_restore(flags) \
|
2009-03-27 07:25:35 -06:00
|
|
|
do { \
|
2009-10-30 05:26:53 -06:00
|
|
|
asm volatile (" mts rmsr, %0; \
|
|
|
|
nop;" \
|
2009-03-27 07:25:35 -06:00
|
|
|
: \
|
2009-10-30 05:26:53 -06:00
|
|
|
: "r"(flags) \
|
2009-03-27 07:25:35 -06:00
|
|
|
: "memory"); \
|
|
|
|
} while (0)
|
|
|
|
|
2009-10-30 05:26:53 -06:00
|
|
|
static inline unsigned long get_msr(void)
|
2009-03-27 07:25:35 -06:00
|
|
|
{
|
|
|
|
unsigned long flags;
|
2009-10-30 05:26:53 -06:00
|
|
|
asm volatile (" mfs %0, rmsr; \
|
|
|
|
nop;" \
|
|
|
|
: "=r"(flags) \
|
|
|
|
: \
|
|
|
|
: "memory"); \
|
|
|
|
return flags;
|
2009-03-27 07:25:35 -06:00
|
|
|
}
|
|
|
|
|
2009-10-30 05:26:53 -06:00
|
|
|
#define raw_local_save_flags(flags) ((flags) = get_msr())
|
|
|
|
#define raw_irqs_disabled() ((get_msr() & MSR_IE) == 0)
|
|
|
|
#define raw_irqs_disabled_flags(flags) ((flags & MSR_IE) == 0)
|
2009-03-27 07:25:35 -06:00
|
|
|
|
|
|
|
#endif /* _ASM_MICROBLAZE_IRQFLAGS_H */
|