2 * This file contains the power_save function for 970-family CPUs.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
10 #include <linux/threads.h>
11 #include <asm/processor.h>
13 #include <asm/cputable.h>
14 #include <asm/thread_info.h>
15 #include <asm/ppc_asm.h>
16 #include <asm/asm-offsets.h>
17 #include <asm/irqflags.h>
18 #include <asm/hw_irq.h>
19 #include <asm/feature-fixups.h>
28 END_FTR_SECTION_IFCLR(CPU_FTR_CAN_NAP)
29 /* Now check if user or arch enabled NAP mode */
30 LOAD_REG_ADDRBASE(r3,powersave_nap)
31 lwz r4,ADDROFF(powersave_nap)(r3)
35 /* This sequence is similar to prep_irq_for_idle() */
37 /* Hard disable interrupts */
43 /* Check if something happened while soft-disabled */
44 lbz r0,PACAIRQHAPPENED(r13)
49 * Soft-enable interrupts. This will make power4_fixup_nap return
50 * to our caller with interrupts enabled (soft and hard). The caller
51 * can cope with either interrupts disabled or enabled upon return.
53 #ifdef CONFIG_TRACE_IRQFLAGS
54 /* Tell the tracer interrupts are on, because idle responds to them. */
63 #endif /* CONFIG_TRACE_IRQFLAGS */
66 stb r0,PACAIRQSOFTMASK(r13) /* we'll hard-enable shortly */
70 END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
71 CURRENT_THREAD_INFO(r9, r1)
72 ld r8,TI_LOCAL_FLAGS(r9) /* set napping bit */
73 ori r8,r8,_TLF_NAPPING /* so when we take an exception */
74 std r8,TI_LOCAL_FLAGS(r9) /* it will return to our caller */
83 2: /* Return if an interrupt had happened while soft disabled */
84 /* Set the HARD_DIS flag because interrupts are now hard disabled */
85 ori r0,r0,PACA_IRQ_HARD_DIS
86 stb r0,PACAIRQHAPPENED(r13)