aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/hardware/hwsleep.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/hardware/hwsleep.c')
-rw-r--r--drivers/acpi/hardware/hwsleep.c79
1 files changed, 57 insertions, 22 deletions
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c
index 81b248429703..fd1c4ba63367 100644
--- a/drivers/acpi/hardware/hwsleep.c
+++ b/drivers/acpi/hardware/hwsleep.c
@@ -192,18 +192,13 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)
192 arg.type = ACPI_TYPE_INTEGER; 192 arg.type = ACPI_TYPE_INTEGER;
193 arg.integer.value = sleep_state; 193 arg.integer.value = sleep_state;
194 194
195 /* Run the _PTS and _GTS methods */ 195 /* Run the _PTS method */
196 196
197 status = acpi_evaluate_object(NULL, METHOD_NAME__PTS, &arg_list, NULL); 197 status = acpi_evaluate_object(NULL, METHOD_NAME__PTS, &arg_list, NULL);
198 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { 198 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
199 return_ACPI_STATUS(status); 199 return_ACPI_STATUS(status);
200 } 200 }
201 201
202 status = acpi_evaluate_object(NULL, METHOD_NAME__GTS, &arg_list, NULL);
203 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
204 return_ACPI_STATUS(status);
205 }
206
207 /* Setup the argument to _SST */ 202 /* Setup the argument to _SST */
208 203
209 switch (sleep_state) { 204 switch (sleep_state) {
@@ -234,10 +229,6 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)
234 "While executing method _SST")); 229 "While executing method _SST"));
235 } 230 }
236 231
237 /* Disable/Clear all GPEs */
238
239 status = acpi_hw_disable_all_gpes();
240
241 return_ACPI_STATUS(status); 232 return_ACPI_STATUS(status);
242} 233}
243 234
@@ -262,6 +253,8 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
262 struct acpi_bit_register_info *sleep_type_reg_info; 253 struct acpi_bit_register_info *sleep_type_reg_info;
263 struct acpi_bit_register_info *sleep_enable_reg_info; 254 struct acpi_bit_register_info *sleep_enable_reg_info;
264 u32 in_value; 255 u32 in_value;
256 struct acpi_object_list arg_list;
257 union acpi_object arg;
265 acpi_status status; 258 acpi_status status;
266 259
267 ACPI_FUNCTION_TRACE(acpi_enter_sleep_state); 260 ACPI_FUNCTION_TRACE(acpi_enter_sleep_state);
@@ -307,6 +300,18 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
307 return_ACPI_STATUS(status); 300 return_ACPI_STATUS(status);
308 } 301 }
309 302
303 /* Execute the _GTS method */
304
305 arg_list.count = 1;
306 arg_list.pointer = &arg;
307 arg.type = ACPI_TYPE_INTEGER;
308 arg.integer.value = sleep_state;
309
310 status = acpi_evaluate_object(NULL, METHOD_NAME__GTS, &arg_list, NULL);
311 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
312 return_ACPI_STATUS(status);
313 }
314
310 /* Get current value of PM1A control */ 315 /* Get current value of PM1A control */
311 316
312 status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol); 317 status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol);
@@ -473,17 +478,18 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios)
473 478
474/******************************************************************************* 479/*******************************************************************************
475 * 480 *
476 * FUNCTION: acpi_leave_sleep_state 481 * FUNCTION: acpi_leave_sleep_state_prep
477 * 482 *
478 * PARAMETERS: sleep_state - Which sleep state we just exited 483 * PARAMETERS: sleep_state - Which sleep state we are exiting
479 * 484 *
480 * RETURN: Status 485 * RETURN: Status
481 * 486 *
482 * DESCRIPTION: Perform OS-independent ACPI cleanup after a sleep 487 * DESCRIPTION: Perform the first state of OS-independent ACPI cleanup after a
483 * Called with interrupts ENABLED. 488 * sleep.
489 * Called with interrupts DISABLED.
484 * 490 *
485 ******************************************************************************/ 491 ******************************************************************************/
486acpi_status acpi_leave_sleep_state(u8 sleep_state) 492acpi_status acpi_leave_sleep_state_prep(u8 sleep_state)
487{ 493{
488 struct acpi_object_list arg_list; 494 struct acpi_object_list arg_list;
489 union acpi_object arg; 495 union acpi_object arg;
@@ -493,7 +499,7 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state)
493 u32 PM1Acontrol; 499 u32 PM1Acontrol;
494 u32 PM1Bcontrol; 500 u32 PM1Bcontrol;
495 501
496 ACPI_FUNCTION_TRACE(acpi_leave_sleep_state); 502 ACPI_FUNCTION_TRACE(acpi_leave_sleep_state_prep);
497 503
498 /* 504 /*
499 * Set SLP_TYPE and SLP_EN to state S0. 505 * Set SLP_TYPE and SLP_EN to state S0.
@@ -540,6 +546,41 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state)
540 } 546 }
541 } 547 }
542 548
549 /* Execute the _BFS method */
550
551 arg_list.count = 1;
552 arg_list.pointer = &arg;
553 arg.type = ACPI_TYPE_INTEGER;
554 arg.integer.value = sleep_state;
555
556 status = acpi_evaluate_object(NULL, METHOD_NAME__BFS, &arg_list, NULL);
557 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
558 ACPI_EXCEPTION((AE_INFO, status, "During Method _BFS"));
559 }
560
561 return_ACPI_STATUS(status);
562}
563
564/*******************************************************************************
565 *
566 * FUNCTION: acpi_leave_sleep_state
567 *
568 * PARAMETERS: sleep_state - Which sleep state we just exited
569 *
570 * RETURN: Status
571 *
572 * DESCRIPTION: Perform OS-independent ACPI cleanup after a sleep
573 * Called with interrupts ENABLED.
574 *
575 ******************************************************************************/
576acpi_status acpi_leave_sleep_state(u8 sleep_state)
577{
578 struct acpi_object_list arg_list;
579 union acpi_object arg;
580 acpi_status status;
581
582 ACPI_FUNCTION_TRACE(acpi_leave_sleep_state);
583
543 /* Ensure enter_sleep_state_prep -> enter_sleep_state ordering */ 584 /* Ensure enter_sleep_state_prep -> enter_sleep_state ordering */
544 585
545 acpi_gbl_sleep_type_a = ACPI_SLEEP_TYPE_INVALID; 586 acpi_gbl_sleep_type_a = ACPI_SLEEP_TYPE_INVALID;
@@ -558,12 +599,6 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state)
558 ACPI_EXCEPTION((AE_INFO, status, "During Method _SST")); 599 ACPI_EXCEPTION((AE_INFO, status, "During Method _SST"));
559 } 600 }
560 601
561 arg.integer.value = sleep_state;
562 status = acpi_evaluate_object(NULL, METHOD_NAME__BFS, &arg_list, NULL);
563 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
564 ACPI_EXCEPTION((AE_INFO, status, "During Method _BFS"));
565 }
566
567 /* 602 /*
568 * GPEs must be enabled before _WAK is called as GPEs 603 * GPEs must be enabled before _WAK is called as GPEs
569 * might get fired there 604 * might get fired there