diff options
author | Bob Moore <robert.moore@intel.com> | 2012-02-14 05:47:42 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2012-03-22 01:45:03 -0400 |
commit | 709585765734e90d9fe0a2dc9c6f4e49eff5c6ec (patch) | |
tree | 937a5f1bc23c706f9771e9a4cbbee8bd9b497b02 /drivers/acpi/acpica/hwsleep.c | |
parent | f99648b1aff8b6158333a06c50d627be3c243a32 (diff) |
ACPICA: Split sleep/wake functions into two files
The functions for the original/legacy sleep/wake registers are in
hwsleep.c, and the functions for the new extended FADT V5 sleep
registers are in hwesleep.c
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/acpica/hwsleep.c')
-rw-r--r-- | drivers/acpi/acpica/hwsleep.c | 207 |
1 files changed, 3 insertions, 204 deletions
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c index abe65ff4231e..b96d41bbc64e 100644 --- a/drivers/acpi/acpica/hwsleep.c +++ b/drivers/acpi/acpica/hwsleep.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | * | 2 | * |
3 | * Name: hwsleep.c - ACPI Hardware Sleep/Wake Support Functions | 3 | * Name: hwsleep.c - ACPI Hardware Sleep/Wake Support functions for the |
4 | * original/legacy sleep/PM registers. | ||
4 | * | 5 | * |
5 | *****************************************************************************/ | 6 | *****************************************************************************/ |
6 | 7 | ||
@@ -49,56 +50,7 @@ | |||
49 | #define _COMPONENT ACPI_HARDWARE | 50 | #define _COMPONENT ACPI_HARDWARE |
50 | ACPI_MODULE_NAME("hwsleep") | 51 | ACPI_MODULE_NAME("hwsleep") |
51 | 52 | ||
52 | static unsigned int gts, bfs; | 53 | #if (!ACPI_REDUCED_HARDWARE) /* Entire module */ |
53 | module_param(gts, uint, 0644); | ||
54 | module_param(bfs, uint, 0644); | ||
55 | MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend."); | ||
56 | MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".); | ||
57 | |||
58 | /******************************************************************************* | ||
59 | * | ||
60 | * FUNCTION: acpi_hw_execute_sleep_method | ||
61 | * | ||
62 | * PARAMETERS: method_name - Pathname of method to execute | ||
63 | * integer_argument - Argument to pass to the method | ||
64 | * | ||
65 | * RETURN: None | ||
66 | * | ||
67 | * DESCRIPTION: Execute a sleep/wake related method, with one integer argument | ||
68 | * and no return value. | ||
69 | * | ||
70 | ******************************************************************************/ | ||
71 | void acpi_hw_execute_sleep_method(char *method_name, u32 integer_argument) | ||
72 | { | ||
73 | struct acpi_object_list arg_list; | ||
74 | union acpi_object arg; | ||
75 | acpi_status status; | ||
76 | |||
77 | ACPI_FUNCTION_TRACE(hw_execute_sleep_method); | ||
78 | |||
79 | if (!ACPI_STRCMP(METHOD_NAME__GTS, method_name) && !gts) | ||
80 | return_VOID; | ||
81 | |||
82 | if (!ACPI_STRCMP(METHOD_NAME__BFS, method_name) && !bfs) | ||
83 | return_VOID; | ||
84 | |||
85 | /* One argument, integer_argument */ | ||
86 | |||
87 | arg_list.count = 1; | ||
88 | arg_list.pointer = &arg; | ||
89 | arg.type = ACPI_TYPE_INTEGER; | ||
90 | arg.integer.value = (u64)integer_argument; | ||
91 | |||
92 | status = acpi_evaluate_object(NULL, method_name, &arg_list, NULL); | ||
93 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { | ||
94 | ACPI_EXCEPTION((AE_INFO, status, "While executing method %s", | ||
95 | method_name)); | ||
96 | } | ||
97 | |||
98 | return_VOID; | ||
99 | } | ||
100 | |||
101 | #if (!ACPI_REDUCED_HARDWARE) | ||
102 | /******************************************************************************* | 54 | /******************************************************************************* |
103 | * | 55 | * |
104 | * FUNCTION: acpi_hw_legacy_sleep | 56 | * FUNCTION: acpi_hw_legacy_sleep |
@@ -111,7 +63,6 @@ void acpi_hw_execute_sleep_method(char *method_name, u32 integer_argument) | |||
111 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED | 63 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED |
112 | * | 64 | * |
113 | ******************************************************************************/ | 65 | ******************************************************************************/ |
114 | |||
115 | acpi_status acpi_hw_legacy_sleep(u8 sleep_state) | 66 | acpi_status acpi_hw_legacy_sleep(u8 sleep_state) |
116 | { | 67 | { |
117 | struct acpi_bit_register_info *sleep_type_reg_info; | 68 | struct acpi_bit_register_info *sleep_type_reg_info; |
@@ -415,155 +366,3 @@ acpi_status acpi_hw_legacy_wake(u8 sleep_state) | |||
415 | } | 366 | } |
416 | 367 | ||
417 | #endif /* !ACPI_REDUCED_HARDWARE */ | 368 | #endif /* !ACPI_REDUCED_HARDWARE */ |
418 | |||
419 | /******************************************************************************* | ||
420 | * | ||
421 | * FUNCTION: acpi_hw_extended_sleep | ||
422 | * | ||
423 | * PARAMETERS: sleep_state - Which sleep state to enter | ||
424 | * | ||
425 | * RETURN: Status | ||
426 | * | ||
427 | * DESCRIPTION: Enter a system sleep state via the extended FADT sleep | ||
428 | * registers (V5 FADT). | ||
429 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED | ||
430 | * | ||
431 | ******************************************************************************/ | ||
432 | |||
433 | acpi_status acpi_hw_extended_sleep(u8 sleep_state) | ||
434 | { | ||
435 | acpi_status status; | ||
436 | u8 sleep_type_value; | ||
437 | u64 sleep_status; | ||
438 | |||
439 | ACPI_FUNCTION_TRACE(hw_extended_sleep); | ||
440 | |||
441 | /* Extended sleep registers must be valid */ | ||
442 | |||
443 | if (!acpi_gbl_FADT.sleep_control.address || | ||
444 | !acpi_gbl_FADT.sleep_status.address) { | ||
445 | return_ACPI_STATUS(AE_NOT_EXIST); | ||
446 | } | ||
447 | |||
448 | /* Clear wake status (WAK_STS) */ | ||
449 | |||
450 | status = acpi_write(ACPI_X_WAKE_STATUS, &acpi_gbl_FADT.sleep_status); | ||
451 | if (ACPI_FAILURE(status)) { | ||
452 | return_ACPI_STATUS(status); | ||
453 | } | ||
454 | |||
455 | acpi_gbl_system_awake_and_running = FALSE; | ||
456 | |||
457 | /* Execute the _GTS method (Going To Sleep) */ | ||
458 | |||
459 | acpi_hw_execute_sleep_method(METHOD_NAME__GTS, sleep_state); | ||
460 | |||
461 | /* Flush caches, as per ACPI specification */ | ||
462 | |||
463 | ACPI_FLUSH_CPU_CACHE(); | ||
464 | |||
465 | /* | ||
466 | * Set the SLP_TYP and SLP_EN bits. | ||
467 | * | ||
468 | * Note: We only use the first value returned by the \_Sx method | ||
469 | * (acpi_gbl_sleep_type_a) - As per ACPI specification. | ||
470 | */ | ||
471 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, | ||
472 | "Entering sleep state [S%u]\n", sleep_state)); | ||
473 | |||
474 | sleep_type_value = | ||
475 | ((acpi_gbl_sleep_type_a << ACPI_X_SLEEP_TYPE_POSITION) & | ||
476 | ACPI_X_SLEEP_TYPE_MASK); | ||
477 | |||
478 | status = acpi_write((sleep_type_value | ACPI_X_SLEEP_ENABLE), | ||
479 | &acpi_gbl_FADT.sleep_control); | ||
480 | if (ACPI_FAILURE(status)) { | ||
481 | return_ACPI_STATUS(status); | ||
482 | } | ||
483 | |||
484 | /* Wait for transition back to Working State */ | ||
485 | |||
486 | do { | ||
487 | status = acpi_read(&sleep_status, &acpi_gbl_FADT.sleep_status); | ||
488 | if (ACPI_FAILURE(status)) { | ||
489 | return_ACPI_STATUS(status); | ||
490 | } | ||
491 | |||
492 | } while (!(((u8)sleep_status) & ACPI_X_WAKE_STATUS)); | ||
493 | |||
494 | return_ACPI_STATUS(AE_OK); | ||
495 | } | ||
496 | |||
497 | /******************************************************************************* | ||
498 | * | ||
499 | * FUNCTION: acpi_hw_extended_wake_prep | ||
500 | * | ||
501 | * PARAMETERS: sleep_state - Which sleep state we just exited | ||
502 | * | ||
503 | * RETURN: Status | ||
504 | * | ||
505 | * DESCRIPTION: Perform first part of OS-independent ACPI cleanup after | ||
506 | * a sleep. Called with interrupts ENABLED. | ||
507 | * | ||
508 | ******************************************************************************/ | ||
509 | |||
510 | acpi_status acpi_hw_extended_wake_prep(u8 sleep_state) | ||
511 | { | ||
512 | acpi_status status; | ||
513 | u8 sleep_type_value; | ||
514 | |||
515 | ACPI_FUNCTION_TRACE(hw_extended_wake_prep); | ||
516 | |||
517 | status = acpi_get_sleep_type_data(ACPI_STATE_S0, | ||
518 | &acpi_gbl_sleep_type_a, | ||
519 | &acpi_gbl_sleep_type_b); | ||
520 | if (ACPI_SUCCESS(status)) { | ||
521 | sleep_type_value = | ||
522 | ((acpi_gbl_sleep_type_a << ACPI_X_SLEEP_TYPE_POSITION) & | ||
523 | ACPI_X_SLEEP_TYPE_MASK); | ||
524 | |||
525 | (void)acpi_write((sleep_type_value | ACPI_X_SLEEP_ENABLE), | ||
526 | &acpi_gbl_FADT.sleep_control); | ||
527 | } | ||
528 | |||
529 | acpi_hw_execute_sleep_method(METHOD_NAME__BFS, sleep_state); | ||
530 | return_ACPI_STATUS(AE_OK); | ||
531 | } | ||
532 | |||
533 | /******************************************************************************* | ||
534 | * | ||
535 | * FUNCTION: acpi_hw_extended_wake | ||
536 | * | ||
537 | * PARAMETERS: sleep_state - Which sleep state we just exited | ||
538 | * | ||
539 | * RETURN: Status | ||
540 | * | ||
541 | * DESCRIPTION: Perform OS-independent ACPI cleanup after a sleep | ||
542 | * Called with interrupts ENABLED. | ||
543 | * | ||
544 | ******************************************************************************/ | ||
545 | |||
546 | acpi_status acpi_hw_extended_wake(u8 sleep_state) | ||
547 | { | ||
548 | ACPI_FUNCTION_TRACE(hw_extended_wake); | ||
549 | |||
550 | /* Ensure enter_sleep_state_prep -> enter_sleep_state ordering */ | ||
551 | |||
552 | acpi_gbl_sleep_type_a = ACPI_SLEEP_TYPE_INVALID; | ||
553 | |||
554 | /* Execute the wake methods */ | ||
555 | |||
556 | acpi_hw_execute_sleep_method(METHOD_NAME__SST, ACPI_SST_WAKING); | ||
557 | acpi_hw_execute_sleep_method(METHOD_NAME__WAK, sleep_state); | ||
558 | |||
559 | /* | ||
560 | * Some BIOS code assumes that WAK_STS will be cleared on resume | ||
561 | * and use it to determine whether the system is rebooting or | ||
562 | * resuming. Clear WAK_STS for compatibility. | ||
563 | */ | ||
564 | (void)acpi_write(ACPI_X_WAKE_STATUS, &acpi_gbl_FADT.sleep_status); | ||
565 | acpi_gbl_system_awake_and_running = TRUE; | ||
566 | |||
567 | acpi_hw_execute_sleep_method(METHOD_NAME__SST, ACPI_SST_WORKING); | ||
568 | return_ACPI_STATUS(AE_OK); | ||
569 | } | ||