~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/arc/include/asm/irqflags.h

Version: ~ [ linux-5.4-rc7 ] ~ [ linux-5.3.11 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.84 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.154 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.201 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.201 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.77 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
  3  *
  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  */
  8 
  9 #ifndef __ASM_ARC_IRQFLAGS_H
 10 #define __ASM_ARC_IRQFLAGS_H
 11 
 12 /* vineetg: March 2010 : local_irq_save( ) optimisation
 13  *  -Remove explicit mov of current status32 into reg, that is not needed
 14  *  -Use BIC  insn instead of INVERTED + AND
 15  *  -Conditionally disable interrupts (if they are not enabled, don't disable)
 16 */
 17 
 18 #ifdef __KERNEL__
 19 
 20 #include <asm/arcregs.h>
 21 
 22 #ifndef __ASSEMBLY__
 23 
 24 /******************************************************************
 25  * IRQ Control Macros
 26  ******************************************************************/
 27 
 28 /*
 29  * Save IRQ state and disable IRQs
 30  */
 31 static inline long arch_local_irq_save(void)
 32 {
 33         unsigned long temp, flags;
 34 
 35         __asm__ __volatile__(
 36         "       lr  %1, [status32]      \n"
 37         "       bic %0, %1, %2          \n"
 38         "       and.f 0, %1, %2 \n"
 39         "       flag.nz %0              \n"
 40         : "=r"(temp), "=r"(flags)
 41         : "n"((STATUS_E1_MASK | STATUS_E2_MASK))
 42         : "memory", "cc");
 43 
 44         return flags;
 45 }
 46 
 47 /*
 48  * restore saved IRQ state
 49  */
 50 static inline void arch_local_irq_restore(unsigned long flags)
 51 {
 52 
 53         __asm__ __volatile__(
 54         "       flag %0                 \n"
 55         :
 56         : "r"(flags)
 57         : "memory");
 58 }
 59 
 60 /*
 61  * Unconditionally Enable IRQs
 62  */
 63 extern void arch_local_irq_enable(void);
 64 
 65 /*
 66  * Unconditionally Disable IRQs
 67  */
 68 static inline void arch_local_irq_disable(void)
 69 {
 70         unsigned long temp;
 71 
 72         __asm__ __volatile__(
 73         "       lr  %0, [status32]      \n"
 74         "       and %0, %0, %1          \n"
 75         "       flag %0                 \n"
 76         : "=&r"(temp)
 77         : "n"(~(STATUS_E1_MASK | STATUS_E2_MASK))
 78         : "memory");
 79 }
 80 
 81 /*
 82  * save IRQ state
 83  */
 84 static inline long arch_local_save_flags(void)
 85 {
 86         unsigned long temp;
 87 
 88         __asm__ __volatile__(
 89         "       lr  %0, [status32]      \n"
 90         : "=&r"(temp)
 91         :
 92         : "memory");
 93 
 94         return temp;
 95 }
 96 
 97 /*
 98  * Query IRQ state
 99  */
100 static inline int arch_irqs_disabled_flags(unsigned long flags)
101 {
102         return !(flags & (STATUS_E1_MASK
103 #ifdef CONFIG_ARC_COMPACT_IRQ_LEVELS
104                         | STATUS_E2_MASK
105 #endif
106                 ));
107 }
108 
109 static inline int arch_irqs_disabled(void)
110 {
111         return arch_irqs_disabled_flags(arch_local_save_flags());
112 }
113 
114 static inline void arch_mask_irq(unsigned int irq)
115 {
116         unsigned int ienb;
117 
118         ienb = read_aux_reg(AUX_IENABLE);
119         ienb &= ~(1 << irq);
120         write_aux_reg(AUX_IENABLE, ienb);
121 }
122 
123 static inline void arch_unmask_irq(unsigned int irq)
124 {
125         unsigned int ienb;
126 
127         ienb = read_aux_reg(AUX_IENABLE);
128         ienb |= (1 << irq);
129         write_aux_reg(AUX_IENABLE, ienb);
130 }
131 
132 #else
133 
134 .macro IRQ_DISABLE  scratch
135         lr      \scratch, [status32]
136         bic     \scratch, \scratch, (STATUS_E1_MASK | STATUS_E2_MASK)
137         flag    \scratch
138 .endm
139 
140 .macro IRQ_ENABLE  scratch
141         lr      \scratch, [status32]
142         or      \scratch, \scratch, (STATUS_E1_MASK | STATUS_E2_MASK)
143         flag    \scratch
144 .endm
145 
146 #endif  /* __ASSEMBLY__ */
147 
148 #endif  /* KERNEL */
149 
150 #endif
151 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp