ACPICA: Expand OSL memory read/write interfaces to 64 bits
[pandora-kernel.git] / drivers / acpi / acpica / hwxface.c
index 7bdbbcf..a716fed 100644 (file)
@@ -138,11 +138,6 @@ acpi_status acpi_read(u64 *return_value, struct acpi_generic_address *reg)
                return (status);
        }
 
-       width = reg->bit_width;
-       if (width == 64) {
-               width = 32;     /* Break into two 32-bit transfers */
-       }
-
        /* Initialize entire 64-bit return value to zero */
 
        *return_value = 0;
@@ -154,24 +149,17 @@ acpi_status acpi_read(u64 *return_value, struct acpi_generic_address *reg)
         */
        if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
                status = acpi_os_read_memory((acpi_physical_address)
-                                            address, &value, width);
+                                            address, return_value,
+                                            reg->bit_width);
                if (ACPI_FAILURE(status)) {
                        return (status);
                }
-               *return_value = value;
-
-               if (reg->bit_width == 64) {
-
-                       /* Read the top 32 bits */
+       } else {                /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
 
-                       status = acpi_os_read_memory((acpi_physical_address)
-                                                    (address + 4), &value, 32);
-                       if (ACPI_FAILURE(status)) {
-                               return (status);
-                       }
-                       *return_value |= ((u64)value << 32);
+               width = reg->bit_width;
+               if (width == 64) {
+                       width = 32;     /* Break into two 32-bit transfers */
                }
-       } else {                /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
 
                status = acpi_hw_read_port((acpi_io_address)
                                           address, &value, width);
@@ -231,32 +219,22 @@ acpi_status acpi_write(u64 value, struct acpi_generic_address *reg)
                return (status);
        }
 
-       width = reg->bit_width;
-       if (width == 64) {
-               width = 32;     /* Break into two 32-bit transfers */
-       }
-
        /*
         * Two address spaces supported: Memory or IO. PCI_Config is
         * not supported here because the GAS structure is insufficient
         */
        if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
                status = acpi_os_write_memory((acpi_physical_address)
-                                             address, ACPI_LODWORD(value),
-                                             width);
+                                             address, value, reg->bit_width);
                if (ACPI_FAILURE(status)) {
                        return (status);
                }
+       } else {                /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
 
-               if (reg->bit_width == 64) {
-                       status = acpi_os_write_memory((acpi_physical_address)
-                                                     (address + 4),
-                                                     ACPI_HIDWORD(value), 32);
-                       if (ACPI_FAILURE(status)) {
-                               return (status);
-                       }
+               width = reg->bit_width;
+               if (width == 64) {
+                       width = 32;     /* Break into two 32-bit transfers */
                }
-       } else {                /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
 
                status = acpi_hw_write_port((acpi_io_address)
                                            address, ACPI_LODWORD(value),
@@ -286,6 +264,7 @@ acpi_status acpi_write(u64 value, struct acpi_generic_address *reg)
 
 ACPI_EXPORT_SYMBOL(acpi_write)
 
+#if (!ACPI_REDUCED_HARDWARE)
 /*******************************************************************************
  *
  * FUNCTION:    acpi_read_bit_register
@@ -356,7 +335,7 @@ ACPI_EXPORT_SYMBOL(acpi_read_bit_register)
  *
  * PARAMETERS:  register_id     - ID of ACPI Bit Register to access
  *              Value           - Value to write to the register, in bit
- *                                position zero. The bit is automaticallly
+ *                                position zero. The bit is automatically
  *                                shifted to the correct position.
  *
  * RETURN:      Status
@@ -453,7 +432,7 @@ unlock_and_exit:
 }
 
 ACPI_EXPORT_SYMBOL(acpi_write_bit_register)
-
+#endif                         /* !ACPI_REDUCED_HARDWARE */
 /*******************************************************************************
  *
  * FUNCTION:    acpi_get_sleep_type_data