|
@@ -274,6 +274,53 @@ int hibernation_snapshot(int platform_mode)
|
|
return error;
|
|
return error;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * resume_target_kernel - prepare devices that need to be suspended with
|
|
|
|
+ * interrupts off, restore the contents of highmem that have not been
|
|
|
|
+ * restored yet from the image and run the low level code that will restore
|
|
|
|
+ * the remaining contents of memory and switch to the just restored target
|
|
|
|
+ * kernel.
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+static int resume_target_kernel(void)
|
|
|
|
+{
|
|
|
|
+ int error;
|
|
|
|
+
|
|
|
|
+ local_irq_disable();
|
|
|
|
+ error = device_power_down(PMSG_PRETHAW);
|
|
|
|
+ if (error) {
|
|
|
|
+ printk(KERN_ERR "Some devices failed to power down, "
|
|
|
|
+ "aborting resume\n");
|
|
|
|
+ goto Enable_irqs;
|
|
|
|
+ }
|
|
|
|
+ /* We'll ignore saved state, but this gets preempt count (etc) right */
|
|
|
|
+ save_processor_state();
|
|
|
|
+ error = restore_highmem();
|
|
|
|
+ if (!error) {
|
|
|
|
+ error = swsusp_arch_resume();
|
|
|
|
+ /*
|
|
|
|
+ * The code below is only ever reached in case of a failure.
|
|
|
|
+ * Otherwise execution continues at place where
|
|
|
|
+ * swsusp_arch_suspend() was called
|
|
|
|
+ */
|
|
|
|
+ BUG_ON(!error);
|
|
|
|
+ /* This call to restore_highmem() undos the previous one */
|
|
|
|
+ restore_highmem();
|
|
|
|
+ }
|
|
|
|
+ /*
|
|
|
|
+ * The only reason why swsusp_arch_resume() can fail is memory being
|
|
|
|
+ * very tight, so we have to free it as soon as we can to avoid
|
|
|
|
+ * subsequent failures
|
|
|
|
+ */
|
|
|
|
+ swsusp_free();
|
|
|
|
+ restore_processor_state();
|
|
|
|
+ touch_softlockup_watchdog();
|
|
|
|
+ device_power_up();
|
|
|
|
+ Enable_irqs:
|
|
|
|
+ local_irq_enable();
|
|
|
|
+ return error;
|
|
|
|
+}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* hibernation_restore - quiesce devices and restore the hibernation
|
|
* hibernation_restore - quiesce devices and restore the hibernation
|
|
* snapshot image. If successful, control returns in hibernation_snaphot()
|
|
* snapshot image. If successful, control returns in hibernation_snaphot()
|
|
@@ -297,7 +344,7 @@ int hibernation_restore(int platform_mode)
|
|
if (!error) {
|
|
if (!error) {
|
|
error = disable_nonboot_cpus();
|
|
error = disable_nonboot_cpus();
|
|
if (!error)
|
|
if (!error)
|
|
- error = swsusp_resume();
|
|
|
|
|
|
+ error = resume_target_kernel();
|
|
enable_nonboot_cpus();
|
|
enable_nonboot_cpus();
|
|
}
|
|
}
|
|
platform_restore_cleanup(platform_mode);
|
|
platform_restore_cleanup(platform_mode);
|