| 
									
										
										
										
											2008-07-17 21:55:51 -07:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2008-07-27 23:00:59 +02:00
										 |  |  |  * include/asm/irqflags.h | 
					
						
							| 
									
										
										
										
											2008-07-17 21:55:51 -07:00
										 |  |  |  * | 
					
						
							|  |  |  |  * IRQ flags handling | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This file gets included from lowlevel asm headers too, to provide | 
					
						
							|  |  |  |  * wrapped versions of the local_irq_*() APIs, based on the | 
					
						
							| 
									
										
										
										
											2010-10-07 14:08:55 +01:00
										 |  |  |  * arch_local_irq_*() functions from the lowlevel headers. | 
					
						
							| 
									
										
										
										
											2008-07-17 21:55:51 -07:00
										 |  |  |  */ | 
					
						
							|  |  |  | #ifndef _ASM_IRQFLAGS_H
 | 
					
						
							|  |  |  | #define _ASM_IRQFLAGS_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef __ASSEMBLY__
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-07 14:08:55 +01:00
										 |  |  | #include <linux/types.h>
 | 
					
						
							| 
									
										
										
										
											2012-03-28 18:30:03 +01:00
										 |  |  | #include <asm/psr.h>
 | 
					
						
							| 
									
										
										
										
											2008-07-17 21:55:51 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-07 14:08:55 +01:00
										 |  |  | extern void arch_local_irq_restore(unsigned long); | 
					
						
							|  |  |  | extern unsigned long arch_local_irq_save(void); | 
					
						
							|  |  |  | extern void arch_local_irq_enable(void); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-06 08:00:29 -07:00
										 |  |  | static inline notrace unsigned long arch_local_save_flags(void) | 
					
						
							| 
									
										
										
										
											2008-07-17 21:55:51 -07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-10-07 14:08:55 +01:00
										 |  |  | 	unsigned long flags; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	asm volatile("rd        %%psr, %0" : "=r" (flags)); | 
					
						
							|  |  |  | 	return flags; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2008-07-17 21:55:51 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-06 08:00:29 -07:00
										 |  |  | static inline notrace void arch_local_irq_disable(void) | 
					
						
							| 
									
										
										
										
											2010-10-07 14:08:55 +01:00
										 |  |  | { | 
					
						
							|  |  |  | 	arch_local_irq_save(); | 
					
						
							| 
									
										
										
										
											2008-07-17 21:55:51 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-06 08:00:29 -07:00
										 |  |  | static inline notrace bool arch_irqs_disabled_flags(unsigned long flags) | 
					
						
							| 
									
										
										
										
											2010-10-07 14:08:55 +01:00
										 |  |  | { | 
					
						
							|  |  |  | 	return (flags & PSR_PIL) != 0; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2008-07-17 21:55:51 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-06 08:00:29 -07:00
										 |  |  | static inline notrace bool arch_irqs_disabled(void) | 
					
						
							| 
									
										
										
										
											2008-07-17 21:55:51 -07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-10-07 14:08:55 +01:00
										 |  |  | 	return arch_irqs_disabled_flags(arch_local_save_flags()); | 
					
						
							| 
									
										
										
										
											2008-07-17 21:55:51 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif /* (__ASSEMBLY__) */
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif /* !(_ASM_IRQFLAGS_H) */
 |