Commit 49fbabf5 authored by Zhao Yakui's avatar Zhao Yakui Committed by Len Brown

ACPI: Handle I/O access width requestst that are not a multiple of 8 bits.

We've run into BIOS that hand us 4-bit access width requests
for T-state control when the code expected only multipls of 8-bits.
Round up.
Signed-off-by: default avatarZhao Yakui <yakui.zhao@intel.com>
Signed-off-by: default avatarLi Shaohua <shaohua.li@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent ef54d5ad
...@@ -387,17 +387,14 @@ acpi_status acpi_os_read_port(acpi_io_address port, u32 * value, u32 width) ...@@ -387,17 +387,14 @@ acpi_status acpi_os_read_port(acpi_io_address port, u32 * value, u32 width)
if (!value) if (!value)
value = &dummy; value = &dummy;
switch (width) { *value = 0;
case 8: if (width <= 8) {
*(u8 *) value = inb(port); *(u8 *) value = inb(port);
break; } else if (width <= 16) {
case 16:
*(u16 *) value = inw(port); *(u16 *) value = inw(port);
break; } else if (width <= 32) {
case 32:
*(u32 *) value = inl(port); *(u32 *) value = inl(port);
break; } else {
default:
BUG(); BUG();
} }
...@@ -408,17 +405,13 @@ EXPORT_SYMBOL(acpi_os_read_port); ...@@ -408,17 +405,13 @@ EXPORT_SYMBOL(acpi_os_read_port);
acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width) acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width)
{ {
switch (width) { if (width <= 8) {
case 8:
outb(value, port); outb(value, port);
break; } else if (width <= 16) {
case 16:
outw(value, port); outw(value, port);
break; } else if (width <= 32) {
case 32:
outl(value, port); outl(value, port);
break; } else {
default:
BUG(); BUG();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment