• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Hibernation support specific for loongarch - temporary page tables
4 *
5 * Licensed under the GPLv2
6 *
7 * Copyright (C) 2009 Lemote Inc.
8 * Author: Hu Hongbing <huhb@lemote.com>
9 *	   Wu Zhangjin <wuzhangjin@gmail.com>
10 * Copyright (C) 2020 Loongson Technology Co., Ltd.
11 */
12#include <linux/linkage.h>
13#include <asm/asm-offsets.h>
14#include <asm/regdef.h>
15#include <asm/asm.h>
16
17.text
18SYM_FUNC_START(swsusp_asm_suspend)
19	la.pcrel	t0, saved_regs
20	PTR_S		ra, t0, PT_R1
21	PTR_S		tp, t0, PT_R2
22	PTR_S		sp, t0, PT_R3
23	PTR_S		u0, t0, PT_R21
24	PTR_S		fp, t0, PT_R22
25	PTR_S		s0, t0, PT_R23
26	PTR_S		s1, t0, PT_R24
27	PTR_S		s2, t0, PT_R25
28	PTR_S		s3, t0, PT_R26
29	PTR_S		s4, t0, PT_R27
30	PTR_S		s5, t0, PT_R28
31	PTR_S		s6, t0, PT_R29
32	PTR_S		s7, t0, PT_R30
33	PTR_S		s8, t0, PT_R31
34	b		swsusp_save
35SYM_FUNC_END(swsusp_asm_suspend)
36
37SYM_FUNC_START(swsusp_asm_resume)
38	la.pcrel	t0, restore_pblist
39	PTR_L		t0, t0, 0
400:
41	PTR_L		t1, t0, PBE_ADDRESS  /* source */
42	PTR_L		t2, t0, PBE_ORIG_ADDRESS /* destination */
43	PTR_LI		t3, _PAGE_SIZE
44	PTR_ADD		t3, t3, t1
451:
46	REG_L		t8, t1, 0
47	REG_S		t8, t2, 0
48	PTR_ADDI	t1, t1, SZREG
49	PTR_ADDI	t2, t2, SZREG
50	bne		t1, t3, 1b
51	PTR_L		t0, t0, PBE_NEXT
52	bnez		t0, 0b
53	la.pcrel	t0, saved_regs
54	PTR_L		ra, t0, PT_R1
55	PTR_L		tp, t0, PT_R2
56	PTR_L		sp, t0, PT_R3
57	PTR_L		u0, t0, PT_R21
58	PTR_L		fp, t0, PT_R22
59	PTR_L		s0, t0, PT_R23
60	PTR_L		s1, t0, PT_R24
61	PTR_L		s2, t0, PT_R25
62	PTR_L		s3, t0, PT_R26
63	PTR_L		s4, t0, PT_R27
64	PTR_L		s5, t0, PT_R28
65	PTR_L		s6, t0, PT_R29
66	PTR_L		s7, t0, PT_R30
67	PTR_L		s8, t0, PT_R31
68	PTR_LI		a0, 0x0
69	jirl		zero, ra, 0
70SYM_FUNC_END(swsusp_asm_resume)
71