aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/sleep.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/sleep.c')
-rw-r--r--drivers/acpi/sleep.c52
1 files changed, 28 insertions, 24 deletions
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 1d661b5c328..eb6fd233764 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -28,23 +28,33 @@
28#include "internal.h" 28#include "internal.h"
29#include "sleep.h" 29#include "sleep.h"
30 30
31u8 wake_sleep_flags = ACPI_NO_OPTIONAL_METHODS;
31static unsigned int gts, bfs; 32static unsigned int gts, bfs;
32module_param(gts, uint, 0644); 33static int set_param_wake_flag(const char *val, struct kernel_param *kp)
33module_param(bfs, uint, 0644);
34MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend.");
35MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".);
36
37static u8 wake_sleep_flags(void)
38{ 34{
39 u8 flags = ACPI_NO_OPTIONAL_METHODS; 35 int ret = param_set_int(val, kp);
40 36
41 if (gts) 37 if (ret)
42 flags |= ACPI_EXECUTE_GTS; 38 return ret;
43 if (bfs)
44 flags |= ACPI_EXECUTE_BFS;
45 39
46 return flags; 40 if (kp->arg == (const char *)&gts) {
41 if (gts)
42 wake_sleep_flags |= ACPI_EXECUTE_GTS;
43 else
44 wake_sleep_flags &= ~ACPI_EXECUTE_GTS;
45 }
46 if (kp->arg == (const char *)&bfs) {
47 if (bfs)
48 wake_sleep_flags |= ACPI_EXECUTE_BFS;
49 else
50 wake_sleep_flags &= ~ACPI_EXECUTE_BFS;
51 }
52 return ret;
47} 53}
54module_param_call(gts, set_param_wake_flag, param_get_int, &gts, 0644);
55module_param_call(bfs, set_param_wake_flag, param_get_int, &bfs, 0644);
56MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend.");
57MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".);
48 58
49static u8 sleep_states[ACPI_S_STATE_COUNT]; 59static u8 sleep_states[ACPI_S_STATE_COUNT];
50 60
@@ -263,7 +273,6 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
263{ 273{
264 acpi_status status = AE_OK; 274 acpi_status status = AE_OK;
265 u32 acpi_state = acpi_target_sleep_state; 275 u32 acpi_state = acpi_target_sleep_state;
266 u8 flags = wake_sleep_flags();
267 int error; 276 int error;
268 277
269 ACPI_FLUSH_CPU_CACHE(); 278 ACPI_FLUSH_CPU_CACHE();
@@ -271,7 +280,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
271 switch (acpi_state) { 280 switch (acpi_state) {
272 case ACPI_STATE_S1: 281 case ACPI_STATE_S1:
273 barrier(); 282 barrier();
274 status = acpi_enter_sleep_state(acpi_state, flags); 283 status = acpi_enter_sleep_state(acpi_state, wake_sleep_flags);
275 break; 284 break;
276 285
277 case ACPI_STATE_S3: 286 case ACPI_STATE_S3:
@@ -286,7 +295,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
286 acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1); 295 acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1);
287 296
288 /* Reprogram control registers and execute _BFS */ 297 /* Reprogram control registers and execute _BFS */
289 acpi_leave_sleep_state_prep(acpi_state, flags); 298 acpi_leave_sleep_state_prep(acpi_state, wake_sleep_flags);
290 299
291 /* ACPI 3.0 specs (P62) says that it's the responsibility 300 /* ACPI 3.0 specs (P62) says that it's the responsibility
292 * of the OSPM to clear the status bit [ implying that the 301 * of the OSPM to clear the status bit [ implying that the
@@ -550,30 +559,27 @@ static int acpi_hibernation_begin(void)
550 559
551static int acpi_hibernation_enter(void) 560static int acpi_hibernation_enter(void)
552{ 561{
553 u8 flags = wake_sleep_flags();
554 acpi_status status = AE_OK; 562 acpi_status status = AE_OK;
555 563
556 ACPI_FLUSH_CPU_CACHE(); 564 ACPI_FLUSH_CPU_CACHE();
557 565
558 /* This shouldn't return. If it returns, we have a problem */ 566 /* This shouldn't return. If it returns, we have a problem */
559 status = acpi_enter_sleep_state(ACPI_STATE_S4, flags); 567 status = acpi_enter_sleep_state(ACPI_STATE_S4, wake_sleep_flags);
560 /* Reprogram control registers and execute _BFS */ 568 /* Reprogram control registers and execute _BFS */
561 acpi_leave_sleep_state_prep(ACPI_STATE_S4, flags); 569 acpi_leave_sleep_state_prep(ACPI_STATE_S4, wake_sleep_flags);
562 570
563 return ACPI_SUCCESS(status) ? 0 : -EFAULT; 571 return ACPI_SUCCESS(status) ? 0 : -EFAULT;
564} 572}
565 573
566static void acpi_hibernation_leave(void) 574static void acpi_hibernation_leave(void)
567{ 575{
568 u8 flags = wake_sleep_flags();
569
570 /* 576 /*
571 * If ACPI is not enabled by the BIOS and the boot kernel, we need to 577 * If ACPI is not enabled by the BIOS and the boot kernel, we need to
572 * enable it here. 578 * enable it here.
573 */ 579 */
574 acpi_enable(); 580 acpi_enable();
575 /* Reprogram control registers and execute _BFS */ 581 /* Reprogram control registers and execute _BFS */
576 acpi_leave_sleep_state_prep(ACPI_STATE_S4, flags); 582 acpi_leave_sleep_state_prep(ACPI_STATE_S4, wake_sleep_flags);
577 /* Check the hardware signature */ 583 /* Check the hardware signature */
578 if (facs && s4_hardware_signature != facs->hardware_signature) { 584 if (facs && s4_hardware_signature != facs->hardware_signature) {
579 printk(KERN_EMERG "ACPI: Hardware changed while hibernated, " 585 printk(KERN_EMERG "ACPI: Hardware changed while hibernated, "
@@ -828,12 +834,10 @@ static void acpi_power_off_prepare(void)
828 834
829static void acpi_power_off(void) 835static void acpi_power_off(void)
830{ 836{
831 u8 flags = wake_sleep_flags();
832
833 /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ 837 /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
834 printk(KERN_DEBUG "%s called\n", __func__); 838 printk(KERN_DEBUG "%s called\n", __func__);
835 local_irq_disable(); 839 local_irq_disable();
836 acpi_enter_sleep_state(ACPI_STATE_S5, flags); 840 acpi_enter_sleep_state(ACPI_STATE_S5, wake_sleep_flags);
837} 841}
838 842
839/* 843/*