suspend.h 1.8 KB

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