diff options
| -rw-r--r-- | drivers/acpi/acpica/aclocal.h | 1 | ||||
| -rw-r--r-- | drivers/acpi/acpica/evgpe.c | 6 | ||||
| -rw-r--r-- | drivers/acpi/acpica/hwgpe.c | 53 | ||||
| -rw-r--r-- | include/acpi/actypes.h | 4 |
4 files changed, 51 insertions, 13 deletions
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index 80c74e90f3cc..680d23bbae7c 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h | |||
| @@ -454,6 +454,7 @@ struct acpi_gpe_register_info { | |||
| 454 | u16 base_gpe_number; /* Base GPE number for this register */ | 454 | u16 base_gpe_number; /* Base GPE number for this register */ |
| 455 | u8 enable_for_wake; /* GPEs to keep enabled when sleeping */ | 455 | u8 enable_for_wake; /* GPEs to keep enabled when sleeping */ |
| 456 | u8 enable_for_run; /* GPEs to keep enabled when running */ | 456 | u8 enable_for_run; /* GPEs to keep enabled when running */ |
| 457 | u8 enable_mask; /* Current mask of enabled GPEs */ | ||
| 457 | }; | 458 | }; |
| 458 | 459 | ||
| 459 | /* | 460 | /* |
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c index 2095dfb72bcb..81db932b15ee 100644 --- a/drivers/acpi/acpica/evgpe.c +++ b/drivers/acpi/acpica/evgpe.c | |||
| @@ -134,7 +134,7 @@ acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
| 134 | 134 | ||
| 135 | /* Enable the requested GPE */ | 135 | /* Enable the requested GPE */ |
| 136 | 136 | ||
| 137 | status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE); | 137 | status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE_SAVE); |
| 138 | return_ACPI_STATUS(status); | 138 | return_ACPI_STATUS(status); |
| 139 | } | 139 | } |
| 140 | 140 | ||
| @@ -213,7 +213,7 @@ acpi_ev_remove_gpe_reference(struct acpi_gpe_event_info *gpe_event_info) | |||
| 213 | if (ACPI_SUCCESS(status)) { | 213 | if (ACPI_SUCCESS(status)) { |
| 214 | status = | 214 | status = |
| 215 | acpi_hw_low_set_gpe(gpe_event_info, | 215 | acpi_hw_low_set_gpe(gpe_event_info, |
| 216 | ACPI_GPE_DISABLE); | 216 | ACPI_GPE_DISABLE_SAVE); |
| 217 | } | 217 | } |
| 218 | 218 | ||
| 219 | if (ACPI_FAILURE(status)) { | 219 | if (ACPI_FAILURE(status)) { |
| @@ -655,7 +655,7 @@ acpi_status acpi_ev_finish_gpe(struct acpi_gpe_event_info * gpe_event_info) | |||
| 655 | 655 | ||
| 656 | /* | 656 | /* |
| 657 | * Enable this GPE, conditionally. This means that the GPE will | 657 | * Enable this GPE, conditionally. This means that the GPE will |
| 658 | * only be physically enabled if the enable_for_run bit is set | 658 | * only be physically enabled if the enable_mask bit is set |
| 659 | * in the event_info. | 659 | * in the event_info. |
| 660 | */ | 660 | */ |
| 661 | (void)acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_CONDITIONAL_ENABLE); | 661 | (void)acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_CONDITIONAL_ENABLE); |
diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c index 48ac7b7b59cd..494027f5c067 100644 --- a/drivers/acpi/acpica/hwgpe.c +++ b/drivers/acpi/acpica/hwgpe.c | |||
| @@ -115,12 +115,12 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action) | |||
| 115 | /* Set or clear just the bit that corresponds to this GPE */ | 115 | /* Set or clear just the bit that corresponds to this GPE */ |
| 116 | 116 | ||
| 117 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info); | 117 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info); |
| 118 | switch (action) { | 118 | switch (action & ~ACPI_GPE_SAVE_MASK) { |
| 119 | case ACPI_GPE_CONDITIONAL_ENABLE: | 119 | case ACPI_GPE_CONDITIONAL_ENABLE: |
| 120 | 120 | ||
| 121 | /* Only enable if the enable_for_run bit is set */ | 121 | /* Only enable if the corresponding enable_mask bit is set */ |
| 122 | 122 | ||
| 123 | if (!(register_bit & gpe_register_info->enable_for_run)) { | 123 | if (!(register_bit & gpe_register_info->enable_mask)) { |
| 124 | return (AE_BAD_PARAMETER); | 124 | return (AE_BAD_PARAMETER); |
| 125 | } | 125 | } |
| 126 | 126 | ||
| @@ -145,6 +145,9 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action) | |||
| 145 | /* Write the updated enable mask */ | 145 | /* Write the updated enable mask */ |
| 146 | 146 | ||
| 147 | status = acpi_hw_write(enable_mask, &gpe_register_info->enable_address); | 147 | status = acpi_hw_write(enable_mask, &gpe_register_info->enable_address); |
| 148 | if (ACPI_SUCCESS(status) && (action & ACPI_GPE_SAVE_MASK)) { | ||
| 149 | gpe_register_info->enable_mask = enable_mask; | ||
| 150 | } | ||
| 148 | return (status); | 151 | return (status); |
| 149 | } | 152 | } |
| 150 | 153 | ||
| @@ -262,6 +265,32 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, | |||
| 262 | 265 | ||
| 263 | /****************************************************************************** | 266 | /****************************************************************************** |
| 264 | * | 267 | * |
| 268 | * FUNCTION: acpi_hw_gpe_enable_write | ||
| 269 | * | ||
| 270 | * PARAMETERS: enable_mask - Bit mask to write to the GPE register | ||
| 271 | * gpe_register_info - Gpe Register info | ||
| 272 | * | ||
| 273 | * RETURN: Status | ||
| 274 | * | ||
| 275 | * DESCRIPTION: Write the enable mask byte to the given GPE register. | ||
| 276 | * | ||
| 277 | ******************************************************************************/ | ||
| 278 | |||
| 279 | static acpi_status | ||
| 280 | acpi_hw_gpe_enable_write(u8 enable_mask, | ||
| 281 | struct acpi_gpe_register_info *gpe_register_info) | ||
| 282 | { | ||
| 283 | acpi_status status; | ||
| 284 | |||
| 285 | status = acpi_hw_write(enable_mask, &gpe_register_info->enable_address); | ||
| 286 | if (ACPI_SUCCESS(status)) { | ||
| 287 | gpe_register_info->enable_mask = enable_mask; | ||
| 288 | } | ||
| 289 | return (status); | ||
| 290 | } | ||
| 291 | |||
| 292 | /****************************************************************************** | ||
| 293 | * | ||
| 265 | * FUNCTION: acpi_hw_disable_gpe_block | 294 | * FUNCTION: acpi_hw_disable_gpe_block |
| 266 | * | 295 | * |
| 267 | * PARAMETERS: gpe_xrupt_info - GPE Interrupt info | 296 | * PARAMETERS: gpe_xrupt_info - GPE Interrupt info |
| @@ -287,8 +316,8 @@ acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
| 287 | /* Disable all GPEs in this register */ | 316 | /* Disable all GPEs in this register */ |
| 288 | 317 | ||
| 289 | status = | 318 | status = |
| 290 | acpi_hw_write(0x00, | 319 | acpi_hw_gpe_enable_write(0x00, |
| 291 | &gpe_block->register_info[i].enable_address); | 320 | &gpe_block->register_info[i]); |
| 292 | if (ACPI_FAILURE(status)) { | 321 | if (ACPI_FAILURE(status)) { |
| 293 | return (status); | 322 | return (status); |
| 294 | } | 323 | } |
| @@ -355,21 +384,23 @@ acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
| 355 | { | 384 | { |
| 356 | u32 i; | 385 | u32 i; |
| 357 | acpi_status status; | 386 | acpi_status status; |
| 387 | struct acpi_gpe_register_info *gpe_register_info; | ||
| 358 | 388 | ||
| 359 | /* NOTE: assumes that all GPEs are currently disabled */ | 389 | /* NOTE: assumes that all GPEs are currently disabled */ |
| 360 | 390 | ||
| 361 | /* Examine each GPE Register within the block */ | 391 | /* Examine each GPE Register within the block */ |
| 362 | 392 | ||
| 363 | for (i = 0; i < gpe_block->register_count; i++) { | 393 | for (i = 0; i < gpe_block->register_count; i++) { |
| 364 | if (!gpe_block->register_info[i].enable_for_run) { | 394 | gpe_register_info = &gpe_block->register_info[i]; |
| 395 | if (!gpe_register_info->enable_for_run) { | ||
| 365 | continue; | 396 | continue; |
| 366 | } | 397 | } |
| 367 | 398 | ||
| 368 | /* Enable all "runtime" GPEs in this register */ | 399 | /* Enable all "runtime" GPEs in this register */ |
| 369 | 400 | ||
| 370 | status = | 401 | status = |
| 371 | acpi_hw_write(gpe_block->register_info[i].enable_for_run, | 402 | acpi_hw_gpe_enable_write(gpe_register_info->enable_for_run, |
| 372 | &gpe_block->register_info[i].enable_address); | 403 | gpe_register_info); |
| 373 | if (ACPI_FAILURE(status)) { | 404 | if (ACPI_FAILURE(status)) { |
| 374 | return (status); | 405 | return (status); |
| 375 | } | 406 | } |
| @@ -399,10 +430,12 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
| 399 | { | 430 | { |
| 400 | u32 i; | 431 | u32 i; |
| 401 | acpi_status status; | 432 | acpi_status status; |
| 433 | struct acpi_gpe_register_info *gpe_register_info; | ||
| 402 | 434 | ||
| 403 | /* Examine each GPE Register within the block */ | 435 | /* Examine each GPE Register within the block */ |
| 404 | 436 | ||
| 405 | for (i = 0; i < gpe_block->register_count; i++) { | 437 | for (i = 0; i < gpe_block->register_count; i++) { |
| 438 | gpe_register_info = &gpe_block->register_info[i]; | ||
| 406 | 439 | ||
| 407 | /* | 440 | /* |
| 408 | * Enable all "wake" GPEs in this register and disable the | 441 | * Enable all "wake" GPEs in this register and disable the |
| @@ -410,8 +443,8 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
| 410 | */ | 443 | */ |
| 411 | 444 | ||
| 412 | status = | 445 | status = |
| 413 | acpi_hw_write(gpe_block->register_info[i].enable_for_wake, | 446 | acpi_hw_gpe_enable_write(gpe_register_info->enable_for_wake, |
| 414 | &gpe_block->register_info[i].enable_address); | 447 | gpe_register_info); |
| 415 | if (ACPI_FAILURE(status)) { | 448 | if (ACPI_FAILURE(status)) { |
| 416 | return (status); | 449 | return (status); |
| 417 | } | 450 | } |
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 7000e66f768e..bbef17368e49 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
| @@ -736,6 +736,10 @@ typedef u32 acpi_event_status; | |||
| 736 | #define ACPI_GPE_ENABLE 0 | 736 | #define ACPI_GPE_ENABLE 0 |
| 737 | #define ACPI_GPE_DISABLE 1 | 737 | #define ACPI_GPE_DISABLE 1 |
| 738 | #define ACPI_GPE_CONDITIONAL_ENABLE 2 | 738 | #define ACPI_GPE_CONDITIONAL_ENABLE 2 |
| 739 | #define ACPI_GPE_SAVE_MASK 4 | ||
| 740 | |||
| 741 | #define ACPI_GPE_ENABLE_SAVE (ACPI_GPE_ENABLE | ACPI_GPE_SAVE_MASK) | ||
| 742 | #define ACPI_GPE_DISABLE_SAVE (ACPI_GPE_DISABLE | ACPI_GPE_SAVE_MASK) | ||
| 739 | 743 | ||
| 740 | /* | 744 | /* |
| 741 | * GPE info flags - Per GPE | 745 | * GPE info flags - Per GPE |
