Pull sony into release branch
[pandora-kernel.git] / drivers / acpi / executer / excreate.c
index 106dc72..7c38528 100644 (file)
@@ -5,7 +5,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
@@ -177,7 +177,7 @@ acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state)
         * that the event is created in an unsignalled state
         */
        status = acpi_os_create_semaphore(ACPI_NO_UNIT_LIMIT, 0,
-                                         &obj_desc->event.semaphore);
+                                         &obj_desc->event.os_semaphore);
        if (ACPI_FAILURE(status)) {
                goto cleanup;
        }
@@ -226,12 +226,9 @@ acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state)
                goto cleanup;
        }
 
-       /*
-        * Create the actual OS semaphore.
-        * One unit max to make it a mutex, with one initial unit to allow
-        * the mutex to be acquired.
-        */
-       status = acpi_os_create_semaphore(1, 1, &obj_desc->mutex.semaphore);
+       /* Create the actual OS Mutex */
+
+       status = acpi_os_create_mutex(&obj_desc->mutex.os_mutex);
        if (ACPI_FAILURE(status)) {
                goto cleanup;
        }
@@ -362,8 +359,9 @@ acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state)
        union acpi_operand_object **operand = &walk_state->operands[0];
        union acpi_operand_object *obj_desc;
        struct acpi_namespace_node *node;
-       struct acpi_table_header *table;
        union acpi_operand_object *region_obj2;
+       acpi_native_uint table_index;
+       struct acpi_table_header *table;
 
        ACPI_FUNCTION_TRACE(ex_create_table_region);
 
@@ -383,7 +381,7 @@ acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state)
 
        status = acpi_tb_find_table(operand[1]->string.pointer,
                                    operand[2]->string.pointer,
-                                   operand[3]->string.pointer, &table);
+                                   operand[3]->string.pointer, &table_index);
        if (ACPI_FAILURE(status)) {
                return_ACPI_STATUS(status);
        }
@@ -398,6 +396,11 @@ acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state)
        region_obj2 = obj_desc->common.next_object;
        region_obj2->extra.region_context = NULL;
 
+       status = acpi_get_table_by_index(table_index, &table);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
+       }
+
        /* Init the region from the operands */
 
        obj_desc->region.space_id = REGION_DATA_TABLE;
@@ -556,7 +559,8 @@ acpi_ex_create_method(u8 * aml_start,
 
        obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_METHOD);
        if (!obj_desc) {
-               return_ACPI_STATUS(AE_NO_MEMORY);
+               status = AE_NO_MEMORY;
+               goto exit;
        }
 
        /* Save the method's AML pointer and length  */
@@ -565,7 +569,7 @@ acpi_ex_create_method(u8 * aml_start,
        obj_desc->method.aml_length = aml_length;
 
        /*
-        * Disassemble the method flags.  Split off the Arg Count
+        * Disassemble the method flags. Split off the Arg Count
         * for efficiency
         */
        method_flags = (u8) operand[1]->integer.value;
@@ -576,21 +580,16 @@ acpi_ex_create_method(u8 * aml_start,
            (u8) (method_flags & AML_METHOD_ARG_COUNT);
 
        /*
-        * Get the concurrency count.  If required, a semaphore will be
+        * Get the sync_level. If method is serialized, a mutex will be
         * created for this method when it is parsed.
         */
-       if (acpi_gbl_all_methods_serialized) {
-               obj_desc->method.concurrency = 1;
-               obj_desc->method.method_flags |= AML_METHOD_SERIALIZED;
-       } else if (method_flags & AML_METHOD_SERIALIZED) {
+       if (method_flags & AML_METHOD_SERIALIZED) {
                /*
-                * ACPI 1.0: Concurrency = 1
-                * ACPI 2.0: Concurrency = (sync_level (in method declaration) + 1)
+                * ACPI 1.0: sync_level = 0
+                * ACPI 2.0: sync_level = sync_level in method declaration
                 */
-               obj_desc->method.concurrency = (u8)
-                   (((method_flags & AML_METHOD_SYNCH_LEVEL) >> 4) + 1);
-       } else {
-               obj_desc->method.concurrency = ACPI_INFINITE_CONCURRENCY;
+               obj_desc->method.sync_level = (u8)
+                   ((method_flags & AML_METHOD_SYNCH_LEVEL) >> 4);
        }
 
        /* Attach the new object to the method Node */
@@ -602,6 +601,7 @@ acpi_ex_create_method(u8 * aml_start,
 
        acpi_ut_remove_reference(obj_desc);
 
+      exit:
        /* Remove a reference to the operand */
 
        acpi_ut_remove_reference(operand[1]);