2 * PowerPC 64-bit swsusp implementation
4 * Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
9 #include <linux/threads.h>
10 #include <asm/processor.h>
12 #include <asm/cputable.h>
13 #include <asm/thread_info.h>
14 #include <asm/ppc_asm.h>
15 #include <asm/asm-offsets.h>
18 * Structure for storing CPU registers on the save area.
20 #define SL_r1 0x00 /* stack pointer */
49 #define SL_SIZE SL_r31+8
51 /* these macros rely on the save area being
52 * pointed to by r11 */
53 #define SAVE_SPECIAL(special) \
55 std r0, SL_##special(r11)
56 #define RESTORE_SPECIAL(special) \
57 ld r0, SL_##special(r11) ;\
59 #define SAVE_REGISTER(reg) \
60 std reg, SL_##reg(r11)
61 #define RESTORE_REGISTER(reg) \
64 /* space for storing cpu state */
72 .tc swsusp_save_area[TC],swsusp_save_area
74 .tc restore_pblist[TC],restore_pblist
78 _GLOBAL(swsusp_arch_suspend)
79 ld r11,swsusp_save_area_ptr@toc(r2)
109 /* we push the stack up 128 bytes but don't store the
110 * stack pointer on the stack like a real stackframe */
117 ld r11,swsusp_save_area_ptr@toc(r2)
124 _GLOBAL(swsusp_arch_resume)
125 /* Stop pending alitvec streams and memory accesses */
128 END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
131 ld r12,restore_pblist_ptr@toc(r2)
138 ld r13,pbe_address(r12)
139 ld r14,pbe_orig_address(r12)
158 ori r3, r3, CONFIG_KERNEL_START>>48
171 ld r11,swsusp_save_area_ptr@toc(r2)
175 /* restore timebase */
178 /* get upper 32 bits of it */
180 /* clear tb lower to avoid wrap */
188 /* restore registers */
191 RESTORE_REGISTER(r12)
192 RESTORE_REGISTER(r13)
193 RESTORE_REGISTER(r14)
194 RESTORE_REGISTER(r15)
195 RESTORE_REGISTER(r16)
196 RESTORE_REGISTER(r17)
197 RESTORE_REGISTER(r18)
198 RESTORE_REGISTER(r19)
199 RESTORE_REGISTER(r20)
200 RESTORE_REGISTER(r21)
201 RESTORE_REGISTER(r22)
202 RESTORE_REGISTER(r23)
203 RESTORE_REGISTER(r24)
204 RESTORE_REGISTER(r25)
205 RESTORE_REGISTER(r26)
206 RESTORE_REGISTER(r27)
207 RESTORE_REGISTER(r28)
208 RESTORE_REGISTER(r29)
209 RESTORE_REGISTER(r30)
210 RESTORE_REGISTER(r31)
211 /* can't use RESTORE_SPECIAL(MSR) */
214 RESTORE_SPECIAL(SDR1)
220 bl slb_flush_and_rebolt
224 ld r11,swsusp_save_area_ptr@toc(r2)