Skip to content

Commit

Permalink
ACPI: Handle I/O access width requestst that are not a multiple of 8 …
Browse files Browse the repository at this point in the history
…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: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Li Shaohua <shaohua.li@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
  • Loading branch information
Zhao Yakui authored and Len Brown committed Nov 17, 2007
1 parent ef54d5a commit 49fbabf
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions drivers/acpi/osl.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,17 +387,14 @@ acpi_status acpi_os_read_port(acpi_io_address port, u32 * value, u32 width)
if (!value)
value = &dummy;

switch (width) {
case 8:
*value = 0;
if (width <= 8) {
*(u8 *) value = inb(port);
break;
case 16:
} else if (width <= 16) {
*(u16 *) value = inw(port);
break;
case 32:
} else if (width <= 32) {
*(u32 *) value = inl(port);
break;
default:
} else {
BUG();
}

Expand All @@ -408,17 +405,13 @@ EXPORT_SYMBOL(acpi_os_read_port);

acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width)
{
switch (width) {
case 8:
if (width <= 8) {
outb(value, port);
break;
case 16:
} else if (width <= 16) {
outw(value, port);
break;
case 32:
} else if (width <= 32) {
outl(value, port);
break;
default:
} else {
BUG();
}

Expand Down

0 comments on commit 49fbabf

Please sign in to comment.