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/ppc-opcode.h>
24 /* Now check if user or arch enabled NAP mode */
25 LOAD_REG_ADDRBASE(r3,powersave_nap)
26 lwz r4,ADDROFF(powersave_nap)(r3)
30 /* NAP is a state loss, we create a regs frame on the
31 * stack, fill it up with the state we care about and
32 * stick a pointer to it in PACAR1. We really only
33 * need to save PC, some CR bits and the NV GPRs,
34 * but for now an interrupt frame will do.
38 stdu r1,-INT_FRAME_SIZE(r1)
43 /* Make sure FPU, VSX etc... are flushed as we may lose
44 * state when going to nap mode
46 bl .discard_lazy_cpu_state
47 #endif /* CONFIG_SMP */
49 /* Hard disable interrupts */
53 mtmsrd r9,1 /* hard-disable interrupts */
55 stb r0,PACASOFTIRQEN(r13) /* we'll hard-enable shortly */
56 stb r0,PACAHARDIRQEN(r13)
58 /* Continue saving state */
66 /* Magic NAP mode enter sequence */
75 _GLOBAL(power7_wakeup_loss)
83 addi r1,r1,INT_FRAME_SIZE
89 _GLOBAL(power7_wakeup_noloss)
94 addi r1,r1,INT_FRAME_SIZE