diff options
| -rw-r--r-- | drivers/acpi/acpica/exprep.c | 12 | ||||
| -rw-r--r-- | drivers/acpi/ec.c | 35 |
2 files changed, 21 insertions, 26 deletions
diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c index edf62bf5b266..a610ebe18edd 100644 --- a/drivers/acpi/acpica/exprep.c +++ b/drivers/acpi/acpica/exprep.c | |||
| @@ -468,6 +468,18 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
| 468 | 468 | ||
| 469 | acpi_ut_add_reference(obj_desc->field.region_obj); | 469 | acpi_ut_add_reference(obj_desc->field.region_obj); |
| 470 | 470 | ||
| 471 | /* allow full data read from EC address space */ | ||
| 472 | if (obj_desc->field.region_obj->region.space_id == | ||
| 473 | ACPI_ADR_SPACE_EC) { | ||
| 474 | if (obj_desc->common_field.bit_length > 8) | ||
| 475 | obj_desc->common_field.access_bit_width = | ||
| 476 | ACPI_ROUND_UP(obj_desc->common_field. | ||
| 477 | bit_length, 8); | ||
| 478 | obj_desc->common_field.access_byte_width = | ||
| 479 | ACPI_DIV_8(obj_desc->common_field. | ||
| 480 | access_bit_width); | ||
| 481 | } | ||
| 482 | |||
| 471 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 483 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
| 472 | "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n", | 484 | "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n", |
| 473 | obj_desc->field.start_field_bit_offset, | 485 | obj_desc->field.start_field_bit_offset, |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 1ac28c6a672e..7208a692e93c 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
| @@ -628,12 +628,12 @@ static u32 acpi_ec_gpe_handler(void *data) | |||
| 628 | 628 | ||
| 629 | static acpi_status | 629 | static acpi_status |
| 630 | acpi_ec_space_handler(u32 function, acpi_physical_address address, | 630 | acpi_ec_space_handler(u32 function, acpi_physical_address address, |
| 631 | u32 bits, u64 *value, | 631 | u32 bits, u64 *value64, |
| 632 | void *handler_context, void *region_context) | 632 | void *handler_context, void *region_context) |
| 633 | { | 633 | { |
| 634 | struct acpi_ec *ec = handler_context; | 634 | struct acpi_ec *ec = handler_context; |
| 635 | int result = 0, i; | 635 | int result = 0, i, bytes = bits / 8; |
| 636 | u8 temp = 0; | 636 | u8 *value = (u8 *)value64; |
| 637 | 637 | ||
| 638 | if ((address > 0xFF) || !value || !handler_context) | 638 | if ((address > 0xFF) || !value || !handler_context) |
| 639 | return AE_BAD_PARAMETER; | 639 | return AE_BAD_PARAMETER; |
| @@ -641,32 +641,15 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address, | |||
| 641 | if (function != ACPI_READ && function != ACPI_WRITE) | 641 | if (function != ACPI_READ && function != ACPI_WRITE) |
| 642 | return AE_BAD_PARAMETER; | 642 | return AE_BAD_PARAMETER; |
| 643 | 643 | ||
| 644 | if (bits != 8 && acpi_strict) | 644 | if (EC_FLAGS_MSI || bits > 8) |
| 645 | return AE_BAD_PARAMETER; | ||
| 646 | |||
| 647 | if (EC_FLAGS_MSI) | ||
| 648 | acpi_ec_burst_enable(ec); | 645 | acpi_ec_burst_enable(ec); |
| 649 | 646 | ||
| 650 | if (function == ACPI_READ) { | 647 | for (i = 0; i < bytes; ++i, ++address, ++value) |
| 651 | result = acpi_ec_read(ec, address, &temp); | 648 | result = (function == ACPI_READ) ? |
| 652 | *value = temp; | 649 | acpi_ec_read(ec, address, value) : |
| 653 | } else { | 650 | acpi_ec_write(ec, address, *value); |
| 654 | temp = 0xff & (*value); | ||
| 655 | result = acpi_ec_write(ec, address, temp); | ||
| 656 | } | ||
| 657 | |||
| 658 | for (i = 8; unlikely(bits - i > 0); i += 8) { | ||
| 659 | ++address; | ||
| 660 | if (function == ACPI_READ) { | ||
| 661 | result = acpi_ec_read(ec, address, &temp); | ||
| 662 | (*value) |= ((u64)temp) << i; | ||
| 663 | } else { | ||
| 664 | temp = 0xff & ((*value) >> i); | ||
| 665 | result = acpi_ec_write(ec, address, temp); | ||
| 666 | } | ||
| 667 | } | ||
| 668 | 651 | ||
| 669 | if (EC_FLAGS_MSI) | 652 | if (EC_FLAGS_MSI || bits > 8) |
| 670 | acpi_ec_burst_disable(ec); | 653 | acpi_ec_burst_disable(ec); |
| 671 | 654 | ||
| 672 | switch (result) { | 655 | switch (result) { |
