aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/power.h
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2007-07-19 04:47:30 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-19 13:04:42 -0400
commita634cc10164d1c229fbeca33923e6a0ed939e894 (patch)
treea2cdc5403127ca71b2cf378feb86d46745022ac1 /kernel/power/power.h
parent7777fab989b5d006903188c966058ebcd2d6342a (diff)
swsusp: introduce restore platform operations
At least on some machines it is necessary to prepare the ACPI firmware for the restoration of the system memory state from the hibernation image if the "platform" mode of hibernation has been used. Namely, in that cases we need to disable the GPEs before replacing the "boot" kernel with the "frozen" kernel (cf. http://bugzilla.kernel.org/show_bug.cgi?id=7887). After the restore they will be re-enabled by hibernation_ops->finish(), but if the restore fails, they have to be re-enabled by the restore code explicitly. For this purpose we can introduce two additional hibernation operations, called pre_restore() and restore_cleanup() and call them from the restore code path. Still, they should be called if the "platform" mode of hibernation has been used, so we need to pass the information about the hibernation mode from the "frozen" kernel to the "boot" kernel in the image header. Apparently, we can't drop the disabling of GPEs before the restore because of Bug #7887 .  We also can't do it unconditionally, because the GPEs wouldn't have been enabled after a successful restore if the suspend had been done in the 'shutdown' or 'reboot' mode. In principle we could (and probably should) unconditionally disable the GPEs before each snapshot creation *and* before the restore, but then we'd have to unconditionally enable them after the snapshot creation as well as after the restore (or restore failure)   Still, for this purpose we'd need to modify acpi_enter_sleep_state_prep() and acpi_leave_sleep_state() and we'd have to introduce some mechanism synchronizing the disablind/enabling of the GPEs with the device drivers' .suspend()/.resume() routines and with disable_/enable_nonboot_cpus().  However, this would have affected the suspend (ie. s2ram) code as well as the hibernation, which I'd like to avoid in this patch series. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Cc: Nigel Cunningham <nigel@nigel.suspend2.net> Cc: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/power/power.h')
-rw-r--r--kernel/power/power.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/kernel/power/power.h b/kernel/power/power.h
index 70c378b3f85a..eab3603b7caf 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -27,7 +27,7 @@ struct swsusp_info {
27 27
28/* kernel/power/disk.c */ 28/* kernel/power/disk.c */
29extern int hibernation_snapshot(int platform_mode); 29extern int hibernation_snapshot(int platform_mode);
30extern int hibernation_restore(void); 30extern int hibernation_restore(int platform_mode);
31extern int hibernation_platform_enter(void); 31extern int hibernation_platform_enter(void);
32#endif 32#endif
33 33
@@ -155,13 +155,20 @@ extern sector_t alloc_swapdev_block(int swap);
155extern void free_all_swap_pages(int swap); 155extern void free_all_swap_pages(int swap);
156extern int swsusp_swap_in_use(void); 156extern int swsusp_swap_in_use(void);
157 157
158/*
159 * Flags that can be passed from the hibernatig hernel to the "boot" kernel in
160 * the image header.
161 */
162#define SF_PLATFORM_MODE 1
163
164/* kernel/power/disk.c */
158extern int swsusp_check(void); 165extern int swsusp_check(void);
159extern int swsusp_shrink_memory(void); 166extern int swsusp_shrink_memory(void);
160extern void swsusp_free(void); 167extern void swsusp_free(void);
161extern int swsusp_suspend(void); 168extern int swsusp_suspend(void);
162extern int swsusp_resume(void); 169extern int swsusp_resume(void);
163extern int swsusp_read(void); 170extern int swsusp_read(unsigned int *flags_p);
164extern int swsusp_write(void); 171extern int swsusp_write(unsigned int flags);
165extern void swsusp_close(void); 172extern void swsusp_close(void);
166extern int suspend_enter(suspend_state_t state); 173extern int suspend_enter(suspend_state_t state);
167 174