11da177e4SLinus Torvalds #include <linux/suspend.h> 21da177e4SLinus Torvalds #include <linux/utsname.h> 31da177e4SLinus Torvalds 41da177e4SLinus Torvalds struct swsusp_info { 51da177e4SLinus Torvalds struct new_utsname uts; 61da177e4SLinus Torvalds u32 version_code; 71da177e4SLinus Torvalds unsigned long num_physpages; 81da177e4SLinus Torvalds int cpus; 91da177e4SLinus Torvalds unsigned long image_pages; 107088a5c0SRafael J. Wysocki unsigned long pages; 111da177e4SLinus Torvalds } __attribute__((aligned(PAGE_SIZE))); 121da177e4SLinus Torvalds 131da177e4SLinus Torvalds 141da177e4SLinus Torvalds 151da177e4SLinus Torvalds #ifdef CONFIG_SOFTWARE_SUSPEND 161da177e4SLinus Torvalds extern int pm_suspend_disk(void); 171da177e4SLinus Torvalds 181da177e4SLinus Torvalds #else 191da177e4SLinus Torvalds static inline int pm_suspend_disk(void) 201da177e4SLinus Torvalds { 211da177e4SLinus Torvalds return -EPERM; 221da177e4SLinus Torvalds } 231da177e4SLinus Torvalds #endif 241da177e4SLinus Torvalds extern struct semaphore pm_sem; 251da177e4SLinus Torvalds #define power_attr(_name) \ 261da177e4SLinus Torvalds static struct subsys_attribute _name##_attr = { \ 271da177e4SLinus Torvalds .attr = { \ 281da177e4SLinus Torvalds .name = __stringify(_name), \ 291da177e4SLinus Torvalds .mode = 0644, \ 301da177e4SLinus Torvalds }, \ 311da177e4SLinus Torvalds .show = _name##_show, \ 321da177e4SLinus Torvalds .store = _name##_store, \ 331da177e4SLinus Torvalds } 341da177e4SLinus Torvalds 351da177e4SLinus Torvalds extern struct subsystem power_subsys; 361da177e4SLinus Torvalds 3725761b6eSRafael J. Wysocki /* References to section boundaries */ 3825761b6eSRafael J. Wysocki extern const void __nosave_begin, __nosave_end; 3925761b6eSRafael J. Wysocki 4072a97e08SRafael J. Wysocki extern struct pbe *pagedir_nosave; 4172a97e08SRafael J. Wysocki 42853609b6SRafael J. Wysocki /* Preferred image size in bytes (default 500 MB) */ 43853609b6SRafael J. Wysocki extern unsigned long image_size; 4425761b6eSRafael J. Wysocki 45*f577eb30SRafael J. Wysocki extern int in_suspend; 46*f577eb30SRafael J. Wysocki 4725761b6eSRafael J. Wysocki extern asmlinkage int swsusp_arch_suspend(void); 4825761b6eSRafael J. Wysocki extern asmlinkage int swsusp_arch_resume(void); 4925761b6eSRafael J. Wysocki 5072a97e08SRafael J. Wysocki extern unsigned int count_data_pages(void); 512c1b4a5cSRafael J. Wysocki extern void swsusp_free(void); 52*f577eb30SRafael J. Wysocki 53*f577eb30SRafael J. Wysocki struct snapshot_handle { 54*f577eb30SRafael J. Wysocki loff_t offset; 55*f577eb30SRafael J. Wysocki unsigned int page; 56*f577eb30SRafael J. Wysocki unsigned int page_offset; 57*f577eb30SRafael J. Wysocki unsigned int prev; 58*f577eb30SRafael J. Wysocki struct pbe *pbe; 59*f577eb30SRafael J. Wysocki void *buffer; 60*f577eb30SRafael J. Wysocki unsigned int buf_offset; 61*f577eb30SRafael J. Wysocki }; 62*f577eb30SRafael J. Wysocki 63*f577eb30SRafael J. Wysocki #define data_of(handle) ((handle).buffer + (handle).buf_offset) 64*f577eb30SRafael J. Wysocki 65*f577eb30SRafael J. Wysocki extern int snapshot_read_next(struct snapshot_handle *handle, size_t count); 66*f577eb30SRafael J. Wysocki extern int snapshot_write_next(struct snapshot_handle *handle, size_t count); 67*f577eb30SRafael J. Wysocki int snapshot_image_loaded(struct snapshot_handle *handle); 68