hwsleep.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. /******************************************************************************
  2. *
  3. * Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2008, Intel Corp.
  8. * All rights reserved.
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions
  12. * are met:
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions, and the following disclaimer,
  15. * without modification.
  16. * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  17. * substantially similar to the "NO WARRANTY" disclaimer below
  18. * ("Disclaimer") and any redistribution must be conditioned upon
  19. * including a substantially similar Disclaimer requirement for further
  20. * binary redistribution.
  21. * 3. Neither the names of the above-listed copyright holders nor the names
  22. * of any contributors may be used to endorse or promote products derived
  23. * from this software without specific prior written permission.
  24. *
  25. * Alternatively, this software may be distributed under the terms of the
  26. * GNU General Public License ("GPL") version 2 as published by the Free
  27. * Software Foundation.
  28. *
  29. * NO WARRANTY
  30. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  31. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  32. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  33. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  34. * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  35. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  36. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  37. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  38. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  39. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  40. * POSSIBILITY OF SUCH DAMAGES.
  41. */
  42. #include <acpi/acpi.h>
  43. #include "accommon.h"
  44. #include "actables.h"
  45. #define _COMPONENT ACPI_HARDWARE
  46. ACPI_MODULE_NAME("hwsleep")
  47. /*******************************************************************************
  48. *
  49. * FUNCTION: acpi_set_firmware_waking_vector
  50. *
  51. * PARAMETERS: physical_address - 32-bit physical address of ACPI real mode
  52. * entry point.
  53. *
  54. * RETURN: Status
  55. *
  56. * DESCRIPTION: Sets the 32-bit firmware_waking_vector field of the FACS
  57. *
  58. ******************************************************************************/
  59. acpi_status
  60. acpi_set_firmware_waking_vector(u32 physical_address)
  61. {
  62. ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector);
  63. /*
  64. * According to the ACPI specification 2.0c and later, the 64-bit
  65. * waking vector should be cleared and the 32-bit waking vector should
  66. * be used, unless we want the wake-up code to be called by the BIOS in
  67. * Protected Mode. Some systems (for example HP dv5-1004nr) are known
  68. * to fail to resume if the 64-bit vector is used.
  69. */
  70. /* Set the 32-bit vector */
  71. acpi_gbl_FACS->firmware_waking_vector = physical_address;
  72. /* Clear the 64-bit vector if it exists */
  73. if ((acpi_gbl_FACS->length > 32) && (acpi_gbl_FACS->version >= 1)) {
  74. acpi_gbl_FACS->xfirmware_waking_vector = 0;
  75. }
  76. return_ACPI_STATUS(AE_OK);
  77. }
  78. ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector)
  79. /*******************************************************************************
  80. *
  81. * FUNCTION: acpi_set_firmware_waking_vector64
  82. *
  83. * PARAMETERS: physical_address - 64-bit physical address of ACPI protected
  84. * mode entry point.
  85. *
  86. * RETURN: Status
  87. *
  88. * DESCRIPTION: Sets the 64-bit X_firmware_waking_vector field of the FACS, if
  89. * it exists in the table.
  90. *
  91. ******************************************************************************/
  92. acpi_status
  93. acpi_set_firmware_waking_vector64(u64 physical_address)
  94. {
  95. ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector64);
  96. /* Determine if the 64-bit vector actually exists */
  97. if ((acpi_gbl_FACS->length <= 32) || (acpi_gbl_FACS->version < 1)) {
  98. return_ACPI_STATUS(AE_NOT_EXIST);
  99. }
  100. /* Clear 32-bit vector, set the 64-bit X_ vector */
  101. acpi_gbl_FACS->firmware_waking_vector = 0;
  102. acpi_gbl_FACS->xfirmware_waking_vector = physical_address;
  103. return_ACPI_STATUS(AE_OK);
  104. }
  105. ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector64)
  106. /*******************************************************************************
  107. *
  108. * FUNCTION: acpi_enter_sleep_state_prep
  109. *
  110. * PARAMETERS: sleep_state - Which sleep state to enter
  111. *
  112. * RETURN: Status
  113. *
  114. * DESCRIPTION: Prepare to enter a system sleep state (see ACPI 2.0 spec p 231)
  115. * This function must execute with interrupts enabled.
  116. * We break sleeping into 2 stages so that OSPM can handle
  117. * various OS-specific tasks between the two steps.
  118. *
  119. ******************************************************************************/
  120. acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)
  121. {
  122. acpi_status status;
  123. struct acpi_object_list arg_list;
  124. union acpi_object arg;
  125. ACPI_FUNCTION_TRACE(acpi_enter_sleep_state_prep);
  126. /*
  127. * _PSW methods could be run here to enable wake-on keyboard, LAN, etc.
  128. */
  129. status = acpi_get_sleep_type_data(sleep_state,
  130. &acpi_gbl_sleep_type_a,
  131. &acpi_gbl_sleep_type_b);
  132. if (ACPI_FAILURE(status)) {
  133. return_ACPI_STATUS(status);
  134. }
  135. /* Setup parameter object */
  136. arg_list.count = 1;
  137. arg_list.pointer = &arg;
  138. arg.type = ACPI_TYPE_INTEGER;
  139. arg.integer.value = sleep_state;
  140. /* Run the _PTS method */
  141. status = acpi_evaluate_object(NULL, METHOD_NAME__PTS, &arg_list, NULL);
  142. if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
  143. return_ACPI_STATUS(status);
  144. }
  145. /* Setup the argument to _SST */
  146. switch (sleep_state) {
  147. case ACPI_STATE_S0:
  148. arg.integer.value = ACPI_SST_WORKING;
  149. break;
  150. case ACPI_STATE_S1:
  151. case ACPI_STATE_S2:
  152. case ACPI_STATE_S3:
  153. arg.integer.value = ACPI_SST_SLEEPING;
  154. break;
  155. case ACPI_STATE_S4:
  156. arg.integer.value = ACPI_SST_SLEEP_CONTEXT;
  157. break;
  158. default:
  159. arg.integer.value = ACPI_SST_INDICATOR_OFF; /* Default is off */
  160. break;
  161. }
  162. /*
  163. * Set the system indicators to show the desired sleep state.
  164. * _SST is an optional method (return no error if not found)
  165. */
  166. status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL);
  167. if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
  168. ACPI_EXCEPTION((AE_INFO, status,
  169. "While executing method _SST"));
  170. }
  171. return_ACPI_STATUS(AE_OK);
  172. }
  173. ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep)
  174. /*******************************************************************************
  175. *
  176. * FUNCTION: acpi_enter_sleep_state
  177. *
  178. * PARAMETERS: sleep_state - Which sleep state to enter
  179. *
  180. * RETURN: Status
  181. *
  182. * DESCRIPTION: Enter a system sleep state (see ACPI 2.0 spec p 231)
  183. * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
  184. *
  185. ******************************************************************************/
  186. acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
  187. {
  188. u32 PM1Acontrol;
  189. u32 PM1Bcontrol;
  190. struct acpi_bit_register_info *sleep_type_reg_info;
  191. struct acpi_bit_register_info *sleep_enable_reg_info;
  192. u32 in_value;
  193. struct acpi_object_list arg_list;
  194. union acpi_object arg;
  195. acpi_status status;
  196. ACPI_FUNCTION_TRACE(acpi_enter_sleep_state);
  197. if ((acpi_gbl_sleep_type_a > ACPI_SLEEP_TYPE_MAX) ||
  198. (acpi_gbl_sleep_type_b > ACPI_SLEEP_TYPE_MAX)) {
  199. ACPI_ERROR((AE_INFO, "Sleep values out of range: A=%X B=%X",
  200. acpi_gbl_sleep_type_a, acpi_gbl_sleep_type_b));
  201. return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
  202. }
  203. sleep_type_reg_info =
  204. acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_TYPE_A);
  205. sleep_enable_reg_info =
  206. acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_ENABLE);
  207. /* Clear wake status */
  208. status = acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1);
  209. if (ACPI_FAILURE(status)) {
  210. return_ACPI_STATUS(status);
  211. }
  212. /* Clear all fixed and general purpose status bits */
  213. status = acpi_hw_clear_acpi_status();
  214. if (ACPI_FAILURE(status)) {
  215. return_ACPI_STATUS(status);
  216. }
  217. /*
  218. * 1) Disable/Clear all GPEs
  219. * 2) Enable all wakeup GPEs
  220. */
  221. status = acpi_hw_disable_all_gpes();
  222. if (ACPI_FAILURE(status)) {
  223. return_ACPI_STATUS(status);
  224. }
  225. acpi_gbl_system_awake_and_running = FALSE;
  226. status = acpi_hw_enable_all_wakeup_gpes();
  227. if (ACPI_FAILURE(status)) {
  228. return_ACPI_STATUS(status);
  229. }
  230. /* Execute the _GTS method */
  231. arg_list.count = 1;
  232. arg_list.pointer = &arg;
  233. arg.type = ACPI_TYPE_INTEGER;
  234. arg.integer.value = sleep_state;
  235. status = acpi_evaluate_object(NULL, METHOD_NAME__GTS, &arg_list, NULL);
  236. if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
  237. return_ACPI_STATUS(status);
  238. }
  239. /* Get current value of PM1A control */
  240. status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol);
  241. if (ACPI_FAILURE(status)) {
  242. return_ACPI_STATUS(status);
  243. }
  244. ACPI_DEBUG_PRINT((ACPI_DB_INIT,
  245. "Entering sleep state [S%d]\n", sleep_state));
  246. /* Clear SLP_EN and SLP_TYP fields */
  247. PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask |
  248. sleep_enable_reg_info->access_bit_mask);
  249. PM1Bcontrol = PM1Acontrol;
  250. /* Insert SLP_TYP bits */
  251. PM1Acontrol |=
  252. (acpi_gbl_sleep_type_a << sleep_type_reg_info->bit_position);
  253. PM1Bcontrol |=
  254. (acpi_gbl_sleep_type_b << sleep_type_reg_info->bit_position);
  255. /*
  256. * We split the writes of SLP_TYP and SLP_EN to workaround
  257. * poorly implemented hardware.
  258. */
  259. /* Write #1: fill in SLP_TYP data */
  260. status = acpi_hw_register_write(ACPI_REGISTER_PM1A_CONTROL,
  261. PM1Acontrol);
  262. if (ACPI_FAILURE(status)) {
  263. return_ACPI_STATUS(status);
  264. }
  265. status = acpi_hw_register_write(ACPI_REGISTER_PM1B_CONTROL,
  266. PM1Bcontrol);
  267. if (ACPI_FAILURE(status)) {
  268. return_ACPI_STATUS(status);
  269. }
  270. /* Insert SLP_ENABLE bit */
  271. PM1Acontrol |= sleep_enable_reg_info->access_bit_mask;
  272. PM1Bcontrol |= sleep_enable_reg_info->access_bit_mask;
  273. /* Write #2: SLP_TYP + SLP_EN */
  274. ACPI_FLUSH_CPU_CACHE();
  275. status = acpi_hw_register_write(ACPI_REGISTER_PM1A_CONTROL,
  276. PM1Acontrol);
  277. if (ACPI_FAILURE(status)) {
  278. return_ACPI_STATUS(status);
  279. }
  280. status = acpi_hw_register_write(ACPI_REGISTER_PM1B_CONTROL,
  281. PM1Bcontrol);
  282. if (ACPI_FAILURE(status)) {
  283. return_ACPI_STATUS(status);
  284. }
  285. if (sleep_state > ACPI_STATE_S3) {
  286. /*
  287. * We wanted to sleep > S3, but it didn't happen (by virtue of the
  288. * fact that we are still executing!)
  289. *
  290. * Wait ten seconds, then try again. This is to get S4/S5 to work on
  291. * all machines.
  292. *
  293. * We wait so long to allow chipsets that poll this reg very slowly to
  294. * still read the right value. Ideally, this block would go
  295. * away entirely.
  296. */
  297. acpi_os_stall(10000000);
  298. status = acpi_hw_register_write(ACPI_REGISTER_PM1_CONTROL,
  299. sleep_enable_reg_info->
  300. access_bit_mask);
  301. if (ACPI_FAILURE(status)) {
  302. return_ACPI_STATUS(status);
  303. }
  304. }
  305. /* Wait until we enter sleep state */
  306. do {
  307. status = acpi_get_register_unlocked(ACPI_BITREG_WAKE_STATUS,
  308. &in_value);
  309. if (ACPI_FAILURE(status)) {
  310. return_ACPI_STATUS(status);
  311. }
  312. /* Spin until we wake */
  313. } while (!in_value);
  314. return_ACPI_STATUS(AE_OK);
  315. }
  316. ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state)
  317. /*******************************************************************************
  318. *
  319. * FUNCTION: acpi_enter_sleep_state_s4bios
  320. *
  321. * PARAMETERS: None
  322. *
  323. * RETURN: Status
  324. *
  325. * DESCRIPTION: Perform a S4 bios request.
  326. * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
  327. *
  328. ******************************************************************************/
  329. acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void)
  330. {
  331. u32 in_value;
  332. acpi_status status;
  333. ACPI_FUNCTION_TRACE(acpi_enter_sleep_state_s4bios);
  334. status = acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1);
  335. if (ACPI_FAILURE(status)) {
  336. return_ACPI_STATUS(status);
  337. }
  338. status = acpi_hw_clear_acpi_status();
  339. if (ACPI_FAILURE(status)) {
  340. return_ACPI_STATUS(status);
  341. }
  342. /*
  343. * 1) Disable/Clear all GPEs
  344. * 2) Enable all wakeup GPEs
  345. */
  346. status = acpi_hw_disable_all_gpes();
  347. if (ACPI_FAILURE(status)) {
  348. return_ACPI_STATUS(status);
  349. }
  350. acpi_gbl_system_awake_and_running = FALSE;
  351. status = acpi_hw_enable_all_wakeup_gpes();
  352. if (ACPI_FAILURE(status)) {
  353. return_ACPI_STATUS(status);
  354. }
  355. ACPI_FLUSH_CPU_CACHE();
  356. status = acpi_os_write_port(acpi_gbl_FADT.smi_command,
  357. (u32) acpi_gbl_FADT.S4bios_request, 8);
  358. do {
  359. acpi_os_stall(1000);
  360. status = acpi_get_register(ACPI_BITREG_WAKE_STATUS, &in_value);
  361. if (ACPI_FAILURE(status)) {
  362. return_ACPI_STATUS(status);
  363. }
  364. } while (!in_value);
  365. return_ACPI_STATUS(AE_OK);
  366. }
  367. ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios)
  368. /*******************************************************************************
  369. *
  370. * FUNCTION: acpi_leave_sleep_state_prep
  371. *
  372. * PARAMETERS: sleep_state - Which sleep state we are exiting
  373. *
  374. * RETURN: Status
  375. *
  376. * DESCRIPTION: Perform the first state of OS-independent ACPI cleanup after a
  377. * sleep.
  378. * Called with interrupts DISABLED.
  379. *
  380. ******************************************************************************/
  381. acpi_status acpi_leave_sleep_state_prep(u8 sleep_state)
  382. {
  383. struct acpi_object_list arg_list;
  384. union acpi_object arg;
  385. acpi_status status;
  386. struct acpi_bit_register_info *sleep_type_reg_info;
  387. struct acpi_bit_register_info *sleep_enable_reg_info;
  388. u32 PM1Acontrol;
  389. u32 PM1Bcontrol;
  390. ACPI_FUNCTION_TRACE(acpi_leave_sleep_state_prep);
  391. /*
  392. * Set SLP_TYPE and SLP_EN to state S0.
  393. * This is unclear from the ACPI Spec, but it is required
  394. * by some machines.
  395. */
  396. status = acpi_get_sleep_type_data(ACPI_STATE_S0,
  397. &acpi_gbl_sleep_type_a,
  398. &acpi_gbl_sleep_type_b);
  399. if (ACPI_SUCCESS(status)) {
  400. sleep_type_reg_info =
  401. acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_TYPE_A);
  402. sleep_enable_reg_info =
  403. acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_ENABLE);
  404. /* Get current value of PM1A control */
  405. status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL,
  406. &PM1Acontrol);
  407. if (ACPI_SUCCESS(status)) {
  408. /* Clear SLP_EN and SLP_TYP fields */
  409. PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask |
  410. sleep_enable_reg_info->
  411. access_bit_mask);
  412. PM1Bcontrol = PM1Acontrol;
  413. /* Insert SLP_TYP bits */
  414. PM1Acontrol |=
  415. (acpi_gbl_sleep_type_a << sleep_type_reg_info->
  416. bit_position);
  417. PM1Bcontrol |=
  418. (acpi_gbl_sleep_type_b << sleep_type_reg_info->
  419. bit_position);
  420. /* Just ignore any errors */
  421. (void)acpi_hw_register_write(ACPI_REGISTER_PM1A_CONTROL,
  422. PM1Acontrol);
  423. (void)acpi_hw_register_write(ACPI_REGISTER_PM1B_CONTROL,
  424. PM1Bcontrol);
  425. }
  426. }
  427. /* Execute the _BFS method */
  428. arg_list.count = 1;
  429. arg_list.pointer = &arg;
  430. arg.type = ACPI_TYPE_INTEGER;
  431. arg.integer.value = sleep_state;
  432. status = acpi_evaluate_object(NULL, METHOD_NAME__BFS, &arg_list, NULL);
  433. if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
  434. ACPI_EXCEPTION((AE_INFO, status, "During Method _BFS"));
  435. }
  436. return_ACPI_STATUS(status);
  437. }
  438. /*******************************************************************************
  439. *
  440. * FUNCTION: acpi_leave_sleep_state
  441. *
  442. * PARAMETERS: sleep_state - Which sleep state we just exited
  443. *
  444. * RETURN: Status
  445. *
  446. * DESCRIPTION: Perform OS-independent ACPI cleanup after a sleep
  447. * Called with interrupts ENABLED.
  448. *
  449. ******************************************************************************/
  450. acpi_status acpi_leave_sleep_state(u8 sleep_state)
  451. {
  452. struct acpi_object_list arg_list;
  453. union acpi_object arg;
  454. acpi_status status;
  455. ACPI_FUNCTION_TRACE(acpi_leave_sleep_state);
  456. /* Ensure enter_sleep_state_prep -> enter_sleep_state ordering */
  457. acpi_gbl_sleep_type_a = ACPI_SLEEP_TYPE_INVALID;
  458. /* Setup parameter object */
  459. arg_list.count = 1;
  460. arg_list.pointer = &arg;
  461. arg.type = ACPI_TYPE_INTEGER;
  462. /* Ignore any errors from these methods */
  463. arg.integer.value = ACPI_SST_WAKING;
  464. status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL);
  465. if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
  466. ACPI_EXCEPTION((AE_INFO, status, "During Method _SST"));
  467. }
  468. /*
  469. * GPEs must be enabled before _WAK is called as GPEs
  470. * might get fired there
  471. *
  472. * Restore the GPEs:
  473. * 1) Disable/Clear all GPEs
  474. * 2) Enable all runtime GPEs
  475. */
  476. status = acpi_hw_disable_all_gpes();
  477. if (ACPI_FAILURE(status)) {
  478. return_ACPI_STATUS(status);
  479. }
  480. status = acpi_hw_enable_all_runtime_gpes();
  481. if (ACPI_FAILURE(status)) {
  482. return_ACPI_STATUS(status);
  483. }
  484. arg.integer.value = sleep_state;
  485. status = acpi_evaluate_object(NULL, METHOD_NAME__WAK, &arg_list, NULL);
  486. if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
  487. ACPI_EXCEPTION((AE_INFO, status, "During Method _WAK"));
  488. }
  489. /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */
  490. /*
  491. * Some BIOSes assume that WAK_STS will be cleared on resume and use
  492. * it to determine whether the system is rebooting or resuming. Clear
  493. * it for compatibility.
  494. */
  495. acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1);
  496. acpi_gbl_system_awake_and_running = TRUE;
  497. /* Enable power button */
  498. (void)
  499. acpi_set_register(acpi_gbl_fixed_event_info
  500. [ACPI_EVENT_POWER_BUTTON].enable_register_id, 1);
  501. (void)
  502. acpi_set_register(acpi_gbl_fixed_event_info
  503. [ACPI_EVENT_POWER_BUTTON].status_register_id, 1);
  504. arg.integer.value = ACPI_SST_WORKING;
  505. status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL);
  506. if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
  507. ACPI_EXCEPTION((AE_INFO, status, "During Method _SST"));
  508. }
  509. return_ACPI_STATUS(status);
  510. }
  511. ACPI_EXPORT_SYMBOL(acpi_leave_sleep_state)