aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2012-02-14 05:43:03 -0500
committerLen Brown <len.brown@intel.com>2012-03-22 01:45:00 -0400
commitf99648b1aff8b6158333a06c50d627be3c243a32 (patch)
tree79718a2ed4c5962a0b728ba4a13b9303fffbdc13 /drivers/acpi
parentf7b004a17c9183f023796dea0d70284684ec000d (diff)
ACPICA: Distill multiple sleep method functions to a single function
Adds acpi_hw_execute_sleep_method to handle the various sleep methods such as _GTS, _BFS, _WAK, and _SST. Removes the specialized functions previously used for each of these methods. 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')
-rw-r--r--drivers/acpi/acpica/achware.h2
-rw-r--r--drivers/acpi/acpica/hwsleep.c153
-rw-r--r--drivers/acpi/acpica/hwxfsleep.c2
3 files changed, 29 insertions, 128 deletions
diff --git a/drivers/acpi/acpica/achware.h b/drivers/acpi/acpica/achware.h
index eed204acf0f9..d3f62a83f454 100644
--- a/drivers/acpi/acpica/achware.h
+++ b/drivers/acpi/acpica/achware.h
@@ -83,7 +83,7 @@ acpi_status acpi_hw_clear_acpi_status(void);
83/* 83/*
84 * hwsleep - sleep/wake support 84 * hwsleep - sleep/wake support
85 */ 85 */
86void acpi_hw_execute_SST(u32 value); 86void acpi_hw_execute_sleep_method(char *method_name, u32 integer_argument);
87 87
88acpi_status acpi_hw_extended_sleep(u8 sleep_state); 88acpi_status acpi_hw_extended_sleep(u8 sleep_state);
89 89
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index fa341471c231..abe65ff4231e 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -49,13 +49,6 @@
49#define _COMPONENT ACPI_HARDWARE 49#define _COMPONENT ACPI_HARDWARE
50ACPI_MODULE_NAME("hwsleep") 50ACPI_MODULE_NAME("hwsleep")
51 51
52/* Local prototypes */
53static void acpi_hw_execute_GTS(u8 sleep_state);
54
55static void acpi_hw_execute_BFS(u8 sleep_state);
56
57static void acpi_hw_execute_WAK(u8 sleep_state);
58
59static unsigned int gts, bfs; 52static unsigned int gts, bfs;
60module_param(gts, uint, 0644); 53module_param(gts, uint, 0644);
61module_param(bfs, uint, 0644); 54module_param(bfs, uint, 0644);
@@ -64,137 +57,45 @@ MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".);
64 57
65/******************************************************************************* 58/*******************************************************************************
66 * 59 *
67 * FUNCTION: acpi_hw_execute_GTS 60 * FUNCTION: acpi_hw_execute_sleep_method
68 * 61 *
69 * PARAMETERS: sleep_state - Sleep state that will be entered 62 * PARAMETERS: method_name - Pathname of method to execute
63 * integer_argument - Argument to pass to the method
70 * 64 *
71 * RETURN: None 65 * RETURN: None
72 * 66 *
73 * DESCRIPTION: Execute the optional _GTS method (Going To Sleep) 67 * DESCRIPTION: Execute a sleep/wake related method, with one integer argument
68 * and no return value.
74 * 69 *
75 ******************************************************************************/ 70 ******************************************************************************/
76 71void acpi_hw_execute_sleep_method(char *method_name, u32 integer_argument)
77static void acpi_hw_execute_GTS(u8 sleep_state)
78{ 72{
79 struct acpi_object_list arg_list; 73 struct acpi_object_list arg_list;
80 union acpi_object arg; 74 union acpi_object arg;
81 acpi_status status; 75 acpi_status status;
82 76
83 if (!gts) 77 ACPI_FUNCTION_TRACE(hw_execute_sleep_method);
84 return;
85 78
86 /* One argument, sleep_state */ 79 if (!ACPI_STRCMP(METHOD_NAME__GTS, method_name) && !gts)
80 return_VOID;
87 81
88 arg_list.count = 1; 82 if (!ACPI_STRCMP(METHOD_NAME__BFS, method_name) && !bfs)
89 arg_list.pointer = &arg; 83 return_VOID;
90 arg.type = ACPI_TYPE_INTEGER;
91 arg.integer.value = sleep_state;
92 84
93 status = acpi_evaluate_object(NULL, METHOD_NAME__GTS, &arg_list, NULL); 85 /* One argument, integer_argument */
94 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
95 ACPI_EXCEPTION((AE_INFO, status,
96 "While executing method _GTS"));
97 }
98}
99
100/*******************************************************************************
101 *
102 * FUNCTION: acpi_hw_execute_BFS
103 *
104 * PARAMETERS: sleep_state - Which sleep state we just exited
105 *
106 * RETURN: None
107 *
108 * DESCRIPTION: Execute the optional _BFS method (Back From Sleep)
109 *
110 ******************************************************************************/
111
112static void acpi_hw_execute_BFS(u8 sleep_state)
113{
114 struct acpi_object_list arg_list;
115 union acpi_object arg;
116 acpi_status status;
117
118 if (!bfs)
119 return;
120
121 /* One argument, sleep_state */
122 86
123 arg_list.count = 1; 87 arg_list.count = 1;
124 arg_list.pointer = &arg; 88 arg_list.pointer = &arg;
125 arg.type = ACPI_TYPE_INTEGER; 89 arg.type = ACPI_TYPE_INTEGER;
126 arg.integer.value = sleep_state; 90 arg.integer.value = (u64)integer_argument;
127 91
128 status = acpi_evaluate_object(NULL, METHOD_NAME__BFS, &arg_list, NULL); 92 status = acpi_evaluate_object(NULL, method_name, &arg_list, NULL);
129 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { 93 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
130 ACPI_EXCEPTION((AE_INFO, status, 94 ACPI_EXCEPTION((AE_INFO, status, "While executing method %s",
131 "While executing method _BFS")); 95 method_name));
132 } 96 }
133}
134 97
135/******************************************************************************* 98 return_VOID;
136 *
137 * FUNCTION: acpi_hw_execute_WAK
138 *
139 * PARAMETERS: sleep_state - Which sleep state we just exited
140 *
141 * RETURN: None
142 *
143 * DESCRIPTION: Execute the _WAK method (System Wake)
144 *
145 ******************************************************************************/
146
147static void acpi_hw_execute_WAK(u8 sleep_state)
148{
149 struct acpi_object_list arg_list;
150 union acpi_object arg;
151 acpi_status status;
152
153 /* One argument, sleep_state */
154
155 arg_list.count = 1;
156 arg_list.pointer = &arg;
157 arg.type = ACPI_TYPE_INTEGER;
158 arg.integer.value = sleep_state;
159
160 status = acpi_evaluate_object(NULL, METHOD_NAME__WAK, &arg_list, NULL);
161 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
162 ACPI_EXCEPTION((AE_INFO, status,
163 "While executing method _WAK"));
164 }
165 /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */
166}
167
168/*******************************************************************************
169 *
170 * FUNCTION: acpi_hw_execute_SST
171 *
172 * PARAMETERS: indicator_id - Value to be passed to the _SST method
173 *
174 * RETURN: None
175 *
176 * DESCRIPTION: Execute the optional _SST method (System Status)
177 *
178 ******************************************************************************/
179
180void acpi_hw_execute_SST(u32 indicator_id)
181{
182 struct acpi_object_list arg_list;
183 union acpi_object arg;
184 acpi_status status;
185
186 /* One argument, status indicator ID */
187
188 arg_list.count = 1;
189 arg_list.pointer = &arg;
190 arg.type = ACPI_TYPE_INTEGER;
191
192 arg.integer.value = indicator_id;
193 status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL);
194 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
195 ACPI_EXCEPTION((AE_INFO, status,
196 "While executing method _SST"));
197 }
198} 99}
199 100
200#if (!ACPI_REDUCED_HARDWARE) 101#if (!ACPI_REDUCED_HARDWARE)
@@ -271,7 +172,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)
271 172
272 /* Execute the _GTS method (Going To Sleep) */ 173 /* Execute the _GTS method (Going To Sleep) */
273 174
274 acpi_hw_execute_GTS(sleep_state); 175 acpi_hw_execute_sleep_method(METHOD_NAME__GTS, sleep_state);
275 176
276 /* Get current value of PM1A control */ 177 /* Get current value of PM1A control */
277 178
@@ -427,7 +328,7 @@ acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state)
427 } 328 }
428 } 329 }
429 330
430 acpi_hw_execute_BFS(sleep_state); 331 acpi_hw_execute_sleep_method(METHOD_NAME__BFS, sleep_state);
431 return_ACPI_STATUS(status); 332 return_ACPI_STATUS(status);
432} 333}
433 334
@@ -453,7 +354,7 @@ acpi_status acpi_hw_legacy_wake(u8 sleep_state)
453 /* Ensure enter_sleep_state_prep -> enter_sleep_state ordering */ 354 /* Ensure enter_sleep_state_prep -> enter_sleep_state ordering */
454 355
455 acpi_gbl_sleep_type_a = ACPI_SLEEP_TYPE_INVALID; 356 acpi_gbl_sleep_type_a = ACPI_SLEEP_TYPE_INVALID;
456 acpi_hw_execute_SST(ACPI_SST_WAKING); 357 acpi_hw_execute_sleep_method(METHOD_NAME__SST, ACPI_SST_WAKING);
457 358
458 /* 359 /*
459 * GPEs must be enabled before _WAK is called as GPEs 360 * GPEs must be enabled before _WAK is called as GPEs
@@ -477,7 +378,7 @@ acpi_status acpi_hw_legacy_wake(u8 sleep_state)
477 * Now we can execute _WAK, etc. Some machines require that the GPEs 378 * Now we can execute _WAK, etc. Some machines require that the GPEs
478 * are enabled before the wake methods are executed. 379 * are enabled before the wake methods are executed.
479 */ 380 */
480 acpi_hw_execute_WAK(sleep_state); 381 acpi_hw_execute_sleep_method(METHOD_NAME__WAK, sleep_state);
481 382
482 /* 383 /*
483 * Some BIOS code assumes that WAK_STS will be cleared on resume 384 * Some BIOS code assumes that WAK_STS will be cleared on resume
@@ -509,7 +410,7 @@ acpi_status acpi_hw_legacy_wake(u8 sleep_state)
509 return_ACPI_STATUS(status); 410 return_ACPI_STATUS(status);
510 } 411 }
511 412
512 acpi_hw_execute_SST(ACPI_SST_WORKING); 413 acpi_hw_execute_sleep_method(METHOD_NAME__SST, ACPI_SST_WORKING);
513 return_ACPI_STATUS(status); 414 return_ACPI_STATUS(status);
514} 415}
515 416
@@ -555,7 +456,7 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)
555 456
556 /* Execute the _GTS method (Going To Sleep) */ 457 /* Execute the _GTS method (Going To Sleep) */
557 458
558 acpi_hw_execute_GTS(sleep_state); 459 acpi_hw_execute_sleep_method(METHOD_NAME__GTS, sleep_state);
559 460
560 /* Flush caches, as per ACPI specification */ 461 /* Flush caches, as per ACPI specification */
561 462
@@ -625,7 +526,7 @@ acpi_status acpi_hw_extended_wake_prep(u8 sleep_state)
625 &acpi_gbl_FADT.sleep_control); 526 &acpi_gbl_FADT.sleep_control);
626 } 527 }
627 528
628 acpi_hw_execute_BFS(sleep_state); 529 acpi_hw_execute_sleep_method(METHOD_NAME__BFS, sleep_state);
629 return_ACPI_STATUS(AE_OK); 530 return_ACPI_STATUS(AE_OK);
630} 531}
631 532
@@ -652,8 +553,8 @@ acpi_status acpi_hw_extended_wake(u8 sleep_state)
652 553
653 /* Execute the wake methods */ 554 /* Execute the wake methods */
654 555
655 acpi_hw_execute_SST(ACPI_SST_WAKING); 556 acpi_hw_execute_sleep_method(METHOD_NAME__SST, ACPI_SST_WAKING);
656 acpi_hw_execute_WAK(sleep_state); 557 acpi_hw_execute_sleep_method(METHOD_NAME__WAK, sleep_state);
657 558
658 /* 559 /*
659 * Some BIOS code assumes that WAK_STS will be cleared on resume 560 * Some BIOS code assumes that WAK_STS will be cleared on resume
@@ -663,6 +564,6 @@ acpi_status acpi_hw_extended_wake(u8 sleep_state)
663 (void)acpi_write(ACPI_X_WAKE_STATUS, &acpi_gbl_FADT.sleep_status); 564 (void)acpi_write(ACPI_X_WAKE_STATUS, &acpi_gbl_FADT.sleep_status);
664 acpi_gbl_system_awake_and_running = TRUE; 565 acpi_gbl_system_awake_and_running = TRUE;
665 566
666 acpi_hw_execute_SST(ACPI_SST_WORKING); 567 acpi_hw_execute_sleep_method(METHOD_NAME__SST, ACPI_SST_WORKING);
667 return_ACPI_STATUS(AE_OK); 568 return_ACPI_STATUS(AE_OK);
668} 569}
diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c
index d599961e93c8..ff2055804809 100644
--- a/drivers/acpi/acpica/hwxfsleep.c
+++ b/drivers/acpi/acpica/hwxfsleep.c
@@ -261,7 +261,7 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)
261 * Set the system indicators to show the desired sleep state. 261 * Set the system indicators to show the desired sleep state.
262 * _SST is an optional method (return no error if not found) 262 * _SST is an optional method (return no error if not found)
263 */ 263 */
264 acpi_hw_execute_SST(sst_value); 264 acpi_hw_execute_sleep_method(METHOD_NAME__SST, sst_value);
265 return_ACPI_STATUS(AE_OK); 265 return_ACPI_STATUS(AE_OK);
266} 266}
267 267