1 /* SPDX-License-Identifier: GPL-2.0 */
3 * hibernate_asm.S: Hibernaton support specific for sparc64.
5 * Copyright (C) 2013 Kirill V Tkhai (tkhai@yandex.ru)
8 #include <linux/linkage.h>
10 #include <asm/asm-offsets.h>
11 #include <asm/cpudata.h>
14 ENTRY(swsusp_arch_suspend)
19 setuw saved_context, %g3
21 /* Save window regs */
23 stx %g2, [%g3 + SC_REG_CWP]
25 stx %g2, [%g3 + SC_REG_WSTATE]
26 stx %fp, [%g3 + SC_REG_FP]
30 stx %g2, [%g3 + SC_REG_TICK]
32 stx %g2, [%g3 + SC_REG_PSTATE]
34 /* Save global regs */
35 stx %g4, [%g3 + SC_REG_G4]
36 stx %g5, [%g3 + SC_REG_G5]
37 stx %g6, [%g3 + SC_REG_G6]
49 ENTRY(swsusp_arch_resume)
50 /* Write restore_pblist to %l0 */
51 sethi %hi(restore_pblist), %l0
52 ldx [%l0 + %lo(restore_pblist)], %l0
57 /* Write PAGE_OFFSET to %g7 */
58 sethi %hi(PAGE_OFFSET), %g7
59 ldx [%g7 + %lo(PAGE_OFFSET)], %g7
61 setuw (PAGE_SIZE-8), %g3
65 wr %g0, ASI_PHYS_USE_EC, %asi
75 ldxa [%l0 ] %asi, %l1 /* address */
76 ldxa [%l0 + 8] %asi, %l2 /* orig_address */
82 mov %g3, %l3 /* PAGE_SIZE-8 */
84 ldxa [%l1 + %l3] ASI_PHYS_USE_EC, %g2
85 stxa %g2, [%l2 + %l3] ASI_PHYS_USE_EC
92 ldxa [%l0 + 16] %asi, %l0
95 setuw saved_context, %g3
97 /* Restore window regs */
98 wrpr %g0, 0, %canrestore
99 wrpr %g0, 0, %otherwin
100 wrpr %g0, 6, %cansave
101 wrpr %g0, 0, %cleanwin
103 ldxa [%g3 + SC_REG_CWP] %asi, %g2
105 ldxa [%g3 + SC_REG_WSTATE] %asi, %g2
107 ldxa [%g3 + SC_REG_FP] %asi, %fp
109 /* Restore state regs */
110 ldxa [%g3 + SC_REG_PSTATE] %asi, %g2
112 ldxa [%g3 + SC_REG_TICK] %asi, %g2
115 /* Restore global regs */
116 ldxa [%g3 + SC_REG_G4] %asi, %g4
117 ldxa [%g3 + SC_REG_G5] %asi, %g5
118 ldxa [%g3 + SC_REG_G6] %asi, %g6