[netdrvr e100] experiment with doing RX in a similar manner to eepro100
[powerpc.git] / drivers / acpi / executer / exregion.c
index 9db68d1..2e9ce94 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2006, R. Byron Moore
+ * Copyright (C) 2000 - 2007, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -81,7 +81,7 @@ acpi_ex_system_memory_space_handler(u32 function,
        u32 remainder;
 #endif
 
-       ACPI_FUNCTION_TRACE("ex_system_memory_space_handler");
+       ACPI_FUNCTION_TRACE(ex_system_memory_space_handler);
 
        /* Validate and translate the bit width */
 
@@ -103,7 +103,7 @@ acpi_ex_system_memory_space_handler(u32 function,
                break;
 
        default:
-               ACPI_ERROR((AE_INFO, "Invalid system_memory width %d",
+               ACPI_ERROR((AE_INFO, "Invalid SystemMemory width %d",
                            bit_width));
                return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
        }
@@ -155,16 +155,15 @@ acpi_ex_system_memory_space_handler(u32 function,
 
                /* Create a new mapping starting at the address given */
 
-               status = acpi_os_map_memory(address, window_size,
-                                           (void **)&mem_info->
-                                           mapped_logical_address);
-               if (ACPI_FAILURE(status)) {
+               mem_info->mapped_logical_address =
+                   acpi_os_map_memory((acpi_native_uint) address, window_size);
+               if (!mem_info->mapped_logical_address) {
                        ACPI_ERROR((AE_INFO,
                                    "Could not map memory at %8.8X%8.8X, size %X",
                                    ACPI_FORMAT_UINT64(address),
                                    (u32) window_size));
                        mem_info->mapped_length = 0;
-                       return_ACPI_STATUS(status);
+                       return_ACPI_STATUS(AE_NO_MEMORY);
                }
 
                /* Save the physical address and mapping size */
@@ -182,8 +181,8 @@ acpi_ex_system_memory_space_handler(u32 function,
             (acpi_integer) mem_info->mapped_physical_address);
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                         "system_memory %d (%d width) Address=%8.8X%8.8X\n",
-                         function, bit_width, ACPI_FORMAT_UINT64(address)));
+                         "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n",
+                         bit_width, function, ACPI_FORMAT_UINT64(address)));
 
        /*
         * Perform the memory read or write
@@ -210,11 +209,10 @@ acpi_ex_system_memory_space_handler(u32 function,
                        *value = (acpi_integer) ACPI_GET32(logical_addr_ptr);
                        break;
 
-#if ACPI_MACHINE_WIDTH != 16
                case 64:
                        *value = (acpi_integer) ACPI_GET64(logical_addr_ptr);
                        break;
-#endif
+
                default:
                        /* bit_width was already validated */
                        break;
@@ -236,11 +234,9 @@ acpi_ex_system_memory_space_handler(u32 function,
                        ACPI_SET32(logical_addr_ptr) = (u32) * value;
                        break;
 
-#if ACPI_MACHINE_WIDTH != 16
                case 64:
                        ACPI_SET64(logical_addr_ptr) = (u64) * value;
                        break;
-#endif
 
                default:
                        /* bit_width was already validated */
@@ -284,11 +280,11 @@ acpi_ex_system_io_space_handler(u32 function,
        acpi_status status = AE_OK;
        u32 value32;
 
-       ACPI_FUNCTION_TRACE("ex_system_io_space_handler");
+       ACPI_FUNCTION_TRACE(ex_system_io_space_handler);
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                         "system_iO %d (%d width) Address=%8.8X%8.8X\n",
-                         function, bit_width, ACPI_FORMAT_UINT64(address)));
+                         "System-IO (width %d) R/W %d Address=%8.8X%8.8X\n",
+                         bit_width, function, ACPI_FORMAT_UINT64(address)));
 
        /* Decode the function parameter */
 
@@ -343,7 +339,7 @@ acpi_ex_pci_config_space_handler(u32 function,
        struct acpi_pci_id *pci_id;
        u16 pci_register;
 
-       ACPI_FUNCTION_TRACE("ex_pci_config_space_handler");
+       ACPI_FUNCTION_TRACE(ex_pci_config_space_handler);
 
        /*
         *  The arguments to acpi_os(Read|Write)pci_configuration are:
@@ -361,7 +357,7 @@ acpi_ex_pci_config_space_handler(u32 function,
        pci_register = (u16) (u32) address;
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                         "pci_config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
+                         "Pci-Config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
                          function, bit_width, pci_id->segment, pci_id->bus,
                          pci_id->device, pci_id->function, pci_register));
 
@@ -415,7 +411,7 @@ acpi_ex_cmos_space_handler(u32 function,
 {
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE("ex_cmos_space_handler");
+       ACPI_FUNCTION_TRACE(ex_cmos_space_handler);
 
        return_ACPI_STATUS(status);
 }
@@ -447,7 +443,7 @@ acpi_ex_pci_bar_space_handler(u32 function,
 {
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE("ex_pci_bar_space_handler");
+       ACPI_FUNCTION_TRACE(ex_pci_bar_space_handler);
 
        return_ACPI_STATUS(status);
 }
@@ -477,23 +473,16 @@ acpi_ex_data_table_space_handler(u32 function,
                                 acpi_integer * value,
                                 void *handler_context, void *region_context)
 {
-       acpi_status status = AE_OK;
-       u32 byte_width = ACPI_DIV_8(bit_width);
-       u32 i;
-       char *logical_addr_ptr;
-
-       ACPI_FUNCTION_TRACE("ex_data_table_space_handler");
-
-       logical_addr_ptr = ACPI_PHYSADDR_TO_PTR(address);
+       ACPI_FUNCTION_TRACE(ex_data_table_space_handler);
 
        /* Perform the memory read or write */
 
        switch (function) {
        case ACPI_READ:
 
-               for (i = 0; i < byte_width; i++) {
-                       ((char *)value)[i] = logical_addr_ptr[i];
-               }
+               ACPI_MEMCPY(ACPI_CAST_PTR(char, value),
+                           ACPI_PHYSADDR_TO_PTR(address),
+                           ACPI_DIV_8(bit_width));
                break;
 
        case ACPI_WRITE:
@@ -502,5 +491,5 @@ acpi_ex_data_table_space_handler(u32 function,
                return_ACPI_STATUS(AE_SUPPORT);
        }
 
-       return_ACPI_STATUS(status);
+       return_ACPI_STATUS(AE_OK);
 }