aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica/evgpeblk.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/acpica/evgpeblk.c')
-rw-r--r--drivers/acpi/acpica/evgpeblk.c70
1 files changed, 34 insertions, 36 deletions
diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c
index 484cc0565d5b..7b3463639422 100644
--- a/drivers/acpi/acpica/evgpeblk.c
+++ b/drivers/acpi/acpica/evgpeblk.c
@@ -104,9 +104,9 @@ u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info)
104 104
105 while (gpe_block) { 105 while (gpe_block) {
106 if ((&gpe_block->event_info[0] <= gpe_event_info) && 106 if ((&gpe_block->event_info[0] <= gpe_event_info) &&
107 (&gpe_block-> 107 (&gpe_block->event_info[((acpi_size)
108 event_info[((acpi_size) gpe_block-> 108 gpe_block->
109 register_count) * 8] > 109 register_count) * 8] >
110 gpe_event_info)) { 110 gpe_event_info)) {
111 return (TRUE); 111 return (TRUE);
112 } 112 }
@@ -210,10 +210,9 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
210 /* Now look at the individual GPEs in this byte register */ 210 /* Now look at the individual GPEs in this byte register */
211 211
212 for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { 212 for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
213 gpe_event_info = 213 gpe_event_info = &gpe_block->event_info[((acpi_size) i *
214 &gpe_block-> 214 ACPI_GPE_REGISTER_WIDTH)
215 event_info[((acpi_size) i * 215 + j];
216 ACPI_GPE_REGISTER_WIDTH) + j];
217 216
218 if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == 217 if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
219 ACPI_GPE_DISPATCH_HANDLER) { 218 ACPI_GPE_DISPATCH_HANDLER) {
@@ -293,8 +292,8 @@ acpi_ev_save_method_info(acpi_handle obj_handle,
293 /* Unknown method type, just ignore it! */ 292 /* Unknown method type, just ignore it! */
294 293
295 ACPI_DEBUG_PRINT((ACPI_DB_LOAD, 294 ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
296 "Ignoring unknown GPE method type: %s (name not of form _Lxx or _Exx)", 295 "Ignoring unknown GPE method type: %s "
297 name)); 296 "(name not of form _Lxx or _Exx)", name));
298 return_ACPI_STATUS(AE_OK); 297 return_ACPI_STATUS(AE_OK);
299 } 298 }
300 299
@@ -306,17 +305,16 @@ acpi_ev_save_method_info(acpi_handle obj_handle,
306 /* Conversion failed; invalid method, just ignore it */ 305 /* Conversion failed; invalid method, just ignore it */
307 306
308 ACPI_DEBUG_PRINT((ACPI_DB_LOAD, 307 ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
309 "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)", 308 "Could not extract GPE number from name: %s "
310 name)); 309 "(name is not of form _Lxx or _Exx)", name));
311 return_ACPI_STATUS(AE_OK); 310 return_ACPI_STATUS(AE_OK);
312 } 311 }
313 312
314 /* Ensure that we have a valid GPE number for this GPE block */ 313 /* Ensure that we have a valid GPE number for this GPE block */
315 314
316 if ((gpe_number < gpe_block->block_base_number) || 315 if ((gpe_number < gpe_block->block_base_number) ||
317 (gpe_number >= 316 (gpe_number >= (gpe_block->block_base_number +
318 (gpe_block->block_base_number + 317 (gpe_block->register_count * 8)))) {
319 (gpe_block->register_count * 8)))) {
320 /* 318 /*
321 * Not valid for this GPE block, just ignore it. However, it may be 319 * Not valid for this GPE block, just ignore it. However, it may be
322 * valid for a different GPE block, since GPE0 and GPE1 methods both 320 * valid for a different GPE block, since GPE0 and GPE1 methods both
@@ -408,7 +406,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
408 */ 406 */
409 obj_desc = pkg_desc->package.elements[0]; 407 obj_desc = pkg_desc->package.elements[0];
410 408
411 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { 409 if (obj_desc->common.type == ACPI_TYPE_INTEGER) {
412 410
413 /* Use FADT-defined GPE device (from definition of _PRW) */ 411 /* Use FADT-defined GPE device (from definition of _PRW) */
414 412
@@ -417,15 +415,15 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
417 /* Integer is the GPE number in the FADT described GPE blocks */ 415 /* Integer is the GPE number in the FADT described GPE blocks */
418 416
419 gpe_number = (u32) obj_desc->integer.value; 417 gpe_number = (u32) obj_desc->integer.value;
420 } else if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { 418 } else if (obj_desc->common.type == ACPI_TYPE_PACKAGE) {
421 419
422 /* Package contains a GPE reference and GPE number within a GPE block */ 420 /* Package contains a GPE reference and GPE number within a GPE block */
423 421
424 if ((obj_desc->package.count < 2) || 422 if ((obj_desc->package.count < 2) ||
425 (ACPI_GET_OBJECT_TYPE(obj_desc->package.elements[0]) != 423 ((obj_desc->package.elements[0])->common.type !=
426 ACPI_TYPE_LOCAL_REFERENCE) 424 ACPI_TYPE_LOCAL_REFERENCE) ||
427 || (ACPI_GET_OBJECT_TYPE(obj_desc->package.elements[1]) != 425 ((obj_desc->package.elements[1])->common.type !=
428 ACPI_TYPE_INTEGER)) { 426 ACPI_TYPE_INTEGER)) {
429 goto cleanup; 427 goto cleanup;
430 } 428 }
431 429
@@ -450,11 +448,11 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
450 */ 448 */
451 if ((gpe_device == target_gpe_device) && 449 if ((gpe_device == target_gpe_device) &&
452 (gpe_number >= gpe_block->block_base_number) && 450 (gpe_number >= gpe_block->block_base_number) &&
453 (gpe_number < 451 (gpe_number < gpe_block->block_base_number +
454 gpe_block->block_base_number + (gpe_block->register_count * 8))) { 452 (gpe_block->register_count * 8))) {
455 gpe_event_info = 453 gpe_event_info = &gpe_block->event_info[gpe_number -
456 &gpe_block->event_info[gpe_number - 454 gpe_block->
457 gpe_block->block_base_number]; 455 block_base_number];
458 456
459 /* Mark GPE for WAKE-ONLY but WAKE_DISABLED */ 457 /* Mark GPE for WAKE-ONLY but WAKE_DISABLED */
460 458
@@ -1033,8 +1031,8 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
1033 * 1) are "runtime" or "run/wake" GPEs, and 1031 * 1) are "runtime" or "run/wake" GPEs, and
1034 * 2) have a corresponding _Lxx or _Exx method 1032 * 2) have a corresponding _Lxx or _Exx method
1035 * 1033 *
1036 * Any other GPEs within this block must be enabled via the acpi_enable_gpe() 1034 * Any other GPEs within this block must be enabled via the
1037 * external interface. 1035 * acpi_enable_gpe() external interface.
1038 */ 1036 */
1039 wake_gpe_count = 0; 1037 wake_gpe_count = 0;
1040 gpe_enabled_count = 0; 1038 gpe_enabled_count = 0;
@@ -1044,14 +1042,13 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
1044 1042
1045 /* Get the info block for this particular GPE */ 1043 /* Get the info block for this particular GPE */
1046 1044
1047 gpe_event_info = 1045 gpe_event_info = &gpe_block->event_info[((acpi_size) i *
1048 &gpe_block-> 1046 ACPI_GPE_REGISTER_WIDTH)
1049 event_info[((acpi_size) i * 1047 + j];
1050 ACPI_GPE_REGISTER_WIDTH) + j];
1051 1048
1052 if (((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == 1049 if (((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
1053 ACPI_GPE_DISPATCH_METHOD) 1050 ACPI_GPE_DISPATCH_METHOD) &&
1054 && (gpe_event_info->flags & ACPI_GPE_TYPE_RUNTIME)) { 1051 (gpe_event_info->flags & ACPI_GPE_TYPE_RUNTIME)) {
1055 gpe_enabled_count++; 1052 gpe_enabled_count++;
1056 } 1053 }
1057 1054
@@ -1105,8 +1102,8 @@ acpi_status acpi_ev_gpe_initialize(void)
1105 /* 1102 /*
1106 * Initialize the GPE Block(s) defined in the FADT 1103 * Initialize the GPE Block(s) defined in the FADT
1107 * 1104 *
1108 * Why the GPE register block lengths are divided by 2: From the ACPI Spec, 1105 * Why the GPE register block lengths are divided by 2: From the ACPI
1109 * section "General-Purpose Event Registers", we have: 1106 * Spec, section "General-Purpose Event Registers", we have:
1110 * 1107 *
1111 * "Each register block contains two registers of equal length 1108 * "Each register block contains two registers of equal length
1112 * GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the 1109 * GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the
@@ -1163,7 +1160,8 @@ acpi_status acpi_ev_gpe_initialize(void)
1163 if ((register_count0) && 1160 if ((register_count0) &&
1164 (gpe_number_max >= acpi_gbl_FADT.gpe1_base)) { 1161 (gpe_number_max >= acpi_gbl_FADT.gpe1_base)) {
1165 ACPI_ERROR((AE_INFO, 1162 ACPI_ERROR((AE_INFO,
1166 "GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1", 1163 "GPE0 block (GPE 0 to %d) overlaps the GPE1 block "
1164 "(GPE %d to %d) - Ignoring GPE1",
1167 gpe_number_max, acpi_gbl_FADT.gpe1_base, 1165 gpe_number_max, acpi_gbl_FADT.gpe1_base,
1168 acpi_gbl_FADT.gpe1_base + 1166 acpi_gbl_FADT.gpe1_base +
1169 ((register_count1 * 1167 ((register_count1 *