xref: /linux/arch/hexagon/include/asm/irqflags.h (revision 99a70aa051d2aef6a91761c2230264cfcf20ae74)
1*99a70aa0SRichard Kuo /*
2*99a70aa0SRichard Kuo  * IRQ support for the Hexagon architecture
3*99a70aa0SRichard Kuo  *
4*99a70aa0SRichard Kuo  * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
5*99a70aa0SRichard Kuo  *
6*99a70aa0SRichard Kuo  * This program is free software; you can redistribute it and/or modify
7*99a70aa0SRichard Kuo  * it under the terms of the GNU General Public License version 2 and
8*99a70aa0SRichard Kuo  * only version 2 as published by the Free Software Foundation.
9*99a70aa0SRichard Kuo  *
10*99a70aa0SRichard Kuo  * This program is distributed in the hope that it will be useful,
11*99a70aa0SRichard Kuo  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12*99a70aa0SRichard Kuo  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13*99a70aa0SRichard Kuo  * GNU General Public License for more details.
14*99a70aa0SRichard Kuo  *
15*99a70aa0SRichard Kuo  * You should have received a copy of the GNU General Public License
16*99a70aa0SRichard Kuo  * along with this program; if not, write to the Free Software
17*99a70aa0SRichard Kuo  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18*99a70aa0SRichard Kuo  * 02110-1301, USA.
19*99a70aa0SRichard Kuo  */
20*99a70aa0SRichard Kuo 
21*99a70aa0SRichard Kuo #ifndef _ASM_IRQFLAGS_H
22*99a70aa0SRichard Kuo #define _ASM_IRQFLAGS_H
23*99a70aa0SRichard Kuo 
24*99a70aa0SRichard Kuo #include <asm/hexagon_vm.h>
25*99a70aa0SRichard Kuo #include <linux/types.h>
26*99a70aa0SRichard Kuo 
27*99a70aa0SRichard Kuo static inline unsigned long arch_local_save_flags(void)
28*99a70aa0SRichard Kuo {
29*99a70aa0SRichard Kuo 	return __vmgetie();
30*99a70aa0SRichard Kuo }
31*99a70aa0SRichard Kuo 
32*99a70aa0SRichard Kuo static inline unsigned long arch_local_irq_save(void)
33*99a70aa0SRichard Kuo {
34*99a70aa0SRichard Kuo 	return __vmsetie(VM_INT_DISABLE);
35*99a70aa0SRichard Kuo }
36*99a70aa0SRichard Kuo 
37*99a70aa0SRichard Kuo static inline bool arch_irqs_disabled_flags(unsigned long flags)
38*99a70aa0SRichard Kuo {
39*99a70aa0SRichard Kuo 	return !flags;
40*99a70aa0SRichard Kuo }
41*99a70aa0SRichard Kuo 
42*99a70aa0SRichard Kuo static inline bool arch_irqs_disabled(void)
43*99a70aa0SRichard Kuo {
44*99a70aa0SRichard Kuo 	return !__vmgetie();
45*99a70aa0SRichard Kuo }
46*99a70aa0SRichard Kuo 
47*99a70aa0SRichard Kuo static inline void arch_local_irq_enable(void)
48*99a70aa0SRichard Kuo {
49*99a70aa0SRichard Kuo 	__vmsetie(VM_INT_ENABLE);
50*99a70aa0SRichard Kuo }
51*99a70aa0SRichard Kuo 
52*99a70aa0SRichard Kuo static inline void arch_local_irq_disable(void)
53*99a70aa0SRichard Kuo {
54*99a70aa0SRichard Kuo 	__vmsetie(VM_INT_DISABLE);
55*99a70aa0SRichard Kuo }
56*99a70aa0SRichard Kuo 
57*99a70aa0SRichard Kuo static inline void arch_local_irq_restore(unsigned long flags)
58*99a70aa0SRichard Kuo {
59*99a70aa0SRichard Kuo 	__vmsetie(flags);
60*99a70aa0SRichard Kuo }
61*99a70aa0SRichard Kuo 
62*99a70aa0SRichard Kuo #endif
63