2 * sleep.c - ACPI sleep support.
4 * Copyright (c) 2005 Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
5 * Copyright (c) 2004 David Shaohua Li <shaohua.li@intel.com>
6 * Copyright (c) 2000-2003 Patrick Mochel
7 * Copyright (c) 2003 Open Source Development Lab
9 * This file is released under the GPLv2.
13 #include <linux/delay.h>
14 #include <linux/irq.h>
15 #include <linux/dmi.h>
16 #include <linux/device.h>
17 #include <linux/suspend.h>
18 #include <linux/reboot.h>
19 #include <linux/acpi.h>
20 #include <linux/module.h>
21 #include <linux/pm_runtime.h>
25 #include <acpi/acpi_bus.h>
26 #include <acpi/acpi_drivers.h>
31 static u8 sleep_states[ACPI_S_STATE_COUNT];
33 static void acpi_sleep_tts_switch(u32 acpi_state)
35 union acpi_object in_arg = { ACPI_TYPE_INTEGER };
36 struct acpi_object_list arg_list = { 1, &in_arg };
37 acpi_status status = AE_OK;
39 in_arg.integer.value = acpi_state;
40 status = acpi_evaluate_object(NULL, "\\_TTS", &arg_list, NULL);
41 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
43 * OS can't evaluate the _TTS object correctly. Some warning
44 * message will be printed. But it won't break anything.
46 printk(KERN_NOTICE "Failure in evaluating _TTS object\n");
50 static int tts_notify_reboot(struct notifier_block *this,
51 unsigned long code, void *x)
53 acpi_sleep_tts_switch(ACPI_STATE_S5);
57 static struct notifier_block tts_notifier = {
58 .notifier_call = tts_notify_reboot,
63 static int acpi_sleep_prepare(u32 acpi_state)
65 #ifdef CONFIG_ACPI_SLEEP
66 /* do we have a wakeup address for S2 and S3? */
67 if (acpi_state == ACPI_STATE_S3) {
68 if (!acpi_wakeup_address)
70 acpi_set_firmware_waking_vector(acpi_wakeup_address);
73 ACPI_FLUSH_CPU_CACHE();
75 printk(KERN_INFO PREFIX "Preparing to enter system sleep state S%d\n",
77 acpi_enable_wakeup_devices(acpi_state);
78 acpi_enter_sleep_state_prep(acpi_state);
82 #ifdef CONFIG_ACPI_SLEEP
83 static u32 acpi_target_sleep_state = ACPI_STATE_S0;
84 static bool pwr_btn_event_pending;
87 * The ACPI specification wants us to save NVS memory regions during hibernation
88 * and to restore them during the subsequent resume. Windows does that also for
89 * suspend to RAM. However, it is known that this mechanism does not work on
90 * all machines, so we allow the user to disable it with the help of the
91 * 'acpi_sleep=nonvs' kernel command line option.
93 static bool nvs_nosave;
95 void __init acpi_nvs_nosave(void)
101 * ACPI 1.0 wants us to execute _PTS before suspending devices, so we allow the
102 * user to request that behavior by using the 'acpi_old_suspend_ordering'
103 * kernel command line option that causes the following variable to be set.
105 static bool old_suspend_ordering;
107 void __init acpi_old_suspend_ordering(void)
109 old_suspend_ordering = true;
113 * acpi_pm_freeze - Disable the GPEs and suspend EC transactions.
115 static int acpi_pm_freeze(void)
117 acpi_disable_all_gpes();
118 acpi_os_wait_events_complete();
119 acpi_ec_block_transactions();
124 * acpi_pre_suspend - Enable wakeup devices, "freeze" EC and save NVS.
126 static int acpi_pm_pre_suspend(void)
129 return suspend_nvs_save();
133 * __acpi_pm_prepare - Prepare the platform to enter the target state.
135 * If necessary, set the firmware waking vector and do arch-specific
136 * nastiness to get the wakeup code to the waking vector.
138 static int __acpi_pm_prepare(void)
140 int error = acpi_sleep_prepare(acpi_target_sleep_state);
142 acpi_target_sleep_state = ACPI_STATE_S0;
148 * acpi_pm_prepare - Prepare the platform to enter the target sleep
149 * state and disable the GPEs.
151 static int acpi_pm_prepare(void)
153 int error = __acpi_pm_prepare();
155 error = acpi_pm_pre_suspend();
160 static int find_powerf_dev(struct device *dev, void *data)
162 struct acpi_device *device = to_acpi_device(dev);
163 const char *hid = acpi_device_hid(device);
165 return !strcmp(hid, ACPI_BUTTON_HID_POWERF);
169 * acpi_pm_finish - Instruct the platform to leave a sleep state.
171 * This is called after we wake back up (or if entering the sleep state
174 static void acpi_pm_finish(void)
176 struct device *pwr_btn_dev;
177 u32 acpi_state = acpi_target_sleep_state;
179 acpi_ec_unblock_transactions();
182 if (acpi_state == ACPI_STATE_S0)
185 printk(KERN_INFO PREFIX "Waking up from system sleep state S%d\n",
187 acpi_disable_wakeup_devices(acpi_state);
188 acpi_leave_sleep_state(acpi_state);
190 /* reset firmware waking vector */
191 acpi_set_firmware_waking_vector((acpi_physical_address) 0);
193 acpi_target_sleep_state = ACPI_STATE_S0;
195 /* If we were woken with the fixed power button, provide a small
196 * hint to userspace in the form of a wakeup event on the fixed power
197 * button device (if it can be found).
199 * We delay the event generation til now, as the PM layer requires
200 * timekeeping to be running before we generate events. */
201 if (!pwr_btn_event_pending)
204 pwr_btn_event_pending = false;
205 pwr_btn_dev = bus_find_device(&acpi_bus_type, NULL, NULL,
208 pm_wakeup_event(pwr_btn_dev, 0);
209 put_device(pwr_btn_dev);
214 * acpi_pm_end - Finish up suspend sequence.
216 static void acpi_pm_end(void)
219 * This is necessary in case acpi_pm_finish() is not called during a
220 * failing transition to a sleep state.
222 acpi_target_sleep_state = ACPI_STATE_S0;
223 acpi_sleep_tts_switch(acpi_target_sleep_state);
225 #else /* !CONFIG_ACPI_SLEEP */
226 #define acpi_target_sleep_state ACPI_STATE_S0
227 #endif /* CONFIG_ACPI_SLEEP */
229 #ifdef CONFIG_SUSPEND
230 static u32 acpi_suspend_states[] = {
231 [PM_SUSPEND_ON] = ACPI_STATE_S0,
232 [PM_SUSPEND_STANDBY] = ACPI_STATE_S1,
233 [PM_SUSPEND_MEM] = ACPI_STATE_S3,
234 [PM_SUSPEND_MAX] = ACPI_STATE_S5
238 * acpi_suspend_begin - Set the target system sleep state to the state
239 * associated with given @pm_state, if supported.
241 static int acpi_suspend_begin(suspend_state_t pm_state)
243 u32 acpi_state = acpi_suspend_states[pm_state];
246 error = nvs_nosave ? 0 : suspend_nvs_alloc();
250 if (sleep_states[acpi_state]) {
251 acpi_target_sleep_state = acpi_state;
252 acpi_sleep_tts_switch(acpi_target_sleep_state);
254 printk(KERN_ERR "ACPI does not support this state: %d\n",
262 * acpi_suspend_enter - Actually enter a sleep state.
265 * Flush caches and go to sleep. For STR we have to call arch-specific
266 * assembly, which in turn call acpi_enter_sleep_state().
267 * It's unfortunate, but it works. Please fix if you're feeling frisky.
269 static int acpi_suspend_enter(suspend_state_t pm_state)
271 acpi_status status = AE_OK;
272 u32 acpi_state = acpi_target_sleep_state;
275 ACPI_FLUSH_CPU_CACHE();
277 switch (acpi_state) {
280 status = acpi_enter_sleep_state(acpi_state);
284 error = acpi_suspend_lowlevel();
287 pr_info(PREFIX "Low-level resume complete\n");
291 /* This violates the spec but is required for bug compatibility. */
292 acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1);
294 /* Reprogram control registers */
295 acpi_leave_sleep_state_prep(acpi_state);
297 /* ACPI 3.0 specs (P62) says that it's the responsibility
298 * of the OSPM to clear the status bit [ implying that the
299 * POWER_BUTTON event should not reach userspace ]
301 * However, we do generate a small hint for userspace in the form of
302 * a wakeup event. We flag this condition for now and generate the
303 * event later, as we're currently too early in resume to be able to
304 * generate wakeup events.
306 if (ACPI_SUCCESS(status) && (acpi_state == ACPI_STATE_S3)) {
307 acpi_event_status pwr_btn_status;
309 acpi_get_event_status(ACPI_EVENT_POWER_BUTTON, &pwr_btn_status);
311 if (pwr_btn_status & ACPI_EVENT_FLAG_SET) {
312 acpi_clear_event(ACPI_EVENT_POWER_BUTTON);
314 pwr_btn_event_pending = true;
319 * Disable and clear GPE status before interrupt is enabled. Some GPEs
320 * (like wakeup GPE) haven't handler, this can avoid such GPE misfire.
321 * acpi_leave_sleep_state will reenable specific GPEs later
323 acpi_disable_all_gpes();
324 /* Allow EC transactions to happen. */
325 acpi_ec_unblock_transactions_early();
327 suspend_nvs_restore();
329 return ACPI_SUCCESS(status) ? 0 : -EFAULT;
332 static int acpi_suspend_state_valid(suspend_state_t pm_state)
338 case PM_SUSPEND_STANDBY:
340 acpi_state = acpi_suspend_states[pm_state];
342 return sleep_states[acpi_state];
348 static const struct platform_suspend_ops acpi_suspend_ops = {
349 .valid = acpi_suspend_state_valid,
350 .begin = acpi_suspend_begin,
351 .prepare_late = acpi_pm_prepare,
352 .enter = acpi_suspend_enter,
353 .wake = acpi_pm_finish,
358 * acpi_suspend_begin_old - Set the target system sleep state to the
359 * state associated with given @pm_state, if supported, and
360 * execute the _PTS control method. This function is used if the
361 * pre-ACPI 2.0 suspend ordering has been requested.
363 static int acpi_suspend_begin_old(suspend_state_t pm_state)
365 int error = acpi_suspend_begin(pm_state);
367 error = __acpi_pm_prepare();
373 * The following callbacks are used if the pre-ACPI 2.0 suspend ordering has
376 static const struct platform_suspend_ops acpi_suspend_ops_old = {
377 .valid = acpi_suspend_state_valid,
378 .begin = acpi_suspend_begin_old,
379 .prepare_late = acpi_pm_pre_suspend,
380 .enter = acpi_suspend_enter,
381 .wake = acpi_pm_finish,
383 .recover = acpi_pm_finish,
386 static int __init init_old_suspend_ordering(const struct dmi_system_id *d)
388 old_suspend_ordering = true;
392 static int __init init_nvs_nosave(const struct dmi_system_id *d)
398 static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
400 .callback = init_old_suspend_ordering,
401 .ident = "Abit KN9 (nForce4 variant)",
403 DMI_MATCH(DMI_BOARD_VENDOR, "http://www.abit.com.tw/"),
404 DMI_MATCH(DMI_BOARD_NAME, "KN9 Series(NF-CK804)"),
408 .callback = init_old_suspend_ordering,
409 .ident = "HP xw4600 Workstation",
411 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
412 DMI_MATCH(DMI_PRODUCT_NAME, "HP xw4600 Workstation"),
416 .callback = init_old_suspend_ordering,
417 .ident = "Asus Pundit P1-AH2 (M2N8L motherboard)",
419 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTek Computer INC."),
420 DMI_MATCH(DMI_BOARD_NAME, "M2N8L"),
424 .callback = init_old_suspend_ordering,
425 .ident = "Panasonic CF51-2L",
427 DMI_MATCH(DMI_BOARD_VENDOR,
428 "Matsushita Electric Industrial Co.,Ltd."),
429 DMI_MATCH(DMI_BOARD_NAME, "CF51-2L"),
433 .callback = init_nvs_nosave,
434 .ident = "Sony Vaio VGN-FW21E",
436 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
437 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FW21E"),
441 .callback = init_nvs_nosave,
442 .ident = "Sony Vaio VPCEB17FX",
444 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
445 DMI_MATCH(DMI_PRODUCT_NAME, "VPCEB17FX"),
449 .callback = init_nvs_nosave,
450 .ident = "Sony Vaio VGN-SR11M",
452 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
453 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SR11M"),
457 .callback = init_nvs_nosave,
458 .ident = "Everex StepNote Series",
460 DMI_MATCH(DMI_SYS_VENDOR, "Everex Systems, Inc."),
461 DMI_MATCH(DMI_PRODUCT_NAME, "Everex StepNote Series"),
465 .callback = init_nvs_nosave,
466 .ident = "Sony Vaio VPCEB1Z1E",
468 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
469 DMI_MATCH(DMI_PRODUCT_NAME, "VPCEB1Z1E"),
473 .callback = init_nvs_nosave,
474 .ident = "Sony Vaio VGN-NW130D",
476 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
477 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-NW130D"),
481 .callback = init_nvs_nosave,
482 .ident = "Sony Vaio VPCCW29FX",
484 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
485 DMI_MATCH(DMI_PRODUCT_NAME, "VPCCW29FX"),
489 .callback = init_nvs_nosave,
490 .ident = "Averatec AV1020-ED2",
492 DMI_MATCH(DMI_SYS_VENDOR, "AVERATEC"),
493 DMI_MATCH(DMI_PRODUCT_NAME, "1000 Series"),
497 .callback = init_old_suspend_ordering,
498 .ident = "Asus A8N-SLI DELUXE",
500 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
501 DMI_MATCH(DMI_BOARD_NAME, "A8N-SLI DELUXE"),
505 .callback = init_old_suspend_ordering,
506 .ident = "Asus A8N-SLI Premium",
508 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
509 DMI_MATCH(DMI_BOARD_NAME, "A8N-SLI Premium"),
513 .callback = init_nvs_nosave,
514 .ident = "Sony Vaio VGN-SR26GN_P",
516 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
517 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SR26GN_P"),
521 .callback = init_nvs_nosave,
522 .ident = "Sony Vaio VGN-FW520F",
524 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
525 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FW520F"),
529 .callback = init_nvs_nosave,
530 .ident = "Asus K54C",
532 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
533 DMI_MATCH(DMI_PRODUCT_NAME, "K54C"),
537 .callback = init_nvs_nosave,
538 .ident = "Asus K54HR",
540 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
541 DMI_MATCH(DMI_PRODUCT_NAME, "K54HR"),
546 #endif /* CONFIG_SUSPEND */
548 #ifdef CONFIG_HIBERNATION
549 static unsigned long s4_hardware_signature;
550 static struct acpi_table_facs *facs;
551 static bool nosigcheck;
553 void __init acpi_no_s4_hw_signature(void)
558 static int acpi_hibernation_begin(void)
562 error = nvs_nosave ? 0 : suspend_nvs_alloc();
564 acpi_target_sleep_state = ACPI_STATE_S4;
565 acpi_sleep_tts_switch(acpi_target_sleep_state);
571 static int acpi_hibernation_enter(void)
573 acpi_status status = AE_OK;
575 ACPI_FLUSH_CPU_CACHE();
577 /* This shouldn't return. If it returns, we have a problem */
578 status = acpi_enter_sleep_state(ACPI_STATE_S4);
579 /* Reprogram control registers */
580 acpi_leave_sleep_state_prep(ACPI_STATE_S4);
582 return ACPI_SUCCESS(status) ? 0 : -EFAULT;
585 static void acpi_hibernation_leave(void)
588 * If ACPI is not enabled by the BIOS and the boot kernel, we need to
592 /* Reprogram control registers */
593 acpi_leave_sleep_state_prep(ACPI_STATE_S4);
594 /* Check the hardware signature */
595 if (facs && s4_hardware_signature != facs->hardware_signature) {
596 printk(KERN_EMERG "ACPI: Hardware changed while hibernated, "
598 panic("ACPI S4 hardware signature mismatch");
600 /* Restore the NVS memory area */
601 suspend_nvs_restore();
602 /* Allow EC transactions to happen. */
603 acpi_ec_unblock_transactions_early();
606 static void acpi_pm_thaw(void)
608 acpi_ec_unblock_transactions();
609 acpi_enable_all_runtime_gpes();
612 static const struct platform_hibernation_ops acpi_hibernation_ops = {
613 .begin = acpi_hibernation_begin,
615 .pre_snapshot = acpi_pm_prepare,
616 .finish = acpi_pm_finish,
617 .prepare = acpi_pm_prepare,
618 .enter = acpi_hibernation_enter,
619 .leave = acpi_hibernation_leave,
620 .pre_restore = acpi_pm_freeze,
621 .restore_cleanup = acpi_pm_thaw,
625 * acpi_hibernation_begin_old - Set the target system sleep state to
626 * ACPI_STATE_S4 and execute the _PTS control method. This
627 * function is used if the pre-ACPI 2.0 suspend ordering has been
630 static int acpi_hibernation_begin_old(void)
634 * The _TTS object should always be evaluated before the _PTS object.
635 * When the old_suspended_ordering is true, the _PTS object is
636 * evaluated in the acpi_sleep_prepare.
638 acpi_sleep_tts_switch(ACPI_STATE_S4);
640 error = acpi_sleep_prepare(ACPI_STATE_S4);
644 error = suspend_nvs_alloc();
646 acpi_target_sleep_state = ACPI_STATE_S4;
652 * The following callbacks are used if the pre-ACPI 2.0 suspend ordering has
655 static const struct platform_hibernation_ops acpi_hibernation_ops_old = {
656 .begin = acpi_hibernation_begin_old,
658 .pre_snapshot = acpi_pm_pre_suspend,
659 .prepare = acpi_pm_freeze,
660 .finish = acpi_pm_finish,
661 .enter = acpi_hibernation_enter,
662 .leave = acpi_hibernation_leave,
663 .pre_restore = acpi_pm_freeze,
664 .restore_cleanup = acpi_pm_thaw,
665 .recover = acpi_pm_finish,
667 #endif /* CONFIG_HIBERNATION */
669 int acpi_suspend(u32 acpi_state)
671 suspend_state_t states[] = {
672 [1] = PM_SUSPEND_STANDBY,
673 [3] = PM_SUSPEND_MEM,
677 if (acpi_state < 6 && states[acpi_state])
678 return pm_suspend(states[acpi_state]);
686 * acpi_pm_device_sleep_state - Get preferred power state of ACPI device.
687 * @dev: Device whose preferred target power state to return.
688 * @d_min_p: Location to store the upper limit of the allowed states range.
689 * @d_max_in: Deepest low-power state to take into consideration.
690 * Return value: Preferred power state of the device on success, -ENODEV
691 * (if there's no 'struct acpi_device' for @dev) or -EINVAL on failure
693 * The caller must ensure that @dev is valid before using this function.
695 int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p, int d_max_in)
697 acpi_handle handle = DEVICE_ACPI_HANDLE(dev);
698 struct acpi_device *adev;
700 if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &adev))) {
701 dev_dbg(dev, "ACPI handle without context in %s!\n", __func__);
705 return acpi_device_power_state(dev, adev, acpi_target_sleep_state,
708 EXPORT_SYMBOL(acpi_pm_device_sleep_state);
709 #endif /* CONFIG_PM */
711 #ifdef CONFIG_PM_RUNTIME
713 * acpi_pm_device_run_wake - Enable/disable remote wakeup for given device.
714 * @phys_dev: Device to enable/disable the platform to wake up.
715 * @enable: Whether to enable or disable the wakeup functionality.
717 * Find the ACPI device object corresponding to @phys_dev and try to
718 * enable/disable the GPE associated with it, so that it can generate
719 * wakeup signals for the device in response to external (remote) events.
721 int acpi_pm_device_run_wake(struct device *phys_dev, bool enable)
723 struct acpi_device *dev;
726 if (!device_run_wake(phys_dev))
729 handle = DEVICE_ACPI_HANDLE(phys_dev);
730 if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &dev))) {
731 dev_dbg(phys_dev, "ACPI handle has no context in %s!\n",
737 acpi_enable_wakeup_device_power(dev, ACPI_STATE_S0);
738 acpi_enable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number);
740 acpi_disable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number);
741 acpi_disable_wakeup_device_power(dev);
746 EXPORT_SYMBOL(acpi_pm_device_run_wake);
747 #endif /* CONFIG_PM_RUNTIME */
749 #ifdef CONFIG_PM_SLEEP
751 * acpi_pm_device_sleep_wake - Enable or disable device to wake up the system.
752 * @dev: Device to enable/desible to wake up the system from sleep states.
753 * @enable: Whether to enable or disable @dev to wake up the system.
755 int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
758 struct acpi_device *adev;
761 if (!device_can_wakeup(dev))
764 handle = DEVICE_ACPI_HANDLE(dev);
765 if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &adev))) {
766 dev_dbg(dev, "ACPI handle has no context in %s!\n", __func__);
771 acpi_enable_wakeup_device_power(adev, acpi_target_sleep_state) :
772 acpi_disable_wakeup_device_power(adev);
774 dev_info(dev, "wake-up capability %s by ACPI\n",
775 enable ? "enabled" : "disabled");
779 #endif /* CONFIG_PM_SLEEP */
781 static void acpi_power_off_prepare(void)
783 /* Prepare to power off the system */
784 acpi_sleep_prepare(ACPI_STATE_S5);
785 acpi_disable_all_gpes();
788 static void acpi_power_off(void)
790 /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
791 printk(KERN_DEBUG "%s called\n", __func__);
793 acpi_enter_sleep_state(ACPI_STATE_S5);
796 int __init acpi_sleep_init(void)
800 #ifdef CONFIG_SUSPEND
803 dmi_check_system(acpisleep_dmi_table);
809 sleep_states[ACPI_STATE_S0] = 1;
810 printk(KERN_INFO PREFIX "(supports S0");
812 #ifdef CONFIG_SUSPEND
813 for (i = ACPI_STATE_S1; i < ACPI_STATE_S4; i++) {
814 status = acpi_get_sleep_type_data(i, &type_a, &type_b);
815 if (ACPI_SUCCESS(status)) {
817 printk(KERN_CONT " S%d", i);
821 suspend_set_ops(old_suspend_ordering ?
822 &acpi_suspend_ops_old : &acpi_suspend_ops);
825 #ifdef CONFIG_HIBERNATION
826 status = acpi_get_sleep_type_data(ACPI_STATE_S4, &type_a, &type_b);
827 if (ACPI_SUCCESS(status)) {
828 hibernation_set_ops(old_suspend_ordering ?
829 &acpi_hibernation_ops_old : &acpi_hibernation_ops);
830 sleep_states[ACPI_STATE_S4] = 1;
831 printk(KERN_CONT " S4");
833 acpi_get_table(ACPI_SIG_FACS, 1,
834 (struct acpi_table_header **)&facs);
836 s4_hardware_signature =
837 facs->hardware_signature;
841 status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b);
842 if (ACPI_SUCCESS(status)) {
843 sleep_states[ACPI_STATE_S5] = 1;
844 printk(KERN_CONT " S5");
845 pm_power_off_prepare = acpi_power_off_prepare;
846 pm_power_off = acpi_power_off;
848 printk(KERN_CONT ")\n");
850 * Register the tts_notifier to reboot notifier list so that the _TTS
851 * object can also be evaluated when the system enters S5.
853 register_reboot_notifier(&tts_notifier);