diff options
Diffstat (limited to 'drivers/acpi/acpica/hwgpe.c')
-rw-r--r-- | drivers/acpi/acpica/hwgpe.c | 53 |
1 files changed, 43 insertions, 10 deletions
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 | } |