blob: 5f68ecfdf516bf85d2094396363849647dae9ebd [file] [log] [blame]
Ingo Molnarde30a2b2006-07-03 00:24:42 -07001/*
Ingo Molnarde30a2b2006-07-03 00:24:42 -07002 * IRQ flags handling
Ingo Molnarde30a2b2006-07-03 00:24:42 -07003 */
4#ifndef _ASM_IRQFLAGS_H
5#define _ASM_IRQFLAGS_H
6
Benjamin Herrenschmidt945feb12008-04-17 14:35:01 +10007#ifndef __ASSEMBLY__
Ingo Molnarde30a2b2006-07-03 00:24:42 -07008/*
9 * Get definitions for raw_local_save_flags(x), etc.
10 */
Stephen Rothwellb8b572e2008-08-01 15:20:30 +100011#include <asm/hw_irq.h>
Ingo Molnarde30a2b2006-07-03 00:24:42 -070012
Ingo Molnarde30a2b2006-07-03 00:24:42 -070013#else
Benjamin Herrenschmidt945feb12008-04-17 14:35:01 +100014#ifdef CONFIG_TRACE_IRQFLAGS
15/*
16 * Most of the CPU's IRQ-state tracing is done from assembly code; we
17 * have to call a C function so call a wrapper that saves all the
18 * C-clobbered registers.
19 */
20#define TRACE_ENABLE_INTS bl .trace_hardirqs_on
21#define TRACE_DISABLE_INTS bl .trace_hardirqs_off
22#define TRACE_AND_RESTORE_IRQ_PARTIAL(en,skip) \
Benjamin Herrenschmidt22b8f9e2008-08-15 17:11:31 +100023 cmpdi en,0; \
Benjamin Herrenschmidt945feb12008-04-17 14:35:01 +100024 bne 95f; \
25 stb en,PACASOFTIRQEN(r13); \
26 bl .trace_hardirqs_off; \
27 b skip; \
2895: bl .trace_hardirqs_on; \
29 li en,1;
30#define TRACE_AND_RESTORE_IRQ(en) \
31 TRACE_AND_RESTORE_IRQ_PARTIAL(en,96f); \
Benjamin Herrenschmidt22b8f9e2008-08-15 17:11:31 +100032 stb en,PACASOFTIRQEN(r13); \
3396:
Benjamin Herrenschmidt945feb12008-04-17 14:35:01 +100034#else
35#define TRACE_ENABLE_INTS
36#define TRACE_DISABLE_INTS
37#define TRACE_AND_RESTORE_IRQ_PARTIAL(en,skip)
38#define TRACE_AND_RESTORE_IRQ(en) \
39 stb en,PACASOFTIRQEN(r13)
40#endif
Ingo Molnarde30a2b2006-07-03 00:24:42 -070041#endif
42
43#endif