diff options
Diffstat (limited to 'kernel/power/power.h')
-rw-r--r-- | kernel/power/power.h | 49 |
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 |
17 | extern 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 | ||
28 | extern int pm_suspend_disk(void); | ||
19 | #else | 29 | #else |
20 | static inline int pm_suspend_disk(void) | 30 | static 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 | ||
36 | extern int pfn_is_nosave(unsigned long); | ||
37 | |||
26 | extern struct mutex pm_mutex; | 38 | extern 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 | ||
38 | extern struct subsystem power_subsys; | 50 | extern struct kset power_subsys; |
39 | |||
40 | /* References to section boundaries */ | ||
41 | extern 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) */ |
44 | extern unsigned long image_size; | 53 | extern unsigned long image_size; |
@@ -49,6 +58,8 @@ extern sector_t swsusp_resume_block; | |||
49 | extern asmlinkage int swsusp_arch_suspend(void); | 58 | extern asmlinkage int swsusp_arch_suspend(void); |
50 | extern asmlinkage int swsusp_arch_resume(void); | 59 | extern asmlinkage int swsusp_arch_resume(void); |
51 | 60 | ||
61 | extern int create_basic_memory_bitmaps(void); | ||
62 | extern void free_basic_memory_bitmaps(void); | ||
52 | extern unsigned int count_data_pages(void); | 63 | extern 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 | 154 | extern 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 | |||
157 | struct bitmap_page { | ||
158 | unsigned long chunks[BITMAP_PAGE_CHUNKS]; | ||
159 | struct bitmap_page *next; | ||
160 | }; | ||
161 | 155 | ||
162 | extern void free_bitmap(struct bitmap_page *bitmap); | 156 | extern sector_t alloc_swapdev_block(int swap); |
163 | extern struct bitmap_page *alloc_bitmap(unsigned int nr_bits); | 157 | extern void free_all_swap_pages(int swap); |
164 | extern sector_t alloc_swapdev_block(int swap, struct bitmap_page *bitmap); | 158 | extern int swsusp_swap_in_use(void); |
165 | extern void free_all_swap_pages(int swap, struct bitmap_page *bitmap); | ||
166 | 159 | ||
167 | extern int swsusp_check(void); | 160 | extern int swsusp_check(void); |
168 | extern int swsusp_shrink_memory(void); | 161 | extern int swsusp_shrink_memory(void); |