suspend.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #ifndef _LINUX_SWSUSP_H
  2. #define _LINUX_SWSUSP_H
  3. #if defined(CONFIG_X86) || defined(CONFIG_FRV) || defined(CONFIG_PPC32)
  4. #include <asm/suspend.h>
  5. #endif
  6. #include <linux/swap.h>
  7. #include <linux/notifier.h>
  8. #include <linux/config.h>
  9. #include <linux/init.h>
  10. #include <linux/pm.h>
  11. /* page backup entry */
  12. typedef struct pbe {
  13. unsigned long address; /* address of the copy */
  14. unsigned long orig_address; /* original address of page */
  15. struct pbe *next;
  16. } suspend_pagedir_t;
  17. #define for_each_pbe(pbe, pblist) \
  18. for (pbe = pblist ; pbe ; pbe = pbe->next)
  19. #define PBES_PER_PAGE (PAGE_SIZE/sizeof(struct pbe))
  20. #define PB_PAGE_SKIP (PBES_PER_PAGE-1)
  21. #define for_each_pb_page(pbe, pblist) \
  22. for (pbe = pblist ; pbe ; pbe = (pbe+PB_PAGE_SKIP)->next)
  23. #define SWAP_FILENAME_MAXLENGTH 32
  24. extern dev_t swsusp_resume_device;
  25. /* mm/vmscan.c */
  26. extern int shrink_mem(void);
  27. /* mm/page_alloc.c */
  28. extern void drain_local_pages(void);
  29. extern void mark_free_pages(struct zone *zone);
  30. #ifdef CONFIG_PM
  31. /* kernel/power/swsusp.c */
  32. extern int software_suspend(void);
  33. #if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
  34. extern int pm_prepare_console(void);
  35. extern void pm_restore_console(void);
  36. #else
  37. static inline int pm_prepare_console(void) { return 0; }
  38. static inline void pm_restore_console(void) {}
  39. #endif /* defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE) */
  40. #else
  41. static inline int software_suspend(void)
  42. {
  43. printk("Warning: fake suspend called\n");
  44. return -EPERM;
  45. }
  46. #endif /* CONFIG_PM */
  47. #ifdef CONFIG_SUSPEND_SMP
  48. extern void disable_nonboot_cpus(void);
  49. extern void enable_nonboot_cpus(void);
  50. #else
  51. static inline void disable_nonboot_cpus(void) {}
  52. static inline void enable_nonboot_cpus(void) {}
  53. #endif
  54. void save_processor_state(void);
  55. void restore_processor_state(void);
  56. struct saved_context;
  57. void __save_processor_state(struct saved_context *ctxt);
  58. void __restore_processor_state(struct saved_context *ctxt);
  59. unsigned long get_safe_page(gfp_t gfp_mask);
  60. /*
  61. * XXX: We try to keep some more pages free so that I/O operations succeed
  62. * without paging. Might this be more?
  63. */
  64. #define PAGES_FOR_IO 1024
  65. #endif /* _LINUX_SWSUSP_H */