2 * kernel/power/hibernate.c - Hibernation (a.k.a suspend-to-disk) support.
4 * Copyright (c) 2003 Patrick Mochel
5 * Copyright (c) 2003 Open Source Development Lab
6 * Copyright (c) 2004 Pavel Machek <pavel@ucw.cz>
7 * Copyright (c) 2009 Rafael J. Wysocki, Novell Inc.
8 * Copyright (C) 2012 Bojan Smojver <bojan@rexursive.com>
10 * This file is released under the GPLv2.
13 #include <linux/export.h>
14 #include <linux/suspend.h>
15 #include <linux/syscalls.h>
16 #include <linux/reboot.h>
17 #include <linux/string.h>
18 #include <linux/device.h>
19 #include <linux/async.h>
20 #include <linux/delay.h>
22 #include <linux/mount.h>
24 #include <linux/console.h>
25 #include <linux/cpu.h>
26 #include <linux/freezer.h>
27 #include <linux/gfp.h>
28 #include <linux/syscore_ops.h>
29 #include <linux/ctype.h>
30 #include <linux/genhd.h>
31 #include <trace/events/power.h>
36 static int nocompress;
38 static int nohibernate;
39 static int resume_wait;
40 static unsigned int resume_delay;
41 static char resume_file[256] = CONFIG_PM_STD_PARTITION;
42 dev_t swsusp_resume_device;
43 sector_t swsusp_resume_block;
44 __visible int in_suspend __nosavedata;
55 __HIBERNATION_AFTER_LAST
57 #define HIBERNATION_MAX (__HIBERNATION_AFTER_LAST-1)
58 #define HIBERNATION_FIRST (HIBERNATION_INVALID + 1)
60 static int hibernation_mode = HIBERNATION_SHUTDOWN;
62 bool freezer_test_done;
64 static const struct platform_hibernation_ops *hibernation_ops;
66 bool hibernation_available(void)
68 return (nohibernate == 0);
72 * hibernation_set_ops - Set the global hibernate operations.
73 * @ops: Hibernation operations to use in subsequent hibernation transitions.
75 void hibernation_set_ops(const struct platform_hibernation_ops *ops)
77 if (ops && !(ops->begin && ops->end && ops->pre_snapshot
78 && ops->prepare && ops->finish && ops->enter && ops->pre_restore
79 && ops->restore_cleanup && ops->leave)) {
84 hibernation_ops = ops;
86 hibernation_mode = HIBERNATION_PLATFORM;
87 else if (hibernation_mode == HIBERNATION_PLATFORM)
88 hibernation_mode = HIBERNATION_SHUTDOWN;
90 unlock_system_sleep();
92 EXPORT_SYMBOL_GPL(hibernation_set_ops);
94 static bool entering_platform_hibernation;
96 bool system_entering_hibernation(void)
98 return entering_platform_hibernation;
100 EXPORT_SYMBOL(system_entering_hibernation);
102 #ifdef CONFIG_PM_DEBUG
103 static void hibernation_debug_sleep(void)
105 printk(KERN_INFO "hibernation debug: Waiting for 5 seconds.\n");
109 static int hibernation_test(int level)
111 if (pm_test_level == level) {
112 hibernation_debug_sleep();
117 #else /* !CONFIG_PM_DEBUG */
118 static int hibernation_test(int level) { return 0; }
119 #endif /* !CONFIG_PM_DEBUG */
122 * platform_begin - Call platform to start hibernation.
123 * @platform_mode: Whether or not to use the platform driver.
125 static int platform_begin(int platform_mode)
127 return (platform_mode && hibernation_ops) ?
128 hibernation_ops->begin() : 0;
132 * platform_end - Call platform to finish transition to the working state.
133 * @platform_mode: Whether or not to use the platform driver.
135 static void platform_end(int platform_mode)
137 if (platform_mode && hibernation_ops)
138 hibernation_ops->end();
142 * platform_pre_snapshot - Call platform to prepare the machine for hibernation.
143 * @platform_mode: Whether or not to use the platform driver.
145 * Use the platform driver to prepare the system for creating a hibernate image,
146 * if so configured, and return an error code if that fails.
149 static int platform_pre_snapshot(int platform_mode)
151 return (platform_mode && hibernation_ops) ?
152 hibernation_ops->pre_snapshot() : 0;
156 * platform_leave - Call platform to prepare a transition to the working state.
157 * @platform_mode: Whether or not to use the platform driver.
159 * Use the platform driver prepare to prepare the machine for switching to the
160 * normal mode of operation.
162 * This routine is called on one CPU with interrupts disabled.
164 static void platform_leave(int platform_mode)
166 if (platform_mode && hibernation_ops)
167 hibernation_ops->leave();
171 * platform_finish - Call platform to switch the system to the working state.
172 * @platform_mode: Whether or not to use the platform driver.
174 * Use the platform driver to switch the machine to the normal mode of
177 * This routine must be called after platform_prepare().
179 static void platform_finish(int platform_mode)
181 if (platform_mode && hibernation_ops)
182 hibernation_ops->finish();
186 * platform_pre_restore - Prepare for hibernate image restoration.
187 * @platform_mode: Whether or not to use the platform driver.
189 * Use the platform driver to prepare the system for resume from a hibernation
192 * If the restore fails after this function has been called,
193 * platform_restore_cleanup() must be called.
195 static int platform_pre_restore(int platform_mode)
197 return (platform_mode && hibernation_ops) ?
198 hibernation_ops->pre_restore() : 0;
202 * platform_restore_cleanup - Switch to the working state after failing restore.
203 * @platform_mode: Whether or not to use the platform driver.
205 * Use the platform driver to switch the system to the normal mode of operation
206 * after a failing restore.
208 * If platform_pre_restore() has been called before the failing restore, this
209 * function must be called too, regardless of the result of
210 * platform_pre_restore().
212 static void platform_restore_cleanup(int platform_mode)
214 if (platform_mode && hibernation_ops)
215 hibernation_ops->restore_cleanup();
219 * platform_recover - Recover from a failure to suspend devices.
220 * @platform_mode: Whether or not to use the platform driver.
222 static void platform_recover(int platform_mode)
224 if (platform_mode && hibernation_ops && hibernation_ops->recover)
225 hibernation_ops->recover();
229 * swsusp_show_speed - Print time elapsed between two events during hibernation.
230 * @start: Starting event.
231 * @stop: Final event.
232 * @nr_pages: Number of memory pages processed between @start and @stop.
233 * @msg: Additional diagnostic message to print.
235 void swsusp_show_speed(struct timeval *start, struct timeval *stop,
236 unsigned nr_pages, char *msg)
238 u64 elapsed_centisecs64;
239 unsigned int centisecs;
243 elapsed_centisecs64 = timeval_to_ns(stop) - timeval_to_ns(start);
245 * If "(s64)elapsed_centisecs64 < 0", it will print long elapsed time,
246 * it is obvious enough for what went wrong.
248 do_div(elapsed_centisecs64, NSEC_PER_SEC / 100);
249 centisecs = elapsed_centisecs64;
251 centisecs = 1; /* avoid div-by-zero */
252 k = nr_pages * (PAGE_SIZE / 1024);
253 kps = (k * 100) / centisecs;
254 printk(KERN_INFO "PM: %s %u kbytes in %u.%02u seconds (%u.%02u MB/s)\n",
256 centisecs / 100, centisecs % 100,
257 kps / 1000, (kps % 1000) / 10);
261 * create_image - Create a hibernation image.
262 * @platform_mode: Whether or not to use the platform driver.
264 * Execute device drivers' "late" and "noirq" freeze callbacks, create a
265 * hibernation image and run the drivers' "noirq" and "early" thaw callbacks.
267 * Control reappears in this routine after the subsequent restore.
269 static int create_image(int platform_mode)
273 error = dpm_suspend_end(PMSG_FREEZE);
275 printk(KERN_ERR "PM: Some devices failed to power down, "
276 "aborting hibernation\n");
280 error = platform_pre_snapshot(platform_mode);
281 if (error || hibernation_test(TEST_PLATFORM))
282 goto Platform_finish;
284 error = disable_nonboot_cpus();
285 if (error || hibernation_test(TEST_CPUS))
290 error = syscore_suspend();
292 printk(KERN_ERR "PM: Some system devices failed to power down, "
293 "aborting hibernation\n");
297 if (hibernation_test(TEST_CORE) || pm_wakeup_pending())
301 save_processor_state();
302 trace_suspend_resume(TPS("machine_suspend"), PM_EVENT_HIBERNATE, true);
303 error = swsusp_arch_suspend();
304 trace_suspend_resume(TPS("machine_suspend"), PM_EVENT_HIBERNATE, false);
306 printk(KERN_ERR "PM: Error %d creating hibernation image\n",
308 /* Restore control flow magically appears here */
309 restore_processor_state();
311 events_check_enabled = false;
313 platform_leave(platform_mode);
322 enable_nonboot_cpus();
325 platform_finish(platform_mode);
327 dpm_resume_start(in_suspend ?
328 (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE);
334 * hibernation_snapshot - Quiesce devices and create a hibernation image.
335 * @platform_mode: If set, use platform driver to prepare for the transition.
337 * This routine must be called with pm_mutex held.
339 int hibernation_snapshot(int platform_mode)
344 error = platform_begin(platform_mode);
348 /* Preallocate image memory before shutting down devices. */
349 error = hibernate_preallocate_memory();
353 error = freeze_kernel_threads();
357 if (hibernation_test(TEST_FREEZER)) {
360 * Indicate to the caller that we are returning due to a
361 * successful freezer test.
363 freezer_test_done = true;
367 error = dpm_prepare(PMSG_FREEZE);
369 dpm_complete(PMSG_RECOVER);
374 pm_restrict_gfp_mask();
376 error = dpm_suspend(PMSG_FREEZE);
378 if (error || hibernation_test(TEST_DEVICES))
379 platform_recover(platform_mode);
381 error = create_image(platform_mode);
384 * In the case that we call create_image() above, the control
385 * returns here (1) after the image has been created or the
386 * image creation has failed and (2) after a successful restore.
389 /* We may need to release the preallocated image pages here. */
390 if (error || !in_suspend)
393 msg = in_suspend ? (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE;
396 if (error || !in_suspend)
397 pm_restore_gfp_mask();
403 platform_end(platform_mode);
407 thaw_kernel_threads();
414 * resume_target_kernel - Restore system state from a hibernation image.
415 * @platform_mode: Whether or not to use the platform driver.
417 * Execute device drivers' "noirq" and "late" freeze callbacks, restore the
418 * contents of highmem that have not been restored yet from the image and run
419 * the low-level code that will restore the remaining contents of memory and
420 * switch to the just restored target kernel.
422 static int resume_target_kernel(bool platform_mode)
426 error = dpm_suspend_end(PMSG_QUIESCE);
428 printk(KERN_ERR "PM: Some devices failed to power down, "
429 "aborting resume\n");
433 error = platform_pre_restore(platform_mode);
437 error = disable_nonboot_cpus();
443 error = syscore_suspend();
447 save_processor_state();
448 error = restore_highmem();
450 error = swsusp_arch_resume();
452 * The code below is only ever reached in case of a failure.
453 * Otherwise, execution continues at the place where
454 * swsusp_arch_suspend() was called.
458 * This call to restore_highmem() reverts the changes made by
464 * The only reason why swsusp_arch_resume() can fail is memory being
465 * very tight, so we have to free it as soon as we can to avoid
466 * subsequent failures.
469 restore_processor_state();
470 touch_softlockup_watchdog();
478 enable_nonboot_cpus();
481 platform_restore_cleanup(platform_mode);
483 dpm_resume_start(PMSG_RECOVER);
489 * hibernation_restore - Quiesce devices and restore from a hibernation image.
490 * @platform_mode: If set, use platform driver to prepare for the transition.
492 * This routine must be called with pm_mutex held. If it is successful, control
493 * reappears in the restored target kernel in hibernation_snapshot().
495 int hibernation_restore(int platform_mode)
499 pm_prepare_console();
501 pm_restrict_gfp_mask();
502 error = dpm_suspend_start(PMSG_QUIESCE);
504 error = resume_target_kernel(platform_mode);
505 dpm_resume_end(PMSG_RECOVER);
507 pm_restore_gfp_mask();
509 pm_restore_console();
514 * hibernation_platform_enter - Power off the system using the platform driver.
516 int hibernation_platform_enter(void)
520 if (!hibernation_ops)
524 * We have cancelled the power transition by running
525 * hibernation_ops->finish() before saving the image, so we should let
526 * the firmware know that we're going to enter the sleep state after all
528 error = hibernation_ops->begin();
532 entering_platform_hibernation = true;
534 error = dpm_suspend_start(PMSG_HIBERNATE);
536 if (hibernation_ops->recover)
537 hibernation_ops->recover();
541 error = dpm_suspend_end(PMSG_HIBERNATE);
545 error = hibernation_ops->prepare();
547 goto Platform_finish;
549 error = disable_nonboot_cpus();
551 goto Platform_finish;
555 if (pm_wakeup_pending()) {
560 hibernation_ops->enter();
561 /* We should never get here */
567 enable_nonboot_cpus();
570 hibernation_ops->finish();
572 dpm_resume_start(PMSG_RESTORE);
575 entering_platform_hibernation = false;
576 dpm_resume_end(PMSG_RESTORE);
580 hibernation_ops->end();
586 * power_down - Shut the machine down for hibernation.
588 * Use the platform driver, if configured, to put the system into the sleep
589 * state corresponding to hibernation, or try to power it off or reboot,
590 * depending on the value of hibernation_mode.
592 static void power_down(void)
594 #ifdef CONFIG_SUSPEND
598 switch (hibernation_mode) {
599 case HIBERNATION_REBOOT:
600 kernel_restart(NULL);
602 case HIBERNATION_PLATFORM:
603 hibernation_platform_enter();
604 case HIBERNATION_SHUTDOWN:
608 #ifdef CONFIG_SUSPEND
609 case HIBERNATION_SUSPEND:
610 error = suspend_devices_and_enter(PM_SUSPEND_MEM);
613 hibernation_mode = HIBERNATION_PLATFORM;
615 hibernation_mode = HIBERNATION_SHUTDOWN;
619 * Restore swap signature.
621 error = swsusp_unmark();
623 printk(KERN_ERR "PM: Swap will be unusable! "
630 * Valid image is on the disk, if we continue we risk serious data
631 * corruption after resume.
633 printk(KERN_CRIT "PM: Please power down manually\n");
639 * hibernate - Carry out system hibernation, including saving the image.
645 if (!hibernation_available()) {
646 pr_debug("PM: Hibernation not available.\n");
651 /* The snapshot device should not be opened while we're running */
652 if (!atomic_add_unless(&snapshot_device_available, -1, 0)) {
657 pm_prepare_console();
658 error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE);
662 printk(KERN_INFO "PM: Syncing filesystems ... ");
666 error = freeze_processes();
670 lock_device_hotplug();
671 /* Allocate memory management structures */
672 error = create_basic_memory_bitmaps();
676 error = hibernation_snapshot(hibernation_mode == HIBERNATION_PLATFORM);
677 if (error || freezer_test_done)
681 unsigned int flags = 0;
683 if (hibernation_mode == HIBERNATION_PLATFORM)
684 flags |= SF_PLATFORM_MODE;
686 flags |= SF_NOCOMPRESS_MODE;
688 flags |= SF_CRC32_MODE;
690 pr_debug("PM: writing image.\n");
691 error = swsusp_write(flags);
696 pm_restore_gfp_mask();
698 pr_debug("PM: Image restored successfully.\n");
702 free_basic_memory_bitmaps();
704 unlock_device_hotplug();
707 /* Don't bother checking whether freezer_test_done is true */
708 freezer_test_done = false;
710 pm_notifier_call_chain(PM_POST_HIBERNATION);
711 pm_restore_console();
712 atomic_inc(&snapshot_device_available);
714 unlock_system_sleep();
720 * software_resume - Resume from a saved hibernation image.
722 * This routine is called as a late initcall, when all devices have been
723 * discovered and initialized already.
725 * The image reading code is called to see if there is a hibernation image
726 * available for reading. If that is the case, devices are quiesced and the
727 * contents of memory is restored from the saved image.
729 * If this is successful, control reappears in the restored target kernel in
730 * hibernation_snaphot() which returns to hibernate(). Otherwise, the routine
731 * attempts to recover gracefully and make the kernel return to the normal mode
734 static int software_resume(void)
740 * If the user said "noresume".. bail out early.
742 if (noresume || !hibernation_available())
746 * name_to_dev_t() below takes a sysfs buffer mutex when sysfs
747 * is configured into the kernel. Since the regular hibernate
748 * trigger path is via sysfs which takes a buffer mutex before
749 * calling hibernate functions (which take pm_mutex) this can
750 * cause lockdep to complain about a possible ABBA deadlock
751 * which cannot happen since we're in the boot code here and
752 * sysfs can't be invoked yet. Therefore, we use a subclass
753 * here to avoid lockdep complaining.
755 mutex_lock_nested(&pm_mutex, SINGLE_DEPTH_NESTING);
757 if (swsusp_resume_device)
760 if (!strlen(resume_file)) {
765 pr_debug("PM: Checking hibernation image partition %s\n", resume_file);
768 printk(KERN_INFO "Waiting %dsec before reading resume device...\n",
770 ssleep(resume_delay);
773 /* Check if the device is there */
774 swsusp_resume_device = name_to_dev_t(resume_file);
777 * name_to_dev_t is ineffective to verify parition if resume_file is in
778 * integer format. (e.g. major:minor)
780 if (isdigit(resume_file[0]) && resume_wait) {
782 while (!get_gendisk(swsusp_resume_device, &partno))
786 if (!swsusp_resume_device) {
788 * Some device discovery might still be in progress; we need
789 * to wait for this to finish.
791 wait_for_device_probe();
794 while ((swsusp_resume_device = name_to_dev_t(resume_file)) == 0)
796 async_synchronize_full();
799 swsusp_resume_device = name_to_dev_t(resume_file);
800 if (!swsusp_resume_device) {
807 pr_debug("PM: Hibernation image partition %d:%d present\n",
808 MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device));
810 pr_debug("PM: Looking for hibernation image.\n");
811 error = swsusp_check();
815 /* The snapshot device should not be opened while we're running */
816 if (!atomic_add_unless(&snapshot_device_available, -1, 0)) {
818 swsusp_close(FMODE_READ);
822 pm_prepare_console();
823 error = pm_notifier_call_chain(PM_RESTORE_PREPARE);
827 pr_debug("PM: Preparing processes for restore.\n");
828 error = freeze_processes();
832 pr_debug("PM: Loading hibernation image.\n");
834 lock_device_hotplug();
835 error = create_basic_memory_bitmaps();
839 error = swsusp_read(&flags);
840 swsusp_close(FMODE_READ);
842 hibernation_restore(flags & SF_PLATFORM_MODE);
844 printk(KERN_ERR "PM: Failed to load hibernation image, recovering.\n");
846 free_basic_memory_bitmaps();
848 unlock_device_hotplug();
851 pm_notifier_call_chain(PM_POST_RESTORE);
852 pm_restore_console();
853 atomic_inc(&snapshot_device_available);
854 /* For success case, the suspend path will release the lock */
856 mutex_unlock(&pm_mutex);
857 pr_debug("PM: Hibernation image not present or could not be loaded.\n");
860 swsusp_close(FMODE_READ);
864 late_initcall_sync(software_resume);
867 static const char * const hibernation_modes[] = {
868 [HIBERNATION_PLATFORM] = "platform",
869 [HIBERNATION_SHUTDOWN] = "shutdown",
870 [HIBERNATION_REBOOT] = "reboot",
871 #ifdef CONFIG_SUSPEND
872 [HIBERNATION_SUSPEND] = "suspend",
877 * /sys/power/disk - Control hibernation mode.
879 * Hibernation can be handled in several ways. There are a few different ways
880 * to put the system into the sleep state: using the platform driver (e.g. ACPI
881 * or other hibernation_ops), powering it off or rebooting it (for testing
884 * The sysfs file /sys/power/disk provides an interface for selecting the
885 * hibernation mode to use. Reading from this file causes the available modes
886 * to be printed. There are 3 modes that can be supported:
892 * If a platform hibernation driver is in use, 'platform' will be supported
893 * and will be used by default. Otherwise, 'shutdown' will be used by default.
894 * The selected option (i.e. the one corresponding to the current value of
895 * hibernation_mode) is enclosed by a square bracket.
897 * To select a given hibernation mode it is necessary to write the mode's
898 * string representation (as returned by reading from /sys/power/disk) back
899 * into /sys/power/disk.
902 static ssize_t disk_show(struct kobject *kobj, struct kobj_attribute *attr,
908 if (!hibernation_available())
909 return sprintf(buf, "[disabled]\n");
911 for (i = HIBERNATION_FIRST; i <= HIBERNATION_MAX; i++) {
912 if (!hibernation_modes[i])
915 case HIBERNATION_SHUTDOWN:
916 case HIBERNATION_REBOOT:
917 #ifdef CONFIG_SUSPEND
918 case HIBERNATION_SUSPEND:
921 case HIBERNATION_PLATFORM:
924 /* not a valid mode, continue with loop */
927 if (i == hibernation_mode)
928 buf += sprintf(buf, "[%s] ", hibernation_modes[i]);
930 buf += sprintf(buf, "%s ", hibernation_modes[i]);
932 buf += sprintf(buf, "\n");
936 static ssize_t disk_store(struct kobject *kobj, struct kobj_attribute *attr,
937 const char *buf, size_t n)
943 int mode = HIBERNATION_INVALID;
945 if (!hibernation_available())
948 p = memchr(buf, '\n', n);
949 len = p ? p - buf : n;
952 for (i = HIBERNATION_FIRST; i <= HIBERNATION_MAX; i++) {
953 if (len == strlen(hibernation_modes[i])
954 && !strncmp(buf, hibernation_modes[i], len)) {
959 if (mode != HIBERNATION_INVALID) {
961 case HIBERNATION_SHUTDOWN:
962 case HIBERNATION_REBOOT:
963 #ifdef CONFIG_SUSPEND
964 case HIBERNATION_SUSPEND:
966 hibernation_mode = mode;
968 case HIBERNATION_PLATFORM:
970 hibernation_mode = mode;
978 pr_debug("PM: Hibernation mode set to '%s'\n",
979 hibernation_modes[mode]);
980 unlock_system_sleep();
981 return error ? error : n;
986 static ssize_t resume_show(struct kobject *kobj, struct kobj_attribute *attr,
989 return sprintf(buf,"%d:%d\n", MAJOR(swsusp_resume_device),
990 MINOR(swsusp_resume_device));
993 static ssize_t resume_store(struct kobject *kobj, struct kobj_attribute *attr,
994 const char *buf, size_t n)
1000 if (len && buf[len-1] == '\n')
1002 name = kstrndup(buf, len, GFP_KERNEL);
1006 res = name_to_dev_t(name);
1011 lock_system_sleep();
1012 swsusp_resume_device = res;
1013 unlock_system_sleep();
1014 printk(KERN_INFO "PM: Starting manual resume from disk\n");
1022 static ssize_t image_size_show(struct kobject *kobj, struct kobj_attribute *attr,
1025 return sprintf(buf, "%lu\n", image_size);
1028 static ssize_t image_size_store(struct kobject *kobj, struct kobj_attribute *attr,
1029 const char *buf, size_t n)
1033 if (sscanf(buf, "%lu", &size) == 1) {
1041 power_attr(image_size);
1043 static ssize_t reserved_size_show(struct kobject *kobj,
1044 struct kobj_attribute *attr, char *buf)
1046 return sprintf(buf, "%lu\n", reserved_size);
1049 static ssize_t reserved_size_store(struct kobject *kobj,
1050 struct kobj_attribute *attr,
1051 const char *buf, size_t n)
1055 if (sscanf(buf, "%lu", &size) == 1) {
1056 reserved_size = size;
1063 power_attr(reserved_size);
1065 static struct attribute * g[] = {
1068 &image_size_attr.attr,
1069 &reserved_size_attr.attr,
1074 static struct attribute_group attr_group = {
1079 static int __init pm_disk_init(void)
1081 return sysfs_create_group(power_kobj, &attr_group);
1084 core_initcall(pm_disk_init);
1087 static int __init resume_setup(char *str)
1092 strncpy( resume_file, str, 255 );
1096 static int __init resume_offset_setup(char *str)
1098 unsigned long long offset;
1103 if (sscanf(str, "%llu", &offset) == 1)
1104 swsusp_resume_block = offset;
1109 static int __init hibernate_setup(char *str)
1111 if (!strncmp(str, "noresume", 8))
1113 else if (!strncmp(str, "nocompress", 10))
1115 else if (!strncmp(str, "no", 2)) {
1122 static int __init noresume_setup(char *str)
1128 static int __init resumewait_setup(char *str)
1134 static int __init resumedelay_setup(char *str)
1136 int rc = kstrtouint(str, 0, &resume_delay);
1143 static int __init nohibernate_setup(char *str)
1150 static int __init kaslr_nohibernate_setup(char *str)
1152 return nohibernate_setup(str);
1155 __setup("noresume", noresume_setup);
1156 __setup("resume_offset=", resume_offset_setup);
1157 __setup("resume=", resume_setup);
1158 __setup("hibernate=", hibernate_setup);
1159 __setup("resumewait", resumewait_setup);
1160 __setup("resumedelay=", resumedelay_setup);
1161 __setup("nohibernate", nohibernate_setup);
1162 __setup("kaslr", kaslr_nohibernate_setup);