suspend.h 2.1 KB

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