From: t_jeang Date: Tue, 6 Jan 2009 12:05:21 +0000 (+0000) Subject: commit 49fbabf56dc715bbb51e59742e82ba762790aac0 X-Git-Tag: git-bbf4a6bc8c4d59a0a9033fc2cb96ec03430c96e4 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=32f683fc9e1166394cfb0407daab8abdb2625c82;p=xenclient%2Fkernel.git commit 49fbabf56dc715bbb51e59742e82ba762790aac0 Author: Zhao Yakui Date: Thu Nov 15 17:01:06 2007 +0800 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: Zhao Yakui Signed-off-by: Li Shaohua Signed-off-by: Len Brown --- diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 507f051d..261621d2 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -337,17 +337,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(); } @@ -358,17 +355,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(); }