blob: c11cacf1a13b68b4b5cb703ce02949d1a13dc386 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _LINUX_SWSUSP_H
2#define _LINUX_SWSUSP_H
3
4#if defined(CONFIG_X86) || defined(CONFIG_FRV) || defined(CONFIG_PPC32)
5#include <asm/suspend.h>
6#endif
7#include <linux/swap.h>
8#include <linux/notifier.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07009#include <linux/init.h>
10#include <linux/pm.h>
11
12/* page backup entry */
Rafael J. Wysockidcbb5a52006-09-25 23:32:51 -070013struct pbe {
Linus Torvalds1da177e2005-04-16 15:20:36 -070014 unsigned long address; /* address of the copy */
15 unsigned long orig_address; /* original address of page */
Rafael J. Wysocki7088a5c2006-01-06 00:13:05 -080016 struct pbe *next;
Rafael J. Wysockidcbb5a52006-09-25 23:32:51 -070017};
Linus Torvalds1da177e2005-04-16 15:20:36 -070018
19#define for_each_pbe(pbe, pblist) \
20 for (pbe = pblist ; pbe ; pbe = pbe->next)
21
22#define PBES_PER_PAGE (PAGE_SIZE/sizeof(struct pbe))
23#define PB_PAGE_SKIP (PBES_PER_PAGE-1)
24
25#define for_each_pb_page(pbe, pblist) \
26 for (pbe = pblist ; pbe ; pbe = (pbe+PB_PAGE_SKIP)->next)
27
Linus Torvalds1da177e2005-04-16 15:20:36 -070028/* mm/page_alloc.c */
29extern void drain_local_pages(void);
30extern void mark_free_pages(struct zone *zone);
31
32#ifdef CONFIG_PM
33/* kernel/power/swsusp.c */
34extern int software_suspend(void);
Rafael J. Wysocki46cd2f32006-02-07 12:58:50 -080035
36#if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
37extern int pm_prepare_console(void);
38extern void pm_restore_console(void);
39#else
40static inline int pm_prepare_console(void) { return 0; }
41static inline void pm_restore_console(void) {}
42#endif /* defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE) */
Linus Torvalds1da177e2005-04-16 15:20:36 -070043#else
44static inline int software_suspend(void)
45{
46 printk("Warning: fake suspend called\n");
Rafael J. Wysockidcbb5a52006-09-25 23:32:51 -070047 return -ENOSYS;
Linus Torvalds1da177e2005-04-16 15:20:36 -070048}
Rafael J. Wysocki46cd2f32006-02-07 12:58:50 -080049#endif /* CONFIG_PM */
Linus Torvalds1da177e2005-04-16 15:20:36 -070050
Linus Torvalds1da177e2005-04-16 15:20:36 -070051void save_processor_state(void);
52void restore_processor_state(void);
53struct saved_context;
54void __save_processor_state(struct saved_context *ctxt);
55void __restore_processor_state(struct saved_context *ctxt);
Rafael J. Wysocki2c1b4a52005-10-30 14:59:58 -080056unsigned long get_safe_page(gfp_t gfp_mask);
Linus Torvalds1da177e2005-04-16 15:20:36 -070057
Rafael J. Wysocki25761b62005-10-30 14:59:56 -080058/*
59 * XXX: We try to keep some more pages free so that I/O operations succeed
60 * without paging. Might this be more?
61 */
Rafael J. Wysocki72a97e02006-01-06 00:13:46 -080062#define PAGES_FOR_IO 1024
Rafael J. Wysocki25761b62005-10-30 14:59:56 -080063
Linus Torvalds1da177e2005-04-16 15:20:36 -070064#endif /* _LINUX_SWSUSP_H */