aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/power.h
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/power/power.h')
-rw-r--r--kernel/power/power.h49
1 files changed, 21 insertions, 28 deletions
diff --git a/kernel/power/power.h b/kernel/power/power.h
index eb461b816bf4..34b43542785a 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -14,8 +14,18 @@ struct swsusp_info {
14 14
15 15
16#ifdef CONFIG_SOFTWARE_SUSPEND 16#ifdef CONFIG_SOFTWARE_SUSPEND
17extern int pm_suspend_disk(void); 17/*
18 * Keep some memory free so that I/O operations can succeed without paging
19 * [Might this be more than 4 MB?]
20 */
21#define PAGES_FOR_IO ((4096 * 1024) >> PAGE_SHIFT)
22/*
23 * Keep 1 MB of memory free so that device drivers can allocate some pages in
24 * their .suspend() routines without breaking the suspend to disk.
25 */
26#define SPARE_PAGES ((1024 * 1024) >> PAGE_SHIFT)
18 27
28extern int pm_suspend_disk(void);
19#else 29#else
20static inline int pm_suspend_disk(void) 30static inline int pm_suspend_disk(void)
21{ 31{
@@ -23,6 +33,8 @@ static inline int pm_suspend_disk(void)
23} 33}
24#endif 34#endif
25 35
36extern int pfn_is_nosave(unsigned long);
37
26extern struct mutex pm_mutex; 38extern struct mutex pm_mutex;
27 39
28#define power_attr(_name) \ 40#define power_attr(_name) \
@@ -35,10 +47,7 @@ static struct subsys_attribute _name##_attr = { \
35 .store = _name##_store, \ 47 .store = _name##_store, \
36} 48}
37 49
38extern struct subsystem power_subsys; 50extern struct kset power_subsys;
39
40/* References to section boundaries */
41extern const void __nosave_begin, __nosave_end;
42 51
43/* Preferred image size in bytes (default 500 MB) */ 52/* Preferred image size in bytes (default 500 MB) */
44extern unsigned long image_size; 53extern unsigned long image_size;
@@ -49,6 +58,8 @@ extern sector_t swsusp_resume_block;
49extern asmlinkage int swsusp_arch_suspend(void); 58extern asmlinkage int swsusp_arch_suspend(void);
50extern asmlinkage int swsusp_arch_resume(void); 59extern asmlinkage int swsusp_arch_resume(void);
51 60
61extern int create_basic_memory_bitmaps(void);
62extern void free_basic_memory_bitmaps(void);
52extern unsigned int count_data_pages(void); 63extern unsigned int count_data_pages(void);
53 64
54/** 65/**
@@ -139,30 +150,12 @@ struct resume_swap_area {
139#define PMOPS_ENTER 2 150#define PMOPS_ENTER 2
140#define PMOPS_FINISH 3 151#define PMOPS_FINISH 3
141 152
142/** 153/* If unset, the snapshot device cannot be open. */
143 * The bitmap is used for tracing allocated swap pages 154extern atomic_t snapshot_device_available;
144 *
145 * The entire bitmap consists of a number of bitmap_page
146 * structures linked with the help of the .next member.
147 * Thus each page can be allocated individually, so we only
148 * need to make 0-order memory allocations to create
149 * the bitmap.
150 */
151
152#define BITMAP_PAGE_SIZE (PAGE_SIZE - sizeof(void *))
153#define BITMAP_PAGE_CHUNKS (BITMAP_PAGE_SIZE / sizeof(long))
154#define BITS_PER_CHUNK (sizeof(long) * 8)
155#define BITMAP_PAGE_BITS (BITMAP_PAGE_CHUNKS * BITS_PER_CHUNK)
156
157struct bitmap_page {
158 unsigned long chunks[BITMAP_PAGE_CHUNKS];
159 struct bitmap_page *next;
160};
161 155
162extern void free_bitmap(struct bitmap_page *bitmap); 156extern sector_t alloc_swapdev_block(int swap);
163extern struct bitmap_page *alloc_bitmap(unsigned int nr_bits); 157extern void free_all_swap_pages(int swap);
164extern sector_t alloc_swapdev_block(int swap, struct bitmap_page *bitmap); 158extern int swsusp_swap_in_use(void);
165extern void free_all_swap_pages(int swap, struct bitmap_page *bitmap);
166 159
167extern int swsusp_check(void); 160extern int swsusp_check(void);
168extern int swsusp_shrink_memory(void); 161extern int swsusp_shrink_memory(void);