1b8b572e1SStephen Rothwell /*
2b8b572e1SStephen Rothwell  * IRQ flags handling
3b8b572e1SStephen Rothwell  */
4b8b572e1SStephen Rothwell #ifndef _ASM_IRQFLAGS_H
5b8b572e1SStephen Rothwell #define _ASM_IRQFLAGS_H
6b8b572e1SStephen Rothwell 
7b8b572e1SStephen Rothwell #ifndef __ASSEMBLY__
8b8b572e1SStephen Rothwell /*
9b8b572e1SStephen Rothwell  * Get definitions for raw_local_save_flags(x), etc.
10b8b572e1SStephen Rothwell  */
11b8b572e1SStephen Rothwell #include <asm/hw_irq.h>
12b8b572e1SStephen Rothwell 
13b8b572e1SStephen Rothwell #else
14b8b572e1SStephen Rothwell #ifdef CONFIG_TRACE_IRQFLAGS
15b8b572e1SStephen Rothwell /*
16b8b572e1SStephen Rothwell  * Most of the CPU's IRQ-state tracing is done from assembly code; we
17b8b572e1SStephen Rothwell  * have to call a C function so call a wrapper that saves all the
18b8b572e1SStephen Rothwell  * C-clobbered registers.
19b8b572e1SStephen Rothwell  */
20b8b572e1SStephen Rothwell #define TRACE_ENABLE_INTS	bl .trace_hardirqs_on
21b8b572e1SStephen Rothwell #define TRACE_DISABLE_INTS	bl .trace_hardirqs_off
22b8b572e1SStephen Rothwell #define TRACE_AND_RESTORE_IRQ_PARTIAL(en,skip)	\
23b8b572e1SStephen Rothwell 	cmpdi	en, 0;				\
24b8b572e1SStephen Rothwell 	bne	95f;				\
25b8b572e1SStephen Rothwell 	stb	en,PACASOFTIRQEN(r13);		\
26b8b572e1SStephen Rothwell 	bl	.trace_hardirqs_off;		\
27b8b572e1SStephen Rothwell 	b	skip;				\
28b8b572e1SStephen Rothwell 95:	bl	.trace_hardirqs_on;		\
29b8b572e1SStephen Rothwell 	li	en,1;
30b8b572e1SStephen Rothwell #define TRACE_AND_RESTORE_IRQ(en)		\
31b8b572e1SStephen Rothwell 	TRACE_AND_RESTORE_IRQ_PARTIAL(en,96f);	\
32b8b572e1SStephen Rothwell 96:	stb	en,PACASOFTIRQEN(r13)
33b8b572e1SStephen Rothwell #else
34b8b572e1SStephen Rothwell #define TRACE_ENABLE_INTS
35b8b572e1SStephen Rothwell #define TRACE_DISABLE_INTS
36b8b572e1SStephen Rothwell #define TRACE_AND_RESTORE_IRQ_PARTIAL(en,skip)
37b8b572e1SStephen Rothwell #define TRACE_AND_RESTORE_IRQ(en)		\
38b8b572e1SStephen Rothwell 	stb	en,PACASOFTIRQEN(r13)
39b8b572e1SStephen Rothwell #endif
40b8b572e1SStephen Rothwell #endif
41b8b572e1SStephen Rothwell 
42b8b572e1SStephen Rothwell #endif
43