xref: /linux/kernel/power/power.h (revision 7088a5c00103ef48782d6c359cd12b13a10666e6)
11da177e4SLinus Torvalds #include <linux/suspend.h>
21da177e4SLinus Torvalds #include <linux/utsname.h>
31da177e4SLinus Torvalds 
48686bcd0SPavel Machek /* With SUSPEND_CONSOLE defined suspend looks *really* cool, but
51da177e4SLinus Torvalds    we probably do not take enough locks for switching consoles, etc,
61da177e4SLinus Torvalds    so bad things might happen.
71da177e4SLinus Torvalds */
81da177e4SLinus Torvalds #if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
91da177e4SLinus Torvalds #define SUSPEND_CONSOLE	(MAX_NR_CONSOLES-1)
101da177e4SLinus Torvalds #endif
111da177e4SLinus Torvalds 
121da177e4SLinus Torvalds struct swsusp_info {
131da177e4SLinus Torvalds 	struct new_utsname	uts;
141da177e4SLinus Torvalds 	u32			version_code;
151da177e4SLinus Torvalds 	unsigned long		num_physpages;
161da177e4SLinus Torvalds 	int			cpus;
171da177e4SLinus Torvalds 	unsigned long		image_pages;
18*7088a5c0SRafael J. Wysocki 	unsigned long		pages;
19*7088a5c0SRafael J. Wysocki 	swp_entry_t		start;
201da177e4SLinus Torvalds } __attribute__((aligned(PAGE_SIZE)));
211da177e4SLinus Torvalds 
221da177e4SLinus Torvalds 
231da177e4SLinus Torvalds 
241da177e4SLinus Torvalds #ifdef CONFIG_SOFTWARE_SUSPEND
251da177e4SLinus Torvalds extern int pm_suspend_disk(void);
261da177e4SLinus Torvalds 
271da177e4SLinus Torvalds #else
281da177e4SLinus Torvalds static inline int pm_suspend_disk(void)
291da177e4SLinus Torvalds {
301da177e4SLinus Torvalds 	return -EPERM;
311da177e4SLinus Torvalds }
321da177e4SLinus Torvalds #endif
331da177e4SLinus Torvalds extern struct semaphore pm_sem;
341da177e4SLinus Torvalds #define power_attr(_name) \
351da177e4SLinus Torvalds static struct subsys_attribute _name##_attr = {	\
361da177e4SLinus Torvalds 	.attr	= {				\
371da177e4SLinus Torvalds 		.name = __stringify(_name),	\
381da177e4SLinus Torvalds 		.mode = 0644,			\
391da177e4SLinus Torvalds 	},					\
401da177e4SLinus Torvalds 	.show	= _name##_show,			\
411da177e4SLinus Torvalds 	.store	= _name##_store,		\
421da177e4SLinus Torvalds }
431da177e4SLinus Torvalds 
441da177e4SLinus Torvalds extern struct subsystem power_subsys;
451da177e4SLinus Torvalds 
461da177e4SLinus Torvalds extern int freeze_processes(void);
471da177e4SLinus Torvalds extern void thaw_processes(void);
481da177e4SLinus Torvalds 
491da177e4SLinus Torvalds extern int pm_prepare_console(void);
501da177e4SLinus Torvalds extern void pm_restore_console(void);
5125761b6eSRafael J. Wysocki 
5225761b6eSRafael J. Wysocki 
5325761b6eSRafael J. Wysocki /* References to section boundaries */
5425761b6eSRafael J. Wysocki extern const void __nosave_begin, __nosave_end;
5525761b6eSRafael J. Wysocki 
5625761b6eSRafael J. Wysocki extern unsigned int nr_copy_pages;
5725761b6eSRafael J. Wysocki extern suspend_pagedir_t *pagedir_nosave;
5825761b6eSRafael J. Wysocki extern suspend_pagedir_t *pagedir_save;
5925761b6eSRafael J. Wysocki 
6025761b6eSRafael J. Wysocki extern asmlinkage int swsusp_arch_suspend(void);
6125761b6eSRafael J. Wysocki extern asmlinkage int swsusp_arch_resume(void);
6225761b6eSRafael J. Wysocki 
63ed14b527SRafael J. Wysocki extern void free_pagedir(struct pbe *pblist);
64054bd4c1SRafael J. Wysocki extern struct pbe *alloc_pagedir(unsigned nr_pages, gfp_t gfp_mask, int safe_needed);
652c1b4a5cSRafael J. Wysocki extern void swsusp_free(void);
66054bd4c1SRafael J. Wysocki extern int alloc_data_pages(struct pbe *pblist, gfp_t gfp_mask, int safe_needed);
67*7088a5c0SRafael J. Wysocki extern unsigned int snapshot_nr_pages(void);
68*7088a5c0SRafael J. Wysocki extern struct pbe *snapshot_pblist(void);
69*7088a5c0SRafael J. Wysocki extern void snapshot_pblist_set(struct pbe *pblist);
70