18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Hibernation support specific for loongarch - temporary page tables 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Licensed under the GPLv2 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Copyright (C) 2009 Lemote Inc. 88c2ecf20Sopenharmony_ci * Author: Hu Hongbing <huhb@lemote.com> 98c2ecf20Sopenharmony_ci * Wu Zhangjin <wuzhangjin@gmail.com> 108c2ecf20Sopenharmony_ci * Copyright (C) 2020 Loongson Technology Co., Ltd. 118c2ecf20Sopenharmony_ci */ 128c2ecf20Sopenharmony_ci#include <linux/linkage.h> 138c2ecf20Sopenharmony_ci#include <asm/asm-offsets.h> 148c2ecf20Sopenharmony_ci#include <asm/regdef.h> 158c2ecf20Sopenharmony_ci#include <asm/asm.h> 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci.text 188c2ecf20Sopenharmony_ciSYM_FUNC_START(swsusp_asm_suspend) 198c2ecf20Sopenharmony_ci la.pcrel t0, saved_regs 208c2ecf20Sopenharmony_ci PTR_S ra, t0, PT_R1 218c2ecf20Sopenharmony_ci PTR_S tp, t0, PT_R2 228c2ecf20Sopenharmony_ci PTR_S sp, t0, PT_R3 238c2ecf20Sopenharmony_ci PTR_S u0, t0, PT_R21 248c2ecf20Sopenharmony_ci PTR_S fp, t0, PT_R22 258c2ecf20Sopenharmony_ci PTR_S s0, t0, PT_R23 268c2ecf20Sopenharmony_ci PTR_S s1, t0, PT_R24 278c2ecf20Sopenharmony_ci PTR_S s2, t0, PT_R25 288c2ecf20Sopenharmony_ci PTR_S s3, t0, PT_R26 298c2ecf20Sopenharmony_ci PTR_S s4, t0, PT_R27 308c2ecf20Sopenharmony_ci PTR_S s5, t0, PT_R28 318c2ecf20Sopenharmony_ci PTR_S s6, t0, PT_R29 328c2ecf20Sopenharmony_ci PTR_S s7, t0, PT_R30 338c2ecf20Sopenharmony_ci PTR_S s8, t0, PT_R31 348c2ecf20Sopenharmony_ci b swsusp_save 358c2ecf20Sopenharmony_ciSYM_FUNC_END(swsusp_asm_suspend) 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ciSYM_FUNC_START(swsusp_asm_resume) 388c2ecf20Sopenharmony_ci la.pcrel t0, restore_pblist 398c2ecf20Sopenharmony_ci PTR_L t0, t0, 0 408c2ecf20Sopenharmony_ci0: 418c2ecf20Sopenharmony_ci PTR_L t1, t0, PBE_ADDRESS /* source */ 428c2ecf20Sopenharmony_ci PTR_L t2, t0, PBE_ORIG_ADDRESS /* destination */ 438c2ecf20Sopenharmony_ci PTR_LI t3, _PAGE_SIZE 448c2ecf20Sopenharmony_ci PTR_ADD t3, t3, t1 458c2ecf20Sopenharmony_ci1: 468c2ecf20Sopenharmony_ci REG_L t8, t1, 0 478c2ecf20Sopenharmony_ci REG_S t8, t2, 0 488c2ecf20Sopenharmony_ci PTR_ADDI t1, t1, SZREG 498c2ecf20Sopenharmony_ci PTR_ADDI t2, t2, SZREG 508c2ecf20Sopenharmony_ci bne t1, t3, 1b 518c2ecf20Sopenharmony_ci PTR_L t0, t0, PBE_NEXT 528c2ecf20Sopenharmony_ci bnez t0, 0b 538c2ecf20Sopenharmony_ci la.pcrel t0, saved_regs 548c2ecf20Sopenharmony_ci PTR_L ra, t0, PT_R1 558c2ecf20Sopenharmony_ci PTR_L tp, t0, PT_R2 568c2ecf20Sopenharmony_ci PTR_L sp, t0, PT_R3 578c2ecf20Sopenharmony_ci PTR_L u0, t0, PT_R21 588c2ecf20Sopenharmony_ci PTR_L fp, t0, PT_R22 598c2ecf20Sopenharmony_ci PTR_L s0, t0, PT_R23 608c2ecf20Sopenharmony_ci PTR_L s1, t0, PT_R24 618c2ecf20Sopenharmony_ci PTR_L s2, t0, PT_R25 628c2ecf20Sopenharmony_ci PTR_L s3, t0, PT_R26 638c2ecf20Sopenharmony_ci PTR_L s4, t0, PT_R27 648c2ecf20Sopenharmony_ci PTR_L s5, t0, PT_R28 658c2ecf20Sopenharmony_ci PTR_L s6, t0, PT_R29 668c2ecf20Sopenharmony_ci PTR_L s7, t0, PT_R30 678c2ecf20Sopenharmony_ci PTR_L s8, t0, PT_R31 688c2ecf20Sopenharmony_ci PTR_LI a0, 0x0 698c2ecf20Sopenharmony_ci jirl zero, ra, 0 708c2ecf20Sopenharmony_ciSYM_FUNC_END(swsusp_asm_resume) 71