suspend.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. extern int pm_prepare_console(void);
  34. extern void pm_restore_console(void);
  35. #else
  36. static inline int software_suspend(void)
  37. {
  38. printk("Warning: fake suspend called\n");
  39. return -EPERM;
  40. }
  41. #endif
  42. #ifdef CONFIG_SUSPEND_SMP
  43. extern void disable_nonboot_cpus(void);
  44. extern void enable_nonboot_cpus(void);
  45. #else
  46. static inline void disable_nonboot_cpus(void) {}
  47. static inline void enable_nonboot_cpus(void) {}
  48. #endif
  49. void save_processor_state(void);
  50. void restore_processor_state(void);
  51. struct saved_context;
  52. void __save_processor_state(struct saved_context *ctxt);
  53. void __restore_processor_state(struct saved_context *ctxt);
  54. unsigned long get_safe_page(gfp_t gfp_mask);
  55. /*
  56. * XXX: We try to keep some more pages free so that I/O operations succeed
  57. * without paging. Might this be more?
  58. */
  59. #define PAGES_FOR_IO 1024
  60. #endif /* _LINUX_SWSUSP_H */