blk: rq_data_dir() should not return a boolean
[cris-mirror.git] / arch / arc / include / asm / irqflags-arcv2.h
blobad481c24070dd1f369fefab436160f6d60f9dc2c
1 /*
2 * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com)
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
9 #ifndef __ASM_IRQFLAGS_ARCV2_H
10 #define __ASM_IRQFLAGS_ARCV2_H
12 #include <asm/arcregs.h>
14 /* status32 Bits */
15 #define STATUS_AD_BIT 19 /* Disable Align chk: core supports non-aligned */
16 #define STATUS_IE_BIT 31
18 #define STATUS_AD_MASK (1<<STATUS_AD_BIT)
19 #define STATUS_IE_MASK (1<<STATUS_IE_BIT)
21 #define AUX_USER_SP 0x00D
22 #define AUX_IRQ_CTRL 0x00E
23 #define AUX_IRQ_ACT 0x043 /* Active Intr across all levels */
24 #define AUX_IRQ_LVL_PEND 0x200 /* Pending Intr across all levels */
25 #define AUX_IRQ_PRIORITY 0x206
26 #define ICAUSE 0x40a
27 #define AUX_IRQ_SELECT 0x40b
28 #define AUX_IRQ_ENABLE 0x40c
30 /* Was Intr taken in User Mode */
31 #define AUX_IRQ_ACT_BIT_U 31
33 /* 0 is highest level, but taken by FIRQs, if present in design */
34 #define ARCV2_IRQ_DEF_PRIO 0
36 /* seed value for status register */
37 #define ISA_INIT_STATUS_BITS (STATUS_IE_MASK | STATUS_AD_MASK | \
38 (ARCV2_IRQ_DEF_PRIO << 1))
40 #ifndef __ASSEMBLY__
43 * Save IRQ state and disable IRQs
45 static inline long arch_local_irq_save(void)
47 unsigned long flags;
49 __asm__ __volatile__(" clri %0 \n" : "=r" (flags) : : "memory");
51 return flags;
55 * restore saved IRQ state
57 static inline void arch_local_irq_restore(unsigned long flags)
59 __asm__ __volatile__(" seti %0 \n" : : "r" (flags) : "memory");
63 * Unconditionally Enable IRQs
65 static inline void arch_local_irq_enable(void)
67 unsigned int irqact = read_aux_reg(AUX_IRQ_ACT);
69 if (irqact & 0xffff)
70 write_aux_reg(AUX_IRQ_ACT, irqact & ~0xffff);
72 __asm__ __volatile__(" seti \n" : : : "memory");
76 * Unconditionally Disable IRQs
78 static inline void arch_local_irq_disable(void)
80 __asm__ __volatile__(" clri \n" : : : "memory");
84 * save IRQ state
86 static inline long arch_local_save_flags(void)
88 unsigned long temp;
90 __asm__ __volatile__(
91 " lr %0, [status32] \n"
92 : "=&r"(temp)
94 : "memory");
96 return temp;
100 * Query IRQ state
102 static inline int arch_irqs_disabled_flags(unsigned long flags)
104 return !(flags & (STATUS_IE_MASK));
107 static inline int arch_irqs_disabled(void)
109 return arch_irqs_disabled_flags(arch_local_save_flags());
112 #else
114 .macro IRQ_DISABLE scratch
115 clri
116 .endm
118 .macro IRQ_ENABLE scratch
119 seti
120 .endm
122 #endif /* __ASSEMBLY__ */
124 #endif