mirror of
https://github.com/adulau/aha.git
synced 2024-12-31 21:26:18 +00:00
ACPI: EC: Do the byte access with a fast path
Specification allows only byte access for EC region, so make it separate from bug-compatible multi-byte access. Also do not allow return of garbage in supplied *value. Reference: http://bugzilla.kernel.org/show_bug.cgi?id=9341 Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
parent
fd0b45dfd1
commit
3e71a87d03
1 changed files with 11 additions and 4 deletions
|
@ -563,7 +563,7 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address,
|
||||||
void *handler_context, void *region_context)
|
void *handler_context, void *region_context)
|
||||||
{
|
{
|
||||||
struct acpi_ec *ec = handler_context;
|
struct acpi_ec *ec = handler_context;
|
||||||
int result = 0, i = 0;
|
int result = 0, i;
|
||||||
u8 temp = 0;
|
u8 temp = 0;
|
||||||
|
|
||||||
if ((address > 0xFF) || !value || !handler_context)
|
if ((address > 0xFF) || !value || !handler_context)
|
||||||
|
@ -575,7 +575,16 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address,
|
||||||
if (bits != 8 && acpi_strict)
|
if (bits != 8 && acpi_strict)
|
||||||
return AE_BAD_PARAMETER;
|
return AE_BAD_PARAMETER;
|
||||||
|
|
||||||
while (bits - i > 0) {
|
if (function == ACPI_READ) {
|
||||||
|
result = acpi_ec_read(ec, address, &temp);
|
||||||
|
*value = temp;
|
||||||
|
} else {
|
||||||
|
temp = 0xff & (*value);
|
||||||
|
result = acpi_ec_write(ec, address, temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 8; unlikely(bits - i > 0); i += 8) {
|
||||||
|
++address;
|
||||||
if (function == ACPI_READ) {
|
if (function == ACPI_READ) {
|
||||||
result = acpi_ec_read(ec, address, &temp);
|
result = acpi_ec_read(ec, address, &temp);
|
||||||
(*value) |= ((acpi_integer)temp) << i;
|
(*value) |= ((acpi_integer)temp) << i;
|
||||||
|
@ -583,8 +592,6 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address,
|
||||||
temp = 0xff & ((*value) >> i);
|
temp = 0xff & ((*value) >> i);
|
||||||
result = acpi_ec_write(ec, address, temp);
|
result = acpi_ec_write(ec, address, temp);
|
||||||
}
|
}
|
||||||
i += 8;
|
|
||||||
++address;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (result) {
|
switch (result) {
|
||||||
|
|
Loading…
Reference in a new issue