Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __ASM_SUSPEND_H
0003 #define __ASM_SUSPEND_H
0004 
0005 #define NR_CTX_REGS 13
0006 #define NR_CALLEE_SAVED_REGS 12
0007 
0008 /*
0009  * struct cpu_suspend_ctx must be 16-byte aligned since it is allocated on
0010  * the stack, which must be 16-byte aligned on v8
0011  */
0012 struct cpu_suspend_ctx {
0013     /*
0014      * This struct must be kept in sync with
0015      * cpu_do_{suspend/resume} in mm/proc.S
0016      */
0017     u64 ctx_regs[NR_CTX_REGS];
0018     u64 sp;
0019 } __aligned(16);
0020 
0021 /*
0022  * Memory to save the cpu state is allocated on the stack by
0023  * __cpu_suspend_enter()'s caller, and populated by __cpu_suspend_enter().
0024  * This data must survive until cpu_resume() is called.
0025  *
0026  * This struct desribes the size and the layout of the saved cpu state.
0027  * The layout of the callee_saved_regs is defined by the implementation
0028  * of __cpu_suspend_enter(), and cpu_resume(). This struct must be passed
0029  * in by the caller as __cpu_suspend_enter()'s stack-frame is gone once it
0030  * returns, and the data would be subsequently corrupted by the call to the
0031  * finisher.
0032  */
0033 struct sleep_stack_data {
0034     struct cpu_suspend_ctx  system_regs;
0035     unsigned long       callee_saved_regs[NR_CALLEE_SAVED_REGS];
0036 };
0037 
0038 extern unsigned long *sleep_save_stash;
0039 
0040 extern int cpu_suspend(unsigned long arg, int (*fn)(unsigned long));
0041 extern void cpu_resume(void);
0042 int __cpu_suspend_enter(struct sleep_stack_data *state);
0043 void __cpu_suspend_exit(void);
0044 void _cpu_resume(void);
0045 
0046 int swsusp_arch_suspend(void);
0047 int swsusp_arch_resume(void);
0048 int arch_hibernation_header_save(void *addr, unsigned int max_size);
0049 int arch_hibernation_header_restore(void *addr);
0050 
0051 /* Used to resume on the CPU we hibernated on */
0052 int hibernate_resume_nonboot_cpu_disable(void);
0053 
0054 #endif