aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/hardware
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-07-12 17:21:56 -0400
committerLen Brown <len.brown@intel.com>2005-07-12 17:21:56 -0400
commit5028770a42e7bc4d15791a44c28f0ad539323807 (patch)
tree74800e35129775413c13ce7caf036ca19e3ce56c /drivers/acpi/hardware
parent9f02d6b7b43d46a74dd385f06090104ecd0fb807 (diff)
parentd8683a0cb5d09cb7f19feefa708424a84577e68f (diff)
[ACPI] merge acpi-2.6.12 branch into latest Linux 2.6.13-rc...
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/hardware')
-rw-r--r--drivers/acpi/hardware/hwacpi.c19
-rw-r--r--drivers/acpi/hardware/hwgpe.c31
-rw-r--r--drivers/acpi/hardware/hwregs.c114
-rw-r--r--drivers/acpi/hardware/hwsleep.c101
-rw-r--r--drivers/acpi/hardware/hwtimer.c4
5 files changed, 156 insertions, 113 deletions
diff --git a/drivers/acpi/hardware/hwacpi.c b/drivers/acpi/hardware/hwacpi.c
index 529e922bdc85..b51001e74eea 100644
--- a/drivers/acpi/hardware/hwacpi.c
+++ b/drivers/acpi/hardware/hwacpi.c
@@ -58,7 +58,8 @@
58 * 58 *
59 * RETURN: Status 59 * RETURN: Status
60 * 60 *
61 * DESCRIPTION: Initialize and validate various ACPI registers 61 * DESCRIPTION: Initialize and validate the various ACPI registers defined in
62 * the FADT.
62 * 63 *
63 ******************************************************************************/ 64 ******************************************************************************/
64 65
@@ -75,7 +76,7 @@ acpi_hw_initialize (
75 /* We must have the ACPI tables by the time we get here */ 76 /* We must have the ACPI tables by the time we get here */
76 77
77 if (!acpi_gbl_FADT) { 78 if (!acpi_gbl_FADT) {
78 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "A FADT is not loaded\n")); 79 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No FADT is present\n"));
79 80
80 return_ACPI_STATUS (AE_NO_ACPI_TABLES); 81 return_ACPI_STATUS (AE_NO_ACPI_TABLES);
81 } 82 }
@@ -131,7 +132,8 @@ acpi_hw_set_mode (
131 * transitions are not supported. 132 * transitions are not supported.
132 */ 133 */
133 if (!acpi_gbl_FADT->acpi_enable && !acpi_gbl_FADT->acpi_disable) { 134 if (!acpi_gbl_FADT->acpi_enable && !acpi_gbl_FADT->acpi_disable) {
134 ACPI_REPORT_ERROR (("No ACPI mode transition supported in this system (enable/disable both zero)\n")); 135 ACPI_REPORT_ERROR ((
136 "No ACPI mode transition supported in this system (enable/disable both zero)\n"));
135 return_ACPI_STATUS (AE_OK); 137 return_ACPI_STATUS (AE_OK);
136 } 138 }
137 139
@@ -162,7 +164,8 @@ acpi_hw_set_mode (
162 } 164 }
163 165
164 if (ACPI_FAILURE (status)) { 166 if (ACPI_FAILURE (status)) {
165 ACPI_REPORT_ERROR (("Could not write mode change, %s\n", acpi_format_exception (status))); 167 ACPI_REPORT_ERROR (("Could not write mode change, %s\n",
168 acpi_format_exception (status)));
166 return_ACPI_STATUS (status); 169 return_ACPI_STATUS (status);
167 } 170 }
168 171
@@ -173,7 +176,8 @@ acpi_hw_set_mode (
173 retry = 3000; 176 retry = 3000;
174 while (retry) { 177 while (retry) {
175 if (acpi_hw_get_mode() == mode) { 178 if (acpi_hw_get_mode() == mode) {
176 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n", mode)); 179 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n",
180 mode));
177 return_ACPI_STATUS (AE_OK); 181 return_ACPI_STATUS (AE_OK);
178 } 182 }
179 acpi_os_stall(1000); 183 acpi_os_stall(1000);
@@ -185,7 +189,7 @@ acpi_hw_set_mode (
185} 189}
186 190
187 191
188/****************************************************************************** 192/*******************************************************************************
189 * 193 *
190 * FUNCTION: acpi_hw_get_mode 194 * FUNCTION: acpi_hw_get_mode
191 * 195 *
@@ -199,7 +203,8 @@ acpi_hw_set_mode (
199 ******************************************************************************/ 203 ******************************************************************************/
200 204
201u32 205u32
202acpi_hw_get_mode (void) 206acpi_hw_get_mode (
207 void)
203{ 208{
204 acpi_status status; 209 acpi_status status;
205 u32 value; 210 u32 value;
diff --git a/drivers/acpi/hardware/hwgpe.c b/drivers/acpi/hardware/hwgpe.c
index 9ac1d639bf51..8daeabb2fc7a 100644
--- a/drivers/acpi/hardware/hwgpe.c
+++ b/drivers/acpi/hardware/hwgpe.c
@@ -48,6 +48,13 @@
48#define _COMPONENT ACPI_HARDWARE 48#define _COMPONENT ACPI_HARDWARE
49 ACPI_MODULE_NAME ("hwgpe") 49 ACPI_MODULE_NAME ("hwgpe")
50 50
51/* Local prototypes */
52
53static acpi_status
54acpi_hw_enable_wakeup_gpe_block (
55 struct acpi_gpe_xrupt_info *gpe_xrupt_info,
56 struct acpi_gpe_block_info *gpe_block);
57
51 58
52/****************************************************************************** 59/******************************************************************************
53 * 60 *
@@ -135,6 +142,7 @@ acpi_hw_clear_gpe (
135 * DESCRIPTION: Return the status of a single GPE. 142 * DESCRIPTION: Return the status of a single GPE.
136 * 143 *
137 ******************************************************************************/ 144 ******************************************************************************/
145
138#ifdef ACPI_FUTURE_USAGE 146#ifdef ACPI_FUTURE_USAGE
139acpi_status 147acpi_status
140acpi_hw_get_gpe_status ( 148acpi_hw_get_gpe_status (
@@ -206,7 +214,7 @@ unlock_and_exit:
206 * 214 *
207 * RETURN: Status 215 * RETURN: Status
208 * 216 *
209 * DESCRIPTION: Disable all GPEs within a GPE block 217 * DESCRIPTION: Disable all GPEs within a single GPE block
210 * 218 *
211 ******************************************************************************/ 219 ******************************************************************************/
212 220
@@ -244,7 +252,7 @@ acpi_hw_disable_gpe_block (
244 * 252 *
245 * RETURN: Status 253 * RETURN: Status
246 * 254 *
247 * DESCRIPTION: Clear status bits for all GPEs within a GPE block 255 * DESCRIPTION: Clear status bits for all GPEs within a single GPE block
248 * 256 *
249 ******************************************************************************/ 257 ******************************************************************************/
250 258
@@ -282,8 +290,8 @@ acpi_hw_clear_gpe_block (
282 * 290 *
283 * RETURN: Status 291 * RETURN: Status
284 * 292 *
285 * DESCRIPTION: Enable all "runtime" GPEs within a GPE block. (Includes 293 * DESCRIPTION: Enable all "runtime" GPEs within a single GPE block. Includes
286 * combination wake/run GPEs.) 294 * combination wake/run GPEs.
287 * 295 *
288 ******************************************************************************/ 296 ******************************************************************************/
289 297
@@ -327,12 +335,12 @@ acpi_hw_enable_runtime_gpe_block (
327 * 335 *
328 * RETURN: Status 336 * RETURN: Status
329 * 337 *
330 * DESCRIPTION: Enable all "wake" GPEs within a GPE block. (Includes 338 * DESCRIPTION: Enable all "wake" GPEs within a single GPE block. Includes
331 * combination wake/run GPEs.) 339 * combination wake/run GPEs.
332 * 340 *
333 ******************************************************************************/ 341 ******************************************************************************/
334 342
335acpi_status 343static acpi_status
336acpi_hw_enable_wakeup_gpe_block ( 344acpi_hw_enable_wakeup_gpe_block (
337 struct acpi_gpe_xrupt_info *gpe_xrupt_info, 345 struct acpi_gpe_xrupt_info *gpe_xrupt_info,
338 struct acpi_gpe_block_info *gpe_block) 346 struct acpi_gpe_block_info *gpe_block)
@@ -350,7 +358,8 @@ acpi_hw_enable_wakeup_gpe_block (
350 358
351 /* Enable all "wake" GPEs in this register */ 359 /* Enable all "wake" GPEs in this register */
352 360
353 status = acpi_hw_low_level_write (8, gpe_block->register_info[i].enable_for_wake, 361 status = acpi_hw_low_level_write (8,
362 gpe_block->register_info[i].enable_for_wake,
354 &gpe_block->register_info[i].enable_address); 363 &gpe_block->register_info[i].enable_address);
355 if (ACPI_FAILURE (status)) { 364 if (ACPI_FAILURE (status)) {
356 return (status); 365 return (status);
@@ -369,7 +378,7 @@ acpi_hw_enable_wakeup_gpe_block (
369 * 378 *
370 * RETURN: Status 379 * RETURN: Status
371 * 380 *
372 * DESCRIPTION: Disable and clear all GPEs 381 * DESCRIPTION: Disable and clear all GPEs in all GPE blocks
373 * 382 *
374 ******************************************************************************/ 383 ******************************************************************************/
375 384
@@ -397,7 +406,7 @@ acpi_hw_disable_all_gpes (
397 * 406 *
398 * RETURN: Status 407 * RETURN: Status
399 * 408 *
400 * DESCRIPTION: Enable all GPEs of the given type 409 * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks
401 * 410 *
402 ******************************************************************************/ 411 ******************************************************************************/
403 412
@@ -424,7 +433,7 @@ acpi_hw_enable_all_runtime_gpes (
424 * 433 *
425 * RETURN: Status 434 * RETURN: Status
426 * 435 *
427 * DESCRIPTION: Enable all GPEs of the given type 436 * DESCRIPTION: Enable all "wakeup" GPEs, in all GPE blocks
428 * 437 *
429 ******************************************************************************/ 438 ******************************************************************************/
430 439
diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c
index 91af0c2ddcf7..6d9e4eb84836 100644
--- a/drivers/acpi/hardware/hwregs.c
+++ b/drivers/acpi/hardware/hwregs.c
@@ -87,8 +87,9 @@ acpi_hw_clear_acpi_status (
87 } 87 }
88 } 88 }
89 89
90 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, 90 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
91 ACPI_BITMASK_ALL_FIXED_STATUS); 91 ACPI_REGISTER_PM1_STATUS,
92 ACPI_BITMASK_ALL_FIXED_STATUS);
92 if (ACPI_FAILURE (status)) { 93 if (ACPI_FAILURE (status)) {
93 goto unlock_and_exit; 94 goto unlock_and_exit;
94 } 95 }
@@ -138,28 +139,30 @@ acpi_get_sleep_type_data (
138{ 139{
139 acpi_status status = AE_OK; 140 acpi_status status = AE_OK;
140 struct acpi_parameter_info info; 141 struct acpi_parameter_info info;
142 char *sleep_state_name;
141 143
142 144
143 ACPI_FUNCTION_TRACE ("acpi_get_sleep_type_data"); 145 ACPI_FUNCTION_TRACE ("acpi_get_sleep_type_data");
144 146
145 147
146 /* 148 /* Validate parameters */
147 * Validate parameters 149
148 */
149 if ((sleep_state > ACPI_S_STATES_MAX) || 150 if ((sleep_state > ACPI_S_STATES_MAX) ||
150 !sleep_type_a || !sleep_type_b) { 151 !sleep_type_a || !sleep_type_b) {
151 return_ACPI_STATUS (AE_BAD_PARAMETER); 152 return_ACPI_STATUS (AE_BAD_PARAMETER);
152 } 153 }
153 154
154 /* 155 /* Evaluate the namespace object containing the values for this state */
155 * Evaluate the namespace object containing the values for this state 156
156 */
157 info.parameters = NULL; 157 info.parameters = NULL;
158 status = acpi_ns_evaluate_by_name ((char *) acpi_gbl_sleep_state_names[sleep_state], 158 info.return_object = NULL;
159 &info); 159 sleep_state_name = (char *) acpi_gbl_sleep_state_names[sleep_state];
160
161 status = acpi_ns_evaluate_by_name (sleep_state_name, &info);
160 if (ACPI_FAILURE (status)) { 162 if (ACPI_FAILURE (status)) {
161 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s while evaluating sleep_state [%s]\n", 163 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
162 acpi_format_exception (status), acpi_gbl_sleep_state_names[sleep_state])); 164 "%s while evaluating sleep_state [%s]\n",
165 acpi_format_exception (status), sleep_state_name));
163 166
164 return_ACPI_STATUS (status); 167 return_ACPI_STATUS (status);
165 } 168 }
@@ -167,45 +170,57 @@ acpi_get_sleep_type_data (
167 /* Must have a return object */ 170 /* Must have a return object */
168 171
169 if (!info.return_object) { 172 if (!info.return_object) {
170 ACPI_REPORT_ERROR (("Missing Sleep State object\n")); 173 ACPI_REPORT_ERROR (("No Sleep State object returned from [%s]\n",
174 sleep_state_name));
171 status = AE_NOT_EXIST; 175 status = AE_NOT_EXIST;
172 } 176 }
173 177
174 /* It must be of type Package */ 178 /* It must be of type Package */
175 179
176 else if (ACPI_GET_OBJECT_TYPE (info.return_object) != ACPI_TYPE_PACKAGE) { 180 else if (ACPI_GET_OBJECT_TYPE (info.return_object) != ACPI_TYPE_PACKAGE) {
177 ACPI_REPORT_ERROR (("Sleep State object not a Package\n")); 181 ACPI_REPORT_ERROR (("Sleep State return object is not a Package\n"));
178 status = AE_AML_OPERAND_TYPE; 182 status = AE_AML_OPERAND_TYPE;
179 } 183 }
180 184
181 /* The package must have at least two elements */ 185 /*
182 186 * The package must have at least two elements. NOTE (March 2005): This
187 * goes against the current ACPI spec which defines this object as a
188 * package with one encoded DWORD element. However, existing practice
189 * by BIOS vendors seems to be to have 2 or more elements, at least
190 * one per sleep type (A/B).
191 */
183 else if (info.return_object->package.count < 2) { 192 else if (info.return_object->package.count < 2) {
184 ACPI_REPORT_ERROR (("Sleep State package does not have at least two elements\n")); 193 ACPI_REPORT_ERROR ((
194 "Sleep State return package does not have at least two elements\n"));
185 status = AE_AML_NO_OPERAND; 195 status = AE_AML_NO_OPERAND;
186 } 196 }
187 197
188 /* The first two elements must both be of type Integer */ 198 /* The first two elements must both be of type Integer */
189 199
190 else if ((ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[0]) != ACPI_TYPE_INTEGER) || 200 else if ((ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[0])
191 (ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[1]) != ACPI_TYPE_INTEGER)) { 201 != ACPI_TYPE_INTEGER) ||
192 ACPI_REPORT_ERROR (("Sleep State package elements are not both Integers (%s, %s)\n", 202 (ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[1])
203 != ACPI_TYPE_INTEGER)) {
204 ACPI_REPORT_ERROR ((
205 "Sleep State return package elements are not both Integers (%s, %s)\n",
193 acpi_ut_get_object_type_name (info.return_object->package.elements[0]), 206 acpi_ut_get_object_type_name (info.return_object->package.elements[0]),
194 acpi_ut_get_object_type_name (info.return_object->package.elements[1]))); 207 acpi_ut_get_object_type_name (info.return_object->package.elements[1])));
195 status = AE_AML_OPERAND_TYPE; 208 status = AE_AML_OPERAND_TYPE;
196 } 209 }
197 else { 210 else {
198 /* 211 /* Valid _Sx_ package size, type, and value */
199 * Valid _Sx_ package size, type, and value 212
200 */ 213 *sleep_type_a = (u8)
201 *sleep_type_a = (u8) (info.return_object->package.elements[0])->integer.value; 214 (info.return_object->package.elements[0])->integer.value;
202 *sleep_type_b = (u8) (info.return_object->package.elements[1])->integer.value; 215 *sleep_type_b = (u8)
216 (info.return_object->package.elements[1])->integer.value;
203 } 217 }
204 218
205 if (ACPI_FAILURE (status)) { 219 if (ACPI_FAILURE (status)) {
206 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 220 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
207 "While evaluating sleep_state [%s], bad Sleep object %p type %s\n", 221 "%s While evaluating sleep_state [%s], bad Sleep object %p type %s\n",
208 acpi_gbl_sleep_state_names[sleep_state], info.return_object, 222 acpi_format_exception (status),
223 sleep_state_name, info.return_object,
209 acpi_ut_get_object_type_name (info.return_object))); 224 acpi_ut_get_object_type_name (info.return_object)));
210 } 225 }
211 226
@@ -221,9 +236,9 @@ EXPORT_SYMBOL(acpi_get_sleep_type_data);
221 * 236 *
222 * PARAMETERS: register_id - Index of ACPI Register to access 237 * PARAMETERS: register_id - Index of ACPI Register to access
223 * 238 *
224 * RETURN: The bit mask to be used when accessing the register 239 * RETURN: The bitmask to be used when accessing the register
225 * 240 *
226 * DESCRIPTION: Map register_id into a register bit mask. 241 * DESCRIPTION: Map register_id into a register bitmask.
227 * 242 *
228 ******************************************************************************/ 243 ******************************************************************************/
229 244
@@ -359,7 +374,7 @@ acpi_set_register (
359 /* Always do a register read first so we can insert the new bits */ 374 /* Always do a register read first so we can insert the new bits */
360 375
361 status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, 376 status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
362 bit_reg_info->parent_register, &register_value); 377 bit_reg_info->parent_register, &register_value);
363 if (ACPI_FAILURE (status)) { 378 if (ACPI_FAILURE (status)) {
364 goto unlock_and_exit; 379 goto unlock_and_exit;
365 } 380 }
@@ -396,7 +411,7 @@ acpi_set_register (
396 bit_reg_info->access_bit_mask, value); 411 bit_reg_info->access_bit_mask, value);
397 412
398 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, 413 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
399 ACPI_REGISTER_PM1_ENABLE, (u16) register_value); 414 ACPI_REGISTER_PM1_ENABLE, (u16) register_value);
400 break; 415 break;
401 416
402 417
@@ -413,7 +428,7 @@ acpi_set_register (
413 bit_reg_info->access_bit_mask, value); 428 bit_reg_info->access_bit_mask, value);
414 429
415 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, 430 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
416 ACPI_REGISTER_PM1_CONTROL, (u16) register_value); 431 ACPI_REGISTER_PM1_CONTROL, (u16) register_value);
417 break; 432 break;
418 433
419 434
@@ -427,17 +442,19 @@ acpi_set_register (
427 442
428 ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n", 443 ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n",
429 register_value, 444 register_value,
430 ACPI_FORMAT_UINT64 (acpi_gbl_FADT->xpm2_cnt_blk.address))); 445 ACPI_FORMAT_UINT64 (
446 acpi_gbl_FADT->xpm2_cnt_blk.address)));
431 447
432 ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position, 448 ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position,
433 bit_reg_info->access_bit_mask, value); 449 bit_reg_info->access_bit_mask, value);
434 450
435 ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %4.4X to %8.8X%8.8X\n", 451 ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %4.4X to %8.8X%8.8X\n",
436 register_value, 452 register_value,
437 ACPI_FORMAT_UINT64 (acpi_gbl_FADT->xpm2_cnt_blk.address))); 453 ACPI_FORMAT_UINT64 (
454 acpi_gbl_FADT->xpm2_cnt_blk.address)));
438 455
439 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, 456 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
440 ACPI_REGISTER_PM2_CONTROL, (u8) (register_value)); 457 ACPI_REGISTER_PM2_CONTROL, (u8) (register_value));
441 break; 458 break;
442 459
443 460
@@ -454,7 +471,9 @@ unlock_and_exit:
454 471
455 /* Normalize the value that was read */ 472 /* Normalize the value that was read */
456 473
457 ACPI_DEBUG_EXEC (register_value = ((register_value & bit_reg_info->access_bit_mask) >> bit_reg_info->bit_position)); 474 ACPI_DEBUG_EXEC (register_value =
475 ((register_value & bit_reg_info->access_bit_mask) >>
476 bit_reg_info->bit_position));
458 477
459 ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n", 478 ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n",
460 value, register_value, bit_reg_info->parent_register)); 479 value, register_value, bit_reg_info->parent_register));
@@ -469,7 +488,7 @@ EXPORT_SYMBOL(acpi_set_register);
469 * 488 *
470 * PARAMETERS: use_lock - Mutex hw access 489 * PARAMETERS: use_lock - Mutex hw access
471 * register_id - register_iD + Offset 490 * register_id - register_iD + Offset
472 * return_value - Value that was read from the register 491 * return_value - Where the register value is returned
473 * 492 *
474 * RETURN: Status and the value read. 493 * RETURN: Status and the value read.
475 * 494 *
@@ -557,7 +576,8 @@ acpi_hw_register_read (
557 break; 576 break;
558 577
559 default: 578 default:
560 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Register ID: %X\n", register_id)); 579 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Register ID: %X\n",
580 register_id));
561 status = AE_BAD_PARAMETER; 581 status = AE_BAD_PARAMETER;
562 break; 582 break;
563 } 583 }
@@ -763,10 +783,11 @@ acpi_hw_low_level_read (
763 return (AE_BAD_PARAMETER); 783 return (AE_BAD_PARAMETER);
764 } 784 }
765 785
766 ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", 786 ACPI_DEBUG_PRINT ((ACPI_DB_IO,
767 *value, width, 787 "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n",
768 ACPI_FORMAT_UINT64 (address), 788 *value, width,
769 acpi_ut_get_region_name (reg->address_space_id))); 789 ACPI_FORMAT_UINT64 (address),
790 acpi_ut_get_region_name (reg->address_space_id)));
770 791
771 return (status); 792 return (status);
772} 793}
@@ -841,10 +862,11 @@ acpi_hw_low_level_write (
841 return (AE_BAD_PARAMETER); 862 return (AE_BAD_PARAMETER);
842 } 863 }
843 864
844 ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", 865 ACPI_DEBUG_PRINT ((ACPI_DB_IO,
845 value, width, 866 "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",
846 ACPI_FORMAT_UINT64 (address), 867 value, width,
847 acpi_ut_get_region_name (reg->address_space_id))); 868 ACPI_FORMAT_UINT64 (address),
869 acpi_ut_get_region_name (reg->address_space_id)));
848 870
849 return (status); 871 return (status);
850} 872}
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c
index 77b3e9a8550b..415d342aeab5 100644
--- a/drivers/acpi/hardware/hwsleep.c
+++ b/drivers/acpi/hardware/hwsleep.c
@@ -43,27 +43,13 @@
43 */ 43 */
44 44
45#include <linux/module.h> 45#include <linux/module.h>
46
47#include <acpi/acpi.h> 46#include <acpi/acpi.h>
48 47
49#define _COMPONENT ACPI_HARDWARE 48#define _COMPONENT ACPI_HARDWARE
50 ACPI_MODULE_NAME ("hwsleep") 49 ACPI_MODULE_NAME ("hwsleep")
51 50
52 51
53#define METHOD_NAME__BFS "\\_BFS" 52/*******************************************************************************
54#define METHOD_NAME__GTS "\\_GTS"
55#define METHOD_NAME__PTS "\\_PTS"
56#define METHOD_NAME__SST "\\_SI._SST"
57#define METHOD_NAME__WAK "\\_WAK"
58
59#define ACPI_SST_INDICATOR_OFF 0
60#define ACPI_SST_WORKING 1
61#define ACPI_SST_WAKING 2
62#define ACPI_SST_SLEEPING 3
63#define ACPI_SST_SLEEP_CONTEXT 4
64
65
66/******************************************************************************
67 * 53 *
68 * FUNCTION: acpi_set_firmware_waking_vector 54 * FUNCTION: acpi_set_firmware_waking_vector
69 * 55 *
@@ -72,7 +58,7 @@
72 * 58 *
73 * RETURN: Status 59 * RETURN: Status
74 * 60 *
75 * DESCRIPTION: access function for d_firmware_waking_vector field in FACS 61 * DESCRIPTION: Access function for the firmware_waking_vector field in FACS
76 * 62 *
77 ******************************************************************************/ 63 ******************************************************************************/
78 64
@@ -99,19 +85,20 @@ acpi_set_firmware_waking_vector (
99} 85}
100 86
101 87
102/****************************************************************************** 88/*******************************************************************************
103 * 89 *
104 * FUNCTION: acpi_get_firmware_waking_vector 90 * FUNCTION: acpi_get_firmware_waking_vector
105 * 91 *
106 * PARAMETERS: *physical_address - Output buffer where contents of 92 * PARAMETERS: *physical_address - Where the contents of
107 * the firmware_waking_vector field of 93 * the firmware_waking_vector field of
108 * the FACS will be stored. 94 * the FACS will be returned.
109 * 95 *
110 * RETURN: Status 96 * RETURN: Status, vector
111 * 97 *
112 * DESCRIPTION: Access function for firmware_waking_vector field in FACS 98 * DESCRIPTION: Access function for the firmware_waking_vector field in FACS
113 * 99 *
114 ******************************************************************************/ 100 ******************************************************************************/
101
115#ifdef ACPI_FUTURE_USAGE 102#ifdef ACPI_FUTURE_USAGE
116acpi_status 103acpi_status
117acpi_get_firmware_waking_vector ( 104acpi_get_firmware_waking_vector (
@@ -141,7 +128,7 @@ acpi_get_firmware_waking_vector (
141#endif 128#endif
142 129
143 130
144/****************************************************************************** 131/*******************************************************************************
145 * 132 *
146 * FUNCTION: acpi_enter_sleep_state_prep 133 * FUNCTION: acpi_enter_sleep_state_prep
147 * 134 *
@@ -215,7 +202,7 @@ acpi_enter_sleep_state_prep (
215 break; 202 break;
216 203
217 default: 204 default:
218 arg.integer.value = ACPI_SST_INDICATOR_OFF; /* Default is indicator off */ 205 arg.integer.value = ACPI_SST_INDICATOR_OFF; /* Default is off */
219 break; 206 break;
220 } 207 }
221 208
@@ -223,14 +210,15 @@ acpi_enter_sleep_state_prep (
223 210
224 status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL); 211 status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL);
225 if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { 212 if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
226 ACPI_REPORT_ERROR (("Method _SST failed, %s\n", acpi_format_exception (status))); 213 ACPI_REPORT_ERROR (("Method _SST failed, %s\n",
214 acpi_format_exception (status)));
227 } 215 }
228 216
229 return_ACPI_STATUS (AE_OK); 217 return_ACPI_STATUS (AE_OK);
230} 218}
231 219
232 220
233/****************************************************************************** 221/*******************************************************************************
234 * 222 *
235 * FUNCTION: acpi_enter_sleep_state 223 * FUNCTION: acpi_enter_sleep_state
236 * 224 *
@@ -299,15 +287,18 @@ acpi_enter_sleep_state (
299 287
300 /* Get current value of PM1A control */ 288 /* Get current value of PM1A control */
301 289
302 status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol); 290 status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
291 ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol);
303 if (ACPI_FAILURE (status)) { 292 if (ACPI_FAILURE (status)) {
304 return_ACPI_STATUS (status); 293 return_ACPI_STATUS (status);
305 } 294 }
306 ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Entering sleep state [S%d]\n", sleep_state)); 295 ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
296 "Entering sleep state [S%d]\n", sleep_state));
307 297
308 /* Clear SLP_EN and SLP_TYP fields */ 298 /* Clear SLP_EN and SLP_TYP fields */
309 299
310 PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask | sleep_enable_reg_info->access_bit_mask); 300 PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask |
301 sleep_enable_reg_info->access_bit_mask);
311 PM1Bcontrol = PM1Acontrol; 302 PM1Bcontrol = PM1Acontrol;
312 303
313 /* Insert SLP_TYP bits */ 304 /* Insert SLP_TYP bits */
@@ -322,12 +313,14 @@ acpi_enter_sleep_state (
322 313
323 /* Write #1: fill in SLP_TYP data */ 314 /* Write #1: fill in SLP_TYP data */
324 315
325 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol); 316 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
317 ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol);
326 if (ACPI_FAILURE (status)) { 318 if (ACPI_FAILURE (status)) {
327 return_ACPI_STATUS (status); 319 return_ACPI_STATUS (status);
328 } 320 }
329 321
330 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol); 322 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
323 ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol);
331 if (ACPI_FAILURE (status)) { 324 if (ACPI_FAILURE (status)) {
332 return_ACPI_STATUS (status); 325 return_ACPI_STATUS (status);
333 } 326 }
@@ -341,22 +334,25 @@ acpi_enter_sleep_state (
341 334
342 ACPI_FLUSH_CPU_CACHE (); 335 ACPI_FLUSH_CPU_CACHE ();
343 336
344 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol); 337 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
338 ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol);
345 if (ACPI_FAILURE (status)) { 339 if (ACPI_FAILURE (status)) {
346 return_ACPI_STATUS (status); 340 return_ACPI_STATUS (status);
347 } 341 }
348 342
349 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol); 343 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
344 ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol);
350 if (ACPI_FAILURE (status)) { 345 if (ACPI_FAILURE (status)) {
351 return_ACPI_STATUS (status); 346 return_ACPI_STATUS (status);
352 } 347 }
353 348
354 if (sleep_state > ACPI_STATE_S3) { 349 if (sleep_state > ACPI_STATE_S3) {
355 /* 350 /*
356 * We wanted to sleep > S3, but it didn't happen (by virtue of the fact that 351 * We wanted to sleep > S3, but it didn't happen (by virtue of the
357 * we are still executing!) 352 * fact that we are still executing!)
358 * 353 *
359 * Wait ten seconds, then try again. This is to get S4/S5 to work on all machines. 354 * Wait ten seconds, then try again. This is to get S4/S5 to work on
355 * all machines.
360 * 356 *
361 * We wait so long to allow chipsets that poll this reg very slowly to 357 * We wait so long to allow chipsets that poll this reg very slowly to
362 * still read the right value. Ideally, this block would go 358 * still read the right value. Ideally, this block would go
@@ -364,7 +360,8 @@ acpi_enter_sleep_state (
364 */ 360 */
365 acpi_os_stall (10000000); 361 acpi_os_stall (10000000);
366 362
367 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_CONTROL, 363 status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
364 ACPI_REGISTER_PM1_CONTROL,
368 sleep_enable_reg_info->access_bit_mask); 365 sleep_enable_reg_info->access_bit_mask);
369 if (ACPI_FAILURE (status)) { 366 if (ACPI_FAILURE (status)) {
370 return_ACPI_STATUS (status); 367 return_ACPI_STATUS (status);
@@ -374,7 +371,8 @@ acpi_enter_sleep_state (
374 /* Wait until we enter sleep state */ 371 /* Wait until we enter sleep state */
375 372
376 do { 373 do {
377 status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value, ACPI_MTX_DO_NOT_LOCK); 374 status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value,
375 ACPI_MTX_DO_NOT_LOCK);
378 if (ACPI_FAILURE (status)) { 376 if (ACPI_FAILURE (status)) {
379 return_ACPI_STATUS (status); 377 return_ACPI_STATUS (status);
380 } 378 }
@@ -388,7 +386,7 @@ acpi_enter_sleep_state (
388EXPORT_SYMBOL(acpi_enter_sleep_state); 386EXPORT_SYMBOL(acpi_enter_sleep_state);
389 387
390 388
391/****************************************************************************** 389/*******************************************************************************
392 * 390 *
393 * FUNCTION: acpi_enter_sleep_state_s4bios 391 * FUNCTION: acpi_enter_sleep_state_s4bios
394 * 392 *
@@ -439,11 +437,13 @@ acpi_enter_sleep_state_s4bios (
439 437
440 ACPI_FLUSH_CPU_CACHE (); 438 ACPI_FLUSH_CPU_CACHE ();
441 439
442 status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, (u32) acpi_gbl_FADT->S4bios_req, 8); 440 status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd,
441 (u32) acpi_gbl_FADT->S4bios_req, 8);
443 442
444 do { 443 do {
445 acpi_os_stall(1000); 444 acpi_os_stall(1000);
446 status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value, ACPI_MTX_DO_NOT_LOCK); 445 status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value,
446 ACPI_MTX_DO_NOT_LOCK);
447 if (ACPI_FAILURE (status)) { 447 if (ACPI_FAILURE (status)) {
448 return_ACPI_STATUS (status); 448 return_ACPI_STATUS (status);
449 } 449 }
@@ -454,7 +454,7 @@ acpi_enter_sleep_state_s4bios (
454EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios); 454EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios);
455 455
456 456
457/****************************************************************************** 457/*******************************************************************************
458 * 458 *
459 * FUNCTION: acpi_leave_sleep_state 459 * FUNCTION: acpi_leave_sleep_state
460 * 460 *
@@ -534,18 +534,21 @@ acpi_leave_sleep_state (
534 arg.integer.value = ACPI_SST_WAKING; 534 arg.integer.value = ACPI_SST_WAKING;
535 status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL); 535 status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL);
536 if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { 536 if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
537 ACPI_REPORT_ERROR (("Method _SST failed, %s\n", acpi_format_exception (status))); 537 ACPI_REPORT_ERROR (("Method _SST failed, %s\n",
538 acpi_format_exception (status)));
538 } 539 }
539 540
540 arg.integer.value = sleep_state; 541 arg.integer.value = sleep_state;
541 status = acpi_evaluate_object (NULL, METHOD_NAME__BFS, &arg_list, NULL); 542 status = acpi_evaluate_object (NULL, METHOD_NAME__BFS, &arg_list, NULL);
542 if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { 543 if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
543 ACPI_REPORT_ERROR (("Method _BFS failed, %s\n", acpi_format_exception (status))); 544 ACPI_REPORT_ERROR (("Method _BFS failed, %s\n",
545 acpi_format_exception (status)));
544 } 546 }
545 547
546 status = acpi_evaluate_object (NULL, METHOD_NAME__WAK, &arg_list, NULL); 548 status = acpi_evaluate_object (NULL, METHOD_NAME__WAK, &arg_list, NULL);
547 if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { 549 if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
548 ACPI_REPORT_ERROR (("Method _WAK failed, %s\n", acpi_format_exception (status))); 550 ACPI_REPORT_ERROR (("Method _WAK failed, %s\n",
551 acpi_format_exception (status)));
549 } 552 }
550 /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */ 553 /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */
551 554
@@ -567,15 +570,19 @@ acpi_leave_sleep_state (
567 570
568 /* Enable power button */ 571 /* Enable power button */
569 572
570 (void) acpi_set_register(acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].enable_register_id, 573 (void) acpi_set_register(
574 acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].enable_register_id,
571 1, ACPI_MTX_DO_NOT_LOCK); 575 1, ACPI_MTX_DO_NOT_LOCK);
572 (void) acpi_set_register(acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].status_register_id, 576
577 (void) acpi_set_register(
578 acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].status_register_id,
573 1, ACPI_MTX_DO_NOT_LOCK); 579 1, ACPI_MTX_DO_NOT_LOCK);
574 580
575 arg.integer.value = ACPI_SST_WORKING; 581 arg.integer.value = ACPI_SST_WORKING;
576 status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL); 582 status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL);
577 if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { 583 if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
578 ACPI_REPORT_ERROR (("Method _SST failed, %s\n", acpi_format_exception (status))); 584 ACPI_REPORT_ERROR (("Method _SST failed, %s\n",
585 acpi_format_exception (status)));
579 } 586 }
580 587
581 return_ACPI_STATUS (status); 588 return_ACPI_STATUS (status);
diff --git a/drivers/acpi/hardware/hwtimer.c b/drivers/acpi/hardware/hwtimer.c
index 1906167d7294..49d7b395322e 100644
--- a/drivers/acpi/hardware/hwtimer.c
+++ b/drivers/acpi/hardware/hwtimer.c
@@ -43,7 +43,6 @@
43 */ 43 */
44 44
45#include <linux/module.h> 45#include <linux/module.h>
46
47#include <acpi/acpi.h> 46#include <acpi/acpi.h>
48 47
49#define _COMPONENT ACPI_HARDWARE 48#define _COMPONENT ACPI_HARDWARE
@@ -90,7 +89,7 @@ acpi_get_timer_resolution (
90 * 89 *
91 * PARAMETERS: Ticks - Where the timer value is returned 90 * PARAMETERS: Ticks - Where the timer value is returned
92 * 91 *
93 * RETURN: Status and current ticks 92 * RETURN: Status and current timer value (ticks)
94 * 93 *
95 * DESCRIPTION: Obtains current value of ACPI PM Timer (in ticks). 94 * DESCRIPTION: Obtains current value of ACPI PM Timer (in ticks).
96 * 95 *
@@ -199,5 +198,6 @@ acpi_get_timer_duration (
199 *time_elapsed = (u32) quotient; 198 *time_elapsed = (u32) quotient;
200 return_ACPI_STATUS (status); 199 return_ACPI_STATUS (status);
201} 200}
201
202EXPORT_SYMBOL(acpi_get_timer_duration); 202EXPORT_SYMBOL(acpi_get_timer_duration);
203 203