Lines Matching +full:resume +full:- +full:offset
1 // SPDX-License-Identifier: GPL-2.0-only
3 * kernel/power/hibernate.c - Hibernation (a.k.a suspend-to-disk) support.
71 #define HIBERNATION_MAX (__HIBERNATION_AFTER_LAST-1)
84 return atomic_add_unless(&hibernate_atomic, -1, 0); in hibernate_acquire()
100 * hibernation_set_ops - Set the global hibernate operations.
107 if (ops && !(ops->begin && ops->end && ops->pre_snapshot in hibernation_set_ops()
108 && ops->prepare && ops->finish && ops->enter && ops->pre_restore in hibernation_set_ops()
109 && ops->restore_cleanup && ops->leave)) { in hibernation_set_ops()
154 * platform_begin - Call platform to start hibernation.
160 hibernation_ops->begin(PMSG_FREEZE) : 0; in platform_begin()
164 * platform_end - Call platform to finish transition to the working state.
170 hibernation_ops->end(); in platform_end()
174 * platform_pre_snapshot - Call platform to prepare the machine for hibernation.
184 hibernation_ops->pre_snapshot() : 0; in platform_pre_snapshot()
188 * platform_leave - Call platform to prepare a transition to the working state.
199 hibernation_ops->leave(); in platform_leave()
203 * platform_finish - Call platform to switch the system to the working state.
214 hibernation_ops->finish(); in platform_finish()
218 * platform_pre_restore - Prepare for hibernate image restoration.
221 * Use the platform driver to prepare the system for resume from a hibernation
230 hibernation_ops->pre_restore() : 0; in platform_pre_restore()
234 * platform_restore_cleanup - Switch to the working state after failing restore.
247 hibernation_ops->restore_cleanup(); in platform_restore_cleanup()
251 * platform_recover - Recover from a failure to suspend devices.
256 if (platform_mode && hibernation_ops && hibernation_ops->recover) in platform_recover()
257 hibernation_ops->recover(); in platform_recover()
261 * swsusp_show_speed - Print time elapsed between two events during hibernation.
280 centisecs = 1; /* avoid div-by-zero */ in swsusp_show_speed()
294 * create_image - Create a hibernation image.
360 /* Allow architectures to do nosmt-specific post-resume dances */ in create_image()
374 * hibernation_snapshot - Quiesce devices and create a hibernation image.
460 * resume_target_kernel - Restore system state from a hibernation image.
465 * the low-level code that will restore the remaining contents of memory and
474 pr_err("Some devices failed to power down, aborting resume\n"); in resume_target_kernel()
538 * hibernation_restore - Quiesce devices and restore from a hibernation image.
570 * hibernation_platform_enter - Power off the system using the platform driver.
577 return -ENOSYS; in hibernation_platform_enter()
581 * hibernation_ops->finish() before saving the image, so we should let in hibernation_platform_enter()
584 error = hibernation_ops->begin(PMSG_HIBERNATE); in hibernation_platform_enter()
592 if (hibernation_ops->recover) in hibernation_platform_enter()
593 hibernation_ops->recover(); in hibernation_platform_enter()
601 error = hibernation_ops->prepare(); in hibernation_platform_enter()
613 error = -EAGAIN; in hibernation_platform_enter()
617 hibernation_ops->enter(); in hibernation_platform_enter()
630 hibernation_ops->finish(); in hibernation_platform_enter()
640 hibernation_ops->end(); in hibernation_platform_enter()
646 * power_down - Shut the machine down for hibernation.
667 pr_err("Swap will be unusable! Try swapon -a.\n"); in power_down()
680 if (error == -EAGAIN || error == -EBUSY) { in power_down()
695 * corruption after resume. in power_down()
734 * hibernate - Carry out system hibernation, including saving the image.
744 return -EPERM; in hibernate()
754 return -EOPNOTSUPP; in hibernate()
761 error = -EBUSY; in hibernate()
852 * hibernate_quiet_exec - Execute a function with all devices frozen.
866 error = -EBUSY; in hibernate_quiet_exec()
952 return -ENOENT; in find_resume_device()
957 pr_info("Waiting %dsec before reading resume device ...\n", in find_resume_device()
1005 error = -EOPNOTSUPP; in software_resume()
1012 error = -EBUSY; in software_resume()
1017 pr_info("resume from hibernation\n"); in software_resume()
1040 pr_info("resume failed (%d)\n", error); in software_resume()
1053 * software_resume_initcall - Resume from a saved hibernation image.
1098 * /sys/power/disk - Control hibernation mode.
1157 buf[count - 1] = '\n'; in disk_show()
1173 return -EPERM; in disk_store()
1176 len = p ? p - buf : n; in disk_store()
1200 error = -EINVAL; in disk_store()
1203 error = -EINVAL; in disk_store()
1233 if (len && buf[len-1] == '\n') in resume_store()
1234 len--; in resume_store()
1237 return -ENOMEM; in resume_store()
1241 unsigned maj, min, offset; in resume_store() local
1246 sscanf(name, "%u:%u:%u:%c", &maj, &min, &offset, in resume_store()
1250 error = -EINVAL; in resume_store()
1254 error = -EINVAL; in resume_store()
1265 pm_pr_dbg("Configured hibernation resume from disk to %u\n", in resume_store()
1272 power_attr(resume);
1284 unsigned long long offset; in resume_offset_store() local
1287 rc = kstrtoull(buf, 0, &offset); in resume_offset_store()
1290 swsusp_resume_block = offset; in resume_offset_store()
1313 return -EINVAL; in image_size_store()
1335 return -EINVAL; in reserved_size_store()
1374 unsigned long long offset; in resume_offset_setup() local
1379 if (sscanf(str, "%llu", &offset) == 1) in resume_offset_setup()
1380 swsusp_resume_block = offset; in resume_offset_setup()
1482 __setup("resume=", resume_setup);