aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/swsusp.c
diff options
context:
space:
mode:
authorShaohua Li <shaohua.li@intel.com>2006-06-23 05:04:44 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-23 10:42:59 -0400
commitce4ab0012b32c1a4a1d6e934aeb73bf3151c48d9 (patch)
tree83b5ba44e93eeb8b72fe14028ac25943f77844fe /kernel/power/swsusp.c
parent82dcaafc92fdfbe2c1d6c50b9f5e17d533caf950 (diff)
[PATCH] swsusp: add architecture special saveable pages support
1. Add architecture specific pages save/restore support. Next two patches will use this to save/restore 'ACPI NVS' pages. 2. Allow reserved pages 'nosave'. This could avoid save/restore BIOS reserved pages. Signed-off-by: Shaohua Li <shaohua.li@intel.com> Cc: Pavel Machek <pavel@ucw.cz> Cc: "Rafael J. Wysocki" <rjw@sisk.pl> Cc: Nigel Cunningham <nigel@suspend2.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/power/swsusp.c')
-rw-r--r--kernel/power/swsusp.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c
index f9238faf76e4..78b6e71b0813 100644
--- a/kernel/power/swsusp.c
+++ b/kernel/power/swsusp.c
@@ -62,16 +62,6 @@ unsigned long image_size = 500 * 1024 * 1024;
62 62
63int in_suspend __nosavedata = 0; 63int in_suspend __nosavedata = 0;
64 64
65#ifdef CONFIG_HIGHMEM
66unsigned int count_highmem_pages(void);
67int save_highmem(void);
68int restore_highmem(void);
69#else
70static int save_highmem(void) { return 0; }
71static int restore_highmem(void) { return 0; }
72static unsigned int count_highmem_pages(void) { return 0; }
73#endif
74
75/** 65/**
76 * The following functions are used for tracing the allocated 66 * The following functions are used for tracing the allocated
77 * swap pages, so that they can be freed in case of an error. 67 * swap pages, so that they can be freed in case of an error.
@@ -192,7 +182,7 @@ int swsusp_shrink_memory(void)
192 182
193 printk("Shrinking memory... "); 183 printk("Shrinking memory... ");
194 do { 184 do {
195 size = 2 * count_highmem_pages(); 185 size = 2 * count_special_pages();
196 size += size / 50 + count_data_pages(); 186 size += size / 50 + count_data_pages();
197 size += (size + PBES_PER_PAGE - 1) / PBES_PER_PAGE + 187 size += (size + PBES_PER_PAGE - 1) / PBES_PER_PAGE +
198 PAGES_FOR_IO; 188 PAGES_FOR_IO;
@@ -234,7 +224,7 @@ int swsusp_suspend(void)
234 goto Enable_irqs; 224 goto Enable_irqs;
235 } 225 }
236 226
237 if ((error = save_highmem())) { 227 if ((error = save_special_mem())) {
238 printk(KERN_ERR "swsusp: Not enough free pages for highmem\n"); 228 printk(KERN_ERR "swsusp: Not enough free pages for highmem\n");
239 goto Restore_highmem; 229 goto Restore_highmem;
240 } 230 }
@@ -245,7 +235,7 @@ int swsusp_suspend(void)
245 /* Restore control flow magically appears here */ 235 /* Restore control flow magically appears here */
246 restore_processor_state(); 236 restore_processor_state();
247Restore_highmem: 237Restore_highmem:
248 restore_highmem(); 238 restore_special_mem();
249 device_power_up(); 239 device_power_up();
250Enable_irqs: 240Enable_irqs:
251 local_irq_enable(); 241 local_irq_enable();
@@ -271,7 +261,7 @@ int swsusp_resume(void)
271 */ 261 */
272 swsusp_free(); 262 swsusp_free();
273 restore_processor_state(); 263 restore_processor_state();
274 restore_highmem(); 264 restore_special_mem();
275 touch_softlockup_watchdog(); 265 touch_softlockup_watchdog();
276 device_power_up(); 266 device_power_up();
277 local_irq_enable(); 267 local_irq_enable();