main.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. /*
  2. * sleep.c - ACPI sleep support.
  3. *
  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
  8. *
  9. * This file is released under the GPLv2.
  10. *
  11. */
  12. #include <linux/delay.h>
  13. #include <linux/irq.h>
  14. #include <linux/dmi.h>
  15. #include <linux/device.h>
  16. #include <linux/suspend.h>
  17. #include <linux/reboot.h>
  18. #include <asm/io.h>
  19. #include <acpi/acpi_bus.h>
  20. #include <acpi/acpi_drivers.h>
  21. #include "sleep.h"
  22. u8 sleep_states[ACPI_S_STATE_COUNT];
  23. static void acpi_sleep_tts_switch(u32 acpi_state)
  24. {
  25. union acpi_object in_arg = { ACPI_TYPE_INTEGER };
  26. struct acpi_object_list arg_list = { 1, &in_arg };
  27. acpi_status status = AE_OK;
  28. in_arg.integer.value = acpi_state;
  29. status = acpi_evaluate_object(NULL, "\\_TTS", &arg_list, NULL);
  30. if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
  31. /*
  32. * OS can't evaluate the _TTS object correctly. Some warning
  33. * message will be printed. But it won't break anything.
  34. */
  35. printk(KERN_NOTICE "Failure in evaluating _TTS object\n");
  36. }
  37. }
  38. static int tts_notify_reboot(struct notifier_block *this,
  39. unsigned long code, void *x)
  40. {
  41. acpi_sleep_tts_switch(ACPI_STATE_S5);
  42. return NOTIFY_DONE;
  43. }
  44. static struct notifier_block tts_notifier = {
  45. .notifier_call = tts_notify_reboot,
  46. .next = NULL,
  47. .priority = 0,
  48. };
  49. static int acpi_sleep_prepare(u32 acpi_state)
  50. {
  51. #ifdef CONFIG_ACPI_SLEEP
  52. /* do we have a wakeup address for S2 and S3? */
  53. if (acpi_state == ACPI_STATE_S3) {
  54. if (!acpi_wakeup_address) {
  55. return -EFAULT;
  56. }
  57. acpi_set_firmware_waking_vector(
  58. (acpi_physical_address)acpi_wakeup_address);
  59. }
  60. ACPI_FLUSH_CPU_CACHE();
  61. acpi_enable_wakeup_device_prep(acpi_state);
  62. #endif
  63. printk(KERN_INFO PREFIX "Preparing to enter system sleep state S%d\n",
  64. acpi_state);
  65. acpi_enter_sleep_state_prep(acpi_state);
  66. return 0;
  67. }
  68. #ifdef CONFIG_ACPI_SLEEP
  69. static u32 acpi_target_sleep_state = ACPI_STATE_S0;
  70. /*
  71. * ACPI 1.0 wants us to execute _PTS before suspending devices, so we allow the
  72. * user to request that behavior by using the 'acpi_old_suspend_ordering'
  73. * kernel command line option that causes the following variable to be set.
  74. */
  75. static bool old_suspend_ordering;
  76. void __init acpi_old_suspend_ordering(void)
  77. {
  78. old_suspend_ordering = true;
  79. }
  80. /**
  81. * acpi_pm_disable_gpes - Disable the GPEs.
  82. */
  83. static int acpi_pm_disable_gpes(void)
  84. {
  85. acpi_hw_disable_all_gpes();
  86. return 0;
  87. }
  88. /**
  89. * __acpi_pm_prepare - Prepare the platform to enter the target state.
  90. *
  91. * If necessary, set the firmware waking vector and do arch-specific
  92. * nastiness to get the wakeup code to the waking vector.
  93. */
  94. static int __acpi_pm_prepare(void)
  95. {
  96. int error = acpi_sleep_prepare(acpi_target_sleep_state);
  97. if (error)
  98. acpi_target_sleep_state = ACPI_STATE_S0;
  99. return error;
  100. }
  101. /**
  102. * acpi_pm_prepare - Prepare the platform to enter the target sleep
  103. * state and disable the GPEs.
  104. */
  105. static int acpi_pm_prepare(void)
  106. {
  107. int error = __acpi_pm_prepare();
  108. if (!error)
  109. acpi_hw_disable_all_gpes();
  110. return error;
  111. }
  112. /**
  113. * acpi_pm_finish - Instruct the platform to leave a sleep state.
  114. *
  115. * This is called after we wake back up (or if entering the sleep state
  116. * failed).
  117. */
  118. static void acpi_pm_finish(void)
  119. {
  120. u32 acpi_state = acpi_target_sleep_state;
  121. if (acpi_state == ACPI_STATE_S0)
  122. return;
  123. printk(KERN_INFO PREFIX "Waking up from system sleep state S%d\n",
  124. acpi_state);
  125. acpi_disable_wakeup_device(acpi_state);
  126. acpi_leave_sleep_state(acpi_state);
  127. /* reset firmware waking vector */
  128. acpi_set_firmware_waking_vector((acpi_physical_address) 0);
  129. acpi_target_sleep_state = ACPI_STATE_S0;
  130. }
  131. /**
  132. * acpi_pm_end - Finish up suspend sequence.
  133. */
  134. static void acpi_pm_end(void)
  135. {
  136. /*
  137. * This is necessary in case acpi_pm_finish() is not called during a
  138. * failing transition to a sleep state.
  139. */
  140. acpi_target_sleep_state = ACPI_STATE_S0;
  141. acpi_sleep_tts_switch(acpi_target_sleep_state);
  142. }
  143. #else /* !CONFIG_ACPI_SLEEP */
  144. #define acpi_target_sleep_state ACPI_STATE_S0
  145. #endif /* CONFIG_ACPI_SLEEP */
  146. #ifdef CONFIG_SUSPEND
  147. extern void do_suspend_lowlevel(void);
  148. static u32 acpi_suspend_states[] = {
  149. [PM_SUSPEND_ON] = ACPI_STATE_S0,
  150. [PM_SUSPEND_STANDBY] = ACPI_STATE_S1,
  151. [PM_SUSPEND_MEM] = ACPI_STATE_S3,
  152. [PM_SUSPEND_MAX] = ACPI_STATE_S5
  153. };
  154. /**
  155. * acpi_suspend_begin - Set the target system sleep state to the state
  156. * associated with given @pm_state, if supported.
  157. */
  158. static int acpi_suspend_begin(suspend_state_t pm_state)
  159. {
  160. u32 acpi_state = acpi_suspend_states[pm_state];
  161. int error = 0;
  162. if (sleep_states[acpi_state]) {
  163. acpi_target_sleep_state = acpi_state;
  164. acpi_sleep_tts_switch(acpi_target_sleep_state);
  165. } else {
  166. printk(KERN_ERR "ACPI does not support this state: %d\n",
  167. pm_state);
  168. error = -ENOSYS;
  169. }
  170. return error;
  171. }
  172. /**
  173. * acpi_suspend_enter - Actually enter a sleep state.
  174. * @pm_state: ignored
  175. *
  176. * Flush caches and go to sleep. For STR we have to call arch-specific
  177. * assembly, which in turn call acpi_enter_sleep_state().
  178. * It's unfortunate, but it works. Please fix if you're feeling frisky.
  179. */
  180. static int acpi_suspend_enter(suspend_state_t pm_state)
  181. {
  182. acpi_status status = AE_OK;
  183. unsigned long flags = 0;
  184. u32 acpi_state = acpi_target_sleep_state;
  185. ACPI_FLUSH_CPU_CACHE();
  186. /* Do arch specific saving of state. */
  187. if (acpi_state == ACPI_STATE_S3) {
  188. int error = acpi_save_state_mem();
  189. if (error)
  190. return error;
  191. }
  192. local_irq_save(flags);
  193. acpi_enable_wakeup_device(acpi_state);
  194. switch (acpi_state) {
  195. case ACPI_STATE_S1:
  196. barrier();
  197. status = acpi_enter_sleep_state(acpi_state);
  198. break;
  199. case ACPI_STATE_S3:
  200. do_suspend_lowlevel();
  201. break;
  202. }
  203. /* If ACPI is not enabled by the BIOS, we need to enable it here. */
  204. acpi_enable();
  205. /* Reprogram control registers and execute _BFS */
  206. acpi_leave_sleep_state_prep(acpi_state);
  207. /* ACPI 3.0 specs (P62) says that it's the responsibility
  208. * of the OSPM to clear the status bit [ implying that the
  209. * POWER_BUTTON event should not reach userspace ]
  210. */
  211. if (ACPI_SUCCESS(status) && (acpi_state == ACPI_STATE_S3))
  212. acpi_clear_event(ACPI_EVENT_POWER_BUTTON);
  213. /*
  214. * Disable and clear GPE status before interrupt is enabled. Some GPEs
  215. * (like wakeup GPE) haven't handler, this can avoid such GPE misfire.
  216. * acpi_leave_sleep_state will reenable specific GPEs later
  217. */
  218. acpi_hw_disable_all_gpes();
  219. local_irq_restore(flags);
  220. printk(KERN_DEBUG "Back to C!\n");
  221. /* restore processor state */
  222. if (acpi_state == ACPI_STATE_S3)
  223. acpi_restore_state_mem();
  224. return ACPI_SUCCESS(status) ? 0 : -EFAULT;
  225. }
  226. static int acpi_suspend_state_valid(suspend_state_t pm_state)
  227. {
  228. u32 acpi_state;
  229. switch (pm_state) {
  230. case PM_SUSPEND_ON:
  231. case PM_SUSPEND_STANDBY:
  232. case PM_SUSPEND_MEM:
  233. acpi_state = acpi_suspend_states[pm_state];
  234. return sleep_states[acpi_state];
  235. default:
  236. return 0;
  237. }
  238. }
  239. static struct platform_suspend_ops acpi_suspend_ops = {
  240. .valid = acpi_suspend_state_valid,
  241. .begin = acpi_suspend_begin,
  242. .prepare = acpi_pm_prepare,
  243. .enter = acpi_suspend_enter,
  244. .finish = acpi_pm_finish,
  245. .end = acpi_pm_end,
  246. };
  247. /**
  248. * acpi_suspend_begin_old - Set the target system sleep state to the
  249. * state associated with given @pm_state, if supported, and
  250. * execute the _PTS control method. This function is used if the
  251. * pre-ACPI 2.0 suspend ordering has been requested.
  252. */
  253. static int acpi_suspend_begin_old(suspend_state_t pm_state)
  254. {
  255. int error = acpi_suspend_begin(pm_state);
  256. if (!error)
  257. error = __acpi_pm_prepare();
  258. return error;
  259. }
  260. /*
  261. * The following callbacks are used if the pre-ACPI 2.0 suspend ordering has
  262. * been requested.
  263. */
  264. static struct platform_suspend_ops acpi_suspend_ops_old = {
  265. .valid = acpi_suspend_state_valid,
  266. .begin = acpi_suspend_begin_old,
  267. .prepare = acpi_pm_disable_gpes,
  268. .enter = acpi_suspend_enter,
  269. .finish = acpi_pm_finish,
  270. .end = acpi_pm_end,
  271. .recover = acpi_pm_finish,
  272. };
  273. static int __init init_old_suspend_ordering(const struct dmi_system_id *d)
  274. {
  275. old_suspend_ordering = true;
  276. return 0;
  277. }
  278. static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
  279. {
  280. .callback = init_old_suspend_ordering,
  281. .ident = "Abit KN9 (nForce4 variant)",
  282. .matches = {
  283. DMI_MATCH(DMI_BOARD_VENDOR, "http://www.abit.com.tw/"),
  284. DMI_MATCH(DMI_BOARD_NAME, "KN9 Series(NF-CK804)"),
  285. },
  286. },
  287. {
  288. .callback = init_old_suspend_ordering,
  289. .ident = "HP xw4600 Workstation",
  290. .matches = {
  291. DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
  292. DMI_MATCH(DMI_PRODUCT_NAME, "HP xw4600 Workstation"),
  293. },
  294. },
  295. {},
  296. };
  297. #endif /* CONFIG_SUSPEND */
  298. #ifdef CONFIG_HIBERNATION
  299. static unsigned long s4_hardware_signature;
  300. static struct acpi_table_facs *facs;
  301. static bool nosigcheck;
  302. void __init acpi_no_s4_hw_signature(void)
  303. {
  304. nosigcheck = true;
  305. }
  306. static int acpi_hibernation_begin(void)
  307. {
  308. acpi_target_sleep_state = ACPI_STATE_S4;
  309. acpi_sleep_tts_switch(acpi_target_sleep_state);
  310. return 0;
  311. }
  312. static int acpi_hibernation_enter(void)
  313. {
  314. acpi_status status = AE_OK;
  315. unsigned long flags = 0;
  316. ACPI_FLUSH_CPU_CACHE();
  317. local_irq_save(flags);
  318. acpi_enable_wakeup_device(ACPI_STATE_S4);
  319. /* This shouldn't return. If it returns, we have a problem */
  320. status = acpi_enter_sleep_state(ACPI_STATE_S4);
  321. /* Reprogram control registers and execute _BFS */
  322. acpi_leave_sleep_state_prep(ACPI_STATE_S4);
  323. local_irq_restore(flags);
  324. return ACPI_SUCCESS(status) ? 0 : -EFAULT;
  325. }
  326. static void acpi_hibernation_leave(void)
  327. {
  328. /*
  329. * If ACPI is not enabled by the BIOS and the boot kernel, we need to
  330. * enable it here.
  331. */
  332. acpi_enable();
  333. /* Reprogram control registers and execute _BFS */
  334. acpi_leave_sleep_state_prep(ACPI_STATE_S4);
  335. /* Check the hardware signature */
  336. if (facs && s4_hardware_signature != facs->hardware_signature) {
  337. printk(KERN_EMERG "ACPI: Hardware changed while hibernated, "
  338. "cannot resume!\n");
  339. panic("ACPI S4 hardware signature mismatch");
  340. }
  341. }
  342. static void acpi_pm_enable_gpes(void)
  343. {
  344. acpi_hw_enable_all_runtime_gpes();
  345. }
  346. static struct platform_hibernation_ops acpi_hibernation_ops = {
  347. .begin = acpi_hibernation_begin,
  348. .end = acpi_pm_end,
  349. .pre_snapshot = acpi_pm_prepare,
  350. .finish = acpi_pm_finish,
  351. .prepare = acpi_pm_prepare,
  352. .enter = acpi_hibernation_enter,
  353. .leave = acpi_hibernation_leave,
  354. .pre_restore = acpi_pm_disable_gpes,
  355. .restore_cleanup = acpi_pm_enable_gpes,
  356. };
  357. /**
  358. * acpi_hibernation_begin_old - Set the target system sleep state to
  359. * ACPI_STATE_S4 and execute the _PTS control method. This
  360. * function is used if the pre-ACPI 2.0 suspend ordering has been
  361. * requested.
  362. */
  363. static int acpi_hibernation_begin_old(void)
  364. {
  365. int error;
  366. /*
  367. * The _TTS object should always be evaluated before the _PTS object.
  368. * When the old_suspended_ordering is true, the _PTS object is
  369. * evaluated in the acpi_sleep_prepare.
  370. */
  371. acpi_sleep_tts_switch(ACPI_STATE_S4);
  372. error = acpi_sleep_prepare(ACPI_STATE_S4);
  373. if (!error)
  374. acpi_target_sleep_state = ACPI_STATE_S4;
  375. return error;
  376. }
  377. /*
  378. * The following callbacks are used if the pre-ACPI 2.0 suspend ordering has
  379. * been requested.
  380. */
  381. static struct platform_hibernation_ops acpi_hibernation_ops_old = {
  382. .begin = acpi_hibernation_begin_old,
  383. .end = acpi_pm_end,
  384. .pre_snapshot = acpi_pm_disable_gpes,
  385. .finish = acpi_pm_finish,
  386. .prepare = acpi_pm_disable_gpes,
  387. .enter = acpi_hibernation_enter,
  388. .leave = acpi_hibernation_leave,
  389. .pre_restore = acpi_pm_disable_gpes,
  390. .restore_cleanup = acpi_pm_enable_gpes,
  391. .recover = acpi_pm_finish,
  392. };
  393. #endif /* CONFIG_HIBERNATION */
  394. int acpi_suspend(u32 acpi_state)
  395. {
  396. suspend_state_t states[] = {
  397. [1] = PM_SUSPEND_STANDBY,
  398. [3] = PM_SUSPEND_MEM,
  399. [5] = PM_SUSPEND_MAX
  400. };
  401. if (acpi_state < 6 && states[acpi_state])
  402. return pm_suspend(states[acpi_state]);
  403. if (acpi_state == 4)
  404. return hibernate();
  405. return -EINVAL;
  406. }
  407. #ifdef CONFIG_PM_SLEEP
  408. /**
  409. * acpi_pm_device_sleep_state - return preferred power state of ACPI device
  410. * in the system sleep state given by %acpi_target_sleep_state
  411. * @dev: device to examine; its driver model wakeup flags control
  412. * whether it should be able to wake up the system
  413. * @d_min_p: used to store the upper limit of allowed states range
  414. * Return value: preferred power state of the device on success, -ENODEV on
  415. * failure (ie. if there's no 'struct acpi_device' for @dev)
  416. *
  417. * Find the lowest power (highest number) ACPI device power state that
  418. * device @dev can be in while the system is in the sleep state represented
  419. * by %acpi_target_sleep_state. If @wake is nonzero, the device should be
  420. * able to wake up the system from this sleep state. If @d_min_p is set,
  421. * the highest power (lowest number) device power state of @dev allowed
  422. * in this system sleep state is stored at the location pointed to by it.
  423. *
  424. * The caller must ensure that @dev is valid before using this function.
  425. * The caller is also responsible for figuring out if the device is
  426. * supposed to be able to wake up the system and passing this information
  427. * via @wake.
  428. */
  429. int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p)
  430. {
  431. acpi_handle handle = DEVICE_ACPI_HANDLE(dev);
  432. struct acpi_device *adev;
  433. char acpi_method[] = "_SxD";
  434. unsigned long long d_min, d_max;
  435. if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &adev))) {
  436. printk(KERN_DEBUG "ACPI handle has no context!\n");
  437. return -ENODEV;
  438. }
  439. acpi_method[2] = '0' + acpi_target_sleep_state;
  440. /*
  441. * If the sleep state is S0, we will return D3, but if the device has
  442. * _S0W, we will use the value from _S0W
  443. */
  444. d_min = ACPI_STATE_D0;
  445. d_max = ACPI_STATE_D3;
  446. /*
  447. * If present, _SxD methods return the minimum D-state (highest power
  448. * state) we can use for the corresponding S-states. Otherwise, the
  449. * minimum D-state is D0 (ACPI 3.x).
  450. *
  451. * NOTE: We rely on acpi_evaluate_integer() not clobbering the integer
  452. * provided -- that's our fault recovery, we ignore retval.
  453. */
  454. if (acpi_target_sleep_state > ACPI_STATE_S0)
  455. acpi_evaluate_integer(handle, acpi_method, NULL, &d_min);
  456. /*
  457. * If _PRW says we can wake up the system from the target sleep state,
  458. * the D-state returned by _SxD is sufficient for that (we assume a
  459. * wakeup-aware driver if wake is set). Still, if _SxW exists
  460. * (ACPI 3.x), it should return the maximum (lowest power) D-state that
  461. * can wake the system. _S0W may be valid, too.
  462. */
  463. if (acpi_target_sleep_state == ACPI_STATE_S0 ||
  464. (device_may_wakeup(dev) && adev->wakeup.state.enabled &&
  465. adev->wakeup.sleep_state <= acpi_target_sleep_state)) {
  466. acpi_status status;
  467. acpi_method[3] = 'W';
  468. status = acpi_evaluate_integer(handle, acpi_method, NULL,
  469. &d_max);
  470. if (ACPI_FAILURE(status)) {
  471. d_max = d_min;
  472. } else if (d_max < d_min) {
  473. /* Warn the user of the broken DSDT */
  474. printk(KERN_WARNING "ACPI: Wrong value from %s\n",
  475. acpi_method);
  476. /* Sanitize it */
  477. d_min = d_max;
  478. }
  479. }
  480. if (d_min_p)
  481. *d_min_p = d_min;
  482. return d_max;
  483. }
  484. /**
  485. * acpi_pm_device_sleep_wake - enable or disable the system wake-up
  486. * capability of given device
  487. * @dev: device to handle
  488. * @enable: 'true' - enable, 'false' - disable the wake-up capability
  489. */
  490. int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
  491. {
  492. acpi_handle handle;
  493. struct acpi_device *adev;
  494. if (!device_may_wakeup(dev))
  495. return -EINVAL;
  496. handle = DEVICE_ACPI_HANDLE(dev);
  497. if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &adev))) {
  498. printk(KERN_DEBUG "ACPI handle has no context!\n");
  499. return -ENODEV;
  500. }
  501. return enable ?
  502. acpi_enable_wakeup_device_power(adev, acpi_target_sleep_state) :
  503. acpi_disable_wakeup_device_power(adev);
  504. }
  505. #endif
  506. static void acpi_power_off_prepare(void)
  507. {
  508. /* Prepare to power off the system */
  509. acpi_sleep_prepare(ACPI_STATE_S5);
  510. acpi_hw_disable_all_gpes();
  511. }
  512. static void acpi_power_off(void)
  513. {
  514. /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
  515. printk("%s called\n", __func__);
  516. local_irq_disable();
  517. acpi_enable_wakeup_device(ACPI_STATE_S5);
  518. acpi_enter_sleep_state(ACPI_STATE_S5);
  519. }
  520. int __init acpi_sleep_init(void)
  521. {
  522. acpi_status status;
  523. u8 type_a, type_b;
  524. #ifdef CONFIG_SUSPEND
  525. int i = 0;
  526. dmi_check_system(acpisleep_dmi_table);
  527. #endif
  528. if (acpi_disabled)
  529. return 0;
  530. sleep_states[ACPI_STATE_S0] = 1;
  531. printk(KERN_INFO PREFIX "(supports S0");
  532. #ifdef CONFIG_SUSPEND
  533. for (i = ACPI_STATE_S1; i < ACPI_STATE_S4; i++) {
  534. status = acpi_get_sleep_type_data(i, &type_a, &type_b);
  535. if (ACPI_SUCCESS(status)) {
  536. sleep_states[i] = 1;
  537. printk(" S%d", i);
  538. }
  539. }
  540. suspend_set_ops(old_suspend_ordering ?
  541. &acpi_suspend_ops_old : &acpi_suspend_ops);
  542. #endif
  543. #ifdef CONFIG_HIBERNATION
  544. status = acpi_get_sleep_type_data(ACPI_STATE_S4, &type_a, &type_b);
  545. if (ACPI_SUCCESS(status)) {
  546. hibernation_set_ops(old_suspend_ordering ?
  547. &acpi_hibernation_ops_old : &acpi_hibernation_ops);
  548. sleep_states[ACPI_STATE_S4] = 1;
  549. printk(" S4");
  550. if (!nosigcheck) {
  551. acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS,
  552. (struct acpi_table_header **)&facs);
  553. if (facs)
  554. s4_hardware_signature =
  555. facs->hardware_signature;
  556. }
  557. }
  558. #endif
  559. status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b);
  560. if (ACPI_SUCCESS(status)) {
  561. sleep_states[ACPI_STATE_S5] = 1;
  562. printk(" S5");
  563. pm_power_off_prepare = acpi_power_off_prepare;
  564. pm_power_off = acpi_power_off;
  565. }
  566. printk(")\n");
  567. /*
  568. * Register the tts_notifier to reboot notifier list so that the _TTS
  569. * object can also be evaluated when the system enters S5.
  570. */
  571. register_reboot_notifier(&tts_notifier);
  572. return 0;
  573. }