2 * hibernate_asm.S: Hibernaton support specific for sparc64.
4 * Copyright (C) 2013 Kirill V Tkhai (tkhai@yandex.ru)
7 #include <linux/linkage.h>
9 #include <asm/asm-offsets.h>
10 #include <asm/cpudata.h>
13 ENTRY(swsusp_arch_suspend)
18 setuw saved_context, %g3
20 /* Save window regs */
22 stx %g2, [%g3 + SC_REG_CWP]
24 stx %g2, [%g3 + SC_REG_WSTATE]
25 stx %fp, [%g3 + SC_REG_FP]
29 stx %g2, [%g3 + SC_REG_TICK]
31 stx %g2, [%g3 + SC_REG_PSTATE]
33 /* Save global regs */
34 stx %g4, [%g3 + SC_REG_G4]
35 stx %g5, [%g3 + SC_REG_G5]
36 stx %g6, [%g3 + SC_REG_G6]
48 ENTRY(swsusp_arch_resume)
49 /* Write restore_pblist to %l0 */
50 sethi %hi(restore_pblist), %l0
51 ldx [%l0 + %lo(restore_pblist)], %l0
56 /* Write PAGE_OFFSET to %g7 */
57 sethi %uhi(PAGE_OFFSET), %g7
60 setuw (PAGE_SIZE-8), %g3
64 wr %g0, ASI_PHYS_USE_EC, %asi
74 ldxa [%l0 ] %asi, %l1 /* address */
75 ldxa [%l0 + 8] %asi, %l2 /* orig_address */
81 mov %g3, %l3 /* PAGE_SIZE-8 */
83 ldxa [%l1 + %l3] ASI_PHYS_USE_EC, %g2
84 stxa %g2, [%l2 + %l3] ASI_PHYS_USE_EC
91 ldxa [%l0 + 16] %asi, %l0
94 setuw saved_context, %g3
96 /* Restore window regs */
97 wrpr %g0, 0, %canrestore
98 wrpr %g0, 0, %otherwin
100 wrpr %g0, 0, %cleanwin
102 ldxa [%g3 + SC_REG_CWP] %asi, %g2
104 ldxa [%g3 + SC_REG_WSTATE] %asi, %g2
106 ldxa [%g3 + SC_REG_FP] %asi, %fp
108 /* Restore state regs */
109 ldxa [%g3 + SC_REG_PSTATE] %asi, %g2
111 ldxa [%g3 + SC_REG_TICK] %asi, %g2
114 /* Restore global regs */
115 ldxa [%g3 + SC_REG_G4] %asi, %g4
116 ldxa [%g3 + SC_REG_G5] %asi, %g5
117 ldxa [%g3 + SC_REG_G6] %asi, %g6