1
2
3
4
5
6
7
8#include <linux/threads.h>
9#include <asm/reg.h>
10#include <asm/ppc_asm.h>
11#include <asm/asm-offsets.h>
12#include <asm/ppc-opcode.h>
13#include <asm/processor.h>
14#include <asm/thread_info.h>
15#include <asm/epapr_hcalls.h>
16#include <asm/hw_irq.h>
17
18
19#ifdef CONFIG_PPC64
20
21.macro BOOK3E_IDLE name loop
22_GLOBAL(\name)
23
24 mflr r0
25 std r0,16(r1)
26
27
28 wrteei 0
29
30
31
32
33 lbz r3,PACAIRQHAPPENED(r13)
34 cmpwi cr0,r3,0
35 bne 2f
36
37
38
39
40
41#ifdef CONFIG_TRACE_IRQFLAGS
42 stdu r1,-128(r1)
43 bl trace_hardirqs_on
44 addi r1,r1,128
45#endif
46 li r0,IRQS_ENABLED
47 stb r0,PACAIRQSOFTMASK(r13)
48
49
50
51
52 bl 1f
53
54
55 ld r0,16(r1)
56 mtlr r0
57 blr
58
591:
60
61
62 ld r11, PACACURRENT(r13)
63 ld r10,TI_LOCAL_FLAGS(r11)
64 ori r10,r10,_TLF_NAPPING
65 std r10,TI_LOCAL_FLAGS(r11)
66
67
68 wrteei 1
69 \loop
70
712:
72 lbz r10,PACAIRQHAPPENED(r13)
73 ori r10,r10,PACA_IRQ_HARD_DIS
74 stb r10,PACAIRQHAPPENED(r13)
75 blr
76.endm
77
78.macro BOOK3E_IDLE_LOOP
791:
80 PPC_WAIT(0)
81 b 1b
82.endm
83
84
85
86.macro EPAPR_EV_IDLE_LOOP
87idle_loop:
88 LOAD_REG_IMMEDIATE(r11, EV_HCALL_TOKEN(EV_IDLE))
89
90.global epapr_ev_idle_start
91epapr_ev_idle_start:
92 li r3, -1
93 nop
94 nop
95 nop
96 b idle_loop
97.endm
98
99BOOK3E_IDLE epapr_ev_idle EPAPR_EV_IDLE_LOOP
100
101BOOK3E_IDLE book3e_idle BOOK3E_IDLE_LOOP
102
103#endif
104