~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/loongarch/power/suspend_asm.S

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * Sleep helper for Loongson-3 sleep mode.
  4  *
  5  * Author: Huacai Chen <chenhuacai@loongson.cn>
  6  * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
  7  */
  8 
  9 #include <asm/asm.h>
 10 #include <asm/asmmacro.h>
 11 #include <asm/addrspace.h>
 12 #include <asm/loongarch.h>
 13 #include <asm/stackframe.h>
 14 
 15 /* preparatory stuff */
 16 .macro  SETUP_SLEEP
 17         addi.d          sp, sp, -PT_SIZE
 18         st.d            $r1, sp, PT_R1
 19         st.d            $r2, sp, PT_R2
 20         st.d            $r3, sp, PT_R3
 21         st.d            $r4, sp, PT_R4
 22         st.d            $r21, sp, PT_R21
 23         st.d            $r22, sp, PT_R22
 24         st.d            $r23, sp, PT_R23
 25         st.d            $r24, sp, PT_R24
 26         st.d            $r25, sp, PT_R25
 27         st.d            $r26, sp, PT_R26
 28         st.d            $r27, sp, PT_R27
 29         st.d            $r28, sp, PT_R28
 30         st.d            $r29, sp, PT_R29
 31         st.d            $r30, sp, PT_R30
 32         st.d            $r31, sp, PT_R31
 33 
 34         la.pcrel        t0, acpi_saved_sp
 35         st.d            sp, t0, 0
 36 .endm
 37 
 38 .macro SETUP_WAKEUP
 39         ld.d            $r1, sp, PT_R1
 40         ld.d            $r2, sp, PT_R2
 41         ld.d            $r3, sp, PT_R3
 42         ld.d            $r4, sp, PT_R4
 43         ld.d            $r21, sp, PT_R21
 44         ld.d            $r22, sp, PT_R22
 45         ld.d            $r23, sp, PT_R23
 46         ld.d            $r24, sp, PT_R24
 47         ld.d            $r25, sp, PT_R25
 48         ld.d            $r26, sp, PT_R26
 49         ld.d            $r27, sp, PT_R27
 50         ld.d            $r28, sp, PT_R28
 51         ld.d            $r29, sp, PT_R29
 52         ld.d            $r30, sp, PT_R30
 53         ld.d            $r31, sp, PT_R31
 54 .endm
 55 
 56         .text
 57         .align 12
 58 
 59 /* Sleep/wakeup code for Loongson-3 */
 60 SYM_FUNC_START(loongarch_suspend_enter)
 61         SETUP_SLEEP
 62         bl              __flush_cache_all
 63 
 64         /* Pass RA and SP to BIOS */
 65         addi.d          a1, sp, 0
 66         la.pcrel        a0, loongarch_wakeup_start
 67         la.pcrel        t0, loongarch_suspend_addr
 68         ld.d            t0, t0, 0
 69         jirl            ra, t0, 0 /* Call BIOS's STR sleep routine */
 70 
 71         /*
 72          * This is where we return upon wakeup.
 73          * Reload all of the registers and return.
 74          */
 75 SYM_INNER_LABEL(loongarch_wakeup_start, SYM_L_GLOBAL)
 76         SETUP_DMWINS    t0
 77         JUMP_VIRT_ADDR  t0, t1
 78 
 79         /* Enable PG */
 80         li.w            t0, 0xb0                # PLV=0, IE=0, PG=1
 81         csrwr           t0, LOONGARCH_CSR_CRMD
 82 
 83         la.pcrel        t0, acpi_saved_sp
 84         ld.d            sp, t0, 0
 85         SETUP_WAKEUP
 86         addi.d          sp, sp, PT_SIZE
 87         jr              ra
 88 SYM_FUNC_END(loongarch_suspend_enter)

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php