diff options
author | Luming Yu <luming.yu@intel.com> | 2005-03-19 01:54:47 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-07-11 23:53:38 -0400 |
commit | fa9cd547e097df4966b8bd5c94aeed953e32b14d (patch) | |
tree | 1f5fd7bf77154375fd337d4b98f2646cdc52fc9f /drivers/acpi | |
parent | 451566f45a2e6cd10ba56e7220a9dd84ba3ef550 (diff) |
[ACPI] fix EC access width
http://bugzilla.kernel.org/show_bug.cgi?id=4346
Written-by: David Shaohua Li and Luming Yu
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/ec.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 69b04d430f00..e37162229342 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -600,7 +600,7 @@ acpi_ec_space_handler ( | |||
600 | { | 600 | { |
601 | int result = 0; | 601 | int result = 0; |
602 | struct acpi_ec *ec = NULL; | 602 | struct acpi_ec *ec = NULL; |
603 | u32 temp = 0; | 603 | u64 temp = *value; |
604 | acpi_integer f_v = 0; | 604 | acpi_integer f_v = 0; |
605 | int i = 0; | 605 | int i = 0; |
606 | 606 | ||
@@ -609,10 +609,9 @@ acpi_ec_space_handler ( | |||
609 | if ((address > 0xFF) || !value || !handler_context) | 609 | if ((address > 0xFF) || !value || !handler_context) |
610 | return_VALUE(AE_BAD_PARAMETER); | 610 | return_VALUE(AE_BAD_PARAMETER); |
611 | 611 | ||
612 | if(bit_width != 8) { | 612 | if (bit_width != 8 && acpi_strict) { |
613 | printk(KERN_WARNING PREFIX "acpi_ec_space_handler: bit_width should be 8\n"); | 613 | printk(KERN_WARNING PREFIX "acpi_ec_space_handler: bit_width should be 8\n"); |
614 | if (acpi_strict) | 614 | return_VALUE(AE_BAD_PARAMETER); |
615 | return_VALUE(AE_BAD_PARAMETER); | ||
616 | } | 615 | } |
617 | 616 | ||
618 | ec = (struct acpi_ec *) handler_context; | 617 | ec = (struct acpi_ec *) handler_context; |
@@ -620,11 +619,11 @@ acpi_ec_space_handler ( | |||
620 | next_byte: | 619 | next_byte: |
621 | switch (function) { | 620 | switch (function) { |
622 | case ACPI_READ: | 621 | case ACPI_READ: |
623 | result = acpi_ec_read(ec, (u8) address, &temp); | 622 | temp = 0; |
624 | *value = (acpi_integer) temp; | 623 | result = acpi_ec_read(ec, (u8) address, (u32 *)&temp); |
625 | break; | 624 | break; |
626 | case ACPI_WRITE: | 625 | case ACPI_WRITE: |
627 | result = acpi_ec_write(ec, (u8) address, (u8) *value); | 626 | result = acpi_ec_write(ec, (u8) address, (u8) temp); |
628 | break; | 627 | break; |
629 | default: | 628 | default: |
630 | result = -EINVAL; | 629 | result = -EINVAL; |
@@ -633,19 +632,18 @@ next_byte: | |||
633 | } | 632 | } |
634 | 633 | ||
635 | bit_width -= 8; | 634 | bit_width -= 8; |
636 | if(bit_width){ | 635 | if (bit_width) { |
637 | 636 | if (function == ACPI_READ) | |
638 | if(function == ACPI_READ) | 637 | f_v |= temp << 8 * i; |
639 | f_v |= (acpi_integer) (*value) << 8*i; | 638 | if (function == ACPI_WRITE) |
640 | if(function == ACPI_WRITE) | 639 | temp >>= 8; |
641 | (*value) >>=8; | ||
642 | i++; | 640 | i++; |
641 | (u8)address ++; | ||
643 | goto next_byte; | 642 | goto next_byte; |
644 | } | 643 | } |
645 | 644 | ||
646 | 645 | if (function == ACPI_READ) { | |
647 | if(function == ACPI_READ){ | 646 | f_v |= temp << 8 * i; |
648 | f_v |= (acpi_integer) (*value) << 8*i; | ||
649 | *value = f_v; | 647 | *value = f_v; |
650 | } | 648 | } |
651 | 649 | ||
@@ -664,8 +662,6 @@ out: | |||
664 | default: | 662 | default: |
665 | return_VALUE(AE_OK); | 663 | return_VALUE(AE_OK); |
666 | } | 664 | } |
667 | |||
668 | |||
669 | } | 665 | } |
670 | 666 | ||
671 | 667 | ||