]> xenbits.xensource.com Git - xenclient/kernel.git/commitdiff
commit 49fbabf56dc715bbb51e59742e82ba762790aac0 git-bbf4a6bc8c4d59a0a9033fc2cb96ec03430c96e4
authort_jeang <devnull@localhost>
Tue, 6 Jan 2009 12:05:21 +0000 (12:05 +0000)
committert_jeang <devnull@localhost>
Tue, 6 Jan 2009 12:05:21 +0000 (12:05 +0000)
Author: Zhao Yakui <yakui.zhao@intel.com>
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 <yakui.zhao@intel.com>
Signed-off-by: Li Shaohua <shaohua.li@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/acpi/osl.c

index 507f051d1cefd437634454809aa69c748f256a0d..261621d28ae9046335cf63f9e8df70399d0296ee 100644 (file)
@@ -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();
        }