suspend.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. swp_entry_t swap_address;
  16. struct pbe *next; /* also used as scratch space at
  17. * end of page (see link, diskpage)
  18. */
  19. } suspend_pagedir_t;
  20. #define for_each_pbe(pbe, pblist) \
  21. for (pbe = pblist ; pbe ; pbe = pbe->next)
  22. #define PBES_PER_PAGE (PAGE_SIZE/sizeof(struct pbe))
  23. #define PB_PAGE_SKIP (PBES_PER_PAGE-1)
  24. #define for_each_pb_page(pbe, pblist) \
  25. for (pbe = pblist ; pbe ; pbe = (pbe+PB_PAGE_SKIP)->next)
  26. #define SWAP_FILENAME_MAXLENGTH 32
  27. extern dev_t swsusp_resume_device;
  28. /* mm/vmscan.c */
  29. extern int shrink_mem(void);
  30. /* mm/page_alloc.c */
  31. extern void drain_local_pages(void);
  32. extern void mark_free_pages(struct zone *zone);
  33. #ifdef CONFIG_PM
  34. /* kernel/power/swsusp.c */
  35. extern int software_suspend(void);
  36. extern int pm_prepare_console(void);
  37. extern void pm_restore_console(void);
  38. #else
  39. static inline int software_suspend(void)
  40. {
  41. printk("Warning: fake suspend called\n");
  42. return -EPERM;
  43. }
  44. #endif
  45. #ifdef CONFIG_SUSPEND_SMP
  46. extern void disable_nonboot_cpus(void);
  47. extern void enable_nonboot_cpus(void);
  48. #else
  49. static inline void disable_nonboot_cpus(void) {}
  50. static inline void enable_nonboot_cpus(void) {}
  51. #endif
  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 */