suspend.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #ifndef _LINUX_SWSUSP_H
  2. #define _LINUX_SWSUSP_H
  3. #if defined(CONFIG_X86) || defined(CONFIG_FRV) || defined(CONFIG_PPC32) || defined(CONFIG_PPC64)
  4. #include <asm/suspend.h>
  5. #endif
  6. #include <linux/swap.h>
  7. #include <linux/notifier.h>
  8. #include <linux/init.h>
  9. #include <linux/pm.h>
  10. #include <linux/mm.h>
  11. /* struct pbe is used for creating lists of pages that should be restored
  12. * atomically during the resume from disk, because the page frames they have
  13. * occupied before the suspend are in use.
  14. */
  15. struct pbe {
  16. void *address; /* address of the copy */
  17. void *orig_address; /* original address of a page */
  18. struct pbe *next;
  19. };
  20. /* mm/page_alloc.c */
  21. extern void drain_local_pages(void);
  22. extern void mark_free_pages(struct zone *zone);
  23. #if defined(CONFIG_PM) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
  24. extern int pm_prepare_console(void);
  25. extern void pm_restore_console(void);
  26. #else
  27. static inline int pm_prepare_console(void) { return 0; }
  28. static inline void pm_restore_console(void) {}
  29. #endif
  30. #if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND)
  31. /* kernel/power/snapshot.c */
  32. extern void __register_nosave_region(unsigned long b, unsigned long e, int km);
  33. static inline void register_nosave_region(unsigned long b, unsigned long e)
  34. {
  35. __register_nosave_region(b, e, 0);
  36. }
  37. static inline void register_nosave_region_late(unsigned long b, unsigned long e)
  38. {
  39. __register_nosave_region(b, e, 1);
  40. }
  41. extern int swsusp_page_is_forbidden(struct page *);
  42. extern void swsusp_set_page_free(struct page *);
  43. extern void swsusp_unset_page_free(struct page *);
  44. extern unsigned long get_safe_page(gfp_t gfp_mask);
  45. #else
  46. static inline void register_nosave_region(unsigned long b, unsigned long e) {}
  47. static inline void register_nosave_region_late(unsigned long b, unsigned long e) {}
  48. static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
  49. static inline void swsusp_set_page_free(struct page *p) {}
  50. static inline void swsusp_unset_page_free(struct page *p) {}
  51. #endif /* defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND) */
  52. void save_processor_state(void);
  53. void restore_processor_state(void);
  54. struct saved_context;
  55. void __save_processor_state(struct saved_context *ctxt);
  56. void __restore_processor_state(struct saved_context *ctxt);
  57. #endif /* _LINUX_SWSUSP_H */