diff options
author | Len Brown <len.brown@intel.com> | 2010-06-12 00:51:49 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2010-06-12 00:51:49 -0400 |
commit | 92634825571d86417941855a8e3189c07aa3c706 (patch) | |
tree | 92d30f0714607684642487145ff27ca56b59b9e1 /drivers/acpi | |
parent | 7e27d6e778cd87b6f2415515d7127eba53fe5d02 (diff) | |
parent | 9d3c752de65dbfa6e522f1d666deb0ac152ef367 (diff) |
Merge branch 'gpe-regression-fixes' into release
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/acpica/acevents.h | 4 | ||||
-rw-r--r-- | drivers/acpi/acpica/achware.h | 6 | ||||
-rw-r--r-- | drivers/acpi/acpica/evgpe.c | 115 | ||||
-rw-r--r-- | drivers/acpi/acpica/evgpeblk.c | 14 | ||||
-rw-r--r-- | drivers/acpi/acpica/evxface.c | 7 | ||||
-rw-r--r-- | drivers/acpi/acpica/evxfevnt.c | 59 | ||||
-rw-r--r-- | drivers/acpi/acpica/hwgpe.c | 94 | ||||
-rw-r--r-- | drivers/acpi/system.c | 6 |
8 files changed, 145 insertions, 160 deletions
diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h index 64d1e5c2d4ae..c3f43daa8be3 100644 --- a/drivers/acpi/acpica/acevents.h +++ b/drivers/acpi/acpica/acevents.h | |||
@@ -80,10 +80,6 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list); | |||
80 | acpi_status | 80 | acpi_status |
81 | acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info); | 81 | acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info); |
82 | 82 | ||
83 | acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info); | ||
84 | |||
85 | acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info); | ||
86 | |||
87 | struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, | 83 | struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, |
88 | u32 gpe_number); | 84 | u32 gpe_number); |
89 | 85 | ||
diff --git a/drivers/acpi/acpica/achware.h b/drivers/acpi/acpica/achware.h index 5900f135dc6d..32391588e163 100644 --- a/drivers/acpi/acpica/achware.h +++ b/drivers/acpi/acpica/achware.h | |||
@@ -90,7 +90,11 @@ acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width); | |||
90 | /* | 90 | /* |
91 | * hwgpe - GPE support | 91 | * hwgpe - GPE support |
92 | */ | 92 | */ |
93 | acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info); | 93 | u32 acpi_hw_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info, |
94 | struct acpi_gpe_register_info *gpe_register_info); | ||
95 | |||
96 | acpi_status | ||
97 | acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u8 action); | ||
94 | 98 | ||
95 | acpi_status | 99 | acpi_status |
96 | acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info); | 100 | acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info); |
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c index a221ad404167..7c2c336006a1 100644 --- a/drivers/acpi/acpica/evgpe.c +++ b/drivers/acpi/acpica/evgpe.c | |||
@@ -69,7 +69,7 @@ acpi_status | |||
69 | acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info) | 69 | acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info) |
70 | { | 70 | { |
71 | struct acpi_gpe_register_info *gpe_register_info; | 71 | struct acpi_gpe_register_info *gpe_register_info; |
72 | u8 register_bit; | 72 | u32 register_bit; |
73 | 73 | ||
74 | ACPI_FUNCTION_TRACE(ev_update_gpe_enable_masks); | 74 | ACPI_FUNCTION_TRACE(ev_update_gpe_enable_masks); |
75 | 75 | ||
@@ -78,9 +78,8 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info) | |||
78 | return_ACPI_STATUS(AE_NOT_EXIST); | 78 | return_ACPI_STATUS(AE_NOT_EXIST); |
79 | } | 79 | } |
80 | 80 | ||
81 | register_bit = (u8) | 81 | register_bit = acpi_hw_gpe_register_bit(gpe_event_info, |
82 | (1 << | 82 | gpe_register_info); |
83 | (gpe_event_info->gpe_number - gpe_register_info->base_gpe_number)); | ||
84 | 83 | ||
85 | /* Clear the wake/run bits up front */ | 84 | /* Clear the wake/run bits up front */ |
86 | 85 | ||
@@ -100,106 +99,6 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info) | |||
100 | return_ACPI_STATUS(AE_OK); | 99 | return_ACPI_STATUS(AE_OK); |
101 | } | 100 | } |
102 | 101 | ||
103 | /******************************************************************************* | ||
104 | * | ||
105 | * FUNCTION: acpi_ev_enable_gpe | ||
106 | * | ||
107 | * PARAMETERS: gpe_event_info - GPE to enable | ||
108 | * | ||
109 | * RETURN: Status | ||
110 | * | ||
111 | * DESCRIPTION: Hardware-enable a GPE. Always enables the GPE, regardless | ||
112 | * of type or number of references. | ||
113 | * | ||
114 | * Note: The GPE lock should be already acquired when this function is called. | ||
115 | * | ||
116 | ******************************************************************************/ | ||
117 | |||
118 | acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info) | ||
119 | { | ||
120 | acpi_status status; | ||
121 | |||
122 | |||
123 | ACPI_FUNCTION_TRACE(ev_enable_gpe); | ||
124 | |||
125 | |||
126 | /* | ||
127 | * We will only allow a GPE to be enabled if it has either an | ||
128 | * associated method (_Lxx/_Exx) or a handler. Otherwise, the | ||
129 | * GPE will be immediately disabled by acpi_ev_gpe_dispatch the | ||
130 | * first time it fires. | ||
131 | */ | ||
132 | if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK)) { | ||
133 | return_ACPI_STATUS(AE_NO_HANDLER); | ||
134 | } | ||
135 | |||
136 | /* Ensure the HW enable masks are current */ | ||
137 | |||
138 | status = acpi_ev_update_gpe_enable_masks(gpe_event_info); | ||
139 | if (ACPI_FAILURE(status)) { | ||
140 | return_ACPI_STATUS(status); | ||
141 | } | ||
142 | |||
143 | /* Clear the GPE (of stale events) */ | ||
144 | |||
145 | status = acpi_hw_clear_gpe(gpe_event_info); | ||
146 | if (ACPI_FAILURE(status)) { | ||
147 | return_ACPI_STATUS(status); | ||
148 | } | ||
149 | |||
150 | /* Enable the requested GPE */ | ||
151 | |||
152 | status = acpi_hw_write_gpe_enable_reg(gpe_event_info); | ||
153 | return_ACPI_STATUS(status); | ||
154 | } | ||
155 | |||
156 | /******************************************************************************* | ||
157 | * | ||
158 | * FUNCTION: acpi_ev_disable_gpe | ||
159 | * | ||
160 | * PARAMETERS: gpe_event_info - GPE to disable | ||
161 | * | ||
162 | * RETURN: Status | ||
163 | * | ||
164 | * DESCRIPTION: Hardware-disable a GPE. Always disables the requested GPE, | ||
165 | * regardless of the type or number of references. | ||
166 | * | ||
167 | * Note: The GPE lock should be already acquired when this function is called. | ||
168 | * | ||
169 | ******************************************************************************/ | ||
170 | |||
171 | acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) | ||
172 | { | ||
173 | acpi_status status; | ||
174 | |||
175 | ACPI_FUNCTION_TRACE(ev_disable_gpe); | ||
176 | |||
177 | |||
178 | /* | ||
179 | * Note: Always disable the GPE, even if we think that that it is already | ||
180 | * disabled. It is possible that the AML or some other code has enabled | ||
181 | * the GPE behind our back. | ||
182 | */ | ||
183 | |||
184 | /* Ensure the HW enable masks are current */ | ||
185 | |||
186 | status = acpi_ev_update_gpe_enable_masks(gpe_event_info); | ||
187 | if (ACPI_FAILURE(status)) { | ||
188 | return_ACPI_STATUS(status); | ||
189 | } | ||
190 | |||
191 | /* | ||
192 | * Always H/W disable this GPE, even if we don't know the GPE type. | ||
193 | * Simply clear the enable bit for this particular GPE, but do not | ||
194 | * write out the current GPE enable mask since this may inadvertently | ||
195 | * enable GPEs too early. An example is a rogue GPE that has arrived | ||
196 | * during ACPICA initialization - possibly because AML or other code | ||
197 | * has enabled the GPE. | ||
198 | */ | ||
199 | status = acpi_hw_low_disable_gpe(gpe_event_info); | ||
200 | return_ACPI_STATUS(status); | ||
201 | } | ||
202 | |||
203 | 102 | ||
204 | /******************************************************************************* | 103 | /******************************************************************************* |
205 | * | 104 | * |
@@ -451,10 +350,6 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) | |||
451 | return_VOID; | 350 | return_VOID; |
452 | } | 351 | } |
453 | 352 | ||
454 | /* Update the GPE register masks for return to enabled state */ | ||
455 | |||
456 | (void)acpi_ev_update_gpe_enable_masks(gpe_event_info); | ||
457 | |||
458 | /* | 353 | /* |
459 | * Take a snapshot of the GPE info for this level - we copy the info to | 354 | * Take a snapshot of the GPE info for this level - we copy the info to |
460 | * prevent a race condition with remove_handler/remove_block. | 355 | * prevent a race condition with remove_handler/remove_block. |
@@ -607,7 +502,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) | |||
607 | * Disable the GPE, so it doesn't keep firing before the method has a | 502 | * Disable the GPE, so it doesn't keep firing before the method has a |
608 | * chance to run (it runs asynchronously with interrupts enabled). | 503 | * chance to run (it runs asynchronously with interrupts enabled). |
609 | */ | 504 | */ |
610 | status = acpi_ev_disable_gpe(gpe_event_info); | 505 | status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_DISABLE); |
611 | if (ACPI_FAILURE(status)) { | 506 | if (ACPI_FAILURE(status)) { |
612 | ACPI_EXCEPTION((AE_INFO, status, | 507 | ACPI_EXCEPTION((AE_INFO, status, |
613 | "Unable to disable GPE[0x%2X]", | 508 | "Unable to disable GPE[0x%2X]", |
@@ -644,7 +539,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) | |||
644 | * Disable the GPE. The GPE will remain disabled a handler | 539 | * Disable the GPE. The GPE will remain disabled a handler |
645 | * is installed or ACPICA is restarted. | 540 | * is installed or ACPICA is restarted. |
646 | */ | 541 | */ |
647 | status = acpi_ev_disable_gpe(gpe_event_info); | 542 | status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_DISABLE); |
648 | if (ACPI_FAILURE(status)) { | 543 | if (ACPI_FAILURE(status)) { |
649 | ACPI_EXCEPTION((AE_INFO, status, | 544 | ACPI_EXCEPTION((AE_INFO, status, |
650 | "Unable to disable GPE[0x%2X]", | 545 | "Unable to disable GPE[0x%2X]", |
diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c index 7c28f2d9fd35..341a38ce8aa6 100644 --- a/drivers/acpi/acpica/evgpeblk.c +++ b/drivers/acpi/acpica/evgpeblk.c | |||
@@ -500,6 +500,19 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | |||
500 | 500 | ||
501 | gpe_index = (i * ACPI_GPE_REGISTER_WIDTH) + j; | 501 | gpe_index = (i * ACPI_GPE_REGISTER_WIDTH) + j; |
502 | gpe_event_info = &gpe_block->event_info[gpe_index]; | 502 | gpe_event_info = &gpe_block->event_info[gpe_index]; |
503 | gpe_number = gpe_index + gpe_block->block_base_number; | ||
504 | |||
505 | /* | ||
506 | * If the GPE has already been enabled for runtime | ||
507 | * signaling, make sure it remains enabled, but do not | ||
508 | * increment its reference counter. | ||
509 | */ | ||
510 | if (gpe_event_info->runtime_count) { | ||
511 | acpi_set_gpe(gpe_device, gpe_number, | ||
512 | ACPI_GPE_ENABLE); | ||
513 | gpe_enabled_count++; | ||
514 | continue; | ||
515 | } | ||
503 | 516 | ||
504 | if (gpe_event_info->flags & ACPI_GPE_CAN_WAKE) { | 517 | if (gpe_event_info->flags & ACPI_GPE_CAN_WAKE) { |
505 | wake_gpe_count++; | 518 | wake_gpe_count++; |
@@ -516,7 +529,6 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | |||
516 | 529 | ||
517 | /* Enable this GPE */ | 530 | /* Enable this GPE */ |
518 | 531 | ||
519 | gpe_number = gpe_index + gpe_block->block_base_number; | ||
520 | status = acpi_enable_gpe(gpe_device, gpe_number, | 532 | status = acpi_enable_gpe(gpe_device, gpe_number, |
521 | ACPI_GPE_TYPE_RUNTIME); | 533 | ACPI_GPE_TYPE_RUNTIME); |
522 | if (ACPI_FAILURE(status)) { | 534 | if (ACPI_FAILURE(status)) { |
diff --git a/drivers/acpi/acpica/evxface.c b/drivers/acpi/acpica/evxface.c index cc825023012a..4a531cdf7942 100644 --- a/drivers/acpi/acpica/evxface.c +++ b/drivers/acpi/acpica/evxface.c | |||
@@ -719,13 +719,6 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
719 | handler->context = context; | 719 | handler->context = context; |
720 | handler->method_node = gpe_event_info->dispatch.method_node; | 720 | handler->method_node = gpe_event_info->dispatch.method_node; |
721 | 721 | ||
722 | /* Disable the GPE before installing the handler */ | ||
723 | |||
724 | status = acpi_ev_disable_gpe(gpe_event_info); | ||
725 | if (ACPI_FAILURE (status)) { | ||
726 | goto unlock_and_exit; | ||
727 | } | ||
728 | |||
729 | /* Install the handler */ | 722 | /* Install the handler */ |
730 | 723 | ||
731 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | 724 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c index d5a5efc043bf..d97b8dce1668 100644 --- a/drivers/acpi/acpica/evxfevnt.c +++ b/drivers/acpi/acpica/evxfevnt.c | |||
@@ -210,6 +210,44 @@ ACPI_EXPORT_SYMBOL(acpi_enable_event) | |||
210 | 210 | ||
211 | /******************************************************************************* | 211 | /******************************************************************************* |
212 | * | 212 | * |
213 | * FUNCTION: acpi_clear_and_enable_gpe | ||
214 | * | ||
215 | * PARAMETERS: gpe_event_info - GPE to enable | ||
216 | * | ||
217 | * RETURN: Status | ||
218 | * | ||
219 | * DESCRIPTION: Clear the given GPE from stale events and enable it. | ||
220 | * | ||
221 | ******************************************************************************/ | ||
222 | static acpi_status | ||
223 | acpi_clear_and_enable_gpe(struct acpi_gpe_event_info *gpe_event_info) | ||
224 | { | ||
225 | acpi_status status; | ||
226 | |||
227 | /* | ||
228 | * We will only allow a GPE to be enabled if it has either an | ||
229 | * associated method (_Lxx/_Exx) or a handler. Otherwise, the | ||
230 | * GPE will be immediately disabled by acpi_ev_gpe_dispatch the | ||
231 | * first time it fires. | ||
232 | */ | ||
233 | if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK)) { | ||
234 | return_ACPI_STATUS(AE_NO_HANDLER); | ||
235 | } | ||
236 | |||
237 | /* Clear the GPE (of stale events) */ | ||
238 | status = acpi_hw_clear_gpe(gpe_event_info); | ||
239 | if (ACPI_FAILURE(status)) { | ||
240 | return_ACPI_STATUS(status); | ||
241 | } | ||
242 | |||
243 | /* Enable the requested GPE */ | ||
244 | status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE); | ||
245 | |||
246 | return_ACPI_STATUS(status); | ||
247 | } | ||
248 | |||
249 | /******************************************************************************* | ||
250 | * | ||
213 | * FUNCTION: acpi_set_gpe | 251 | * FUNCTION: acpi_set_gpe |
214 | * | 252 | * |
215 | * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1 | 253 | * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1 |
@@ -249,11 +287,11 @@ acpi_status acpi_set_gpe(acpi_handle gpe_device, u32 gpe_number, u8 action) | |||
249 | 287 | ||
250 | switch (action) { | 288 | switch (action) { |
251 | case ACPI_GPE_ENABLE: | 289 | case ACPI_GPE_ENABLE: |
252 | status = acpi_ev_enable_gpe(gpe_event_info); | 290 | status = acpi_clear_and_enable_gpe(gpe_event_info); |
253 | break; | 291 | break; |
254 | 292 | ||
255 | case ACPI_GPE_DISABLE: | 293 | case ACPI_GPE_DISABLE: |
256 | status = acpi_ev_disable_gpe(gpe_event_info); | 294 | status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_DISABLE); |
257 | break; | 295 | break; |
258 | 296 | ||
259 | default: | 297 | default: |
@@ -316,7 +354,11 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type) | |||
316 | 354 | ||
317 | gpe_event_info->runtime_count++; | 355 | gpe_event_info->runtime_count++; |
318 | if (gpe_event_info->runtime_count == 1) { | 356 | if (gpe_event_info->runtime_count == 1) { |
319 | status = acpi_ev_enable_gpe(gpe_event_info); | 357 | status = acpi_ev_update_gpe_enable_masks(gpe_event_info); |
358 | if (ACPI_SUCCESS(status)) { | ||
359 | status = acpi_clear_and_enable_gpe(gpe_event_info); | ||
360 | } | ||
361 | |||
320 | if (ACPI_FAILURE(status)) { | 362 | if (ACPI_FAILURE(status)) { |
321 | gpe_event_info->runtime_count--; | 363 | gpe_event_info->runtime_count--; |
322 | goto unlock_and_exit; | 364 | goto unlock_and_exit; |
@@ -343,7 +385,7 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type) | |||
343 | */ | 385 | */ |
344 | gpe_event_info->wakeup_count++; | 386 | gpe_event_info->wakeup_count++; |
345 | if (gpe_event_info->wakeup_count == 1) { | 387 | if (gpe_event_info->wakeup_count == 1) { |
346 | (void)acpi_ev_update_gpe_enable_masks(gpe_event_info); | 388 | status = acpi_ev_update_gpe_enable_masks(gpe_event_info); |
347 | } | 389 | } |
348 | } | 390 | } |
349 | 391 | ||
@@ -403,7 +445,12 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type | |||
403 | 445 | ||
404 | gpe_event_info->runtime_count--; | 446 | gpe_event_info->runtime_count--; |
405 | if (!gpe_event_info->runtime_count) { | 447 | if (!gpe_event_info->runtime_count) { |
406 | status = acpi_ev_disable_gpe(gpe_event_info); | 448 | status = acpi_ev_update_gpe_enable_masks(gpe_event_info); |
449 | if (ACPI_SUCCESS(status)) { | ||
450 | status = acpi_hw_low_set_gpe(gpe_event_info, | ||
451 | ACPI_GPE_DISABLE); | ||
452 | } | ||
453 | |||
407 | if (ACPI_FAILURE(status)) { | 454 | if (ACPI_FAILURE(status)) { |
408 | gpe_event_info->runtime_count++; | 455 | gpe_event_info->runtime_count++; |
409 | goto unlock_and_exit; | 456 | goto unlock_and_exit; |
@@ -424,7 +471,7 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type | |||
424 | 471 | ||
425 | gpe_event_info->wakeup_count--; | 472 | gpe_event_info->wakeup_count--; |
426 | if (!gpe_event_info->wakeup_count) { | 473 | if (!gpe_event_info->wakeup_count) { |
427 | (void)acpi_ev_update_gpe_enable_masks(gpe_event_info); | 474 | status = acpi_ev_update_gpe_enable_masks(gpe_event_info); |
428 | } | 475 | } |
429 | } | 476 | } |
430 | 477 | ||
diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c index bd72319a38f0..3450309c2786 100644 --- a/drivers/acpi/acpica/hwgpe.c +++ b/drivers/acpi/acpica/hwgpe.c | |||
@@ -57,21 +57,47 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
57 | 57 | ||
58 | /****************************************************************************** | 58 | /****************************************************************************** |
59 | * | 59 | * |
60 | * FUNCTION: acpi_hw_low_disable_gpe | 60 | * FUNCTION: acpi_hw_gpe_register_bit |
61 | * | ||
62 | * PARAMETERS: gpe_event_info - Info block for the GPE | ||
63 | * gpe_register_info - Info block for the GPE register | ||
64 | * | ||
65 | * RETURN: Status | ||
66 | * | ||
67 | * DESCRIPTION: Compute GPE enable mask with one bit corresponding to the given | ||
68 | * GPE set. | ||
69 | * | ||
70 | ******************************************************************************/ | ||
71 | |||
72 | u32 acpi_hw_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info, | ||
73 | struct acpi_gpe_register_info *gpe_register_info) | ||
74 | { | ||
75 | return (u32)1 << (gpe_event_info->gpe_number - | ||
76 | gpe_register_info->base_gpe_number); | ||
77 | } | ||
78 | |||
79 | /****************************************************************************** | ||
80 | * | ||
81 | * FUNCTION: acpi_hw_low_set_gpe | ||
61 | * | 82 | * |
62 | * PARAMETERS: gpe_event_info - Info block for the GPE to be disabled | 83 | * PARAMETERS: gpe_event_info - Info block for the GPE to be disabled |
84 | * action - Enable or disable | ||
63 | * | 85 | * |
64 | * RETURN: Status | 86 | * RETURN: Status |
65 | * | 87 | * |
66 | * DESCRIPTION: Disable a single GPE in the enable register. | 88 | * DESCRIPTION: Enable or disable a single GPE in its enable register. |
67 | * | 89 | * |
68 | ******************************************************************************/ | 90 | ******************************************************************************/ |
69 | 91 | ||
70 | acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) | 92 | acpi_status |
93 | acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u8 action) | ||
71 | { | 94 | { |
72 | struct acpi_gpe_register_info *gpe_register_info; | 95 | struct acpi_gpe_register_info *gpe_register_info; |
73 | acpi_status status; | 96 | acpi_status status; |
74 | u32 enable_mask; | 97 | u32 enable_mask; |
98 | u32 register_bit; | ||
99 | |||
100 | ACPI_FUNCTION_ENTRY(); | ||
75 | 101 | ||
76 | /* Get the info block for the entire GPE register */ | 102 | /* Get the info block for the entire GPE register */ |
77 | 103 | ||
@@ -87,11 +113,27 @@ acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
87 | return (status); | 113 | return (status); |
88 | } | 114 | } |
89 | 115 | ||
90 | /* Clear just the bit that corresponds to this GPE */ | 116 | /* Set ot clear just the bit that corresponds to this GPE */ |
91 | 117 | ||
92 | ACPI_CLEAR_BIT(enable_mask, ((u32)1 << | 118 | register_bit = acpi_hw_gpe_register_bit(gpe_event_info, |
93 | (gpe_event_info->gpe_number - | 119 | gpe_register_info); |
94 | gpe_register_info->base_gpe_number))); | 120 | switch (action) { |
121 | case ACPI_GPE_COND_ENABLE: | ||
122 | if (!(register_bit & gpe_register_info->enable_for_run)) | ||
123 | return (AE_BAD_PARAMETER); | ||
124 | |||
125 | case ACPI_GPE_ENABLE: | ||
126 | ACPI_SET_BIT(enable_mask, register_bit); | ||
127 | break; | ||
128 | |||
129 | case ACPI_GPE_DISABLE: | ||
130 | ACPI_CLEAR_BIT(enable_mask, register_bit); | ||
131 | break; | ||
132 | |||
133 | default: | ||
134 | ACPI_ERROR((AE_INFO, "Invalid action\n")); | ||
135 | return (AE_BAD_PARAMETER); | ||
136 | } | ||
95 | 137 | ||
96 | /* Write the updated enable mask */ | 138 | /* Write the updated enable mask */ |
97 | 139 | ||
@@ -116,23 +158,11 @@ acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
116 | acpi_status | 158 | acpi_status |
117 | acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info * gpe_event_info) | 159 | acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info * gpe_event_info) |
118 | { | 160 | { |
119 | struct acpi_gpe_register_info *gpe_register_info; | ||
120 | acpi_status status; | 161 | acpi_status status; |
121 | 162 | ||
122 | ACPI_FUNCTION_ENTRY(); | 163 | ACPI_FUNCTION_ENTRY(); |
123 | 164 | ||
124 | /* Get the info block for the entire GPE register */ | 165 | status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_COND_ENABLE); |
125 | |||
126 | gpe_register_info = gpe_event_info->register_info; | ||
127 | if (!gpe_register_info) { | ||
128 | return (AE_NOT_EXIST); | ||
129 | } | ||
130 | |||
131 | /* Write the entire GPE (runtime) enable register */ | ||
132 | |||
133 | status = acpi_hw_write(gpe_register_info->enable_for_run, | ||
134 | &gpe_register_info->enable_address); | ||
135 | |||
136 | return (status); | 166 | return (status); |
137 | } | 167 | } |
138 | 168 | ||
@@ -150,21 +180,28 @@ acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info * gpe_event_info) | |||
150 | 180 | ||
151 | acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info) | 181 | acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info) |
152 | { | 182 | { |
183 | struct acpi_gpe_register_info *gpe_register_info; | ||
153 | acpi_status status; | 184 | acpi_status status; |
154 | u8 register_bit; | 185 | u32 register_bit; |
155 | 186 | ||
156 | ACPI_FUNCTION_ENTRY(); | 187 | ACPI_FUNCTION_ENTRY(); |
157 | 188 | ||
158 | register_bit = (u8)(1 << | 189 | /* Get the info block for the entire GPE register */ |
159 | (gpe_event_info->gpe_number - | 190 | |
160 | gpe_event_info->register_info->base_gpe_number)); | 191 | gpe_register_info = gpe_event_info->register_info; |
192 | if (!gpe_register_info) { | ||
193 | return (AE_NOT_EXIST); | ||
194 | } | ||
195 | |||
196 | register_bit = acpi_hw_gpe_register_bit(gpe_event_info, | ||
197 | gpe_register_info); | ||
161 | 198 | ||
162 | /* | 199 | /* |
163 | * Write a one to the appropriate bit in the status register to | 200 | * Write a one to the appropriate bit in the status register to |
164 | * clear this GPE. | 201 | * clear this GPE. |
165 | */ | 202 | */ |
166 | status = acpi_hw_write(register_bit, | 203 | status = acpi_hw_write(register_bit, |
167 | &gpe_event_info->register_info->status_address); | 204 | &gpe_register_info->status_address); |
168 | 205 | ||
169 | return (status); | 206 | return (status); |
170 | } | 207 | } |
@@ -187,7 +224,7 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, | |||
187 | acpi_event_status * event_status) | 224 | acpi_event_status * event_status) |
188 | { | 225 | { |
189 | u32 in_byte; | 226 | u32 in_byte; |
190 | u8 register_bit; | 227 | u32 register_bit; |
191 | struct acpi_gpe_register_info *gpe_register_info; | 228 | struct acpi_gpe_register_info *gpe_register_info; |
192 | acpi_status status; | 229 | acpi_status status; |
193 | acpi_event_status local_event_status = 0; | 230 | acpi_event_status local_event_status = 0; |
@@ -204,9 +241,8 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, | |||
204 | 241 | ||
205 | /* Get the register bitmask for this GPE */ | 242 | /* Get the register bitmask for this GPE */ |
206 | 243 | ||
207 | register_bit = (u8)(1 << | 244 | register_bit = acpi_hw_gpe_register_bit(gpe_event_info, |
208 | (gpe_event_info->gpe_number - | 245 | gpe_register_info); |
209 | gpe_event_info->register_info->base_gpe_number)); | ||
210 | 246 | ||
211 | /* GPE currently enabled? (enabled for runtime?) */ | 247 | /* GPE currently enabled? (enabled for runtime?) */ |
212 | 248 | ||
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index c79e789ed03a..f8db50a0941c 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c | |||
@@ -388,10 +388,12 @@ static ssize_t counter_set(struct kobject *kobj, | |||
388 | if (index < num_gpes) { | 388 | if (index < num_gpes) { |
389 | if (!strcmp(buf, "disable\n") && | 389 | if (!strcmp(buf, "disable\n") && |
390 | (status & ACPI_EVENT_FLAG_ENABLED)) | 390 | (status & ACPI_EVENT_FLAG_ENABLED)) |
391 | result = acpi_set_gpe(handle, index, ACPI_GPE_DISABLE); | 391 | result = acpi_disable_gpe(handle, index, |
392 | ACPI_GPE_TYPE_RUNTIME); | ||
392 | else if (!strcmp(buf, "enable\n") && | 393 | else if (!strcmp(buf, "enable\n") && |
393 | !(status & ACPI_EVENT_FLAG_ENABLED)) | 394 | !(status & ACPI_EVENT_FLAG_ENABLED)) |
394 | result = acpi_set_gpe(handle, index, ACPI_GPE_ENABLE); | 395 | result = acpi_enable_gpe(handle, index, |
396 | ACPI_GPE_TYPE_RUNTIME); | ||
395 | else if (!strcmp(buf, "clear\n") && | 397 | else if (!strcmp(buf, "clear\n") && |
396 | (status & ACPI_EVENT_FLAG_SET)) | 398 | (status & ACPI_EVENT_FLAG_SET)) |
397 | result = acpi_clear_gpe(handle, index); | 399 | result = acpi_clear_gpe(handle, index); |