suspend.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef __ASM_SUSPEND_H
  2. #define __ASM_SUSPEND_H
  3. #define NR_CTX_REGS 10
  4. #define NR_CALLEE_SAVED_REGS 12
  5. /*
  6. * struct cpu_suspend_ctx must be 16-byte aligned since it is allocated on
  7. * the stack, which must be 16-byte aligned on v8
  8. */
  9. struct cpu_suspend_ctx {
  10. /*
  11. * This struct must be kept in sync with
  12. * cpu_do_{suspend/resume} in mm/proc.S
  13. */
  14. u64 ctx_regs[NR_CTX_REGS];
  15. u64 sp;
  16. } __aligned(16);
  17. /*
  18. * Memory to save the cpu state is allocated on the stack by
  19. * __cpu_suspend_enter()'s caller, and populated by __cpu_suspend_enter().
  20. * This data must survive until cpu_resume() is called.
  21. *
  22. * This struct desribes the size and the layout of the saved cpu state.
  23. * The layout of the callee_saved_regs is defined by the implementation
  24. * of __cpu_suspend_enter(), and cpu_resume(). This struct must be passed
  25. * in by the caller as __cpu_suspend_enter()'s stack-frame is gone once it
  26. * returns, and the data would be subsequently corrupted by the call to the
  27. * finisher.
  28. */
  29. struct sleep_stack_data {
  30. struct cpu_suspend_ctx system_regs;
  31. unsigned long callee_saved_regs[NR_CALLEE_SAVED_REGS];
  32. };
  33. extern unsigned long *sleep_save_stash;
  34. extern int cpu_suspend(unsigned long arg, int (*fn)(unsigned long));
  35. extern void cpu_resume(void);
  36. int __cpu_suspend_enter(struct sleep_stack_data *state);
  37. void __cpu_suspend_exit(void);
  38. void _cpu_resume(void);
  39. int swsusp_arch_suspend(void);
  40. int swsusp_arch_resume(void);
  41. int arch_hibernation_header_save(void *addr, unsigned int max_size);
  42. int arch_hibernation_header_restore(void *addr);
  43. /* Used to resume on the CPU we hibernated on */
  44. int hibernate_resume_nonboot_cpu_disable(void);
  45. #endif