0001
0002
0003
0004
0005
0006
0007
0008 #include <linux/threads.h>
0009 #include <asm/reg.h>
0010 #include <asm/ppc_asm.h>
0011 #include <asm/asm-offsets.h>
0012 #include <asm/ppc-opcode.h>
0013 #include <asm/processor.h>
0014 #include <asm/thread_info.h>
0015 #include <asm/epapr_hcalls.h>
0016 #include <asm/hw_irq.h>
0017
0018
0019 #ifdef CONFIG_PPC64
0020
0021 .macro BOOK3E_IDLE name loop
0022 _GLOBAL(\name)
0023
0024 mflr r0
0025 std r0,16(r1)
0026
0027
0028 wrteei 0
0029
0030
0031
0032
0033 lbz r3,PACAIRQHAPPENED(r13)
0034 cmpwi cr0,r3,0
0035 bne 2f
0036
0037
0038
0039
0040
0041 #ifdef CONFIG_TRACE_IRQFLAGS
0042 stdu r1,-128(r1)
0043 bl trace_hardirqs_on
0044 addi r1,r1,128
0045 #endif
0046 li r0,IRQS_ENABLED
0047 stb r0,PACAIRQSOFTMASK(r13)
0048
0049
0050
0051
0052 bl 1f
0053
0054
0055 ld r0,16(r1)
0056 mtlr r0
0057 blr
0058
0059 1:
0060
0061
0062 ld r11, PACACURRENT(r13)
0063 ld r10,TI_LOCAL_FLAGS(r11)
0064 ori r10,r10,_TLF_NAPPING
0065 std r10,TI_LOCAL_FLAGS(r11)
0066
0067
0068 wrteei 1
0069 \loop
0070
0071 2:
0072 lbz r10,PACAIRQHAPPENED(r13)
0073 ori r10,r10,PACA_IRQ_HARD_DIS
0074 stb r10,PACAIRQHAPPENED(r13)
0075 blr
0076 .endm
0077
0078 .macro BOOK3E_IDLE_LOOP
0079 1:
0080 PPC_WAIT(0)
0081 b 1b
0082 .endm
0083
0084
0085
0086 .macro EPAPR_EV_IDLE_LOOP
0087 idle_loop:
0088 LOAD_REG_IMMEDIATE(r11, EV_HCALL_TOKEN(EV_IDLE))
0089
0090 .global epapr_ev_idle_start
0091 epapr_ev_idle_start:
0092 li r3, -1
0093 nop
0094 nop
0095 nop
0096 b idle_loop
0097 .endm
0098
0099 BOOK3E_IDLE epapr_ev_idle EPAPR_EV_IDLE_LOOP
0100
0101 BOOK3E_IDLE book3e_idle BOOK3E_IDLE_LOOP
0102
0103 #endif