Commit | Line | Data |
---|---|---|
de30a2b3 | 1 | /* |
de30a2b3 | 2 | * IRQ flags handling |
de30a2b3 IM |
3 | */ |
4 | #ifndef _ASM_IRQFLAGS_H | |
5 | #define _ASM_IRQFLAGS_H | |
6 | ||
945feb17 | 7 | #ifndef __ASSEMBLY__ |
de30a2b3 | 8 | /* |
df9ee292 | 9 | * Get definitions for arch_local_save_flags(x), etc. |
de30a2b3 | 10 | */ |
b8b572e1 | 11 | #include <asm/hw_irq.h> |
de30a2b3 | 12 | |
945feb17 BH |
13 | #else |
14 | #ifdef CONFIG_TRACE_IRQFLAGS | |
3cb5f1a3 SR |
15 | #ifdef CONFIG_IRQSOFF_TRACER |
16 | /* | |
17 | * Since the ftrace irqsoff latency trace checks CALLER_ADDR1, | |
18 | * which is the stack frame here, we need to force a stack frame | |
19 | * in case we came from user space. | |
20 | */ | |
21 | #define TRACE_WITH_FRAME_BUFFER(func) \ | |
22 | mflr r0; \ | |
d51959d7 | 23 | stdu r1, -STACK_FRAME_OVERHEAD(r1); \ |
3cb5f1a3 | 24 | std r0, 16(r1); \ |
d51959d7 | 25 | stdu r1, -STACK_FRAME_OVERHEAD(r1); \ |
3cb5f1a3 SR |
26 | bl func; \ |
27 | ld r1, 0(r1); \ | |
28 | ld r1, 0(r1); | |
29 | #else | |
30 | #define TRACE_WITH_FRAME_BUFFER(func) \ | |
31 | bl func; | |
32 | #endif | |
33 | ||
de30a2b3 | 34 | /* |
144beb2f ME |
35 | * These are calls to C code, so the caller must be prepared for volatiles to |
36 | * be clobbered. | |
de30a2b3 | 37 | */ |
b1576fec AB |
38 | #define TRACE_ENABLE_INTS TRACE_WITH_FRAME_BUFFER(trace_hardirqs_on) |
39 | #define TRACE_DISABLE_INTS TRACE_WITH_FRAME_BUFFER(trace_hardirqs_off) | |
3cb5f1a3 | 40 | |
7230c564 | 41 | /* |
de021bb7 TC |
42 | * This is used by assembly code to soft-disable interrupts first and |
43 | * reconcile irq state. | |
144beb2f ME |
44 | * |
45 | * NB: This may call C code, so the caller must be prepared for volatiles to | |
46 | * be clobbered. | |
7230c564 | 47 | */ |
de021bb7 | 48 | #define RECONCILE_IRQ_STATE(__rA, __rB) \ |
7230c564 BH |
49 | lbz __rA,PACASOFTIRQEN(r13); \ |
50 | lbz __rB,PACAIRQHAPPENED(r13); \ | |
51 | cmpwi cr0,__rA,0; \ | |
52 | li __rA,0; \ | |
53 | ori __rB,__rB,PACA_IRQ_HARD_DIS; \ | |
54 | stb __rB,PACAIRQHAPPENED(r13); \ | |
55 | beq 44f; \ | |
56 | stb __rA,PACASOFTIRQEN(r13); \ | |
57 | TRACE_DISABLE_INTS; \ | |
58 | 44: | |
59 | ||
de30a2b3 | 60 | #else |
945feb17 BH |
61 | #define TRACE_ENABLE_INTS |
62 | #define TRACE_DISABLE_INTS | |
7230c564 | 63 | |
de021bb7 | 64 | #define RECONCILE_IRQ_STATE(__rA, __rB) \ |
7230c564 BH |
65 | lbz __rA,PACAIRQHAPPENED(r13); \ |
66 | li __rB,0; \ | |
67 | ori __rA,__rA,PACA_IRQ_HARD_DIS; \ | |
68 | stb __rB,PACASOFTIRQEN(r13); \ | |
69 | stb __rA,PACAIRQHAPPENED(r13) | |
945feb17 | 70 | #endif |
de30a2b3 IM |
71 | #endif |
72 | ||
73 | #endif |