aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/sleep.c
diff options
context:
space:
mode:
authorLin Ming <ming.m.lin@intel.com>2012-03-20 22:58:46 -0400
committerLen Brown <len.brown@intel.com>2012-03-26 21:16:26 -0400
commita2ef5c4fd44ce3922435139393b89f2cce47f576 (patch)
treecd94b53ba4975972022c9f48916d367a07b84386 /drivers/acpi/sleep.c
parent8a73b17e4c0e09cb5b80deee5451e29b830df4cc (diff)
ACPI: Move module parameter gts and bfs to sleep.c
Move linux specific module parameter gts and bfs out of ACPICA core code to sleep.c. Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/sleep.c')
-rw-r--r--drivers/acpi/sleep.c38
1 files changed, 31 insertions, 7 deletions
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 8f1fb4520d24..acf81fe86b53 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -17,6 +17,7 @@
17#include <linux/suspend.h> 17#include <linux/suspend.h>
18#include <linux/reboot.h> 18#include <linux/reboot.h>
19#include <linux/acpi.h> 19#include <linux/acpi.h>
20#include <linux/module.h>
20 21
21#include <asm/io.h> 22#include <asm/io.h>
22 23
@@ -26,6 +27,24 @@
26#include "internal.h" 27#include "internal.h"
27#include "sleep.h" 28#include "sleep.h"
28 29
30static unsigned int gts, bfs;
31module_param(gts, uint, 0644);
32module_param(bfs, uint, 0644);
33MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend.");
34MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".);
35
36static u8 wake_sleep_flags(void)
37{
38 u8 flags = ACPI_NO_OPTIONAL_METHODS;
39
40 if (gts)
41 flags |= ACPI_EXECUTE_GTS;
42 if (bfs)
43 flags |= ACPI_EXECUTE_BFS;
44
45 return flags;
46}
47
29static u8 sleep_states[ACPI_S_STATE_COUNT]; 48static u8 sleep_states[ACPI_S_STATE_COUNT];
30 49
31static void acpi_sleep_tts_switch(u32 acpi_state) 50static void acpi_sleep_tts_switch(u32 acpi_state)
@@ -243,6 +262,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
243{ 262{
244 acpi_status status = AE_OK; 263 acpi_status status = AE_OK;
245 u32 acpi_state = acpi_target_sleep_state; 264 u32 acpi_state = acpi_target_sleep_state;
265 u8 flags = wake_sleep_flags();
246 int error; 266 int error;
247 267
248 ACPI_FLUSH_CPU_CACHE(); 268 ACPI_FLUSH_CPU_CACHE();
@@ -250,8 +270,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
250 switch (acpi_state) { 270 switch (acpi_state) {
251 case ACPI_STATE_S1: 271 case ACPI_STATE_S1:
252 barrier(); 272 barrier();
253 status = acpi_enter_sleep_state(acpi_state, 273 status = acpi_enter_sleep_state(acpi_state, flags);
254 ACPI_NO_OPTIONAL_METHODS);
255 break; 274 break;
256 275
257 case ACPI_STATE_S3: 276 case ACPI_STATE_S3:
@@ -266,7 +285,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
266 acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1); 285 acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1);
267 286
268 /* Reprogram control registers and execute _BFS */ 287 /* Reprogram control registers and execute _BFS */
269 acpi_leave_sleep_state_prep(acpi_state, ACPI_NO_OPTIONAL_METHODS); 288 acpi_leave_sleep_state_prep(acpi_state, flags);
270 289
271 /* ACPI 3.0 specs (P62) says that it's the responsibility 290 /* ACPI 3.0 specs (P62) says that it's the responsibility
272 * of the OSPM to clear the status bit [ implying that the 291 * of the OSPM to clear the status bit [ implying that the
@@ -530,27 +549,30 @@ static int acpi_hibernation_begin(void)
530 549
531static int acpi_hibernation_enter(void) 550static int acpi_hibernation_enter(void)
532{ 551{
552 u8 flags = wake_sleep_flags();
533 acpi_status status = AE_OK; 553 acpi_status status = AE_OK;
534 554
535 ACPI_FLUSH_CPU_CACHE(); 555 ACPI_FLUSH_CPU_CACHE();
536 556
537 /* This shouldn't return. If it returns, we have a problem */ 557 /* This shouldn't return. If it returns, we have a problem */
538 status = acpi_enter_sleep_state(ACPI_STATE_S4, ACPI_NO_OPTIONAL_METHODS); 558 status = acpi_enter_sleep_state(ACPI_STATE_S4, flags);
539 /* Reprogram control registers and execute _BFS */ 559 /* Reprogram control registers and execute _BFS */
540 acpi_leave_sleep_state_prep(ACPI_STATE_S4, ACPI_NO_OPTIONAL_METHODS); 560 acpi_leave_sleep_state_prep(ACPI_STATE_S4, flags);
541 561
542 return ACPI_SUCCESS(status) ? 0 : -EFAULT; 562 return ACPI_SUCCESS(status) ? 0 : -EFAULT;
543} 563}
544 564
545static void acpi_hibernation_leave(void) 565static void acpi_hibernation_leave(void)
546{ 566{
567 u8 flags = wake_sleep_flags();
568
547 /* 569 /*
548 * If ACPI is not enabled by the BIOS and the boot kernel, we need to 570 * If ACPI is not enabled by the BIOS and the boot kernel, we need to
549 * enable it here. 571 * enable it here.
550 */ 572 */
551 acpi_enable(); 573 acpi_enable();
552 /* Reprogram control registers and execute _BFS */ 574 /* Reprogram control registers and execute _BFS */
553 acpi_leave_sleep_state_prep(ACPI_STATE_S4, ACPI_NO_OPTIONAL_METHODS); 575 acpi_leave_sleep_state_prep(ACPI_STATE_S4, flags);
554 /* Check the hardware signature */ 576 /* Check the hardware signature */
555 if (facs && s4_hardware_signature != facs->hardware_signature) { 577 if (facs && s4_hardware_signature != facs->hardware_signature) {
556 printk(KERN_EMERG "ACPI: Hardware changed while hibernated, " 578 printk(KERN_EMERG "ACPI: Hardware changed while hibernated, "
@@ -771,10 +793,12 @@ static void acpi_power_off_prepare(void)
771 793
772static void acpi_power_off(void) 794static void acpi_power_off(void)
773{ 795{
796 u8 flags = wake_sleep_flags();
797
774 /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ 798 /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
775 printk(KERN_DEBUG "%s called\n", __func__); 799 printk(KERN_DEBUG "%s called\n", __func__);
776 local_irq_disable(); 800 local_irq_disable();
777 acpi_enter_sleep_state(ACPI_STATE_S5, ACPI_NO_OPTIONAL_METHODS); 801 acpi_enter_sleep_state(ACPI_STATE_S5, flags);
778} 802}
779 803
780/* 804/*