/home/lenb/src/to-akpm branch 'acpi-2.6.12'
authorLen Brown <len.brown@intel.com>
Thu, 4 Aug 2005 22:09:09 +0000 (18:09 -0400)
committerLen Brown <len.brown@intel.com>
Thu, 4 Aug 2005 22:09:09 +0000 (18:09 -0400)
91 files changed:
Documentation/acpi-hotkey.txt
drivers/acpi/dispatcher/dsinit.c
drivers/acpi/dispatcher/dsmethod.c
drivers/acpi/dispatcher/dsmthdat.c
drivers/acpi/dispatcher/dsobject.c
drivers/acpi/dispatcher/dsopcode.c
drivers/acpi/dispatcher/dswload.c
drivers/acpi/dispatcher/dswstate.c
drivers/acpi/events/evgpe.c
drivers/acpi/events/evgpeblk.c
drivers/acpi/events/evmisc.c
drivers/acpi/events/evrgnini.c
drivers/acpi/events/evxface.c
drivers/acpi/events/evxfevnt.c
drivers/acpi/executer/exconfig.c
drivers/acpi/executer/exconvrt.c
drivers/acpi/executer/exdump.c
drivers/acpi/executer/exfield.c
drivers/acpi/executer/exmisc.c
drivers/acpi/executer/exnames.c
drivers/acpi/executer/exoparg1.c
drivers/acpi/executer/exoparg3.c
drivers/acpi/executer/exresop.c
drivers/acpi/executer/exstore.c
drivers/acpi/executer/exstoren.c
drivers/acpi/executer/exutils.c
drivers/acpi/hardware/hwgpe.c
drivers/acpi/hardware/hwregs.c
drivers/acpi/hardware/hwsleep.c
drivers/acpi/namespace/nsaccess.c
drivers/acpi/namespace/nsalloc.c
drivers/acpi/namespace/nsdump.c
drivers/acpi/namespace/nseval.c
drivers/acpi/namespace/nsload.c
drivers/acpi/namespace/nsparse.c
drivers/acpi/osl.c
drivers/acpi/parser/Makefile
drivers/acpi/parser/psloop.c [new file with mode: 0644]
drivers/acpi/parser/psopcode.c
drivers/acpi/parser/psparse.c
drivers/acpi/parser/psutils.c
drivers/acpi/parser/psxface.c
drivers/acpi/resources/rsdump.c
drivers/acpi/tables/tbconvrt.c
drivers/acpi/tables/tbinstal.c
drivers/acpi/tables/tbrsdt.c
drivers/acpi/tables/tbutils.c
drivers/acpi/tables/tbxface.c
drivers/acpi/tables/tbxfroot.c
drivers/acpi/utilities/Makefile
drivers/acpi/utilities/utalloc.c
drivers/acpi/utilities/utcache.c [new file with mode: 0644]
drivers/acpi/utilities/utcopy.c
drivers/acpi/utilities/utdebug.c
drivers/acpi/utilities/utdelete.c
drivers/acpi/utilities/utglobal.c
drivers/acpi/utilities/utinit.c
drivers/acpi/utilities/utmisc.c
drivers/acpi/utilities/utmutex.c [new file with mode: 0644]
drivers/acpi/utilities/utobject.c
drivers/acpi/utilities/utstate.c [new file with mode: 0644]
drivers/acpi/utilities/utxface.c
include/acpi/acconfig.h
include/acpi/acdebug.h
include/acpi/acdisasm.h
include/acpi/acdispat.h
include/acpi/acevents.h
include/acpi/acexcep.h
include/acpi/acglobal.h
include/acpi/achware.h
include/acpi/aclocal.h
include/acpi/acmacros.h
include/acpi/acnames.h
include/acpi/acnamesp.h
include/acpi/acobject.h
include/acpi/acopcode.h
include/acpi/acoutput.h
include/acpi/acparser.h
include/acpi/acpiosxf.h
include/acpi/acpixf.h
include/acpi/acstruct.h
include/acpi/actables.h
include/acpi/actbl.h
include/acpi/actbl1.h
include/acpi/actbl2.h
include/acpi/actypes.h
include/acpi/acutils.h
include/acpi/amlcode.h
include/acpi/platform/acenv.h
include/acpi/platform/acgcc.h
include/acpi/platform/aclinux.h

index 4c115a7bb8262a95080bbc36355ca77fcd3faa2e..d57b02a4746b0f0e621b9014a1d68ffdd064c3df 100644 (file)
@@ -33,3 +33,6 @@ The result of the execution of this aml method is
 attached to /proc/acpi/hotkey/poll_method, which is dnyamically
 created.  Please use command "cat /proc/acpi/hotkey/polling_method" 
 to retrieve it.
+
+Note: Use cmdline "acpi_specific_hotkey" to enable legacy platform
+specific drivers.
index d7790db50178a2a8c29b31b7da2fcef0a65abe56..bcd1d472b90ff413724b954316a0aa873f403d7e 100644 (file)
@@ -86,20 +86,20 @@ acpi_ds_init_one_object (
        void                            *context,
        void                            **return_value)
 {
+       struct acpi_init_walk_info      *info = (struct acpi_init_walk_info *) context;
+       struct acpi_namespace_node      *node = (struct acpi_namespace_node *) obj_handle;
        acpi_object_type                type;
        acpi_status                     status;
-       struct acpi_init_walk_info      *info = (struct acpi_init_walk_info *) context;
 
 
        ACPI_FUNCTION_NAME ("ds_init_one_object");
 
 
        /*
-        * We are only interested in objects owned by the table that
+        * We are only interested in NS nodes owned by the table that
         * was just loaded
         */
-       if (((struct acpi_namespace_node *) obj_handle)->owner_id !=
-                       info->table_desc->table_id) {
+       if (node->owner_id != info->table_desc->owner_id) {
                return (AE_OK);
        }
 
@@ -126,8 +126,6 @@ acpi_ds_init_one_object (
 
        case ACPI_TYPE_METHOD:
 
-               info->method_count++;
-
                /*
                 * Print a dot for each method unless we are going to print
                 * the entire pathname
@@ -143,7 +141,7 @@ acpi_ds_init_one_object (
                 * on a per-table basis. Currently, we just use a global for the width.
                 */
                if (info->table_desc->pointer->revision == 1) {
-                       ((struct acpi_namespace_node *) obj_handle)->flags |= ANOBJ_DATA_WIDTH_32;
+                       node->flags |= ANOBJ_DATA_WIDTH_32;
                }
 
                /*
@@ -153,22 +151,14 @@ acpi_ds_init_one_object (
                status = acpi_ds_parse_method (obj_handle);
                if (ACPI_FAILURE (status)) {
                        ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Method %p [%4.4s] - parse failure, %s\n",
+                               "\n+Method %p [%4.4s] - parse failure, %s\n",
                                obj_handle, acpi_ut_get_node_name (obj_handle),
                                acpi_format_exception (status)));
 
                        /* This parse failed, but we will continue parsing more methods */
-
-                       break;
                }
 
-               /*
-                * Delete the parse tree.  We simply re-parse the method
-                * for every execution since there isn't much overhead
-                */
-               acpi_ns_delete_namespace_subtree (obj_handle);
-               acpi_ns_delete_namespace_by_owner (
-                       ((struct acpi_namespace_node *) obj_handle)->object->method.owning_id);
+               info->method_count++;
                break;
 
 
@@ -237,7 +227,7 @@ acpi_ds_initialize_objects (
 
        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
                "\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
-               table_desc->pointer->signature, table_desc->table_id, info.object_count,
+               table_desc->pointer->signature, table_desc->owner_id, info.object_count,
                info.device_count, info.method_count, info.op_region_count));
 
        ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
index 9fc3f4c033eb6a5796a1e65ca2e18c2afe0cff5c..e344c06ed33f09d65531c71ada6dc7399897ef82 100644 (file)
  *
  * FUNCTION:    acpi_ds_parse_method
  *
- * PARAMETERS:  obj_handle      - Method node
+ * PARAMETERS:  Node        - Method node
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Call the parser and parse the AML that is associated with the
- *              method.
+ * DESCRIPTION: Parse the AML that is associated with the method.
  *
  * MUTEX:       Assumes parser is locked
  *
 
 acpi_status
 acpi_ds_parse_method (
-       acpi_handle                     obj_handle)
+       struct acpi_namespace_node      *node)
 {
        acpi_status                     status;
        union acpi_operand_object       *obj_desc;
        union acpi_parse_object         *op;
-       struct acpi_namespace_node      *node;
-       acpi_owner_id                   owner_id;
        struct acpi_walk_state          *walk_state;
 
 
-       ACPI_FUNCTION_TRACE_PTR ("ds_parse_method", obj_handle);
+       ACPI_FUNCTION_TRACE_PTR ("ds_parse_method", node);
 
 
        /* Parameter Validation */
 
-       if (!obj_handle) {
+       if (!node) {
                return_ACPI_STATUS (AE_NULL_ENTRY);
        }
 
        ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** named_obj=%p\n",
-               acpi_ut_get_node_name (obj_handle), obj_handle));
+               acpi_ut_get_node_name (node), node));
 
        /* Extract the method object from the method Node */
 
-       node = (struct acpi_namespace_node *) obj_handle;
        obj_desc = acpi_ns_get_attached_object (node);
        if (!obj_desc) {
                return_ACPI_STATUS (AE_NULL_OBJECT);
@@ -132,14 +128,18 @@ acpi_ds_parse_method (
         * objects (such as Operation Regions) can be created during the
         * first pass parse.
         */
-       owner_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD);
-       obj_desc->method.owning_id = owner_id;
+       status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id);
+       if (ACPI_FAILURE (status)) {
+               goto cleanup;
+       }
 
        /* Create and initialize a new walk state */
 
-       walk_state = acpi_ds_create_walk_state (owner_id, NULL, NULL, NULL);
+       walk_state = acpi_ds_create_walk_state (
+                         obj_desc->method.owner_id, NULL, NULL, NULL);
        if (!walk_state) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               status = AE_NO_MEMORY;
+               goto cleanup2;
        }
 
        status = acpi_ds_init_aml_walk (walk_state, op, node,
@@ -147,7 +147,7 @@ acpi_ds_parse_method (
                          obj_desc->method.aml_length, NULL, 1);
        if (ACPI_FAILURE (status)) {
                acpi_ds_delete_walk_state (walk_state);
-               return_ACPI_STATUS (status);
+               goto cleanup2;
        }
 
        /*
@@ -161,13 +161,25 @@ acpi_ds_parse_method (
         */
        status = acpi_ps_parse_aml (walk_state);
        if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+               goto cleanup2;
        }
 
        ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
                "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n",
-               acpi_ut_get_node_name (obj_handle), obj_handle, op));
+               acpi_ut_get_node_name (node), node, op));
+
+       /*
+        * Delete the parse tree. We simply re-parse the method for every
+        * execution since there isn't much overhead (compared to keeping lots
+        * of parse trees around)
+        */
+       acpi_ns_delete_namespace_subtree (node);
+       acpi_ns_delete_namespace_by_owner (obj_desc->method.owner_id);
+
+cleanup2:
+       acpi_ut_release_owner_id (&obj_desc->method.owner_id);
 
+cleanup:
        acpi_ps_delete_parse_tree (op);
        return_ACPI_STATUS (status);
 }
@@ -263,7 +275,7 @@ acpi_ds_call_control_method (
 {
        acpi_status                     status;
        struct acpi_namespace_node      *method_node;
-       struct acpi_walk_state          *next_walk_state;
+       struct acpi_walk_state          *next_walk_state = NULL;
        union acpi_operand_object       *obj_desc;
        struct acpi_parameter_info      info;
        u32                             i;
@@ -287,20 +299,23 @@ acpi_ds_call_control_method (
                return_ACPI_STATUS (AE_NULL_OBJECT);
        }
 
-       obj_desc->method.owning_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD);
+       status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id);
+       if (ACPI_FAILURE (status)) {
+               return_ACPI_STATUS (status);
+       }
 
        /* Init for new method, wait on concurrency semaphore */
 
        status = acpi_ds_begin_method_execution (method_node, obj_desc,
                          this_walk_state->method_node);
        if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+               goto cleanup;
        }
 
        if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) {
                /* 1) Parse: Create a new walk state for the preempting walk */
 
-               next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
+               next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id,
                                  op, obj_desc, NULL);
                if (!next_walk_state) {
                        return_ACPI_STATUS (AE_NO_MEMORY);
@@ -330,7 +345,7 @@ acpi_ds_call_control_method (
 
        /* 2) Execute: Create a new state for the preempting walk */
 
-       next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
+       next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id,
                          NULL, obj_desc, thread);
        if (!next_walk_state) {
                status = AE_NO_MEMORY;
@@ -381,6 +396,7 @@ acpi_ds_call_control_method (
        /* On error, we must delete the new walk state */
 
 cleanup:
+       acpi_ut_release_owner_id (&obj_desc->method.owner_id);
        if (next_walk_state && (next_walk_state->method_desc)) {
                /* Decrement the thread count on the method parse tree */
 
@@ -552,8 +568,7 @@ acpi_ds_terminate_control_method (
                 */
                if ((walk_state->method_desc->method.concurrency == 1) &&
                        (!walk_state->method_desc->method.semaphore)) {
-                       status = acpi_os_create_semaphore (1,
-                                        1,
+                       status = acpi_os_create_semaphore (1, 1,
                                         &walk_state->method_desc->method.semaphore);
                }
 
@@ -582,8 +597,10 @@ acpi_ds_terminate_control_method (
                 * Delete any namespace entries created anywhere else within
                 * the namespace
                 */
-               acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owning_id);
+               acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owner_id);
                status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+               acpi_ut_release_owner_id (&walk_state->method_desc->method.owner_id);
+
                if (ACPI_FAILURE (status)) {
                        return_ACPI_STATUS (status);
                }
index f7998306f756492b396fe5fbb57c6685af72d781..c83d53fd63982afed248b0a5feb2e46317c05e6c 100644 (file)
@@ -632,23 +632,12 @@ acpi_ds_store_object_to_local (
                 * Weird, but true.
                 */
                if (opcode == AML_ARG_OP) {
-                       /*
-                        * Make sure that the object is the correct type.  This may be
-                        * overkill, butit is here because references were NS nodes in
-                        *  the past.  Now they are operand objects of type Reference.
-                        */
-                       if (ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) != ACPI_DESC_TYPE_OPERAND) {
-                               ACPI_REPORT_ERROR ((
-                                       "Invalid descriptor type while storing to method arg: [%s]\n",
-                                       acpi_ut_get_descriptor_name (current_obj_desc)));
-                               return_ACPI_STATUS (AE_AML_INTERNAL);
-                       }
-
                        /*
                         * If we have a valid reference object that came from ref_of(),
                         * do the indirect store
                         */
-                       if ((current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
+                       if ((ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) == ACPI_DESC_TYPE_OPERAND) &&
+                               (current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
                                (current_obj_desc->reference.opcode == AML_REF_OF_OP)) {
                                ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
                                                "Arg (%p) is an obj_ref(Node), storing in node %p\n",
index bfbae4e4c667d76159ba480a8799be0b6c5f4480..1eee2d54180ff800871090698c8c963aa1a188ad 100644 (file)
@@ -547,6 +547,9 @@ acpi_ds_init_object_from_op (
                case AML_TYPE_LITERAL:
 
                        obj_desc->integer.value = op->common.value.integer;
+#ifndef ACPI_NO_METHOD_EXECUTION
+                       acpi_ex_truncate_for32bit_table (obj_desc);
+#endif
                        break;
 
 
index ba13bca28bee94a27d4e26377c2abbf0b676dd7e..750bdb1ac3446dcb6fb15ec3b71384ac0728a5c7 100644 (file)
@@ -119,14 +119,15 @@ acpi_ds_execute_arguments (
 
        walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL);
        if (!walk_state) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               status = AE_NO_MEMORY;
+               goto cleanup;
        }
 
        status = acpi_ds_init_aml_walk (walk_state, op, NULL, aml_start,
                          aml_length, NULL, 1);
        if (ACPI_FAILURE (status)) {
                acpi_ds_delete_walk_state (walk_state);
-               return_ACPI_STATUS (status);
+               goto cleanup;
        }
 
        /* Mark this parse as a deferred opcode */
@@ -138,8 +139,7 @@ acpi_ds_execute_arguments (
 
        status = acpi_ps_parse_aml (walk_state);
        if (ACPI_FAILURE (status)) {
-               acpi_ps_delete_parse_tree (op);
-               return_ACPI_STATUS (status);
+               goto cleanup;
        }
 
        /* Get and init the Op created above */
@@ -160,7 +160,8 @@ acpi_ds_execute_arguments (
 
        walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL);
        if (!walk_state) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               status = AE_NO_MEMORY;
+               goto cleanup;
        }
 
        /* Execute the opcode and arguments */
@@ -169,13 +170,15 @@ acpi_ds_execute_arguments (
                          aml_length, NULL, 3);
        if (ACPI_FAILURE (status)) {
                acpi_ds_delete_walk_state (walk_state);
-               return_ACPI_STATUS (status);
+               goto cleanup;
        }
 
        /* Mark this execution as a deferred opcode */
 
        walk_state->deferred_node = node;
        status = acpi_ps_parse_aml (walk_state);
+
+cleanup:
        acpi_ps_delete_parse_tree (op);
        return_ACPI_STATUS (status);
 }
index d11620018421486f1559c3fc4be1afbd7578a8ef..9100c0bda4701a1560e6157f33bd6d3b86757079 100644 (file)
@@ -50,7 +50,7 @@
 #include <acpi/acnamesp.h>
 #include <acpi/acevents.h>
 
-#ifdef _ACPI_ASL_COMPILER
+#ifdef ACPI_ASL_COMPILER
 #include <acpi/acdisasm.h>
 #endif
 
@@ -145,15 +145,6 @@ acpi_ds_load1_begin_op (
 
        if (op) {
                if (!(walk_state->op_info->flags & AML_NAMED)) {
-#if 0
-                       if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
-                               (walk_state->op_info->class == AML_CLASS_CONTROL)) {
-                               acpi_os_printf ("\n\n***EXECUTABLE OPCODE %s***\n\n",
-                                       walk_state->op_info->name);
-                               *out_op = op;
-                               return (AE_CTRL_SKIP);
-                       }
-#endif
                        *out_op = op;
                        return (AE_OK);
                }
@@ -185,7 +176,7 @@ acpi_ds_load1_begin_op (
                 */
                status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
                                  ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node));
-#ifdef _ACPI_ASL_COMPILER
+#ifdef ACPI_ASL_COMPILER
                if (status == AE_NOT_FOUND) {
                        /*
                         * Table disassembly:
@@ -486,11 +477,31 @@ acpi_ds_load2_begin_op (
        ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
 
        if (op) {
+               if ((walk_state->control_state) &&
+                       (walk_state->control_state->common.state ==
+                               ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
+                       /* We are executing a while loop outside of a method */
+
+                       status = acpi_ds_exec_begin_op (walk_state, out_op);
+                       return_ACPI_STATUS (status);
+               }
+
                /* We only care about Namespace opcodes here */
 
                if ((!(walk_state->op_info->flags & AML_NSOPCODE) &&
                          (walk_state->opcode != AML_INT_NAMEPATH_OP)) ||
                        (!(walk_state->op_info->flags & AML_NAMED))) {
+                       if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
+                               (walk_state->op_info->class == AML_CLASS_CONTROL)) {
+                               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                                       "Begin/EXEC: %s (fl %8.8X)\n", walk_state->op_info->name,
+                                       walk_state->op_info->flags));
+
+                               /* Executing a type1 or type2 opcode outside of a method */
+
+                               status = acpi_ds_exec_begin_op (walk_state, out_op);
+                               return_ACPI_STATUS (status);
+                       }
                        return_ACPI_STATUS (AE_OK);
                }
 
@@ -558,7 +569,7 @@ acpi_ds_load2_begin_op (
                                  ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
                                  walk_state, &(node));
                if (ACPI_FAILURE (status)) {
-#ifdef _ACPI_ASL_COMPILER
+#ifdef ACPI_ASL_COMPILER
                        if (status == AE_NOT_FOUND) {
                                status = AE_OK;
                        }
@@ -651,8 +662,10 @@ acpi_ds_load2_begin_op (
                        break;
                }
 
+               /* Add new entry into namespace */
+
                status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
-                                 ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH,
+                                 ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
                                  walk_state, &(node));
                break;
        }
@@ -662,7 +675,6 @@ acpi_ds_load2_begin_op (
                return_ACPI_STATUS (status);
        }
 
-
        if (!op) {
                /* Create a new op */
 
@@ -676,9 +688,7 @@ acpi_ds_load2_begin_op (
                if (node) {
                        op->named.name = node->name.integer;
                }
-               if (out_op) {
-                       *out_op = op;
-               }
+               *out_op = op;
        }
 
        /*
@@ -725,9 +735,24 @@ acpi_ds_load2_end_op (
        ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
                        walk_state->op_info->name, op, walk_state));
 
-       /* Only interested in opcodes that have namespace objects */
+       /* Check if opcode had an associated namespace object */
 
        if (!(walk_state->op_info->flags & AML_NSOBJECT)) {
+#ifndef ACPI_NO_METHOD_EXECUTION
+               /* No namespace object. Executable opcode? */
+
+               if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
+                       (walk_state->op_info->class == AML_CLASS_CONTROL)) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                               "End/EXEC:   %s (fl %8.8X)\n", walk_state->op_info->name,
+                               walk_state->op_info->flags));
+
+                       /* Executing a type1 or type2 opcode outside of a method */
+
+                       status = acpi_ds_exec_end_op (walk_state);
+                       return_ACPI_STATUS (status);
+               }
+#endif
                return_ACPI_STATUS (AE_OK);
        }
 
@@ -736,7 +761,6 @@ acpi_ds_load2_end_op (
                        "Ending scope Op=%p State=%p\n", op, walk_state));
        }
 
-
        object_type = walk_state->op_info->object_type;
 
        /*
@@ -959,6 +983,7 @@ acpi_ds_load2_end_op (
                                  ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
                                  walk_state, &(new_node));
                if (ACPI_SUCCESS (status)) {
+
                        /*
                         * Make sure that what we found is indeed a method
                         * We didn't search for a method on purpose, to see if the name
index 9cd3db652b31cf622fb029522a4bebedc44c37d7..5621665991b51bb0eacdf3f04796dba1ba5f2cb5 100644 (file)
@@ -261,12 +261,12 @@ acpi_ds_result_pop_from_bottom (
 
        if (!*object) {
                ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Null operand! State=%p #Ops=%X, Index=%X\n",
+                       "Null operand! State=%p #Ops=%X Index=%X\n",
                        walk_state, state->results.num_results, (u32) index));
                return (AE_AML_NO_RETURN_VALUE);
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s], Results=%p State=%p\n",
+       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Results=%p State=%p\n",
                *object, (*object) ? acpi_ut_get_object_type_name (*object) : "NULL",
                state, walk_state));
 
@@ -681,7 +681,7 @@ acpi_ds_create_walk_state (
        ACPI_FUNCTION_TRACE ("ds_create_walk_state");
 
 
-       walk_state = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_WALK);
+       walk_state = ACPI_MEM_CALLOCATE (sizeof (struct acpi_walk_state));
        if (!walk_state) {
                return_PTR (NULL);
        }
@@ -704,7 +704,7 @@ acpi_ds_create_walk_state (
 
        status = acpi_ds_result_stack_push (walk_state);
        if (ACPI_FAILURE (status)) {
-               acpi_ut_release_to_cache (ACPI_MEM_LIST_WALK, walk_state);
+               ACPI_MEM_FREE (walk_state);
                return_PTR (NULL);
        }
 
@@ -744,7 +744,7 @@ acpi_ds_init_aml_walk (
        u8                              *aml_start,
        u32                             aml_length,
        struct acpi_parameter_info      *info,
-       u32                             pass_number)
+       u                             pass_number)
 {
        acpi_status                     status;
        struct acpi_parse_state         *parser_state = &walk_state->parser_state;
@@ -762,6 +762,7 @@ acpi_ds_init_aml_walk (
        /* The next_op of the next_walk will be the beginning of the method */
 
        walk_state->next_op = NULL;
+       walk_state->pass_number = pass_number;
 
        if (info) {
                if (info->parameter_type == ACPI_PARAM_GPE) {
@@ -899,38 +900,11 @@ acpi_ds_delete_walk_state (
                acpi_ut_delete_generic_state (state);
        }
 
-       acpi_ut_release_to_cache (ACPI_MEM_LIST_WALK, walk_state);
+       ACPI_MEM_FREE (walk_state);
        return_VOID;
 }
 
 
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-/******************************************************************************
- *
- * FUNCTION:    acpi_ds_delete_walk_state_cache
- *
- * PARAMETERS:  None
- *
- * RETURN:      None
- *
- * DESCRIPTION: Purge the global state object cache.  Used during subsystem
- *              termination.
- *
- ******************************************************************************/
-
-void
-acpi_ds_delete_walk_state_cache (
-       void)
-{
-       ACPI_FUNCTION_TRACE ("ds_delete_walk_state_cache");
-
-
-       acpi_ut_delete_generic_cache (ACPI_MEM_LIST_WALK);
-       return_VOID;
-}
-#endif
-
-
 #ifdef ACPI_OBSOLETE_FUNCTIONS
 /*******************************************************************************
  *
index 081120b109ba98953e7acc247c50c4580d6d56bd..ede834df4f69f87854cdf3028760d562c793379b 100644 (file)
@@ -396,6 +396,7 @@ acpi_ev_gpe_detect (
        struct acpi_gpe_register_info   *gpe_register_info;
        u32                             status_reg;
        u32                             enable_reg;
+       u32                             flags;
        acpi_status                     status;
        struct acpi_gpe_block_info      *gpe_block;
        acpi_native_uint                i;
@@ -412,7 +413,7 @@ acpi_ev_gpe_detect (
 
        /* Examine all GPE blocks attached to this interrupt level */
 
-       acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_ISR);
+       flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
        gpe_block = gpe_xrupt_list->gpe_block_list_head;
        while (gpe_block) {
                /*
@@ -476,7 +477,7 @@ acpi_ev_gpe_detect (
 
 unlock_and_exit:
 
-       acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_ISR);
+       acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
        return (int_status);
 }
 
index 84186a7d17b2cb414de0622f6c098fd8b44d344a..dfc54692b1270033ec85495cba56bcd001eb67b9 100644 (file)
@@ -66,7 +66,7 @@ acpi_ev_match_prw_and_gpe (
 
 static struct acpi_gpe_xrupt_info *
 acpi_ev_get_gpe_xrupt_block (
-       u32                             interrupt_level);
+       u32                             interrupt_number);
 
 static acpi_status
 acpi_ev_delete_gpe_xrupt (
@@ -75,7 +75,7 @@ acpi_ev_delete_gpe_xrupt (
 static acpi_status
 acpi_ev_install_gpe_block (
        struct acpi_gpe_block_info      *gpe_block,
-       u32                             interrupt_level);
+       u32                             interrupt_number);
 
 static acpi_status
 acpi_ev_create_gpe_info_blocks (
@@ -138,7 +138,6 @@ acpi_ev_valid_gpe_event (
  * FUNCTION:    acpi_ev_walk_gpe_list
  *
  * PARAMETERS:  gpe_walk_callback   - Routine called for each GPE block
- *              Flags               - ACPI_NOT_ISR or ACPI_ISR
  *
  * RETURN:      Status
  *
@@ -148,18 +147,18 @@ acpi_ev_valid_gpe_event (
 
 acpi_status
 acpi_ev_walk_gpe_list (
-       ACPI_GPE_CALLBACK       gpe_walk_callback,
-       u32                             flags)
+       ACPI_GPE_CALLBACK       gpe_walk_callback)
 {
        struct acpi_gpe_block_info      *gpe_block;
        struct acpi_gpe_xrupt_info      *gpe_xrupt_info;
        acpi_status                     status = AE_OK;
+       u32                             flags;
 
 
        ACPI_FUNCTION_TRACE ("ev_walk_gpe_list");
 
 
-       acpi_os_acquire_lock (acpi_gbl_gpe_lock, flags);
+       flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
 
        /* Walk the interrupt level descriptor list */
 
@@ -482,7 +481,7 @@ cleanup:
  *
  * FUNCTION:    acpi_ev_get_gpe_xrupt_block
  *
- * PARAMETERS:  interrupt_level     - Interrupt for a GPE block
+ * PARAMETERS:  interrupt_number     - Interrupt for a GPE block
  *
  * RETURN:      A GPE interrupt block
  *
@@ -495,11 +494,12 @@ cleanup:
 
 static struct acpi_gpe_xrupt_info *
 acpi_ev_get_gpe_xrupt_block (
-       u32                             interrupt_level)
+       u32                             interrupt_number)
 {
        struct acpi_gpe_xrupt_info      *next_gpe_xrupt;
        struct acpi_gpe_xrupt_info      *gpe_xrupt;
        acpi_status                     status;
+       u32                             flags;
 
 
        ACPI_FUNCTION_TRACE ("ev_get_gpe_xrupt_block");
@@ -509,7 +509,7 @@ acpi_ev_get_gpe_xrupt_block (
 
        next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head;
        while (next_gpe_xrupt) {
-               if (next_gpe_xrupt->interrupt_level == interrupt_level) {
+               if (next_gpe_xrupt->interrupt_number == interrupt_number) {
                        return_PTR (next_gpe_xrupt);
                }
 
@@ -523,11 +523,11 @@ acpi_ev_get_gpe_xrupt_block (
                return_PTR (NULL);
        }
 
-       gpe_xrupt->interrupt_level = interrupt_level;
+       gpe_xrupt->interrupt_number = interrupt_number;
 
        /* Install new interrupt descriptor with spin lock */
 
-       acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+       flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
        if (acpi_gbl_gpe_xrupt_list_head) {
                next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head;
                while (next_gpe_xrupt->next) {
@@ -540,17 +540,17 @@ acpi_ev_get_gpe_xrupt_block (
        else {
                acpi_gbl_gpe_xrupt_list_head = gpe_xrupt;
        }
-       acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+       acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
 
        /* Install new interrupt handler if not SCI_INT */
 
-       if (interrupt_level != acpi_gbl_FADT->sci_int) {
-               status = acpi_os_install_interrupt_handler (interrupt_level,
+       if (interrupt_number != acpi_gbl_FADT->sci_int) {
+               status = acpi_os_install_interrupt_handler (interrupt_number,
                                 acpi_ev_gpe_xrupt_handler, gpe_xrupt);
                if (ACPI_FAILURE (status)) {
                        ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
                                "Could not install GPE interrupt handler at level 0x%X\n",
-                               interrupt_level));
+                               interrupt_number));
                        return_PTR (NULL);
                }
        }
@@ -577,6 +577,7 @@ acpi_ev_delete_gpe_xrupt (
        struct acpi_gpe_xrupt_info      *gpe_xrupt)
 {
        acpi_status                     status;
+       u32                             flags;
 
 
        ACPI_FUNCTION_TRACE ("ev_delete_gpe_xrupt");
@@ -584,14 +585,14 @@ acpi_ev_delete_gpe_xrupt (
 
        /* We never want to remove the SCI interrupt handler */
 
-       if (gpe_xrupt->interrupt_level == acpi_gbl_FADT->sci_int) {
+       if (gpe_xrupt->interrupt_number == acpi_gbl_FADT->sci_int) {
                gpe_xrupt->gpe_block_list_head = NULL;
                return_ACPI_STATUS (AE_OK);
        }
 
        /* Disable this interrupt */
 
-       status = acpi_os_remove_interrupt_handler (gpe_xrupt->interrupt_level,
+       status = acpi_os_remove_interrupt_handler (gpe_xrupt->interrupt_number,
                           acpi_ev_gpe_xrupt_handler);
        if (ACPI_FAILURE (status)) {
                return_ACPI_STATUS (status);
@@ -599,7 +600,7 @@ acpi_ev_delete_gpe_xrupt (
 
        /* Unlink the interrupt block with lock */
 
-       acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+       flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
        if (gpe_xrupt->previous) {
                gpe_xrupt->previous->next = gpe_xrupt->next;
        }
@@ -607,7 +608,7 @@ acpi_ev_delete_gpe_xrupt (
        if (gpe_xrupt->next) {
                gpe_xrupt->next->previous = gpe_xrupt->previous;
        }
-       acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+       acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
 
        /* Free the block */
 
@@ -621,7 +622,7 @@ acpi_ev_delete_gpe_xrupt (
  * FUNCTION:    acpi_ev_install_gpe_block
  *
  * PARAMETERS:  gpe_block       - New GPE block
- *              interrupt_level - Level to be associated with this GPE block
+ *              interrupt_number - Xrupt to be associated with this GPE block
  *
  * RETURN:      Status
  *
@@ -632,11 +633,12 @@ acpi_ev_delete_gpe_xrupt (
 static acpi_status
 acpi_ev_install_gpe_block (
        struct acpi_gpe_block_info      *gpe_block,
-       u32                             interrupt_level)
+       u32                             interrupt_number)
 {
        struct acpi_gpe_block_info      *next_gpe_block;
        struct acpi_gpe_xrupt_info      *gpe_xrupt_block;
        acpi_status                     status;
+       u32                             flags;
 
 
        ACPI_FUNCTION_TRACE ("ev_install_gpe_block");
@@ -647,7 +649,7 @@ acpi_ev_install_gpe_block (
                return_ACPI_STATUS (status);
        }
 
-       gpe_xrupt_block = acpi_ev_get_gpe_xrupt_block (interrupt_level);
+       gpe_xrupt_block = acpi_ev_get_gpe_xrupt_block (interrupt_number);
        if (!gpe_xrupt_block) {
                status = AE_NO_MEMORY;
                goto unlock_and_exit;
@@ -655,7 +657,7 @@ acpi_ev_install_gpe_block (
 
        /* Install the new block at the end of the list with lock */
 
-       acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+       flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
        if (gpe_xrupt_block->gpe_block_list_head) {
                next_gpe_block = gpe_xrupt_block->gpe_block_list_head;
                while (next_gpe_block->next) {
@@ -670,7 +672,7 @@ acpi_ev_install_gpe_block (
        }
 
        gpe_block->xrupt_block = gpe_xrupt_block;
-       acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+       acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
 
 unlock_and_exit:
        status = acpi_ut_release_mutex (ACPI_MTX_EVENTS);
@@ -695,6 +697,7 @@ acpi_ev_delete_gpe_block (
        struct acpi_gpe_block_info      *gpe_block)
 {
        acpi_status                     status;
+       u32                             flags;
 
 
        ACPI_FUNCTION_TRACE ("ev_install_gpe_block");
@@ -720,7 +723,7 @@ acpi_ev_delete_gpe_block (
        else {
                /* Remove the block on this interrupt with lock */
 
-               acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+               flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
                if (gpe_block->previous) {
                        gpe_block->previous->next = gpe_block->next;
                }
@@ -731,7 +734,7 @@ acpi_ev_delete_gpe_block (
                if (gpe_block->next) {
                        gpe_block->next->previous = gpe_block->previous;
                }
-               acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+               acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
        }
 
        /* Free the gpe_block */
@@ -887,7 +890,7 @@ error_exit:
  *              gpe_block_address   - Address and space_iD
  *              register_count      - Number of GPE register pairs in the block
  *              gpe_block_base_number - Starting GPE number for the block
- *              interrupt_level     - H/W interrupt for the block
+ *              interrupt_number    - H/W interrupt for the block
  *              return_gpe_block    - Where the new block descriptor is returned
  *
  * RETURN:      Status
@@ -902,7 +905,7 @@ acpi_ev_create_gpe_block (
        struct acpi_generic_address     *gpe_block_address,
        u32                             register_count,
        u8                              gpe_block_base_number,
-       u32                             interrupt_level,
+       u32                             interrupt_number,
        struct acpi_gpe_block_info      **return_gpe_block)
 {
        struct acpi_gpe_block_info      *gpe_block;
@@ -948,7 +951,7 @@ acpi_ev_create_gpe_block (
 
        /* Install the new block in the global list(s) */
 
-       status = acpi_ev_install_gpe_block (gpe_block, interrupt_level);
+       status = acpi_ev_install_gpe_block (gpe_block, interrupt_number);
        if (ACPI_FAILURE (status)) {
                ACPI_MEM_FREE (gpe_block);
                return_ACPI_STATUS (status);
@@ -1013,7 +1016,7 @@ acpi_ev_create_gpe_block (
                                ((gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH) -1)),
                gpe_device->name.ascii,
                gpe_block->register_count,
-               interrupt_level));
+               interrupt_number));
 
        /* Enable all valid GPEs found above */
 
index 659e909561124cd89b28ddfaa182f7353e9792da..3df3ada4b9e7a0fd0736a63ca2e7620720cc88fa 100644 (file)
@@ -411,6 +411,9 @@ acpi_ev_init_global_lock_handler (
         * with an error.
         */
        if (status == AE_NO_HARDWARE_RESPONSE) {
+               ACPI_REPORT_ERROR ((
+                       "No response from Global Lock hardware, disabling lock\n"));
+
                acpi_gbl_global_lock_present = FALSE;
                status = AE_OK;
        }
@@ -589,7 +592,7 @@ acpi_ev_terminate (
 
                /* Disable all GPEs in all GPE blocks */
 
-               status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block, ACPI_NOT_ISR);
+               status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block);
 
                /* Remove SCI handler */
 
@@ -602,7 +605,7 @@ acpi_ev_terminate (
 
        /* Deallocate all handler objects installed within GPE info structs */
 
-       status = acpi_ev_walk_gpe_list (acpi_ev_delete_gpe_handlers, ACPI_NOT_ISR);
+       status = acpi_ev_walk_gpe_list (acpi_ev_delete_gpe_handlers);
 
        /* Return to original mode if necessary */
 
index 95bc09c73a6aa359d19f19c9b508251ac9761912..f2d53af97610075a653f15143e727fb65d52f657 100644 (file)
@@ -218,10 +218,14 @@ acpi_ev_pci_config_region_setup (
                while (pci_root_node != acpi_gbl_root_node) {
                        status = acpi_ut_execute_HID (pci_root_node, &object_hID);
                        if (ACPI_SUCCESS (status)) {
-                               /* Got a valid _HID, check if this is a PCI root */
-
+                               /*
+                                * Got a valid _HID string, check if this is a PCI root.
+                                * New for ACPI 3.0: check for a PCI Express root also.
+                                */
                                if (!(ACPI_STRNCMP (object_hID.value, PCI_ROOT_HID_STRING,
-                                                  sizeof (PCI_ROOT_HID_STRING)))) {
+                                                  sizeof (PCI_ROOT_HID_STRING))           ||
+                                       !(ACPI_STRNCMP (object_hID.value, PCI_EXPRESS_ROOT_HID_STRING,
+                                                         sizeof (PCI_EXPRESS_ROOT_HID_STRING))))) {
                                        /* Install a handler for this PCI root bridge */
 
                                        status = acpi_install_address_space_handler ((acpi_handle) pci_root_node,
index 4092d47f67586d823fc2777b25f02a59012bc8c0..4c1c25e316a895593a0a38ba37576041b1dd4063 100644 (file)
@@ -591,6 +591,7 @@ acpi_install_gpe_handler (
        struct acpi_gpe_event_info      *gpe_event_info;
        struct acpi_handler_info        *handler;
        acpi_status                     status;
+       u32                             flags;
 
 
        ACPI_FUNCTION_TRACE ("acpi_install_gpe_handler");
@@ -643,7 +644,7 @@ acpi_install_gpe_handler (
 
        /* Install the handler */
 
-       acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+       flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
        gpe_event_info->dispatch.handler = handler;
 
        /* Setup up dispatch flags to indicate handler (vs. method) */
@@ -651,7 +652,7 @@ acpi_install_gpe_handler (
        gpe_event_info->flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); /* Clear bits */
        gpe_event_info->flags |= (u8) (type | ACPI_GPE_DISPATCH_HANDLER);
 
-       acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+       acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
 
 
 unlock_and_exit:
@@ -685,6 +686,7 @@ acpi_remove_gpe_handler (
        struct acpi_gpe_event_info      *gpe_event_info;
        struct acpi_handler_info        *handler;
        acpi_status                     status;
+       u32                             flags;
 
 
        ACPI_FUNCTION_TRACE ("acpi_remove_gpe_handler");
@@ -741,7 +743,7 @@ acpi_remove_gpe_handler (
 
        /* Remove the handler */
 
-       acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+       flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
        handler = gpe_event_info->dispatch.handler;
 
        /* Restore Method node (if any), set dispatch flags */
@@ -751,7 +753,7 @@ acpi_remove_gpe_handler (
        if (handler->method_node) {
                gpe_event_info->flags |= ACPI_GPE_DISPATCH_METHOD;
        }
-       acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+       acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
 
        /* Now we can free the handler object */
 
index f337dc2cc56984db838a5b490194aa52082b5a71..c5f74d7b64d83b5c5b656f1582bb7d91a7cb5e9e 100644 (file)
@@ -635,7 +635,7 @@ unlock_and_exit:
  * PARAMETERS:  gpe_device          - Handle to the parent GPE Block Device
  *              gpe_block_address   - Address and space_iD
  *              register_count      - Number of GPE register pairs in the block
- *              interrupt_level     - H/W interrupt for the block
+ *              interrupt_number    - H/W interrupt for the block
  *
  * RETURN:      Status
  *
@@ -648,7 +648,7 @@ acpi_install_gpe_block (
        acpi_handle                     gpe_device,
        struct acpi_generic_address     *gpe_block_address,
        u32                             register_count,
-       u32                             interrupt_level)
+       u32                             interrupt_number)
 {
        acpi_status                     status;
        union acpi_operand_object       *obj_desc;
@@ -681,7 +681,7 @@ acpi_install_gpe_block (
         * is always zero
         */
        status = acpi_ev_create_gpe_block (node, gpe_block_address, register_count,
-                         0, interrupt_level, &gpe_block);
+                         0, interrupt_number, &gpe_block);
        if (ACPI_FAILURE (status)) {
                goto unlock_and_exit;
        }
index 734b2f24af4809aac704ae293c653591b64209ba..d11e9ec827f12798c0c56ae0b2fd03af677819f3 100644 (file)
@@ -99,6 +99,11 @@ acpi_ex_add_table (
                return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
+       /* Init the table handle */
+
+       obj_desc->reference.opcode = AML_LOAD_OP;
+       *ddb_handle = obj_desc;
+
        /* Install the new table into the local data structures */
 
        ACPI_MEMSET (&table_info, 0, sizeof (struct acpi_table_desc));
@@ -109,7 +114,14 @@ acpi_ex_add_table (
        table_info.allocation = ACPI_MEM_ALLOCATED;
 
        status = acpi_tb_install_table (&table_info);
+       obj_desc->reference.object = table_info.installed_desc;
+
        if (ACPI_FAILURE (status)) {
+               if (status == AE_ALREADY_EXISTS) {
+                       /* Table already exists, just return the handle */
+
+                       return_ACPI_STATUS (AE_OK);
+               }
                goto cleanup;
        }
 
@@ -123,16 +135,12 @@ acpi_ex_add_table (
                goto cleanup;
        }
 
-       /* Init the table handle */
-
-       obj_desc->reference.opcode = AML_LOAD_OP;
-       obj_desc->reference.object = table_info.installed_desc;
-       *ddb_handle = obj_desc;
        return_ACPI_STATUS (AE_OK);
 
 
 cleanup:
        acpi_ut_remove_reference (obj_desc);
+       *ddb_handle = NULL;
        return_ACPI_STATUS (status);
 }
 
@@ -376,16 +384,22 @@ acpi_ex_load_op (
                 */
                status = acpi_ex_read_data_from_field (walk_state, obj_desc, &buffer_desc);
                if (ACPI_FAILURE (status)) {
-                       goto cleanup;
+                       return_ACPI_STATUS (status);
                }
 
                table_ptr = ACPI_CAST_PTR (struct acpi_table_header,
                                  buffer_desc->buffer.pointer);
 
-                /* Sanity check the table length */
+               /* All done with the buffer_desc, delete it */
+
+               buffer_desc->buffer.pointer = NULL;
+               acpi_ut_remove_reference (buffer_desc);
+
+               /* Sanity check the table length */
 
                if (table_ptr->length < sizeof (struct acpi_table_header)) {
-                       return_ACPI_STATUS (AE_BAD_HEADER);
+                       status = AE_BAD_HEADER;
+                       goto cleanup;
                }
                break;
 
@@ -413,7 +427,9 @@ acpi_ex_load_op (
 
        status = acpi_ex_add_table (table_ptr, acpi_gbl_root_node, &ddb_handle);
        if (ACPI_FAILURE (status)) {
-               goto cleanup;
+               /* On error, table_ptr was deallocated above */
+
+               return_ACPI_STATUS (status);
        }
 
        /* Store the ddb_handle into the Target operand */
@@ -421,17 +437,14 @@ acpi_ex_load_op (
        status = acpi_ex_store (ddb_handle, target, walk_state);
        if (ACPI_FAILURE (status)) {
                (void) acpi_ex_unload_table (ddb_handle);
-       }
 
-       return_ACPI_STATUS (status);
+               /* table_ptr was deallocated above */
 
+               return_ACPI_STATUS (status);
+       }
 
 cleanup:
-
-       if (buffer_desc) {
-               acpi_ut_remove_reference (buffer_desc);
-       }
-       else {
+       if (ACPI_FAILURE (status)) {
                ACPI_MEM_FREE (table_ptr);
        }
        return_ACPI_STATUS (status);
@@ -482,7 +495,8 @@ acpi_ex_unload_table (
         * Delete the entire namespace under this table Node
         * (Offset contains the table_id)
         */
-       acpi_ns_delete_namespace_by_owner (table_info->table_id);
+       acpi_ns_delete_namespace_by_owner (table_info->owner_id);
+       acpi_ut_release_owner_id (&table_info->owner_id);
 
        /* Delete the table itself */
 
index 97856c48bd744f200e170536a7d046f1f0a3f112..21331625e66e5dbf1d0e2248877a0563b6ed0607 100644 (file)
@@ -367,7 +367,7 @@ acpi_ex_convert_to_ascii (
 
                /* hex_length: 2 ascii hex chars per data byte */
 
-               hex_length = ACPI_MUL_2 (data_width);
+               hex_length = (acpi_native_uint) ACPI_MUL_2 (data_width);
                for (i = 0, j = (hex_length-1); i < hex_length; i++, j--) {
                        /* Get one hex digit, most significant digits first */
 
index 408500648114ab639f4f05944a823c17cc56e636..4f98dceed39a620a9d6527a7d060488b73ac342c 100644 (file)
 #define _COMPONENT          ACPI_EXECUTER
         ACPI_MODULE_NAME    ("exdump")
 
+/*
+ * The following routines are used for debug output only
+ */
+#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+
 /* Local prototypes */
 
 #ifdef ACPI_FUTURE_USAGE
@@ -73,13 +78,17 @@ static void
 acpi_ex_out_address (
        char                            *title,
        acpi_physical_address           value);
-#endif /* ACPI_FUTURE_USAGE */
 
+static void
+acpi_ex_dump_reference (
+       union acpi_operand_object       *obj_desc);
 
-/*
- * The following routines are used for debug output only
- */
-#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+static void
+acpi_ex_dump_package (
+       union acpi_operand_object       *obj_desc,
+       u32                             level,
+       u32                             index);
+#endif /* ACPI_FUTURE_USAGE */
 
 /*******************************************************************************
  *
@@ -118,7 +127,7 @@ acpi_ex_dump_operand (
        }
 
        if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p is a NS Node: ", obj_desc));
+               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p Namespace Node: ", obj_desc));
                ACPI_DUMP_ENTRY (obj_desc, ACPI_LV_EXEC);
                return;
        }
@@ -467,7 +476,7 @@ acpi_ex_dump_operands (
        }
 
        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-               "************* Stack dump from %s(%d), %s\n",
+               "************* Operand Stack dump from %s(%d), %s\n",
                module_name, line_number, note));
        return;
 }
@@ -508,7 +517,7 @@ acpi_ex_out_integer (
        char                            *title,
        u32                             value)
 {
-       acpi_os_printf ("%20s : %X\n", title, value);
+       acpi_os_printf ("%20s : %.2X\n", title, value);
 }
 
 static void
@@ -563,11 +572,146 @@ acpi_ex_dump_node (
 }
 
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ex_dump_reference
+ *
+ * PARAMETERS:  Object              - Descriptor to dump
+ *
+ * DESCRIPTION: Dumps a reference object
+ *
+ ******************************************************************************/
+
+static void
+acpi_ex_dump_reference (
+       union acpi_operand_object       *obj_desc)
+{
+       struct acpi_buffer              ret_buf;
+       acpi_status                     status;
+
+
+       if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) {
+               acpi_os_printf ("Named Object %p ", obj_desc->reference.node);
+               ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER;
+               status = acpi_ns_handle_to_pathname (obj_desc->reference.node, &ret_buf);
+               if (ACPI_FAILURE (status)) {
+                       acpi_os_printf ("Could not convert name to pathname\n");
+               }
+               else {
+                  acpi_os_printf ("%s\n", (char *) ret_buf.pointer);
+                  ACPI_MEM_FREE (ret_buf.pointer);
+               }
+       }
+       else if (obj_desc->reference.object) {
+               acpi_os_printf ("\nReferenced Object: %p\n", obj_desc->reference.object);
+       }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ex_dump_package
+ *
+ * PARAMETERS:  Object              - Descriptor to dump
+ *              Level               - Indentation Level
+ *              Index               - Package index for this object
+ *
+ * DESCRIPTION: Dumps the elements of the package
+ *
+ ******************************************************************************/
+
+static void
+acpi_ex_dump_package (
+       union acpi_operand_object       *obj_desc,
+       u32                             level,
+       u32                             index)
+{
+       u32                             i;
+
+
+       /* Indentation and index output */
+
+       if (level > 0) {
+               for (i = 0; i < level; i++) {
+                       acpi_os_printf (" ");
+               }
+
+               acpi_os_printf ("[%.2d] ", index);
+       }
+
+       acpi_os_printf ("%p ", obj_desc);
+
+       /* Null package elements are allowed */
+
+       if (!obj_desc) {
+               acpi_os_printf ("[Null Object]\n");
+               return;
+       }
+
+       /* Packages may only contain a few object types */
+
+       switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+       case ACPI_TYPE_INTEGER:
+
+               acpi_os_printf ("[Integer] = %8.8X%8.8X\n",
+                                ACPI_FORMAT_UINT64 (obj_desc->integer.value));
+               break;
+
+
+       case ACPI_TYPE_STRING:
+
+               acpi_os_printf ("[String] Value: ");
+               for (i = 0; i < obj_desc->string.length; i++) {
+                       acpi_os_printf ("%c", obj_desc->string.pointer[i]);
+               }
+               acpi_os_printf ("\n");
+               break;
+
+
+       case ACPI_TYPE_BUFFER:
+
+               acpi_os_printf ("[Buffer] Length %.2X = ", obj_desc->buffer.length);
+               if (obj_desc->buffer.length) {
+                       acpi_ut_dump_buffer ((u8 *) obj_desc->buffer.pointer,
+                                       obj_desc->buffer.length, DB_DWORD_DISPLAY, _COMPONENT);
+               }
+               else {
+                       acpi_os_printf ("\n");
+               }
+               break;
+
+
+       case ACPI_TYPE_PACKAGE:
+
+               acpi_os_printf ("[Package] Contains %d Elements: \n",
+                               obj_desc->package.count);
+
+               for (i = 0; i < obj_desc->package.count; i++) {
+                       acpi_ex_dump_package (obj_desc->package.elements[i], level+1, i);
+               }
+               break;
+
+
+       case ACPI_TYPE_LOCAL_REFERENCE:
+
+               acpi_os_printf ("[Object Reference] ");
+               acpi_ex_dump_reference (obj_desc);
+               break;
+
+
+       default:
+
+               acpi_os_printf ("[Unknown Type] %X\n", ACPI_GET_OBJECT_TYPE (obj_desc));
+               break;
+       }
+}
+
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_dump_object_descriptor
  *
- * PARAMETERS:  *Object             - Descriptor to dump
+ * PARAMETERS:  Object              - Descriptor to dump
  *              Flags               - Force display if TRUE
  *
  * DESCRIPTION: Dumps the members of the object descriptor given.
@@ -579,9 +723,6 @@ acpi_ex_dump_object_descriptor (
        union acpi_operand_object       *obj_desc,
        u32                             flags)
 {
-       u32                             i;
-
-
        ACPI_FUNCTION_TRACE ("ex_dump_object_descriptor");
 
 
@@ -648,22 +789,13 @@ acpi_ex_dump_object_descriptor (
        case ACPI_TYPE_PACKAGE:
 
                acpi_ex_out_integer ("Flags",       obj_desc->package.flags);
-               acpi_ex_out_integer ("Count",       obj_desc->package.count);
-               acpi_ex_out_pointer ("Elements",    obj_desc->package.elements);
+               acpi_ex_out_integer ("Elements",    obj_desc->package.count);
+               acpi_ex_out_pointer ("Element List", obj_desc->package.elements);
 
                /* Dump the package contents */
 
-               if (obj_desc->package.count > 0) {
-                       acpi_os_printf ("\nPackage Contents:\n");
-                       for (i = 0; i < obj_desc->package.count; i++) {
-                               acpi_os_printf ("[%.3d] %p", i, obj_desc->package.elements[i]);
-                               if (obj_desc->package.elements[i]) {
-                                       acpi_os_printf (" %s",
-                                               acpi_ut_get_object_type_name (obj_desc->package.elements[i]));
-                               }
-                               acpi_os_printf ("\n");
-                       }
-               }
+               acpi_os_printf ("\nPackage Contents:\n");
+               acpi_ex_dump_package (obj_desc, 0, 0);
                break;
 
 
@@ -686,7 +818,7 @@ acpi_ex_dump_object_descriptor (
                acpi_ex_out_integer ("param_count", obj_desc->method.param_count);
                acpi_ex_out_integer ("Concurrency", obj_desc->method.concurrency);
                acpi_ex_out_pointer ("Semaphore",   obj_desc->method.semaphore);
-               acpi_ex_out_integer ("owning_id",   obj_desc->method.owning_id);
+               acpi_ex_out_integer ("owner_id",    obj_desc->method.owner_id);
                acpi_ex_out_integer ("aml_length",  obj_desc->method.aml_length);
                acpi_ex_out_pointer ("aml_start",   obj_desc->method.aml_start);
                break;
@@ -790,10 +922,7 @@ acpi_ex_dump_object_descriptor (
                acpi_ex_out_pointer ("Node",        obj_desc->reference.node);
                acpi_ex_out_pointer ("Where",       obj_desc->reference.where);
 
-               if (obj_desc->reference.object) {
-                       acpi_os_printf ("\nReferenced Object:\n");
-                       acpi_ex_dump_object_descriptor (obj_desc->reference.object, flags);
-               }
+               acpi_ex_dump_reference (obj_desc);
                break;
 
 
index 22c8fa480f60f6669a48bebbeb1b2765f32034ee..a690c9250990d6e03d78848cd16775b33d9a063a 100644 (file)
@@ -87,6 +87,9 @@ acpi_ex_read_data_from_field (
        if (!obj_desc) {
                return_ACPI_STATUS (AE_AML_NO_OPERAND);
        }
+       if (!ret_buffer_desc) {
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
+       }
 
        if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
                /*
@@ -182,7 +185,7 @@ exit:
        if (ACPI_FAILURE (status)) {
                acpi_ut_remove_reference (buffer_desc);
        }
-       else if (ret_buffer_desc) {
+       else {
                *ret_buffer_desc = buffer_desc;
        }
 
index 022f281345b856fbfd8dd4ffb346aca6e8094ba4..237ef28c813215f78922dc3960a56b76f9f647e6 100644 (file)
@@ -302,7 +302,7 @@ acpi_ex_do_concatenate (
                /* Result of two Integers is a Buffer */
                /* Need enough buffer space for two integers */
 
-               return_desc = acpi_ut_create_buffer_object (
+               return_desc = acpi_ut_create_buffer_object ((acpi_size)
                                   ACPI_MUL_2 (acpi_gbl_integer_byte_width));
                if (!return_desc) {
                        status = AE_NO_MEMORY;
index 639f0bd3f6d86dd25c77c9df9b626be8edbef058..b6ba1a7a677a47cc900c5c78627cdcd4a904b528 100644 (file)
@@ -438,6 +438,13 @@ acpi_ex_get_name_string (
                status = AE_AML_BAD_NAME;
        }
 
+       if (ACPI_FAILURE (status)) {
+               if (name_string) {
+                       ACPI_MEM_FREE (name_string);
+               }
+               return_ACPI_STATUS (status);
+       }
+
        *out_name_string = name_string;
        *out_name_length = (u32) (aml_address - in_aml_address);
 
index dbdf8262ba00d88e6cc51bb6817143778434997c..48c30f80008358d9fad31c4204bbca43bc9fcb76 100644 (file)
@@ -113,8 +113,9 @@ acpi_ex_opcode_0A_0T_1R (
                        status = AE_NO_MEMORY;
                        goto cleanup;
                }
-
+#if ACPI_MACHINE_WIDTH != 16
                return_desc->integer.value = acpi_os_get_timer ();
+#endif
                break;
 
        default:                /*  Unknown opcode  */
@@ -127,15 +128,16 @@ acpi_ex_opcode_0A_0T_1R (
 
 cleanup:
 
-       if (!walk_state->result_obj) {
-               walk_state->result_obj = return_desc;
-       }
-
        /* Delete return object on error */
 
-       if (ACPI_FAILURE (status)) {
+       if ((ACPI_FAILURE (status)) || walk_state->result_obj) {
                acpi_ut_remove_reference (return_desc);
        }
+       else {
+               /* Save the return value */
+
+               walk_state->result_obj = return_desc;
+       }
 
        return_ACPI_STATUS (status);
 }
@@ -902,6 +904,7 @@ acpi_ex_opcode_1A_0T_1R (
                         */
                        return_desc = acpi_ns_get_attached_object (
                                          (struct acpi_namespace_node *) operand[0]);
+                       acpi_ut_add_reference (return_desc);
                }
                else {
                        /*
@@ -951,20 +954,10 @@ acpi_ex_opcode_1A_0T_1R (
                                         * add another reference to the referenced object, however.
                                         */
                                        return_desc = *(operand[0]->reference.where);
-                                       if (!return_desc) {
-                                               /*
-                                                * We can't return a NULL dereferenced value.  This is
-                                                * an uninitialized package element and is thus a
-                                                * severe error.
-                                                */
-                                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                                       "NULL package element obj %p\n",
-                                                       operand[0]));
-                                               status = AE_AML_UNINITIALIZED_ELEMENT;
-                                               goto cleanup;
+                                       if (return_desc) {
+                                               acpi_ut_add_reference (return_desc);
                                        }
 
-                                       acpi_ut_add_reference (return_desc);
                                        break;
 
 
index 23b068adbf5806217011de9ada3aa04d77f745f8..197890f443b5e386175d7a39f2dda039befe3481 100644 (file)
@@ -160,7 +160,7 @@ acpi_ex_opcode_3A_1T_1R (
 {
        union acpi_operand_object       **operand = &walk_state->operands[0];
        union acpi_operand_object       *return_desc = NULL;
-       char                            *buffer;
+       char                            *buffer = NULL;
        acpi_status                     status = AE_OK;
        acpi_integer                    index;
        acpi_size                       length;
@@ -193,34 +193,63 @@ acpi_ex_opcode_3A_1T_1R (
                 * If the index is beyond the length of the String/Buffer, or if the
                 * requested length is zero, return a zero-length String/Buffer
                 */
-               if ((index < operand[0]->string.length) &&
-                       (length > 0)) {
-                       /* Truncate request if larger than the actual String/Buffer */
-
-                       if ((index + length) >
-                               operand[0]->string.length) {
-                               length = (acpi_size) operand[0]->string.length -
-                                                (acpi_size) index;
-                       }
+               if (index >= operand[0]->string.length) {
+                       length = 0;
+               }
+
+               /* Truncate request if larger than the actual String/Buffer */
+
+               else if ((index + length) > operand[0]->string.length) {
+                       length = (acpi_size) operand[0]->string.length -
+                                        (acpi_size) index;
+               }
 
-                       /* Allocate a new buffer for the String/Buffer */
+               /* Strings always have a sub-pointer, not so for buffers */
+
+               switch (ACPI_GET_OBJECT_TYPE (operand[0])) {
+               case ACPI_TYPE_STRING:
+
+                       /* Always allocate a new buffer for the String */
 
                        buffer = ACPI_MEM_CALLOCATE ((acpi_size) length + 1);
                        if (!buffer) {
                                status = AE_NO_MEMORY;
                                goto cleanup;
                        }
+                       break;
+
+               case ACPI_TYPE_BUFFER:
+
+                       /* If the requested length is zero, don't allocate a buffer */
+
+                       if (length > 0) {
+                               /* Allocate a new buffer for the Buffer */
+
+                               buffer = ACPI_MEM_CALLOCATE (length);
+                               if (!buffer) {
+                                       status = AE_NO_MEMORY;
+                                       goto cleanup;
+                               }
+                       }
+                       break;
 
+               default:                        /* Should not happen */
+
+                       status = AE_AML_OPERAND_TYPE;
+                       goto cleanup;
+               }
+
+               if (length > 0) {
                        /* Copy the portion requested */
 
                        ACPI_MEMCPY (buffer, operand[0]->string.pointer + index,
                                          length);
+               }
 
-                       /* Set the length of the new String/Buffer */
+               /* Set the length of the new String/Buffer */
 
-                       return_desc->string.pointer = buffer;
-                       return_desc->string.length = (u32) length;
-               }
+               return_desc->string.pointer = buffer;
+               return_desc->string.length = (u32) length;
 
                /* Mark buffer initialized */
 
@@ -244,13 +273,13 @@ cleanup:
 
        /* Delete return object on error */
 
-       if (ACPI_FAILURE (status)) {
+       if (ACPI_FAILURE (status) || walk_state->result_obj) {
                acpi_ut_remove_reference (return_desc);
        }
 
        /* Set the return object and exit */
 
-       if (!walk_state->result_obj) {
+       else {
                walk_state->result_obj = return_desc;
        }
        return_ACPI_STATUS (status);
index d8b470eefe7a5832cd0eec7d66bab5794338d892..aaba7abcb52db92a038ad718075dd3c75aa9fc7d 100644 (file)
@@ -426,6 +426,10 @@ acpi_ex_resolve_operands (
 
                                return_ACPI_STATUS (status);
                        }
+
+                       if (obj_desc != *stack_ptr) {
+                               acpi_ut_remove_reference (obj_desc);
+                       }
                        goto next_operand;
 
 
@@ -448,6 +452,10 @@ acpi_ex_resolve_operands (
 
                                return_ACPI_STATUS (status);
                        }
+
+                       if (obj_desc != *stack_ptr) {
+                               acpi_ut_remove_reference (obj_desc);
+                       }
                        goto next_operand;
 
 
@@ -471,6 +479,10 @@ acpi_ex_resolve_operands (
 
                                return_ACPI_STATUS (status);
                        }
+
+                       if (obj_desc != *stack_ptr) {
+                               acpi_ut_remove_reference (obj_desc);
+                       }
                        goto next_operand;
 
 
@@ -515,6 +527,10 @@ acpi_ex_resolve_operands (
                                if (ACPI_FAILURE (status)) {
                                        return_ACPI_STATUS (status);
                                }
+
+                               if (obj_desc != *stack_ptr) {
+                                       acpi_ut_remove_reference (obj_desc);
+                               }
                                break;
 
                        default:
index 2725db0901b827133003aa9d21400cd5dcec1384..59dbfeaa54c0e6db989e94b17881ef7e5e8d3de6 100644 (file)
@@ -147,7 +147,7 @@ acpi_ex_do_debug_object (
 
        case ACPI_TYPE_BUFFER:
 
-               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]",
+               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]\n",
                        (u32) source_desc->buffer.length));
                ACPI_DUMP_BUFFER (source_desc->buffer.pointer,
                        (source_desc->buffer.length < 32) ? source_desc->buffer.length : 32);
@@ -574,7 +574,7 @@ acpi_ex_store_object_to_node (
 
        /* If no implicit conversion, drop into the default case below */
 
-       if (!implicit_conversion) {
+       if ((!implicit_conversion) || (walk_state->opcode == AML_COPY_OP)) {
                /* Force execution of default (no implicit conversion) */
 
                target_type = ACPI_TYPE_ANY;
@@ -634,7 +634,7 @@ acpi_ex_store_object_to_node (
        default:
 
                ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                       "Storing %s (%p) directly into node (%p), no implicit conversion\n",
+                       "Storing %s (%p) directly into node (%p) with no implicit conversion\n",
                        acpi_ut_get_object_type_name (source_desc), source_desc, node));
 
                /* No conversions for all other types.  Just attach the source object */
index 120f30ed0bd4a017c7a7363783329f13828fbb99..433588ab432a798b1692befa2a5e869bfbb72f96 100644 (file)
@@ -265,10 +265,6 @@ acpi_ex_store_object_to_object (
 
        case ACPI_TYPE_BUFFER:
 
-               /*
-                * Note: There is different store behavior depending on the original
-                * source type
-                */
                status = acpi_ex_store_buffer_to_buffer (actual_src_desc, dest_desc);
                break;
 
index 5c7ec0c0417767243df04097713a95f441dc9834..d00b0dcba96a0b611643a23d432a46cde53ed186 100644 (file)
@@ -369,7 +369,7 @@ acpi_ex_eisa_id_to_string (
  *
  * RETURN:      None, string
  *
- * DESCRIPTOIN: Convert a number to string representation. Assumes string
+ * DESCRIPTION: Convert a number to string representation. Assumes string
  *              buffer is large enough to hold the string.
  *
  ******************************************************************************/
index 8daeabb2fc7abdd386d689d2286d676bf3dd0340..3536bbb990c3ca439a52b90041e19b0019fb465c 100644 (file)
@@ -374,7 +374,7 @@ acpi_hw_enable_wakeup_gpe_block (
  *
  * FUNCTION:    acpi_hw_disable_all_gpes
  *
- * PARAMETERS:  Flags           - ACPI_NOT_ISR or ACPI_ISR
+ * PARAMETERS:  None
  *
  * RETURN:      Status
  *
@@ -384,7 +384,7 @@ acpi_hw_enable_wakeup_gpe_block (
 
 acpi_status
 acpi_hw_disable_all_gpes (
-       u32                             flags)
+       void)
 {
        acpi_status                     status;
 
@@ -392,8 +392,8 @@ acpi_hw_disable_all_gpes (
        ACPI_FUNCTION_TRACE ("hw_disable_all_gpes");
 
 
-       status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block, flags);
-       status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block, flags);
+       status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block);
+       status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block);
        return_ACPI_STATUS (status);
 }
 
@@ -402,7 +402,7 @@ acpi_hw_disable_all_gpes (
  *
  * FUNCTION:    acpi_hw_enable_all_runtime_gpes
  *
- * PARAMETERS:  Flags           - ACPI_NOT_ISR or ACPI_ISR
+ * PARAMETERS:  None
  *
  * RETURN:      Status
  *
@@ -412,7 +412,7 @@ acpi_hw_disable_all_gpes (
 
 acpi_status
 acpi_hw_enable_all_runtime_gpes (
-       u32                             flags)
+       void)
 {
        acpi_status                     status;
 
@@ -420,7 +420,7 @@ acpi_hw_enable_all_runtime_gpes (
        ACPI_FUNCTION_TRACE ("hw_enable_all_runtime_gpes");
 
 
-       status = acpi_ev_walk_gpe_list (acpi_hw_enable_runtime_gpe_block, flags);
+       status = acpi_ev_walk_gpe_list (acpi_hw_enable_runtime_gpe_block);
        return_ACPI_STATUS (status);
 }
 
@@ -429,7 +429,7 @@ acpi_hw_enable_all_runtime_gpes (
  *
  * FUNCTION:    acpi_hw_enable_all_wakeup_gpes
  *
- * PARAMETERS:  Flags           - ACPI_NOT_ISR or ACPI_ISR
+ * PARAMETERS:  None
  *
  * RETURN:      Status
  *
@@ -439,7 +439,7 @@ acpi_hw_enable_all_runtime_gpes (
 
 acpi_status
 acpi_hw_enable_all_wakeup_gpes (
-       u32                             flags)
+       void)
 {
        acpi_status                     status;
 
@@ -447,7 +447,7 @@ acpi_hw_enable_all_wakeup_gpes (
        ACPI_FUNCTION_TRACE ("hw_enable_all_wakeup_gpes");
 
 
-       status = acpi_ev_walk_gpe_list (acpi_hw_enable_wakeup_gpe_block, flags);
+       status = acpi_ev_walk_gpe_list (acpi_hw_enable_wakeup_gpe_block);
        return_ACPI_STATUS (status);
 }
 
index 6d9e4eb848361539bce2d394279d37d7ce8389ab..04a058565d8d6121e30c7a5e47aa24401df24a2b 100644 (file)
@@ -106,7 +106,7 @@ acpi_hw_clear_acpi_status (
 
        /* Clear the GPE Bits in all GPE registers in all GPE blocks */
 
-       status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block, ACPI_ISR);
+       status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block);
 
 unlock_and_exit:
        if (flags & ACPI_MTX_LOCK) {
index 415d342aeab5cf41661ac5b38e9513757940ca7d..cedee0c43b5fe278028a24485a029c86417bfd88 100644 (file)
@@ -274,13 +274,13 @@ acpi_enter_sleep_state (
         * 1) Disable/Clear all GPEs
         * 2) Enable all wakeup GPEs
         */
-       status = acpi_hw_disable_all_gpes (ACPI_ISR);
+       status = acpi_hw_disable_all_gpes ();
        if (ACPI_FAILURE (status)) {
                return_ACPI_STATUS (status);
        }
        acpi_gbl_system_awake_and_running = FALSE;
 
-       status = acpi_hw_enable_all_wakeup_gpes (ACPI_ISR);
+       status = acpi_hw_enable_all_wakeup_gpes ();
        if (ACPI_FAILURE (status)) {
                return_ACPI_STATUS (status);
        }
@@ -424,13 +424,13 @@ acpi_enter_sleep_state_s4bios (
         * 1) Disable/Clear all GPEs
         * 2) Enable all wakeup GPEs
         */
-       status = acpi_hw_disable_all_gpes (ACPI_ISR);
+       status = acpi_hw_disable_all_gpes ();
        if (ACPI_FAILURE (status)) {
                return_ACPI_STATUS (status);
        }
        acpi_gbl_system_awake_and_running = FALSE;
 
-       status = acpi_hw_enable_all_wakeup_gpes (ACPI_ISR);
+       status = acpi_hw_enable_all_wakeup_gpes ();
        if (ACPI_FAILURE (status)) {
                return_ACPI_STATUS (status);
        }
@@ -557,13 +557,13 @@ acpi_leave_sleep_state (
         * 1) Disable/Clear all GPEs
         * 2) Enable all runtime GPEs
         */
-       status = acpi_hw_disable_all_gpes (ACPI_NOT_ISR);
+       status = acpi_hw_disable_all_gpes ();
        if (ACPI_FAILURE (status)) {
                return_ACPI_STATUS (status);
        }
        acpi_gbl_system_awake_and_running = TRUE;
 
-       status = acpi_hw_enable_all_runtime_gpes (ACPI_NOT_ISR);
+       status = acpi_hw_enable_all_runtime_gpes ();
        if (ACPI_FAILURE (status)) {
                return_ACPI_STATUS (status);
        }
index ece7a9dedd5c740a4b5f95c194538b7ec48513e5..7589e1fdf25ad0e2dc7d0d5c89ead312910e1ff1 100644 (file)
@@ -159,18 +159,19 @@ acpi_ns_root_initialize (
                                obj_desc->method.param_count = (u8) ACPI_TO_INTEGER (val);
                                obj_desc->common.flags |= AOPOBJ_DATA_VALID;
 
-#if defined (_ACPI_ASL_COMPILER) || defined (_ACPI_DUMP_App)
+#if defined (ACPI_ASL_COMPILER)
 
-                               /*
-                                * i_aSL Compiler cheats by putting parameter count
-                                * in the owner_iD
-                                */
-                               new_node->owner_id = obj_desc->method.param_count;
+                               /* save the parameter count for the i_aSL compiler */
+
+                               new_node->value = obj_desc->method.param_count;
 #else
                                /* Mark this as a very SPECIAL method */
 
                                obj_desc->method.method_flags = AML_METHOD_INTERNAL_ONLY;
+
+#ifndef ACPI_DUMP_APP
                                obj_desc->method.implementation = acpi_ut_osi_implementation;
+#endif
 #endif
                                break;
 
index 5653a19d7172b7f1a6383e5adf6169d8005265bb..21d560decbf9b3c10a2342ed754d7d2dc5e471bf 100644 (file)
@@ -83,7 +83,7 @@ acpi_ns_create_node (
                return_PTR (NULL);
        }
 
-       ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_allocated++);
+       ACPI_MEM_TRACKING (acpi_gbl_ns_node_list->total_allocated++);
 
        node->name.integer   = name;
        node->reference_count = 1;
@@ -151,7 +151,7 @@ acpi_ns_delete_node (
                }
        }
 
-       ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++);
+       ACPI_MEM_TRACKING (acpi_gbl_ns_node_list->total_freed++);
 
        /*
         * Detach an object if there is one then delete the node
@@ -176,10 +176,9 @@ acpi_ns_delete_node (
  * DESCRIPTION: Initialize a new namespace node and install it amongst
  *              its peers.
  *
- *              Note: Current namespace lookup is linear search.  However, the
- *              nodes are linked in alphabetical order to 1) put all reserved
- *              names (start with underscore) first, and to 2) make a readable
- *              namespace dump.
+ *              Note: Current namespace lookup is linear search. This appears
+ *              to be sufficient as namespace searches consume only a small
+ *              fraction of the execution time of the ACPI subsystem.
  *
  ******************************************************************************/
 
@@ -190,12 +189,8 @@ acpi_ns_install_node (
        struct acpi_namespace_node      *node,          /* New Child*/
        acpi_object_type                type)
 {
-       u16                             owner_id = 0;
+       acpi_owner_id                   owner_id = 0;
        struct acpi_namespace_node      *child_node;
-#ifdef ACPI_ALPHABETIC_NAMESPACE
-
-       struct acpi_namespace_node      *previous_child_node;
-#endif
 
 
        ACPI_FUNCTION_TRACE ("ns_install_node");
@@ -219,57 +214,6 @@ acpi_ns_install_node (
                node->peer = parent_node;
        }
        else {
-#ifdef ACPI_ALPHABETIC_NAMESPACE
-               /*
-                * Walk the list whilst searching for the correct
-                * alphabetic placement.
-                */
-               previous_child_node = NULL;
-               while (acpi_ns_compare_names (acpi_ut_get_node_name (child_node),
-                                acpi_ut_get_node_name (node)) < 0) {
-                       if (child_node->flags & ANOBJ_END_OF_PEER_LIST) {
-                               /* Last peer;  Clear end-of-list flag */
-
-                               child_node->flags &= ~ANOBJ_END_OF_PEER_LIST;
-
-                               /* This node is the new peer to the child node */
-
-                               child_node->peer = node;
-
-                               /* This node is the new end-of-list */
-
-                               node->flags |= ANOBJ_END_OF_PEER_LIST;
-                               node->peer = parent_node;
-                               break;
-                       }
-
-                       /* Get next peer */
-
-                       previous_child_node = child_node;
-                       child_node = child_node->peer;
-               }
-
-               /* Did the node get inserted at the end-of-list? */
-
-               if (!(node->flags & ANOBJ_END_OF_PEER_LIST)) {
-                       /*
-                        * Loop above terminated without reaching the end-of-list.
-                        * Insert the new node at the current location
-                        */
-                       if (previous_child_node) {
-                               /* Insert node alphabetically */
-
-                               node->peer = child_node;
-                               previous_child_node->peer = node;
-                       }
-                       else {
-                               /* Insert node alphabetically at start of list */
-
-                               node->peer = child_node;
-                               parent_node->child = node;
-                       }
-               }
-#else
                while (!(child_node->flags & ANOBJ_END_OF_PEER_LIST)) {
                        child_node = child_node->peer;
                }
@@ -279,9 +223,8 @@ acpi_ns_install_node (
                /* Clear end-of-list flag */
 
                child_node->flags &= ~ANOBJ_END_OF_PEER_LIST;
-               node->flags     |= ANOBJ_END_OF_PEER_LIST;
+               node->flags |= ANOBJ_END_OF_PEER_LIST;
                node->peer = parent_node;
-#endif
        }
 
        /* Init the new entry */
@@ -362,7 +305,7 @@ acpi_ns_delete_children (
 
                /* Now we can free this child object */
 
-               ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++);
+               ACPI_MEM_TRACKING (acpi_gbl_ns_node_list->total_freed++);
 
                ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p, Remaining %X\n",
                        child_node, acpi_gbl_current_node_count));
@@ -559,7 +502,7 @@ acpi_ns_remove_reference (
 
 void
 acpi_ns_delete_namespace_by_owner (
-       u16                             owner_id)
+       acpi_owner_id                    owner_id)
 {
        struct acpi_namespace_node      *child_node;
        struct acpi_namespace_node      *deletion_node;
@@ -570,6 +513,10 @@ acpi_ns_delete_namespace_by_owner (
        ACPI_FUNCTION_TRACE_U32 ("ns_delete_namespace_by_owner", owner_id);
 
 
+       if (owner_id == 0) {
+               return_VOID;
+       }
+
        parent_node   = acpi_gbl_root_node;
        child_node    = NULL;
        deletion_node = NULL;
@@ -639,54 +586,3 @@ acpi_ns_delete_namespace_by_owner (
 }
 
 
-#ifdef ACPI_ALPHABETIC_NAMESPACE
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ns_compare_names
- *
- * PARAMETERS:  Name1           - First name to compare
- *              Name2           - Second name to compare
- *
- * RETURN:      value from strncmp
- *
- * DESCRIPTION: Compare two ACPI names.  Names that are prefixed with an
- *              underscore are forced to be alphabetically first.
- *
- ******************************************************************************/
-
-int
-acpi_ns_compare_names (
-       char                            *name1,
-       char                            *name2)
-{
-       char                            reversed_name1[ACPI_NAME_SIZE];
-       char                            reversed_name2[ACPI_NAME_SIZE];
-       u32                             i;
-       u32                             j;
-
-
-       /*
-        * Replace all instances of "underscore" with a value that is smaller so
-        * that all names that are prefixed with underscore(s) are alphabetically
-        * first.
-        *
-        * Reverse the name bytewise so we can just do a 32-bit compare instead
-        * of a strncmp.
-        */
-       for (i = 0, j= (ACPI_NAME_SIZE - 1); i < ACPI_NAME_SIZE; i++, j--) {
-               reversed_name1[j] = name1[i];
-               if (name1[i] == '_') {
-                       reversed_name1[j] = '*';
-               }
-
-               reversed_name2[j] = name2[i];
-               if (name2[i] == '_') {
-                       reversed_name2[j] = '*';
-               }
-       }
-
-       return (*(int *) reversed_name1 - *(int *) reversed_name2);
-}
-#endif
-
-
index 6c2aef0e0dd4d47b8f451c487d7c83777a1f8cc8..5d25add6b031b722e63712bba98e911f60d22210 100644 (file)
@@ -85,6 +85,9 @@ acpi_ns_print_pathname (
        u32                             num_segments,
        char                            *pathname)
 {
+       acpi_native_uint                i;
+
+
        ACPI_FUNCTION_NAME ("ns_print_pathname");
 
 
@@ -97,9 +100,13 @@ acpi_ns_print_pathname (
        ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
 
        while (num_segments) {
-               acpi_os_printf ("%4.4s", pathname);
-               pathname += ACPI_NAME_SIZE;
+               for (i = 0; i < 4; i++) {
+                       ACPI_IS_PRINT (pathname[i]) ?
+                               acpi_os_printf ("%c", pathname[i]) :
+                               acpi_os_printf ("?");
+               }
 
+               pathname += ACPI_NAME_SIZE;
                num_segments--;
                if (num_segments) {
                        acpi_os_printf (".");
@@ -203,38 +210,42 @@ acpi_ns_dump_one_object (
 
        /* Check if the owner matches */
 
-       if ((info->owner_id != ACPI_UINT32_MAX) &&
+       if ((info->owner_id != ACPI_OWNER_ID_MAX) &&
                (info->owner_id != this_node->owner_id)) {
                return (AE_OK);
        }
 
-       /* Indent the object according to the level */
+       if (!(info->display_type & ACPI_DISPLAY_SHORT)) {
+               /* Indent the object according to the level */
 
-       acpi_os_printf ("%2d%*s", (u32) level - 1, (int) level * 2, " ");
+               acpi_os_printf ("%2d%*s", (u32) level - 1, (int) level * 2, " ");
 
-       /* Check the node type and name */
+               /* Check the node type and name */
 
-       if (type > ACPI_TYPE_LOCAL_MAX) {
-               ACPI_REPORT_WARNING (("Invalid ACPI Type %08X\n", type));
-       }
+               if (type > ACPI_TYPE_LOCAL_MAX) {
+                       ACPI_REPORT_WARNING (("Invalid ACPI Type %08X\n", type));
+               }
 
-       if (!acpi_ut_valid_acpi_name (this_node->name.integer)) {
-               ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n",
-                       this_node->name.integer));
+               if (!acpi_ut_valid_acpi_name (this_node->name.integer)) {
+                       ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n",
+                               this_node->name.integer));
+               }
+
+               acpi_os_printf ("%4.4s", acpi_ut_get_node_name (this_node));
        }
 
        /*
         * Now we can print out the pertinent information
         */
-       acpi_os_printf ("%4.4s %-12s %p ",
-                       acpi_ut_get_node_name (this_node), acpi_ut_get_type_name (type), this_node);
+       acpi_os_printf (" %-12s %p ",
+                       acpi_ut_get_type_name (type), this_node);
 
        dbg_level = acpi_dbg_level;
        acpi_dbg_level = 0;
        obj_desc = acpi_ns_get_attached_object (this_node);
        acpi_dbg_level = dbg_level;
 
-       switch (info->display_type) {
+       switch (info->display_type & ACPI_DISPLAY_MASK) {
        case ACPI_DISPLAY_SUMMARY:
 
                if (!obj_desc) {
@@ -475,7 +486,7 @@ acpi_ns_dump_one_object (
 
        while (obj_desc) {
                obj_type = ACPI_TYPE_INVALID;
-               acpi_os_printf ("      Attached Object %p: ", obj_desc);
+               acpi_os_printf ("Attached Object %p: ", obj_desc);
 
                /* Decode the type of attached object and dump the contents */
 
@@ -484,9 +495,9 @@ acpi_ns_dump_one_object (
 
                        acpi_os_printf ("(Ptr to Node)\n");
                        bytes_to_dump = sizeof (struct acpi_namespace_node);
+                       ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump);
                        break;
 
-
                case ACPI_DESC_TYPE_OPERAND:
 
                        obj_type = ACPI_GET_OBJECT_TYPE (obj_desc);
@@ -497,24 +508,19 @@ acpi_ns_dump_one_object (
                                bytes_to_dump = 32;
                        }
                        else {
-                               acpi_os_printf ("(Ptr to ACPI Object type %s, %X)\n",
-                                       acpi_ut_get_type_name (obj_type), obj_type);
+                               acpi_os_printf ("(Ptr to ACPI Object type %X [%s])\n",
+                                       obj_type, acpi_ut_get_type_name (obj_type));
                                bytes_to_dump = sizeof (union acpi_operand_object);
                        }
-                       break;
 
+                       ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump);
+                       break;
 
                default:
 
-                       acpi_os_printf (
-                               "(String or Buffer ptr - not an object descriptor) [%s]\n",
-                               acpi_ut_get_descriptor_name (obj_desc));
-                       bytes_to_dump = 16;
                        break;
                }
 
-               ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump);
-
                /* If value is NOT an internal object, we are done */
 
                if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND) {
@@ -525,13 +531,17 @@ acpi_ns_dump_one_object (
                 * Valid object, get the pointer to next level, if any
                 */
                switch (obj_type) {
+               case ACPI_TYPE_BUFFER:
                case ACPI_TYPE_STRING:
+                       /*
+                        * NOTE: takes advantage of common fields between string/buffer
+                        */
+                       bytes_to_dump = obj_desc->string.length;
                        obj_desc = (void *) obj_desc->string.pointer;
-                       break;
-
-               case ACPI_TYPE_BUFFER:
-                       obj_desc = (void *) obj_desc->buffer.pointer;
-                       break;
+                       acpi_os_printf ( "(Buffer/String pointer %p length %X)\n",
+                               obj_desc, bytes_to_dump);
+                       ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump);
+                       goto cleanup;
 
                case ACPI_TYPE_BUFFER_FIELD:
                        obj_desc = (union acpi_operand_object *) obj_desc->buffer_field.buffer_obj;
@@ -595,7 +605,7 @@ acpi_ns_dump_objects (
        acpi_object_type                type,
        u8                              display_type,
        u32                             max_depth,
-       u32                             owner_id,
+       acpi_owner_id                   owner_id,
        acpi_handle                     start_handle)
 {
        struct acpi_walk_info           info;
@@ -640,14 +650,14 @@ acpi_ns_dump_entry (
 
 
        info.debug_level = debug_level;
-       info.owner_id = ACPI_UINT32_MAX;
+       info.owner_id = ACPI_OWNER_ID_MAX;
        info.display_type = ACPI_DISPLAY_SUMMARY;
 
        (void) acpi_ns_dump_one_object (handle, 1, &info, NULL);
 }
 
 
-#ifdef _ACPI_ASL_COMPILER
+#ifdef ACPI_ASL_COMPILER
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_dump_tables
@@ -691,7 +701,7 @@ acpi_ns_dump_tables (
        }
 
        acpi_ns_dump_objects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, max_depth,
-                       ACPI_UINT32_MAX, search_handle);
+                       ACPI_OWNER_ID_MAX, search_handle);
        return_VOID;
 }
 #endif /* _ACPI_ASL_COMPILER */
index 1ae89a1c88268a4a05db959585b6ad86b300c0ab..908cffd5e72035b3dd80f8b5f9aaba8568342635 100644 (file)
@@ -365,6 +365,7 @@ acpi_ns_evaluate_by_handle (
  *
  * PARAMETERS:  Info            - Method info block, contains:
  *                  Node            - Method Node to execute
+ *                  obj_desc        - Method object
  *                  Parameters      - List of parameters to pass to the method,
  *                                    terminated by NULL. Params itself may be
  *                                    NULL if no parameters are being passed.
@@ -387,7 +388,6 @@ acpi_ns_execute_control_method (
        struct acpi_parameter_info      *info)
 {
        acpi_status                     status;
-       union acpi_operand_object       *obj_desc;
 
 
        ACPI_FUNCTION_TRACE ("ns_execute_control_method");
@@ -395,8 +395,8 @@ acpi_ns_execute_control_method (
 
        /* Verify that there is a method associated with this object */
 
-       obj_desc = acpi_ns_get_attached_object (info->node);
-       if (!obj_desc) {
+       info->obj_desc = acpi_ns_get_attached_object (info->node);
+       if (!info->obj_desc) {
                ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No attached method object\n"));
 
                (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
@@ -407,7 +407,7 @@ acpi_ns_execute_control_method (
                ACPI_LV_INFO, _COMPONENT);
 
        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Method at AML address %p Length %X\n",
-               obj_desc->method.aml_start + 1, obj_desc->method.aml_length - 1));
+               info->obj_desc->method.aml_start + 1, info->obj_desc->method.aml_length - 1));
 
        /*
         * Unlock the namespace before execution.  This allows namespace access
@@ -430,7 +430,7 @@ acpi_ns_execute_control_method (
                return_ACPI_STATUS (status);
        }
 
-       status = acpi_psx_execute (info);
+       status = acpi_ps_execute_method (info);
        acpi_ex_exit_interpreter ();
 
        return_ACPI_STATUS (status);
index 34e497016601de5b27af03e8f54ec4f12e83d0ff..1428a84a31e6bee0b6a83d733c13109d27e030e6 100644 (file)
@@ -198,7 +198,7 @@ acpi_ns_load_table_by_type (
        switch (table_type) {
        case ACPI_TABLE_DSDT:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading DSDT\n"));
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace load: DSDT\n"));
 
                table_desc = acpi_gbl_table_lists[ACPI_TABLE_DSDT].next;
 
@@ -218,17 +218,18 @@ acpi_ns_load_table_by_type (
 
 
        case ACPI_TABLE_SSDT:
+       case ACPI_TABLE_PSDT:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d SSDTs\n",
-                       acpi_gbl_table_lists[ACPI_TABLE_SSDT].count));
+               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace load: %d SSDT or PSDTs\n",
+                       acpi_gbl_table_lists[table_type].count));
 
                /*
-                * Traverse list of SSDT tables
+                * Traverse list of SSDT or PSDT tables
                 */
-               table_desc = acpi_gbl_table_lists[ACPI_TABLE_SSDT].next;
-               for (i = 0; i < acpi_gbl_table_lists[ACPI_TABLE_SSDT].count; i++) {
+               table_desc = acpi_gbl_table_lists[table_type].next;
+               for (i = 0; i < acpi_gbl_table_lists[table_type].count; i++) {
                        /*
-                        * Only attempt to load table if it is not
+                        * Only attempt to load table into namespace if it is not
                         * already loaded!
                         */
                        if (!table_desc->loaded_into_namespace) {
@@ -245,33 +246,6 @@ acpi_ns_load_table_by_type (
                break;
 
 
-       case ACPI_TABLE_PSDT:
-
-               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d PSDTs\n",
-                       acpi_gbl_table_lists[ACPI_TABLE_PSDT].count));
-
-               /*
-                * Traverse list of PSDT tables
-                */
-               table_desc = acpi_gbl_table_lists[ACPI_TABLE_PSDT].next;
-
-               for (i = 0; i < acpi_gbl_table_lists[ACPI_TABLE_PSDT].count; i++) {
-                       /* Only attempt to load table if it is not already loaded! */
-
-                       if (!table_desc->loaded_into_namespace) {
-                               status = acpi_ns_load_table (table_desc, acpi_gbl_root_node);
-                               if (ACPI_FAILURE (status)) {
-                                       break;
-                               }
-
-                               table_desc->loaded_into_namespace = TRUE;
-                       }
-
-                       table_desc = table_desc->next;
-               }
-               break;
-
-
        default:
                status = AE_SUPPORT;
                break;
index a0e13e8d376489ee000c2724136f7729b5815c70..24bed931d39d6f7dddfe01a74794f4ff2da1adeb 100644 (file)
@@ -67,7 +67,7 @@
 
 acpi_status
 acpi_ns_one_complete_parse (
-       u32                             pass_number,
+       u                             pass_number,
        struct acpi_table_desc          *table_desc)
 {
        union acpi_parse_object         *parse_root;
@@ -87,7 +87,7 @@ acpi_ns_one_complete_parse (
 
        /* Create and initialize a new walk state */
 
-       walk_state = acpi_ds_create_walk_state (table_desc->table_id,
+       walk_state = acpi_ds_create_walk_state (table_desc->owner_id,
                           NULL, NULL, NULL);
        if (!walk_state) {
                acpi_ps_free_op (parse_root);
@@ -146,6 +146,7 @@ acpi_ns_parse_table (
         * to service the entire parse.  The second pass of the parse then
         * performs another complete parse of the AML..
         */
+       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 1\n"));
        status = acpi_ns_one_complete_parse (1, table_desc);
        if (ACPI_FAILURE (status)) {
                return_ACPI_STATUS (status);
@@ -160,6 +161,7 @@ acpi_ns_parse_table (
         * overhead of this is compensated for by the fact that the
         * parse objects are all cached.
         */
+       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 2\n"));
        status = acpi_ns_one_complete_parse (2, table_desc);
        if (ACPI_FAILURE (status)) {
                return_ACPI_STATUS (status);
index 7289da3c4db6a28778628337f26e79015de7139d..f3a807c342c02da2443a54ef02565c0a01e85407 100644 (file)
@@ -782,54 +782,6 @@ acpi_os_delete_lock (
        return_VOID;
 }
 
-/*
- * Acquire a spinlock.
- *
- * handle is a pointer to the spinlock_t.
- * flags is *not* the result of save_flags - it is an ACPI-specific flag variable
- *   that indicates whether we are at interrupt level.
- */
-void
-acpi_os_acquire_lock (
-       acpi_handle     handle,
-       u32             flags)
-{
-       ACPI_FUNCTION_TRACE ("os_acquire_lock");
-
-       ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Acquiring spinlock[%p] from %s level\n", handle,
-               ((flags & ACPI_NOT_ISR) ? "non-interrupt" : "interrupt")));
-
-       if (flags & ACPI_NOT_ISR)
-               ACPI_DISABLE_IRQS();
-
-       spin_lock((spinlock_t *)handle);
-
-       return_VOID;
-}
-
-
-/*
- * Release a spinlock. See above.
- */
-void
-acpi_os_release_lock (
-       acpi_handle     handle,
-       u32             flags)
-{
-       ACPI_FUNCTION_TRACE ("os_release_lock");
-
-       ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Releasing spinlock[%p] from %s level\n", handle,
-               ((flags & ACPI_NOT_ISR) ? "non-interrupt" : "interrupt")));
-
-       spin_unlock((spinlock_t *)handle);
-
-       if (flags & ACPI_NOT_ISR)
-               ACPI_ENABLE_IRQS();
-
-       return_VOID;
-}
-
-
 acpi_status
 acpi_os_create_semaphore(
        u32             max_units,
@@ -1176,3 +1128,151 @@ unsigned int max_cstate = ACPI_PROCESSOR_MAX_POWER;
 
 
 EXPORT_SYMBOL(max_cstate);
+
+/*
+ * Acquire a spinlock.
+ *
+ * handle is a pointer to the spinlock_t.
+ * flags is *not* the result of save_flags - it is an ACPI-specific flag variable
+ *   that indicates whether we are at interrupt level.
+ */
+
+unsigned long
+acpi_os_acquire_lock (
+       acpi_handle     handle)
+{
+       unsigned long flags;
+       spin_lock_irqsave((spinlock_t *)handle, flags);
+       return flags;
+}
+
+/*
+ * Release a spinlock. See above.
+ */
+
+void
+acpi_os_release_lock (
+       acpi_handle     handle,
+       unsigned long   flags)
+{
+       spin_unlock_irqrestore((spinlock_t *)handle, flags);
+}
+
+
+#ifndef ACPI_USE_LOCAL_CACHE
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_os_create_cache
+ *
+ * PARAMETERS:  CacheName       - Ascii name for the cache
+ *              ObjectSize      - Size of each cached object
+ *              MaxDepth        - Maximum depth of the cache (in objects)
+ *              ReturnCache     - Where the new cache object is returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Create a cache object
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_os_create_cache (
+    char                    *name,
+    u16                  size,
+    u16                  depth,
+    acpi_cache_t           **cache)
+{
+       *cache = kmem_cache_create (name, size, 0, 0, NULL, NULL);
+       return AE_OK;
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_os_purge_cache
+ *
+ * PARAMETERS:  Cache           - Handle to cache object
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Free all objects within the requested cache.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_os_purge_cache (
+    acpi_cache_t        *cache)
+{
+    (void) kmem_cache_shrink(cache);
+    return (AE_OK);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_os_delete_cache
+ *
+ * PARAMETERS:  Cache           - Handle to cache object
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Free all objects within the requested cache and delete the
+ *              cache object.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_os_delete_cache (
+    acpi_cache_t *cache)
+{
+    (void)kmem_cache_destroy(cache);
+    return (AE_OK);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_os_release_object
+ *
+ * PARAMETERS:  Cache       - Handle to cache object
+ *              Object      - The object to be released
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Release an object to the specified cache.  If cache is full,
+ *              the object is deleted.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_os_release_object (
+    acpi_cache_t *cache,
+    void *object)
+{
+    kmem_cache_free(cache, object);
+    return (AE_OK);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_os_acquire_object
+ *
+ * PARAMETERS:  Cache           - Handle to cache object
+ *              ReturnObject    - Where the object is returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Get an object from the specified cache.  If cache is empty,
+ *              the object is allocated.
+ *
+ ******************************************************************************/
+
+void *
+acpi_os_acquire_object (
+    acpi_cache_t *cache)
+{
+    void *object = kmem_cache_alloc(cache, GFP_KERNEL);
+    WARN_ON(!object);
+    return object;
+}
+
+#endif
+
index bbdd286c660d581147efccba0c49a5d58ffde7c0..db24ee09cf11777a11e20e293c9fb85031366be8 100644 (file)
@@ -2,7 +2,7 @@
 # Makefile for all Linux ACPI interpreter subdirectories
 #
 
-obj-y := psargs.o    psparse.o  pstree.o   pswalk.o  \
+obj-y := psargs.o    psparse.o  psloop.o pstree.o   pswalk.o  \
         psopcode.o  psscope.o  psutils.o  psxface.o
 
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c
new file mode 100644 (file)
index 0000000..551d54b
--- /dev/null
@@ -0,0 +1,781 @@
+/******************************************************************************
+ *
+ * Module Name: psloop - Main AML parse loop
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2005, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+
+/*
+ * Parse the AML and build an operation tree as most interpreters,
+ * like Perl, do.  Parsing is done by hand rather than with a YACC
+ * generated parser to tightly constrain stack and dynamic memory
+ * usage.  At the same time, parsing is kept flexible and the code
+ * fairly compact by parsing based on a list of AML opcode
+ * templates in aml_op_info[]
+ */
+
+#include <acpi/acpi.h>
+#include <acpi/acparser.h>
+#include <acpi/acdispat.h>
+#include <acpi/amlcode.h>
+
+#define _COMPONENT          ACPI_PARSER
+        ACPI_MODULE_NAME    ("psloop")
+
+static u32                          acpi_gbl_depth = 0;
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ps_parse_loop
+ *
+ * PARAMETERS:  walk_state          - Current state
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Parse AML (pointed to by the current parser state) and return
+ *              a tree of ops.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ps_parse_loop (
+       struct acpi_walk_state          *walk_state)
+{
+       acpi_status                     status = AE_OK;
+       acpi_status                     status2;
+       union acpi_parse_object         *op = NULL;     /* current op */
+       union acpi_parse_object         *arg = NULL;
+       union acpi_parse_object         *pre_op = NULL;
+       struct acpi_parse_state         *parser_state;
+       u8                              *aml_op_start = NULL;
+
+
+       ACPI_FUNCTION_TRACE_PTR ("ps_parse_loop", walk_state);
+
+       if (walk_state->descending_callback == NULL) {
+               return_ACPI_STATUS (AE_BAD_PARAMETER);
+       }
+
+       parser_state = &walk_state->parser_state;
+       walk_state->arg_types = 0;
+
+#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
+
+       if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) {
+               /* We are restarting a preempted control method */
+
+               if (acpi_ps_has_completed_scope (parser_state)) {
+                       /*
+                        * We must check if a predicate to an IF or WHILE statement
+                        * was just completed
+                        */
+                       if ((parser_state->scope->parse_scope.op) &&
+                          ((parser_state->scope->parse_scope.op->common.aml_opcode == AML_IF_OP) ||
+                               (parser_state->scope->parse_scope.op->common.aml_opcode == AML_WHILE_OP)) &&
+                               (walk_state->control_state) &&
+                               (walk_state->control_state->common.state ==
+                                       ACPI_CONTROL_PREDICATE_EXECUTING)) {
+                               /*
+                                * A predicate was just completed, get the value of the
+                                * predicate and branch based on that value
+                                */
+                               walk_state->op = NULL;
+                               status = acpi_ds_get_predicate_value (walk_state, ACPI_TO_POINTER (TRUE));
+                               if (ACPI_FAILURE (status) &&
+                                       ((status & AE_CODE_MASK) != AE_CODE_CONTROL)) {
+                                       if (status == AE_AML_NO_RETURN_VALUE) {
+                                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                                                       "Invoked method did not return a value, %s\n",
+                                                       acpi_format_exception (status)));
+
+                                       }
+                                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                                               "get_predicate Failed, %s\n",
+                                               acpi_format_exception (status)));
+                                       return_ACPI_STATUS (status);
+                               }
+
+                               status = acpi_ps_next_parse_state (walk_state, op, status);
+                       }
+
+                       acpi_ps_pop_scope (parser_state, &op,
+                               &walk_state->arg_types, &walk_state->arg_count);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op));
+               }
+               else if (walk_state->prev_op) {
+                       /* We were in the middle of an op */
+
+                       op = walk_state->prev_op;
+                       walk_state->arg_types = walk_state->prev_arg_types;
+               }
+       }
+#endif
+
+       /* Iterative parsing loop, while there is more AML to process: */
+
+       while ((parser_state->aml < parser_state->aml_end) || (op)) {
+               aml_op_start = parser_state->aml;
+               if (!op) {
+                       /* Get the next opcode from the AML stream */
+
+                       walk_state->aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml,
+                                         parser_state->aml_start);
+                       walk_state->opcode   = acpi_ps_peek_opcode (parser_state);
+
+                       /*
+                        * First cut to determine what we have found:
+                        * 1) A valid AML opcode
+                        * 2) A name string
+                        * 3) An unknown/invalid opcode
+                        */
+                       walk_state->op_info = acpi_ps_get_opcode_info (walk_state->opcode);
+                       switch (walk_state->op_info->class) {
+                       case AML_CLASS_ASCII:
+                       case AML_CLASS_PREFIX:
+                               /*
+                                * Starts with a valid prefix or ASCII char, this is a name
+                                * string.  Convert the bare name string to a namepath.
+                                */
+                               walk_state->opcode = AML_INT_NAMEPATH_OP;
+                               walk_state->arg_types = ARGP_NAMESTRING;
+                               break;
+
+                       case AML_CLASS_UNKNOWN:
+
+                               /* The opcode is unrecognized.  Just skip unknown opcodes */
+
+                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                                       "Found unknown opcode %X at AML address %p offset %X, ignoring\n",
+                                       walk_state->opcode, parser_state->aml, walk_state->aml_offset));
+
+                               ACPI_DUMP_BUFFER (parser_state->aml, 128);
+
+                               /* Assume one-byte bad opcode */
+
+                               parser_state->aml++;
+                               continue;
+
+                       default:
+
+                               /* Found opcode info, this is a normal opcode */
+
+                               parser_state->aml += acpi_ps_get_opcode_size (walk_state->opcode);
+                               walk_state->arg_types = walk_state->op_info->parse_args;
+                               break;
+                       }
+
+                       /* Create Op structure and append to parent's argument list */
+
+                       if (walk_state->op_info->flags & AML_NAMED) {
+                               /* Allocate a new pre_op if necessary */
+
+                               if (!pre_op) {
+                                       pre_op = acpi_ps_alloc_op (walk_state->opcode);
+                                       if (!pre_op) {
+                                               status = AE_NO_MEMORY;
+                                               goto close_this_op;
+                                       }
+                               }
+
+                               pre_op->common.value.arg = NULL;
+                               pre_op->common.aml_opcode = walk_state->opcode;
+
+                               /*
+                                * Get and append arguments until we find the node that contains
+                                * the name (the type ARGP_NAME).
+                                */
+                               while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) &&
+                                         (GET_CURRENT_ARG_TYPE (walk_state->arg_types) != ARGP_NAME)) {
+                                       status = acpi_ps_get_next_arg (walk_state, parser_state,
+                                                        GET_CURRENT_ARG_TYPE (walk_state->arg_types), &arg);
+                                       if (ACPI_FAILURE (status)) {
+                                               goto close_this_op;
+                                       }
+
+                                       acpi_ps_append_arg (pre_op, arg);
+                                       INCREMENT_ARG_LIST (walk_state->arg_types);
+                               }
+
+                               /*
+                                * Make sure that we found a NAME and didn't run out of
+                                * arguments
+                                */
+                               if (!GET_CURRENT_ARG_TYPE (walk_state->arg_types)) {
+                                       status = AE_AML_NO_OPERAND;
+                                       goto close_this_op;
+                               }
+
+                               /* We know that this arg is a name, move to next arg */
+
+                               INCREMENT_ARG_LIST (walk_state->arg_types);
+
+                               /*
+                                * Find the object.  This will either insert the object into
+                                * the namespace or simply look it up
+                                */
+                               walk_state->op = NULL;
+
+                               status = walk_state->descending_callback (walk_state, &op);
+                               if (ACPI_FAILURE (status)) {
+                                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+                                               "During name lookup/catalog, %s\n",
+                                               acpi_format_exception (status)));
+                                       goto close_this_op;
+                               }
+
+                               if (!op) {
+                                       continue;
+                               }
+
+                               status = acpi_ps_next_parse_state (walk_state, op, status);
+                               if (status == AE_CTRL_PENDING) {
+                                       status = AE_OK;
+                                       goto close_this_op;
+                               }
+
+                               if (ACPI_FAILURE (status)) {
+                                       goto close_this_op;
+                               }
+
+                               acpi_ps_append_arg (op, pre_op->common.value.arg);
+                               acpi_gbl_depth++;
+
+                               if (op->common.aml_opcode == AML_REGION_OP) {
+                                       /*
+                                        * Defer final parsing of an operation_region body,
+                                        * because we don't have enough info in the first pass
+                                        * to parse it correctly (i.e., there may be method
+                                        * calls within the term_arg elements of the body.)
+                                        *
+                                        * However, we must continue parsing because
+                                        * the opregion is not a standalone package --
+                                        * we don't know where the end is at this point.
+                                        *
+                                        * (Length is unknown until parse of the body complete)
+                                        */
+                                       op->named.data    = aml_op_start;
+                                       op->named.length  = 0;
+                               }
+                       }
+                       else {
+                               /* Not a named opcode, just allocate Op and append to parent */
+
+                               walk_state->op_info = acpi_ps_get_opcode_info (walk_state->opcode);
+                               op = acpi_ps_alloc_op (walk_state->opcode);
+                               if (!op) {
+                                       status = AE_NO_MEMORY;
+                                       goto close_this_op;
+                               }
+
+                               if (walk_state->op_info->flags & AML_CREATE) {
+                                       /*
+                                        * Backup to beginning of create_xXXfield declaration
+                                        * body_length is unknown until we parse the body
+                                        */
+                                       op->named.data    = aml_op_start;
+                                       op->named.length  = 0;
+                               }
+
+                               acpi_ps_append_arg (acpi_ps_get_parent_scope (parser_state), op);
+
+                               if ((walk_state->descending_callback != NULL)) {
+                                       /*
+                                        * Find the object. This will either insert the object into
+                                        * the namespace or simply look it up
+                                        */
+                                       walk_state->op = op;
+
+                                       status = walk_state->descending_callback (walk_state, &op);
+                                       status = acpi_ps_next_parse_state (walk_state, op, status);
+                                       if (status == AE_CTRL_PENDING) {
+                                               status = AE_OK;
+                                               goto close_this_op;
+                                       }
+
+                                       if (ACPI_FAILURE (status)) {
+                                               goto close_this_op;
+                                       }
+                               }
+                       }
+
+                       op->common.aml_offset = walk_state->aml_offset;
+
+                       if (walk_state->op_info) {
+                               ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+                                       "Opcode %4.4X [%s] Op %p Aml %p aml_offset %5.5X\n",
+                                        (u32) op->common.aml_opcode, walk_state->op_info->name,
+                                        op, parser_state->aml, op->common.aml_offset));
+                       }
+               }
+
+
+               /*
+                * Start arg_count at zero because we don't know if there are
+                * any args yet
+                */
+               walk_state->arg_count = 0;
+
+               /* Are there any arguments that must be processed? */
+
+               if (walk_state->arg_types) {
+                       /* Get arguments */
+
+                       switch (op->common.aml_opcode) {
+                       case AML_BYTE_OP:       /* AML_BYTEDATA_ARG */
+                       case AML_WORD_OP:       /* AML_WORDDATA_ARG */
+                       case AML_DWORD_OP:      /* AML_DWORDATA_ARG */
+                       case AML_QWORD_OP:      /* AML_QWORDATA_ARG */
+                       case AML_STRING_OP:     /* AML_ASCIICHARLIST_ARG */
+
+                               /* Fill in constant or string argument directly */
+
+                               acpi_ps_get_next_simple_arg (parser_state,
+                                       GET_CURRENT_ARG_TYPE (walk_state->arg_types), op);
+                               break;
+
+                       case AML_INT_NAMEPATH_OP:   /* AML_NAMESTRING_ARG */
+
+                               status = acpi_ps_get_next_namepath (walk_state, parser_state, op, 1);
+                               if (ACPI_FAILURE (status)) {
+                                       goto close_this_op;
+                               }
+
+                               walk_state->arg_types = 0;
+                               break;
+
+                       default:
+                               /*
+                                * Op is not a constant or string, append each argument
+                                * to the Op
+                                */
+                               while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) &&
+                                               !walk_state->arg_count) {
+                                       walk_state->aml_offset = (u32)
+                                               ACPI_PTR_DIFF (parser_state->aml, parser_state->aml_start);
+
+                                       status = acpi_ps_get_next_arg (walk_state, parser_state,
+                                                        GET_CURRENT_ARG_TYPE (walk_state->arg_types),
+                                                        &arg);
+                                       if (ACPI_FAILURE (status)) {
+                                               goto close_this_op;
+                                       }
+
+                                       if (arg) {
+                                               arg->common.aml_offset = walk_state->aml_offset;
+                                               acpi_ps_append_arg (op, arg);
+                                       }
+                                       INCREMENT_ARG_LIST (walk_state->arg_types);
+                               }
+
+
+                               /* Special processing for certain opcodes */
+
+       /* TBD (remove): Temporary mechanism to disable this code if needed */
+
+#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE
+
+                        if ((walk_state->pass_number <= ACPI_IMODE_LOAD_PASS1) &&
+                                  ((walk_state->parse_flags & ACPI_PARSE_DISASSEMBLE) == 0)) {
+                                       /*
+                                        * We want to skip If/Else/While constructs during Pass1
+                                        * because we want to actually conditionally execute the
+                                        * code during Pass2.
+                                        *
+                                        * Except for disassembly, where we always want to
+                                        * walk the If/Else/While packages
+                                        */
+                                       switch (op->common.aml_opcode) {
+                                       case AML_IF_OP:
+                                       case AML_ELSE_OP:
+                                       case AML_WHILE_OP:
+
+                                               ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+                                                       "Pass1: Skipping an If/Else/While body\n"));
+
+                                               /* Skip body of if/else/while in pass 1 */
+
+                                               parser_state->aml   = parser_state->pkg_end;
+                                               walk_state->arg_count = 0;
+                                               break;
+
+                                       default:
+                                               break;
+                                       }
+                               }
+#endif
+                               switch (op->common.aml_opcode) {
+                               case AML_METHOD_OP:
+
+                                       /*
+                                        * Skip parsing of control method
+                                        * because we don't have enough info in the first pass
+                                        * to parse it correctly.
+                                        *
+                                        * Save the length and address of the body
+                                        */
+                                       op->named.data   = parser_state->aml;
+                                       op->named.length = (u32) (parser_state->pkg_end -
+                                                          parser_state->aml);
+
+                                       /* Skip body of method */
+
+                                       parser_state->aml   = parser_state->pkg_end;
+                                       walk_state->arg_count = 0;
+                                       break;
+
+                               case AML_BUFFER_OP:
+                               case AML_PACKAGE_OP:
+                               case AML_VAR_PACKAGE_OP:
+
+                                       if ((op->common.parent) &&
+                                               (op->common.parent->common.aml_opcode == AML_NAME_OP) &&
+                                               (walk_state->pass_number <= ACPI_IMODE_LOAD_PASS2)) {
+                                               /*
+                                                * Skip parsing of Buffers and Packages
+                                                * because we don't have enough info in the first pass
+                                                * to parse them correctly.
+                                                */
+                                               op->named.data   = aml_op_start;
+                                               op->named.length = (u32) (parser_state->pkg_end -
+                                                                  aml_op_start);
+
+                                               /* Skip body */
+
+                                               parser_state->aml   = parser_state->pkg_end;
+                                               walk_state->arg_count = 0;
+                                       }
+                                       break;
+
+                               case AML_WHILE_OP:
+
+                                       if (walk_state->control_state) {
+                                               walk_state->control_state->control.package_end =
+                                                       parser_state->pkg_end;
+                                       }
+                                       break;
+
+                               default:
+
+                                       /* No action for all other opcodes */
+                                       break;
+                               }
+                               break;
+                       }
+               }
+
+               /* Check for arguments that need to be processed */
+
+               if (walk_state->arg_count) {
+                       /*
+                        * There are arguments (complex ones), push Op and
+                        * prepare for argument
+                        */
+                       status = acpi_ps_push_scope (parser_state, op,
+                                        walk_state->arg_types, walk_state->arg_count);
+                       if (ACPI_FAILURE (status)) {
+                               goto close_this_op;
+                       }
+                       op = NULL;
+                       continue;
+               }
+
+               /*
+                * All arguments have been processed -- Op is complete,
+                * prepare for next
+                */
+               walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
+               if (walk_state->op_info->flags & AML_NAMED) {
+                       if (acpi_gbl_depth) {
+                               acpi_gbl_depth--;
+                       }
+
+                       if (op->common.aml_opcode == AML_REGION_OP) {
+                               /*
+                                * Skip parsing of control method or opregion body,
+                                * because we don't have enough info in the first pass
+                                * to parse them correctly.
+                                *
+                                * Completed parsing an op_region declaration, we now
+                                * know the length.
+                                */
+                               op->named.length = (u32) (parser_state->aml - op->named.data);
+                       }
+               }
+
+               if (walk_state->op_info->flags & AML_CREATE) {
+                       /*
+                        * Backup to beginning of create_xXXfield declaration (1 for
+                        * Opcode)
+                        *
+                        * body_length is unknown until we parse the body
+                        */
+                       op->named.length = (u32) (parser_state->aml - op->named.data);
+               }
+
+               /* This op complete, notify the dispatcher */
+
+               if (walk_state->ascending_callback != NULL) {
+                       walk_state->op    = op;
+                       walk_state->opcode = op->common.aml_opcode;
+
+                       status = walk_state->ascending_callback (walk_state);
+                       status = acpi_ps_next_parse_state (walk_state, op, status);
+                       if (status == AE_CTRL_PENDING) {
+                               status = AE_OK;
+                               goto close_this_op;
+                       }
+               }
+
+
+close_this_op:
+               /*
+                * Finished one argument of the containing scope
+                */
+               parser_state->scope->parse_scope.arg_count--;
+
+               /* Finished with pre_op */
+
+               if (pre_op) {
+                       acpi_ps_free_op (pre_op);
+                       pre_op = NULL;
+               }
+
+               /* Close this Op (will result in parse subtree deletion) */
+
+               status2 = acpi_ps_complete_this_op (walk_state, op);
+               if (ACPI_FAILURE (status2)) {
+                       return_ACPI_STATUS (status2);
+               }
+               op = NULL;
+
+               switch (status) {
+               case AE_OK:
+                       break;
+
+
+               case AE_CTRL_TRANSFER:
+
+                       /* We are about to transfer to a called method. */
+
+                       walk_state->prev_op = op;
+                       walk_state->prev_arg_types = walk_state->arg_types;
+                       return_ACPI_STATUS (status);
+
+
+               case AE_CTRL_END:
+
+                       acpi_ps_pop_scope (parser_state, &op,
+                               &walk_state->arg_types, &walk_state->arg_count);
+
+                       if (op) {
+                               walk_state->op    = op;
+                               walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
+                               walk_state->opcode = op->common.aml_opcode;
+
+                               status = walk_state->ascending_callback (walk_state);
+                               status = acpi_ps_next_parse_state (walk_state, op, status);
+
+                               status2 = acpi_ps_complete_this_op (walk_state, op);
+                               if (ACPI_FAILURE (status2)) {
+                                       return_ACPI_STATUS (status2);
+                               }
+                               op = NULL;
+                       }
+                       status = AE_OK;
+                       break;
+
+
+               case AE_CTRL_BREAK:
+               case AE_CTRL_CONTINUE:
+
+                       /* Pop off scopes until we find the While */
+
+                       while (!op || (op->common.aml_opcode != AML_WHILE_OP)) {
+                               acpi_ps_pop_scope (parser_state, &op,
+                                       &walk_state->arg_types, &walk_state->arg_count);
+                       }
+
+                       /* Close this iteration of the While loop */
+
+                       walk_state->op    = op;
+                       walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
+                       walk_state->opcode = op->common.aml_opcode;
+
+                       status = walk_state->ascending_callback (walk_state);
+                       status = acpi_ps_next_parse_state (walk_state, op, status);
+
+                       status2 = acpi_ps_complete_this_op (walk_state, op);
+                       if (ACPI_FAILURE (status2)) {
+                               return_ACPI_STATUS (status2);
+                       }
+                       op = NULL;
+
+                       status = AE_OK;
+                       break;
+
+
+               case AE_CTRL_TERMINATE:
+
+                       status = AE_OK;
+
+                       /* Clean up */
+                       do {
+                               if (op) {
+                                       status2 = acpi_ps_complete_this_op (walk_state, op);
+                                       if (ACPI_FAILURE (status2)) {
+                                               return_ACPI_STATUS (status2);
+                                       }
+                               }
+                               acpi_ps_pop_scope (parser_state, &op,
+                                       &walk_state->arg_types, &walk_state->arg_count);
+
+                       } while (op);
+
+                       return_ACPI_STATUS (status);
+
+
+               default:  /* All other non-AE_OK status */
+
+                       do {
+                               if (op) {
+                                       status2 = acpi_ps_complete_this_op (walk_state, op);
+                                       if (ACPI_FAILURE (status2)) {
+                                               return_ACPI_STATUS (status2);
+                                       }
+                               }
+                               acpi_ps_pop_scope (parser_state, &op,
+                                       &walk_state->arg_types, &walk_state->arg_count);
+
+                       } while (op);
+
+
+                       /*
+                        * TBD: Cleanup parse ops on error
+                        */
+#if 0
+                       if (op == NULL) {
+                               acpi_ps_pop_scope (parser_state, &op,
+                                       &walk_state->arg_types, &walk_state->arg_count);
+                       }
+#endif
+                       walk_state->prev_op = op;
+                       walk_state->prev_arg_types = walk_state->arg_types;
+                       return_ACPI_STATUS (status);
+               }
+
+               /* This scope complete? */
+
+               if (acpi_ps_has_completed_scope (parser_state)) {
+                       acpi_ps_pop_scope (parser_state, &op,
+                               &walk_state->arg_types, &walk_state->arg_count);
+                       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op));
+               }
+               else {
+                       op = NULL;
+               }
+
+       } /* while parser_state->Aml */
+
+
+       /*
+        * Complete the last Op (if not completed), and clear the scope stack.
+        * It is easily possible to end an AML "package" with an unbounded number
+        * of open scopes (such as when several ASL blocks are closed with
+        * sequential closing braces).  We want to terminate each one cleanly.
+        */
+       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "AML package complete at Op %p\n", op));
+       do {
+               if (op) {
+                       if (walk_state->ascending_callback != NULL) {
+                               walk_state->op    = op;
+                               walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
+                               walk_state->opcode = op->common.aml_opcode;
+
+                               status = walk_state->ascending_callback (walk_state);
+                               status = acpi_ps_next_parse_state (walk_state, op, status);
+                               if (status == AE_CTRL_PENDING) {
+                                       status = AE_OK;
+                                       goto close_this_op;
+                               }
+
+                               if (status == AE_CTRL_TERMINATE) {
+                                       status = AE_OK;
+
+                                       /* Clean up */
+                                       do {
+                                               if (op) {
+                                                       status2 = acpi_ps_complete_this_op (walk_state, op);
+                                                       if (ACPI_FAILURE (status2)) {
+                                                               return_ACPI_STATUS (status2);
+                                                       }
+                                               }
+
+                                               acpi_ps_pop_scope (parser_state, &op,
+                                                       &walk_state->arg_types, &walk_state->arg_count);
+
+                                       } while (op);
+
+                                       return_ACPI_STATUS (status);
+                               }
+
+                               else if (ACPI_FAILURE (status)) {
+                                       /* First error is most important */
+
+                                       (void) acpi_ps_complete_this_op (walk_state, op);
+                                       return_ACPI_STATUS (status);
+                               }
+                       }
+
+                       status2 = acpi_ps_complete_this_op (walk_state, op);
+                       if (ACPI_FAILURE (status2)) {
+                               return_ACPI_STATUS (status2);
+                       }
+               }
+
+               acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types,
+                       &walk_state->arg_count);
+
+       } while (op);
+
+       return_ACPI_STATUS (status);
+}
+
+
index 5744673568c0a3bbc8100de14179dea48d785be1..6f7594a516d2dc188bdaad7735360d266f4fd6b9 100644 (file)
@@ -311,7 +311,7 @@ const struct acpi_opcode_info     acpi_gbl_aml_op_info[AML_NUM_OPCODES] =
 /* ACPI 2.0 opcodes */
 
 /* 6E */ ACPI_OP ("QwordConst",         ARGP_QWORD_OP,             ARGI_QWORD_OP,              ACPI_TYPE_INTEGER,           AML_CLASS_ARGUMENT,        AML_TYPE_LITERAL,         AML_CONSTANT),
-/* 6F */ ACPI_OP ("Package /*Var*/",    ARGP_VAR_PACKAGE_OP,       ARGI_VAR_PACKAGE_OP,        ACPI_TYPE_PACKAGE,           AML_CLASS_CREATE,          AML_TYPE_CREATE_OBJECT,   AML_HAS_ARGS | AML_DEFER),
+/* 6F */ ACPI_OP ("Package", /* Var */  ARGP_VAR_PACKAGE_OP,       ARGI_VAR_PACKAGE_OP,        ACPI_TYPE_PACKAGE,           AML_CLASS_CREATE,          AML_TYPE_CREATE_OBJECT,   AML_HAS_ARGS | AML_DEFER),
 /* 70 */ ACPI_OP ("ConcatenateResTemplate", ARGP_CONCAT_RES_OP,    ARGI_CONCAT_RES_OP,         ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
 /* 71 */ ACPI_OP ("Mod",                ARGP_MOD_OP,               ARGI_MOD_OP,                ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
 /* 72 */ ACPI_OP ("CreateQWordField",   ARGP_CREATE_QWORD_FIELD_OP,ARGI_CREATE_QWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD,      AML_CLASS_CREATE,          AML_TYPE_CREATE_FIELD,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
@@ -428,33 +428,23 @@ acpi_ps_get_opcode_info (
        /*
         * Detect normal 8-bit opcode or extended 16-bit opcode
         */
-       switch ((u8) (opcode >> 8)) {
-       case 0:
-
+       if (!(opcode & 0xFF00)) {
                /* Simple (8-bit) opcode: 0-255, can't index beyond table  */
 
                return (&acpi_gbl_aml_op_info [acpi_gbl_short_op_index [(u8) opcode]]);
+       }
 
-       case AML_EXTOP:
-
-               /* Extended (16-bit, prefix+opcode) opcode */
-
-               if (((u8) opcode) <= MAX_EXTENDED_OPCODE) {
-                       return (&acpi_gbl_aml_op_info [acpi_gbl_long_op_index [(u8) opcode]]);
-               }
-
-               /* Else fall through to error case below */
-               /*lint -fallthrough */
-
-       default:
+       if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) &&
+               (((u8) opcode) <= MAX_EXTENDED_OPCODE)) {
+               /* Valid extended (16-bit) opcode */
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Unknown AML opcode [%4.4X]\n", opcode));
-               break;
+               return (&acpi_gbl_aml_op_info [acpi_gbl_long_op_index [(u8) opcode]]);
        }
 
+       /* Unknown AML opcode */
 
-       /* Default is "unknown opcode" */
+       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+               "Unknown AML opcode [%4.4X]\n", opcode));
 
        return (&acpi_gbl_aml_op_info [_UNK]);
 }
index bbfdc1a58c27aeaca93bd97acb85a1ef46846515..16b84a3d04368704d0401f4a3fe38a05fc004cda 100644 (file)
         ACPI_MODULE_NAME    ("psparse")
 
 
-static u32                          acpi_gbl_depth = 0;
-
-/* Local prototypes */
-
-static void
-acpi_ps_complete_this_op (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op);
-
-static acpi_status
-acpi_ps_next_parse_state (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op,
-       acpi_status                     callback_status);
-
-static acpi_status
-acpi_ps_parse_loop (
-       struct acpi_walk_state          *walk_state);
-
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_get_opcode_size
@@ -134,8 +114,8 @@ acpi_ps_peek_opcode (
        aml = parser_state->aml;
        opcode = (u16) ACPI_GET8 (aml);
 
-       if (opcode == AML_EXTOP) {
-               /* Extended opcode */
+       if (opcode == AML_EXTENDED_OP_PREFIX) {
+               /* Extended opcode, get the second opcode byte */
 
                aml++;
                opcode = (u16) ((opcode << 8) | ACPI_GET8 (aml));
@@ -152,13 +132,13 @@ acpi_ps_peek_opcode (
  * PARAMETERS:  walk_state      - Current State
  *              Op              - Op to complete
  *
- * RETURN:      None.
+ * RETURN:      Status
  *
  * DESCRIPTION: Perform any cleanup at the completion of an Op.
  *
  ******************************************************************************/
 
-static void
+acpi_status
 acpi_ps_complete_this_op (
        struct acpi_walk_state          *walk_state,
        union acpi_parse_object         *op)
@@ -175,19 +155,26 @@ acpi_ps_complete_this_op (
        /* Check for null Op, can happen if AML code is corrupt */
 
        if (!op) {
-               return_VOID;
+               return_ACPI_STATUS (AE_OK);  /* OK for now */
        }
 
        /* Delete this op and the subtree below it if asked to */
 
        if (((walk_state->parse_flags & ACPI_PARSE_TREE_MASK) != ACPI_PARSE_DELETE_TREE) ||
                 (walk_state->op_info->class == AML_CLASS_ARGUMENT)) {
-               return_VOID;
+               return_ACPI_STATUS (AE_OK);
        }
 
        /* Make sure that we only delete this subtree */
 
        if (op->common.parent) {
+               prev = op->common.parent->common.value.arg;
+               if (!prev) {
+                       /* Nothing more to do */
+
+                       goto cleanup;
+               }
+
                /*
                 * Check if we need to replace the operator and its subtree
                 * with a return value op (placeholder op)
@@ -206,7 +193,7 @@ acpi_ps_complete_this_op (
                         */
                        replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
                        if (!replacement_op) {
-                               goto cleanup;
+                               goto allocate_error;
                        }
                        break;
 
@@ -223,18 +210,17 @@ acpi_ps_complete_this_op (
                                (op->common.parent->common.aml_opcode == AML_VAR_PACKAGE_OP)) {
                                replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
                                if (!replacement_op) {
-                                       goto cleanup;
+                                       goto allocate_error;
                                }
                        }
-
-                       if ((op->common.parent->common.aml_opcode == AML_NAME_OP) &&
-                               (walk_state->descending_callback != acpi_ds_exec_begin_op)) {
+                       else if ((op->common.parent->common.aml_opcode == AML_NAME_OP) &&
+                                        (walk_state->pass_number <= ACPI_IMODE_LOAD_PASS2)) {
                                if ((op->common.aml_opcode == AML_BUFFER_OP) ||
                                        (op->common.aml_opcode == AML_PACKAGE_OP) ||
                                        (op->common.aml_opcode == AML_VAR_PACKAGE_OP)) {
                                        replacement_op = acpi_ps_alloc_op (op->common.aml_opcode);
                                        if (!replacement_op) {
-                                               goto cleanup;
+                                               goto allocate_error;
                                        }
 
                                        replacement_op->named.data = op->named.data;
@@ -244,15 +230,15 @@ acpi_ps_complete_this_op (
                        break;
 
                default:
+
                        replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
                        if (!replacement_op) {
-                               goto cleanup;
+                               goto allocate_error;
                        }
                }
 
                /* We must unlink this op from the parent tree */
 
-               prev = op->common.parent->common.value.arg;
                if (prev == op) {
                        /* This op is the first in the list */
 
@@ -298,7 +284,15 @@ cleanup:
        /* Now we can actually delete the subtree rooted at Op */
 
        acpi_ps_delete_parse_tree (op);
-       return_VOID;
+       return_ACPI_STATUS (AE_OK);
+
+
+allocate_error:
+
+       /* Always delete the subtree, even on error */
+
+       acpi_ps_delete_parse_tree (op);
+       return_ACPI_STATUS (AE_NO_MEMORY);
 }
 
 
@@ -317,7 +311,7 @@ cleanup:
  *
  ******************************************************************************/
 
-static acpi_status
+acpi_status
 acpi_ps_next_parse_state (
        struct acpi_walk_state          *walk_state,
        union acpi_parse_object         *op,
@@ -425,663 +419,6 @@ acpi_ps_next_parse_state (
 }
 
 
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ps_parse_loop
- *
- * PARAMETERS:  walk_state          - Current state
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Parse AML (pointed to by the current parser state) and return
- *              a tree of ops.
- *
- ******************************************************************************/
-
-static acpi_status
-acpi_ps_parse_loop (
-       struct acpi_walk_state          *walk_state)
-{
-       acpi_status                     status = AE_OK;
-       union acpi_parse_object         *op = NULL;     /* current op */
-       union acpi_parse_object         *arg = NULL;
-       union acpi_parse_object         *pre_op = NULL;
-       struct acpi_parse_state         *parser_state;
-       u8                              *aml_op_start = NULL;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ps_parse_loop", walk_state);
-
-       if (walk_state->descending_callback == NULL) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
-       }
-
-       parser_state = &walk_state->parser_state;
-       walk_state->arg_types = 0;
-
-#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
-
-       if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) {
-               /* We are restarting a preempted control method */
-
-               if (acpi_ps_has_completed_scope (parser_state)) {
-                       /*
-                        * We must check if a predicate to an IF or WHILE statement
-                        * was just completed
-                        */
-                       if ((parser_state->scope->parse_scope.op) &&
-                          ((parser_state->scope->parse_scope.op->common.aml_opcode == AML_IF_OP) ||
-                               (parser_state->scope->parse_scope.op->common.aml_opcode == AML_WHILE_OP)) &&
-                               (walk_state->control_state) &&
-                               (walk_state->control_state->common.state ==
-                                       ACPI_CONTROL_PREDICATE_EXECUTING)) {
-                               /*
-                                * A predicate was just completed, get the value of the
-                                * predicate and branch based on that value
-                                */
-                               walk_state->op = NULL;
-                               status = acpi_ds_get_predicate_value (walk_state, ACPI_TO_POINTER (TRUE));
-                               if (ACPI_FAILURE (status) &&
-                                       ((status & AE_CODE_MASK) != AE_CODE_CONTROL)) {
-                                       if (status == AE_AML_NO_RETURN_VALUE) {
-                                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                                       "Invoked method did not return a value, %s\n",
-                                                       acpi_format_exception (status)));
-
-                                       }
-                                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                               "get_predicate Failed, %s\n",
-                                               acpi_format_exception (status)));
-                                       return_ACPI_STATUS (status);
-                               }
-
-                               status = acpi_ps_next_parse_state (walk_state, op, status);
-                       }
-
-                       acpi_ps_pop_scope (parser_state, &op,
-                               &walk_state->arg_types, &walk_state->arg_count);
-                       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op));
-               }
-               else if (walk_state->prev_op) {
-                       /* We were in the middle of an op */
-
-                       op = walk_state->prev_op;
-                       walk_state->arg_types = walk_state->prev_arg_types;
-               }
-       }
-#endif
-
-       /* Iterative parsing loop, while there is more AML to process: */
-
-       while ((parser_state->aml < parser_state->aml_end) || (op)) {
-               aml_op_start = parser_state->aml;
-               if (!op) {
-                       /* Get the next opcode from the AML stream */
-
-                       walk_state->aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml,
-                                         parser_state->aml_start);
-                       walk_state->opcode   = acpi_ps_peek_opcode (parser_state);
-
-                       /*
-                        * First cut to determine what we have found:
-                        * 1) A valid AML opcode
-                        * 2) A name string
-                        * 3) An unknown/invalid opcode
-                        */
-                       walk_state->op_info = acpi_ps_get_opcode_info (walk_state->opcode);
-                       switch (walk_state->op_info->class) {
-                       case AML_CLASS_ASCII:
-                       case AML_CLASS_PREFIX:
-                               /*
-                                * Starts with a valid prefix or ASCII char, this is a name
-                                * string.  Convert the bare name string to a namepath.
-                                */
-                               walk_state->opcode = AML_INT_NAMEPATH_OP;
-                               walk_state->arg_types = ARGP_NAMESTRING;
-                               break;
-
-                       case AML_CLASS_UNKNOWN:
-
-                               /* The opcode is unrecognized.  Just skip unknown opcodes */
-
-                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                       "Found unknown opcode %X at AML address %p offset %X, ignoring\n",
-                                       walk_state->opcode, parser_state->aml, walk_state->aml_offset));
-
-                               ACPI_DUMP_BUFFER (parser_state->aml, 128);
-
-                               /* Assume one-byte bad opcode */
-
-                               parser_state->aml++;
-                               continue;
-
-                       default:
-
-                               /* Found opcode info, this is a normal opcode */
-
-                               parser_state->aml += acpi_ps_get_opcode_size (walk_state->opcode);
-                               walk_state->arg_types = walk_state->op_info->parse_args;
-                               break;
-                       }
-
-                       /* Create Op structure and append to parent's argument list */
-
-                       if (walk_state->op_info->flags & AML_NAMED) {
-                               /* Allocate a new pre_op if necessary */
-
-                               if (!pre_op) {
-                                       pre_op = acpi_ps_alloc_op (walk_state->opcode);
-                                       if (!pre_op) {
-                                               status = AE_NO_MEMORY;
-                                               goto close_this_op;
-                                       }
-                               }
-
-                               pre_op->common.value.arg = NULL;
-                               pre_op->common.aml_opcode = walk_state->opcode;
-
-                               /*
-                                * Get and append arguments until we find the node that contains
-                                * the name (the type ARGP_NAME).
-                                */
-                               while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) &&
-                                         (GET_CURRENT_ARG_TYPE (walk_state->arg_types) != ARGP_NAME)) {
-                                       status = acpi_ps_get_next_arg (walk_state, parser_state,
-                                                        GET_CURRENT_ARG_TYPE (walk_state->arg_types), &arg);
-                                       if (ACPI_FAILURE (status)) {
-                                               goto close_this_op;
-                                       }
-
-                                       acpi_ps_append_arg (pre_op, arg);
-                                       INCREMENT_ARG_LIST (walk_state->arg_types);
-                               }
-
-                               /*
-                                * Make sure that we found a NAME and didn't run out of
-                                * arguments
-                                */
-                               if (!GET_CURRENT_ARG_TYPE (walk_state->arg_types)) {
-                                       status = AE_AML_NO_OPERAND;
-                                       goto close_this_op;
-                               }
-
-                               /* We know that this arg is a name, move to next arg */
-
-                               INCREMENT_ARG_LIST (walk_state->arg_types);
-
-                               /*
-                                * Find the object.  This will either insert the object into
-                                * the namespace or simply look it up
-                                */
-                               walk_state->op = NULL;
-
-                               status = walk_state->descending_callback (walk_state, &op);
-                               if (ACPI_FAILURE (status)) {
-                                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                               "During name lookup/catalog, %s\n",
-                                               acpi_format_exception (status)));
-                                       goto close_this_op;
-                               }
-
-                               if (!op) {
-                                       continue;
-                               }
-
-                               status = acpi_ps_next_parse_state (walk_state, op, status);
-                               if (status == AE_CTRL_PENDING) {
-                                       status = AE_OK;
-                                       goto close_this_op;
-                               }
-
-                               if (ACPI_FAILURE (status)) {
-                                       goto close_this_op;
-                               }
-
-                               acpi_ps_append_arg (op, pre_op->common.value.arg);
-                               acpi_gbl_depth++;
-
-                               if (op->common.aml_opcode == AML_REGION_OP) {
-                                       /*
-                                        * Defer final parsing of an operation_region body,
-                                        * because we don't have enough info in the first pass
-                                        * to parse it correctly (i.e., there may be method
-                                        * calls within the term_arg elements of the body.)
-                                        *
-                                        * However, we must continue parsing because
-                                        * the opregion is not a standalone package --
-                                        * we don't know where the end is at this point.
-                                        *
-                                        * (Length is unknown until parse of the body complete)
-                                        */
-                                       op->named.data    = aml_op_start;
-                                       op->named.length  = 0;
-                               }
-                       }
-                       else {
-                               /* Not a named opcode, just allocate Op and append to parent */
-
-                               walk_state->op_info = acpi_ps_get_opcode_info (walk_state->opcode);
-                               op = acpi_ps_alloc_op (walk_state->opcode);
-                               if (!op) {
-                                       status = AE_NO_MEMORY;
-                                       goto close_this_op;
-                               }
-
-                               if (walk_state->op_info->flags & AML_CREATE) {
-                                       /*
-                                        * Backup to beginning of create_xXXfield declaration
-                                        * body_length is unknown until we parse the body
-                                        */
-                                       op->named.data    = aml_op_start;
-                                       op->named.length  = 0;
-                               }
-
-                               acpi_ps_append_arg (acpi_ps_get_parent_scope (parser_state), op);
-
-                               if ((walk_state->descending_callback != NULL)) {
-                                       /*
-                                        * Find the object. This will either insert the object into
-                                        * the namespace or simply look it up
-                                        */
-                                       walk_state->op = op;
-
-                                       status = walk_state->descending_callback (walk_state, &op);
-                                       status = acpi_ps_next_parse_state (walk_state, op, status);
-                                       if (status == AE_CTRL_PENDING) {
-                                               status = AE_OK;
-                                               goto close_this_op;
-                                       }
-
-                                       if (ACPI_FAILURE (status)) {
-                                               goto close_this_op;
-                                       }
-                               }
-                       }
-
-                       op->common.aml_offset = walk_state->aml_offset;
-
-                       if (walk_state->op_info) {
-                               ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
-                                       "Opcode %4.4X [%s] Op %p Aml %p aml_offset %5.5X\n",
-                                        (u32) op->common.aml_opcode, walk_state->op_info->name,
-                                        op, parser_state->aml, op->common.aml_offset));
-                       }
-               }
-
-
-               /*
-                * Start arg_count at zero because we don't know if there are
-                * any args yet
-                */
-               walk_state->arg_count = 0;
-
-               /* Are there any arguments that must be processed? */
-
-               if (walk_state->arg_types) {
-                       /* Get arguments */
-
-                       switch (op->common.aml_opcode) {
-                       case AML_BYTE_OP:       /* AML_BYTEDATA_ARG */
-                       case AML_WORD_OP:       /* AML_WORDDATA_ARG */
-                       case AML_DWORD_OP:      /* AML_DWORDATA_ARG */
-                       case AML_QWORD_OP:      /* AML_QWORDATA_ARG */
-                       case AML_STRING_OP:     /* AML_ASCIICHARLIST_ARG */
-
-                               /* Fill in constant or string argument directly */
-
-                               acpi_ps_get_next_simple_arg (parser_state,
-                                       GET_CURRENT_ARG_TYPE (walk_state->arg_types), op);
-                               break;
-
-                       case AML_INT_NAMEPATH_OP:   /* AML_NAMESTRING_ARG */
-
-                               status = acpi_ps_get_next_namepath (walk_state, parser_state, op, 1);
-                               if (ACPI_FAILURE (status)) {
-                                       goto close_this_op;
-                               }
-
-                               walk_state->arg_types = 0;
-                               break;
-
-                       default:
-
-                               /*
-                                * Op is not a constant or string, append each argument
-                                * to the Op
-                                */
-                               while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) &&
-                                               !walk_state->arg_count) {
-                                       walk_state->aml_offset = (u32)
-                                               ACPI_PTR_DIFF (parser_state->aml, parser_state->aml_start);
-
-                                       status = acpi_ps_get_next_arg (walk_state, parser_state,
-                                                        GET_CURRENT_ARG_TYPE (walk_state->arg_types),
-                                                        &arg);
-                                       if (ACPI_FAILURE (status)) {
-                                               goto close_this_op;
-                                       }
-
-                                       if (arg) {
-                                               arg->common.aml_offset = walk_state->aml_offset;
-                                               acpi_ps_append_arg (op, arg);
-                                       }
-                                       INCREMENT_ARG_LIST (walk_state->arg_types);
-                               }
-
-                               /* Special processing for certain opcodes */
-
-                               switch (op->common.aml_opcode) {
-                               case AML_METHOD_OP:
-
-                                       /*
-                                        * Skip parsing of control method
-                                        * because we don't have enough info in the first pass
-                                        * to parse it correctly.
-                                        *
-                                        * Save the length and address of the body
-                                        */
-                                       op->named.data   = parser_state->aml;
-                                       op->named.length = (u32) (parser_state->pkg_end -
-                                                          parser_state->aml);
-
-                                       /* Skip body of method */
-
-                                       parser_state->aml   = parser_state->pkg_end;
-                                       walk_state->arg_count = 0;
-                                       break;
-
-                               case AML_BUFFER_OP:
-                               case AML_PACKAGE_OP:
-                               case AML_VAR_PACKAGE_OP:
-
-                                       if ((op->common.parent) &&
-                                               (op->common.parent->common.aml_opcode == AML_NAME_OP) &&
-                                               (walk_state->descending_callback != acpi_ds_exec_begin_op)) {
-                                               /*
-                                                * Skip parsing of Buffers and Packages
-                                                * because we don't have enough info in the first pass
-                                                * to parse them correctly.
-                                                */
-                                               op->named.data   = aml_op_start;
-                                               op->named.length = (u32) (parser_state->pkg_end -
-                                                                  aml_op_start);
-
-                                               /* Skip body */
-
-                                               parser_state->aml   = parser_state->pkg_end;
-                                               walk_state->arg_count = 0;
-                                       }
-                                       break;
-
-                               case AML_WHILE_OP:
-
-                                       if (walk_state->control_state) {
-                                               walk_state->control_state->control.package_end =
-                                                       parser_state->pkg_end;
-                                       }
-                                       break;
-
-                               default:
-
-                                       /* No action for all other opcodes */
-                                       break;
-                               }
-                               break;
-                       }
-               }
-
-               /* Check for arguments that need to be processed */
-
-               if (walk_state->arg_count) {
-                       /*
-                        * There are arguments (complex ones), push Op and
-                        * prepare for argument
-                        */
-                       status = acpi_ps_push_scope (parser_state, op,
-                                        walk_state->arg_types, walk_state->arg_count);
-                       if (ACPI_FAILURE (status)) {
-                               goto close_this_op;
-                       }
-                       op = NULL;
-                       continue;
-               }
-
-               /*
-                * All arguments have been processed -- Op is complete,
-                * prepare for next
-                */
-               walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
-               if (walk_state->op_info->flags & AML_NAMED) {
-                       if (acpi_gbl_depth) {
-                               acpi_gbl_depth--;
-                       }
-
-                       if (op->common.aml_opcode == AML_REGION_OP) {
-                               /*
-                                * Skip parsing of control method or opregion body,
-                                * because we don't have enough info in the first pass
-                                * to parse them correctly.
-                                *
-                                * Completed parsing an op_region declaration, we now
-                                * know the length.
-                                */
-                               op->named.length = (u32) (parser_state->aml - op->named.data);
-                       }
-               }
-
-               if (walk_state->op_info->flags & AML_CREATE) {
-                       /*
-                        * Backup to beginning of create_xXXfield declaration (1 for
-                        * Opcode)
-                        *
-                        * body_length is unknown until we parse the body
-                        */
-                       op->named.length = (u32) (parser_state->aml - op->named.data);
-               }
-
-               /* This op complete, notify the dispatcher */
-
-               if (walk_state->ascending_callback != NULL) {
-                       walk_state->op    = op;
-                       walk_state->opcode = op->common.aml_opcode;
-
-                       status = walk_state->ascending_callback (walk_state);
-                       status = acpi_ps_next_parse_state (walk_state, op, status);
-                       if (status == AE_CTRL_PENDING) {
-                               status = AE_OK;
-                               goto close_this_op;
-                       }
-               }
-
-
-close_this_op:
-               /*
-                * Finished one argument of the containing scope
-                */
-               parser_state->scope->parse_scope.arg_count--;
-
-               /* Close this Op (will result in parse subtree deletion) */
-
-               acpi_ps_complete_this_op (walk_state, op);
-               op = NULL;
-               if (pre_op) {
-                       acpi_ps_free_op (pre_op);
-                       pre_op = NULL;
-               }
-
-               switch (status) {
-               case AE_OK:
-                       break;
-
-
-               case AE_CTRL_TRANSFER:
-
-                       /* We are about to transfer to a called method. */
-
-                       walk_state->prev_op = op;
-                       walk_state->prev_arg_types = walk_state->arg_types;
-                       return_ACPI_STATUS (status);
-
-
-               case AE_CTRL_END:
-
-                       acpi_ps_pop_scope (parser_state, &op,
-                               &walk_state->arg_types, &walk_state->arg_count);
-
-                       if (op) {
-                               walk_state->op    = op;
-                               walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
-                               walk_state->opcode = op->common.aml_opcode;
-
-                               status = walk_state->ascending_callback (walk_state);
-                               status = acpi_ps_next_parse_state (walk_state, op, status);
-
-                               acpi_ps_complete_this_op (walk_state, op);
-                               op = NULL;
-                       }
-                       status = AE_OK;
-                       break;
-
-
-               case AE_CTRL_BREAK:
-               case AE_CTRL_CONTINUE:
-
-                       /* Pop off scopes until we find the While */
-
-                       while (!op || (op->common.aml_opcode != AML_WHILE_OP)) {
-                               acpi_ps_pop_scope (parser_state, &op,
-                                       &walk_state->arg_types, &walk_state->arg_count);
-                       }
-
-                       /* Close this iteration of the While loop */
-
-                       walk_state->op    = op;
-                       walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
-                       walk_state->opcode = op->common.aml_opcode;
-
-                       status = walk_state->ascending_callback (walk_state);
-                       status = acpi_ps_next_parse_state (walk_state, op, status);
-
-                       acpi_ps_complete_this_op (walk_state, op);
-                       op = NULL;
-
-                       status = AE_OK;
-                       break;
-
-
-               case AE_CTRL_TERMINATE:
-
-                       status = AE_OK;
-
-                       /* Clean up */
-                       do {
-                               if (op) {
-                                       acpi_ps_complete_this_op (walk_state, op);
-                               }
-                               acpi_ps_pop_scope (parser_state, &op,
-                                       &walk_state->arg_types, &walk_state->arg_count);
-
-                       } while (op);
-
-                       return_ACPI_STATUS (status);
-
-
-               default:  /* All other non-AE_OK status */
-
-                       do {
-                               if (op) {
-                                       acpi_ps_complete_this_op (walk_state, op);
-                               }
-                               acpi_ps_pop_scope (parser_state, &op,
-                                       &walk_state->arg_types, &walk_state->arg_count);
-
-                       } while (op);
-
-
-                       /*
-                        * TBD: Cleanup parse ops on error
-                        */
-#if 0
-                       if (op == NULL) {
-                               acpi_ps_pop_scope (parser_state, &op,
-                                       &walk_state->arg_types, &walk_state->arg_count);
-                       }
-#endif
-                       walk_state->prev_op = op;
-                       walk_state->prev_arg_types = walk_state->arg_types;
-                       return_ACPI_STATUS (status);
-               }
-
-               /* This scope complete? */
-
-               if (acpi_ps_has_completed_scope (parser_state)) {
-                       acpi_ps_pop_scope (parser_state, &op,
-                               &walk_state->arg_types, &walk_state->arg_count);
-                       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op));
-               }
-               else {
-                       op = NULL;
-               }
-
-       } /* while parser_state->Aml */
-
-
-       /*
-        * Complete the last Op (if not completed), and clear the scope stack.
-        * It is easily possible to end an AML "package" with an unbounded number
-        * of open scopes (such as when several ASL blocks are closed with
-        * sequential closing braces).  We want to terminate each one cleanly.
-        */
-       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "AML package complete at Op %p\n", op));
-       do {
-               if (op) {
-                       if (walk_state->ascending_callback != NULL) {
-                               walk_state->op    = op;
-                               walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
-                               walk_state->opcode = op->common.aml_opcode;
-
-                               status = walk_state->ascending_callback (walk_state);
-                               status = acpi_ps_next_parse_state (walk_state, op, status);
-                               if (status == AE_CTRL_PENDING) {
-                                       status = AE_OK;
-                                       goto close_this_op;
-                               }
-
-                               if (status == AE_CTRL_TERMINATE) {
-                                       status = AE_OK;
-
-                                       /* Clean up */
-                                       do {
-                                               if (op) {
-                                                       acpi_ps_complete_this_op (walk_state, op);
-                                               }
-
-                                               acpi_ps_pop_scope (parser_state, &op,
-                                                       &walk_state->arg_types, &walk_state->arg_count);
-
-                                       } while (op);
-
-                                       return_ACPI_STATUS (status);
-                               }
-
-                               else if (ACPI_FAILURE (status)) {
-                                       acpi_ps_complete_this_op (walk_state, op);
-                                       return_ACPI_STATUS (status);
-                               }
-                       }
-
-                       acpi_ps_complete_this_op (walk_state, op);
-               }
-
-               acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types,
-                       &walk_state->arg_count);
-
-       } while (op);
-
-       return_ACPI_STATUS (status);
-}
-
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_parse_aml
index a10f88715d43b96dbf26187349686d0c85be9b7a..4221b41ae1a6ac4117ac2331c270eaee0b2eda40 100644 (file)
@@ -154,12 +154,14 @@ acpi_ps_alloc_op (
        if (flags == ACPI_PARSEOP_GENERIC) {
                /* The generic op (default) is by far the most common (16 to 1) */
 
-               op = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_PSNODE);
+               op = acpi_os_acquire_object (acpi_gbl_ps_node_cache);
+               memset(op, 0, sizeof(struct acpi_parse_obj_common));
        }
        else {
                /* Extended parseop */
 
-               op = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_PSNODE_EXT);
+               op = acpi_os_acquire_object (acpi_gbl_ps_node_ext_cache);
+               memset(op, 0, sizeof(struct acpi_parse_obj_named));
        }
 
        /* Initialize the Op */
@@ -198,41 +200,14 @@ acpi_ps_free_op (
        }
 
        if (op->common.flags & ACPI_PARSEOP_GENERIC) {
-               acpi_ut_release_to_cache (ACPI_MEM_LIST_PSNODE, op);
+               (void) acpi_os_release_object (acpi_gbl_ps_node_cache, op);
        }
        else {
-               acpi_ut_release_to_cache (ACPI_MEM_LIST_PSNODE_EXT, op);
+               (void) acpi_os_release_object (acpi_gbl_ps_node_ext_cache, op);
        }
 }
 
 
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ps_delete_parse_cache
- *
- * PARAMETERS:  None
- *
- * RETURN:      None
- *
- * DESCRIPTION: Free all objects that are on the parse cache list.
- *
- ******************************************************************************/
-
-void
-acpi_ps_delete_parse_cache (
-       void)
-{
-       ACPI_FUNCTION_TRACE ("ps_delete_parse_cache");
-
-
-       acpi_ut_delete_generic_cache (ACPI_MEM_LIST_PSNODE);
-       acpi_ut_delete_generic_cache (ACPI_MEM_LIST_PSNODE_EXT);
-       return_VOID;
-}
-#endif
-
-
 /*******************************************************************************
  *
  * FUNCTION:    Utility functions
index dba893648e84b762cba90073ba1b5df05b29bd5f..d1541fabaf0a87d0e64f7e8fa6d158739b1276c7 100644 (file)
 #include <acpi/acparser.h>
 #include <acpi/acdispat.h>
 #include <acpi/acinterp.h>
-#include <acpi/acnamesp.h>
 
 
 #define _COMPONENT          ACPI_PARSER
         ACPI_MODULE_NAME    ("psxface")
 
+/* Local Prototypes */
+
+static acpi_status
+acpi_ps_execute_pass (
+       struct acpi_parameter_info      *info);
+
+static void
+acpi_ps_update_parameter_list (
+       struct acpi_parameter_info      *info,
+       u16                             action);
+
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_psx_execute
+ * FUNCTION:    acpi_ps_execute_method
  *
  * PARAMETERS:  Info            - Method info block, contains:
  *                  Node            - Method Node to execute
+ *                  obj_desc        - Method object
  *                  Parameters      - List of parameters to pass to the method,
  *                                    terminated by NULL. Params itself may be
  *                                    NULL if no parameters are being passed.
@@ -67,6 +78,7 @@
  *                  parameter_type  - Type of Parameter list
  *                  return_object   - Where to put method's return value (if
  *                                    any). If NULL, no value is returned.
+ *                  pass_number     - Parse or execute pass
  *
  * RETURN:      Status
  *
  ******************************************************************************/
 
 acpi_status
-acpi_psx_execute (
+acpi_ps_execute_method (
        struct acpi_parameter_info      *info)
 {
        acpi_status                     status;
-       union acpi_operand_object       *obj_desc;
-       u32                             i;
-       union acpi_parse_object         *op;
-       struct acpi_walk_state          *walk_state;
 
 
-       ACPI_FUNCTION_TRACE ("psx_execute");
+       ACPI_FUNCTION_TRACE ("ps_execute_method");
 
 
-       /* Validate the Node and get the attached object */
+       /* Validate the Info and method Node */
 
        if (!info || !info->node) {
                return_ACPI_STATUS (AE_NULL_ENTRY);
        }
 
-       obj_desc = acpi_ns_get_attached_object (info->node);
-       if (!obj_desc) {
-               return_ACPI_STATUS (AE_NULL_OBJECT);
-       }
-
        /* Init for new method, wait on concurrency semaphore */
 
-       status = acpi_ds_begin_method_execution (info->node, obj_desc, NULL);
+       status = acpi_ds_begin_method_execution (info->node, info->obj_desc, NULL);
        if (ACPI_FAILURE (status)) {
                return_ACPI_STATUS (status);
        }
 
-       if ((info->parameter_type == ACPI_PARAM_ARGS) &&
-               (info->parameters)) {
-               /*
-                * The caller "owns" the parameters, so give each one an extra
-                * reference
-                */
-               for (i = 0; info->parameters[i]; i++) {
-                       acpi_ut_add_reference (info->parameters[i]);
-               }
-       }
-
-       /*
-        * 1) Perform the first pass parse of the method to enter any
-        * named objects that it creates into the namespace
-        */
-       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
-               "**** Begin Method Parse **** Entry=%p obj=%p\n",
-               info->node, obj_desc));
-
-       /* Create and init a Root Node */
-
-       op = acpi_ps_create_scope_op ();
-       if (!op) {
-               status = AE_NO_MEMORY;
-               goto cleanup1;
-       }
-
        /*
         * Get a new owner_id for objects created by this method. Namespace
         * objects (such as Operation Regions) can be created during the
         * first pass parse.
         */
-       obj_desc->method.owning_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD);
-
-       /* Create and initialize a new walk state */
-
-       walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
-                          NULL, NULL, NULL);
-       if (!walk_state) {
-               status = AE_NO_MEMORY;
-               goto cleanup2;
-       }
-
-       status = acpi_ds_init_aml_walk (walk_state, op, info->node,
-                         obj_desc->method.aml_start,
-                         obj_desc->method.aml_length, NULL, 1);
+       status = acpi_ut_allocate_owner_id (&info->obj_desc->method.owner_id);
        if (ACPI_FAILURE (status)) {
-               goto cleanup3;
+               return_ACPI_STATUS (status);
        }
 
-       /* Parse the AML */
+       /*
+        * The caller "owns" the parameters, so give each one an extra
+        * reference
+        */
+       acpi_ps_update_parameter_list (info, REF_INCREMENT);
 
-       status = acpi_ps_parse_aml (walk_state);
-       acpi_ps_delete_parse_tree (op);
+       /*
+        * 1) Perform the first pass parse of the method to enter any
+        *    named objects that it creates into the namespace
+        */
+       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+               "**** Begin Method Parse **** Entry=%p obj=%p\n",
+               info->node, info->obj_desc));
+
+       info->pass_number = 1;
+       status = acpi_ps_execute_pass (info);
        if (ACPI_FAILURE (status)) {
-               goto cleanup1; /* Walk state is already deleted */
+               goto cleanup;
        }
 
        /*
-        * 2) Execute the method.  Performs second pass parse simultaneously
+        * 2) Execute the method. Performs second pass parse simultaneously
         */
        ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
                "**** Begin Method Execution **** Entry=%p obj=%p\n",
-               info->node, obj_desc));
+               info->node, info->obj_desc));
 
-       /* Create and init a Root Node */
+       info->pass_number = 3;
+       status = acpi_ps_execute_pass (info);
 
-       op = acpi_ps_create_scope_op ();
-       if (!op) {
-               status = AE_NO_MEMORY;
-               goto cleanup1;
+
+cleanup:
+       if (info->obj_desc->method.owner_id) {
+               acpi_ut_release_owner_id (&info->obj_desc->method.owner_id);
        }
 
-       /* Init new op with the method name and pointer back to the NS node */
+       /* Take away the extra reference that we gave the parameters above */
 
-       acpi_ps_set_name (op, info->node->name.integer);
-       op->common.node = info->node;
+       acpi_ps_update_parameter_list (info, REF_DECREMENT);
 
-       /* Create and initialize a new walk state */
+       /* Exit now if error above */
 
-       walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL);
-       if (!walk_state) {
-               status = AE_NO_MEMORY;
-               goto cleanup2;
+       if (ACPI_FAILURE (status)) {
+               return_ACPI_STATUS (status);
        }
 
-       status = acpi_ds_init_aml_walk (walk_state, op, info->node,
-                         obj_desc->method.aml_start,
-                         obj_desc->method.aml_length, info, 3);
-       if (ACPI_FAILURE (status)) {
-               goto cleanup3;
+       /*
+        * If the method has returned an object, signal this to the caller with
+        * a control exception code
+        */
+       if (info->return_object) {
+               ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Method returned obj_desc=%p\n",
+                       info->return_object));
+               ACPI_DUMP_STACK_ENTRY (info->return_object);
+
+               status = AE_CTRL_RETURN_VALUE;
        }
 
-       /* The walk of the parse tree is where we actually execute the method */
+       return_ACPI_STATUS (status);
+}
 
-       status = acpi_ps_parse_aml (walk_state);
-       goto cleanup2; /* Walk state already deleted */
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ps_update_parameter_list
+ *
+ * PARAMETERS:  Info            - See struct acpi_parameter_info
+ *                                (Used: parameter_type and Parameters)
+ *              Action          - Add or Remove reference
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Update reference count on all method parameter objects
+ *
+ ******************************************************************************/
 
-cleanup3:
-       acpi_ds_delete_walk_state (walk_state);
+static void
+acpi_ps_update_parameter_list (
+       struct acpi_parameter_info      *info,
+       u16                             action)
+{
+       acpi_native_uint                i;
 
-cleanup2:
-       acpi_ps_delete_parse_tree (op);
 
-cleanup1:
        if ((info->parameter_type == ACPI_PARAM_ARGS) &&
                (info->parameters)) {
-               /* Take away the extra reference that we gave the parameters above */
+               /* Update reference count for each parameter */
 
                for (i = 0; info->parameters[i]; i++) {
                        /* Ignore errors, just do them all */
 
-                       (void) acpi_ut_update_object_reference (
-                                        info->parameters[i], REF_DECREMENT);
+                       (void) acpi_ut_update_object_reference (info->parameters[i], action);
                }
        }
+}
 
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ps_execute_pass
+ *
+ * PARAMETERS:  Info            - See struct acpi_parameter_info
+ *                                (Used: pass_number, Node, and obj_desc)
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Single AML pass: Parse or Execute a control method
+ *
+ ******************************************************************************/
+
+static acpi_status
+acpi_ps_execute_pass (
+       struct acpi_parameter_info      *info)
+{
+       acpi_status                     status;
+       union acpi_parse_object         *op;
+       struct acpi_walk_state          *walk_state;
+
+
+       ACPI_FUNCTION_TRACE ("ps_execute_pass");
+
+
+       /* Create and init a Root Node */
+
+       op = acpi_ps_create_scope_op ();
+       if (!op) {
+               return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
-       /*
-        * If the method has returned an object, signal this to the caller with
-        * a control exception code
-        */
-       if (info->return_object) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Method returned obj_desc=%p\n",
-                       info->return_object));
-               ACPI_DUMP_STACK_ENTRY (info->return_object);
+       /* Create and initialize a new walk state */
 
-               status = AE_CTRL_RETURN_VALUE;
+       walk_state = acpi_ds_create_walk_state (
+                         info->obj_desc->method.owner_id, NULL, NULL, NULL);
+       if (!walk_state) {
+               status = AE_NO_MEMORY;
+               goto cleanup;
+       }
+
+       status = acpi_ds_init_aml_walk (walk_state, op, info->node,
+                         info->obj_desc->method.aml_start,
+                         info->obj_desc->method.aml_length,
+                         info->pass_number == 1 ? NULL : info,
+                         info->pass_number);
+       if (ACPI_FAILURE (status)) {
+               acpi_ds_delete_walk_state (walk_state);
+               goto cleanup;
        }
 
+       /* Parse the AML */
+
+       status = acpi_ps_parse_aml (walk_state);
+
+       /* Walk state was deleted by parse_aml */
+
+cleanup:
+       acpi_ps_delete_parse_tree (op);
        return_ACPI_STATUS (status);
 }
 
index 1935dab2ab5164b2bdf09ea1d26235eb0fb8d0f4..2c3bb8c35741041ab4c8a25d363911216eaa07f4 100644 (file)
@@ -48,6 +48,9 @@
 #define _COMPONENT          ACPI_RESOURCES
         ACPI_MODULE_NAME    ("rsdump")
 
+
+#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+
 /* Local prototypes */
 
 static void
@@ -103,7 +106,6 @@ acpi_rs_dump_vendor_specific (
        union acpi_resource_data        *data);
 
 
-#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_dump_irq
index 92e0c31539bec52af192cc7ba940d5d5f99bcccf..d4ff71f5fe5d4f74428cea847c601ad5351846d2 100644 (file)
@@ -97,7 +97,9 @@ acpi_tb_get_table_count (
        ACPI_FUNCTION_ENTRY ();
 
 
-       if (RSDP->revision < 2) {
+       /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */
+
+       if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
                pointer_size = sizeof (u32);
        }
        else {
@@ -158,7 +160,9 @@ acpi_tb_convert_to_xsdt (
        /* Copy the table pointers */
 
        for (i = 0; i < acpi_gbl_rsdt_table_count; i++) {
-               if (acpi_gbl_RSDP->revision < 2) {
+               /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */
+
+               if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
                        ACPI_STORE_ADDRESS (new_table->table_offset_entry[i],
                                (ACPI_CAST_PTR (struct rsdt_descriptor_rev1,
                                        table_info->pointer))->table_offset_entry[i]);
index 629b64c8193da1858a69b54f68a64f07f22ab528..698799901f55cfed40b0aa5c09c487dbc8c6c6b6 100644 (file)
@@ -124,9 +124,7 @@ acpi_tb_match_signature (
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Load and validate all tables other than the RSDT.  The RSDT must
- *              already be loaded and validated.
- *              Install the table into the global data structs.
+ * DESCRIPTION: Install the table into the global data structures.
  *
  ******************************************************************************/
 
@@ -136,6 +134,7 @@ acpi_tb_install_table (
 {
        acpi_status                     status;
 
+
        ACPI_FUNCTION_TRACE ("tb_install_table");
 
 
@@ -143,22 +142,33 @@ acpi_tb_install_table (
 
        status = acpi_ut_acquire_mutex (ACPI_MTX_TABLES);
        if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_ERROR (("Could not acquire table mutex for [%4.4s], %s\n",
-                       table_info->pointer->signature, acpi_format_exception (status)));
+               ACPI_REPORT_ERROR (("Could not acquire table mutex, %s\n",
+                       acpi_format_exception (status)));
                return_ACPI_STATUS (status);
        }
 
+       /*
+        * Ignore a table that is already installed. For example, some BIOS
+        * ASL code will repeatedly attempt to load the same SSDT.
+        */
+       status = acpi_tb_is_table_installed (table_info);
+       if (ACPI_FAILURE (status)) {
+               goto unlock_and_exit;
+       }
+
        /* Install the table into the global data structure */
 
        status = acpi_tb_init_table_descriptor (table_info->type, table_info);
        if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_ERROR (("Could not install ACPI table [%4.4s], %s\n",
+               ACPI_REPORT_ERROR (("Could not install table [%4.4s], %s\n",
                        table_info->pointer->signature, acpi_format_exception (status)));
        }
 
        ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s located at %p\n",
                acpi_gbl_table_data[table_info->type].name, table_info->pointer));
 
+
+unlock_and_exit:
        (void) acpi_ut_release_mutex (ACPI_MTX_TABLES);
        return_ACPI_STATUS (status);
 }
@@ -251,6 +261,7 @@ acpi_tb_init_table_descriptor (
 {
        struct acpi_table_list          *list_head;
        struct acpi_table_desc          *table_desc;
+       acpi_status                     status;
 
 
        ACPI_FUNCTION_TRACE_U32 ("tb_init_table_descriptor", table_type);
@@ -263,6 +274,13 @@ acpi_tb_init_table_descriptor (
                return_ACPI_STATUS (AE_NO_MEMORY);
        }
 
+       /* Get a new owner ID for the table */
+
+       status = acpi_ut_allocate_owner_id (&table_desc->owner_id);
+       if (ACPI_FAILURE (status)) {
+               return_ACPI_STATUS (status);
+       }
+
        /* Install the table into the global data structure */
 
        list_head = &acpi_gbl_table_lists[table_type];
@@ -325,8 +343,6 @@ acpi_tb_init_table_descriptor (
        table_desc->aml_start           = (u8 *) (table_desc->pointer + 1),
        table_desc->aml_length          = (u32) (table_desc->length -
                         (u32) sizeof (struct acpi_table_header));
-       table_desc->table_id            = acpi_ut_allocate_owner_id (
-                        ACPI_OWNER_TYPE_TABLE);
        table_desc->loaded_into_namespace = FALSE;
 
        /*
@@ -339,7 +355,7 @@ acpi_tb_init_table_descriptor (
 
        /* Return Data */
 
-       table_info->table_id        = table_desc->table_id;
+       table_info->owner_id        = table_desc->owner_id;
        table_info->installed_desc  = table_desc;
 
        return_ACPI_STATUS (AE_OK);
index b7ffe39c3626197d81d8baa515d07555910ec45d..069d498465d0a1221012ec7a190cf93ac82a69c5 100644 (file)
@@ -96,32 +96,13 @@ acpi_tb_verify_rsdp (
                return_ACPI_STATUS (AE_BAD_PARAMETER);
        }
 
-       /*
-        *  The signature and checksum must both be correct
-        */
-       if (ACPI_STRNCMP ((char *) rsdp, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) {
-               /* Nope, BAD Signature */
-
-               status = AE_BAD_SIGNATURE;
-               goto cleanup;
-       }
-
-       /* Check the standard checksum */
+       /* Verify RSDP signature and checksum */
 
-       if (acpi_tb_checksum (rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
-               status = AE_BAD_CHECKSUM;
+       status = acpi_tb_validate_rsdp (rsdp);
+       if (ACPI_FAILURE (status)) {
                goto cleanup;
        }
 
-       /* Check extended checksum if table version >= 2 */
-
-       if (rsdp->revision >= 2) {
-               if (acpi_tb_checksum (rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0) {
-                       status = AE_BAD_CHECKSUM;
-                       goto cleanup;
-               }
-       }
-
        /* The RSDP supplied is OK */
 
        table_info.pointer     = ACPI_CAST_PTR (struct acpi_table_header, rsdp);
@@ -159,8 +140,8 @@ cleanup:
  *
  * RETURN:      None, Address
  *
- * DESCRIPTION: Extract the address of the RSDT or XSDT, depending on the
- *              version of the RSDP
+ * DESCRIPTION: Extract the address of either the RSDT or XSDT, depending on the
+ *              version of the RSDP and whether the XSDT pointer is valid
  *
  ******************************************************************************/
 
@@ -174,16 +155,19 @@ acpi_tb_get_rsdt_address (
 
        out_address->pointer_type = acpi_gbl_table_flags | ACPI_LOGICAL_ADDRESSING;
 
-       /*
-        * For RSDP revision 0 or 1, we use the RSDT.
-        * For RSDP revision 2 (and above), we use the XSDT
-        */
-       if (acpi_gbl_RSDP->revision < 2) {
-               out_address->pointer.value = acpi_gbl_RSDP->rsdt_physical_address;
-       }
-       else {
+       /* Use XSDT if it is present */
+
+       if ((acpi_gbl_RSDP->revision >= 2) &&
+               acpi_gbl_RSDP->xsdt_physical_address) {
                out_address->pointer.value =
                        acpi_gbl_RSDP->xsdt_physical_address;
+               acpi_gbl_root_table_type = ACPI_TABLE_TYPE_XSDT;
+       }
+       else {
+               /* No XSDT, use the RSDT */
+
+               out_address->pointer.value = acpi_gbl_RSDP->rsdt_physical_address;
+               acpi_gbl_root_table_type = ACPI_TABLE_TYPE_RSDT;
        }
 }
 
@@ -211,10 +195,9 @@ acpi_tb_validate_rsdt (
 
 
        /*
-        * For RSDP revision 0 or 1, we use the RSDT.
-        * For RSDP revision 2 and above, we use the XSDT
+        * Search for appropriate signature, RSDT or XSDT
         */
-       if (acpi_gbl_RSDP->revision < 2) {
+       if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
                no_match = ACPI_STRNCMP ((char *) table_ptr, RSDT_SIG,
                                  sizeof (RSDT_SIG) -1);
        }
@@ -236,11 +219,11 @@ acpi_tb_validate_rsdt (
                        acpi_gbl_RSDP->rsdt_physical_address,
                        (void *) (acpi_native_uint) acpi_gbl_RSDP->rsdt_physical_address));
 
-               if (acpi_gbl_RSDP->revision < 2) {
-                       ACPI_REPORT_ERROR (("Looking for RSDT (RSDP->Rev < 2)\n"))
+               if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
+                       ACPI_REPORT_ERROR (("Looking for RSDT\n"))
                }
                else {
-                       ACPI_REPORT_ERROR (("Looking for XSDT (RSDP->Rev >= 2)\n"))
+                       ACPI_REPORT_ERROR (("Looking for XSDT\n"))
                }
 
                ACPI_DUMP_BUFFER ((char *) table_ptr, 48);
index e69d01d443d22773e84ce75965619cc45598fff0..6fc1e36e6042675d112fb4c9d9d1284de52eba44 100644 (file)
@@ -59,6 +59,67 @@ acpi_tb_handle_to_object (
 #endif
 
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_tb_is_table_installed
+ *
+ * PARAMETERS:  new_table_desc      - Descriptor for new table being installed
+ *
+ * RETURN:      Status - AE_ALREADY_EXISTS if the table is already installed
+ *
+ * DESCRIPTION: Determine if an ACPI table is already installed
+ *
+ * MUTEX:       Table data structures should be locked
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_tb_is_table_installed (
+       struct acpi_table_desc          *new_table_desc)
+{
+       struct acpi_table_desc          *table_desc;
+
+
+       ACPI_FUNCTION_TRACE ("tb_is_table_installed");
+
+
+       /* Get the list descriptor and first table descriptor */
+
+       table_desc = acpi_gbl_table_lists[new_table_desc->type].next;
+
+       /* Examine all installed tables of this type */
+
+       while (table_desc) {
+               /* Compare Revision and oem_table_id */
+
+               if ((table_desc->loaded_into_namespace) &&
+                       (table_desc->pointer->revision ==
+                                       new_table_desc->pointer->revision) &&
+                       (!ACPI_MEMCMP (table_desc->pointer->oem_table_id,
+                                       new_table_desc->pointer->oem_table_id, 8))) {
+                       /* This table is already installed */
+
+                       ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
+                               "Table [%4.4s] already installed: Rev %X oem_table_id [%8.8s]\n",
+                               new_table_desc->pointer->signature,
+                               new_table_desc->pointer->revision,
+                               new_table_desc->pointer->oem_table_id));
+
+                       new_table_desc->owner_id    = table_desc->owner_id;
+                       new_table_desc->installed_desc = table_desc;
+
+                       return_ACPI_STATUS (AE_ALREADY_EXISTS);
+               }
+
+               /* Get next table on the list */
+
+               table_desc = table_desc->next;
+       }
+
+       return_ACPI_STATUS (AE_OK);
+}
+
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_validate_table_header
@@ -157,7 +218,7 @@ acpi_tb_verify_table_checksum (
 
        /* Compute the checksum on the table */
 
-       checksum = acpi_tb_checksum (table_header, table_header->length);
+       checksum = acpi_tb_generate_checksum (table_header, table_header->length);
 
        /* Return the appropriate exception */
 
@@ -175,7 +236,7 @@ acpi_tb_verify_table_checksum (
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_tb_checksum
+ * FUNCTION:    acpi_tb_generate_checksum
  *
  * PARAMETERS:  Buffer              - Buffer to checksum
  *              Length              - Size of the buffer
@@ -187,7 +248,7 @@ acpi_tb_verify_table_checksum (
  ******************************************************************************/
 
 u8
-acpi_tb_checksum (
+acpi_tb_generate_checksum (
        void                            *buffer,
        u32                             length)
 {
index 0c0b9085dbeb954843881f6bd865f85118191585..e18a05d1b9b334d2b8686d0653e20035d0a85abb 100644 (file)
@@ -182,10 +182,23 @@ acpi_load_table (
                return_ACPI_STATUS (status);
        }
 
+       /* Check signature for a valid table type */
+
+       status = acpi_tb_recognize_table (&table_info, ACPI_TABLE_ALL);
+       if (ACPI_FAILURE (status)) {
+               return_ACPI_STATUS (status);
+       }
+
        /* Install the new table into the local data structures */
 
        status = acpi_tb_install_table (&table_info);
        if (ACPI_FAILURE (status)) {
+               if (status == AE_ALREADY_EXISTS) {
+                       /* Table already exists, no error */
+
+                       status = AE_OK;
+               }
+
                /* Free table allocated by acpi_tb_get_table_body */
 
                acpi_tb_delete_single_table (&table_info);
@@ -260,8 +273,8 @@ acpi_unload_table (
                 * "Scope" operator.  Thus, we need to track ownership by an ID, not
                 * simply a position within the hierarchy
                 */
-               acpi_ns_delete_namespace_by_owner (table_desc->table_id);
-
+               acpi_ns_delete_namespace_by_owner (table_desc->owner_id);
+               acpi_ut_release_owner_id (&table_desc->owner_id);
                table_desc = table_desc->next;
        }
 
index dc3c3f6a9f621d5c93cf39bfa39ae6c4ee101399..87dccdda9ae2c2c02913b0f8feb209699e1e12f3 100644 (file)
@@ -63,6 +63,51 @@ acpi_tb_scan_memory_for_rsdp (
        u32                             length);
 
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_tb_validate_rsdp
+ *
+ * PARAMETERS:  Rsdp        - Pointer to unvalidated RSDP
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Validate the RSDP (ptr)
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_tb_validate_rsdp (
+       struct rsdp_descriptor          *rsdp)
+{
+       ACPI_FUNCTION_ENTRY ();
+
+
+       /*
+        *  The signature and checksum must both be correct
+        */
+       if (ACPI_STRNCMP ((char *) rsdp, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) {
+               /* Nope, BAD Signature */
+
+               return (AE_BAD_SIGNATURE);
+       }
+
+       /* Check the standard checksum */
+
+       if (acpi_tb_generate_checksum (rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
+               return (AE_BAD_CHECKSUM);
+       }
+
+       /* Check extended checksum if table version >= 2 */
+
+       if ((rsdp->revision >= 2) &&
+               (acpi_tb_generate_checksum (rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)) {
+               return (AE_BAD_CHECKSUM);
+       }
+
+       return (AE_OK);
+}
+
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_find_table
@@ -218,19 +263,11 @@ acpi_get_firmware_table (
                        acpi_gbl_RSDP = address.pointer.logical;
                }
 
-               /* The signature and checksum must both be correct */
-
-               if (ACPI_STRNCMP ((char *) acpi_gbl_RSDP, RSDP_SIG,
-                               sizeof (RSDP_SIG)-1) != 0) {
-                       /* Nope, BAD Signature */
-
-                       return_ACPI_STATUS (AE_BAD_SIGNATURE);
-               }
-
-               if (acpi_tb_checksum (acpi_gbl_RSDP, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
-                       /* Nope, BAD Checksum */
+               /* The RDSP signature and checksum must both be correct */
 
-                       return_ACPI_STATUS (AE_BAD_CHECKSUM);
+               status = acpi_tb_validate_rsdp (acpi_gbl_RSDP);
+               if (ACPI_FAILURE (status)) {
+                       return_ACPI_STATUS (status);
                }
        }
 
@@ -287,9 +324,11 @@ acpi_get_firmware_table (
         * requested table
         */
        for (i = 0, j = 0; i < table_count; i++) {
-               /* Get the next table pointer, handle RSDT vs. XSDT */
-
-               if (acpi_gbl_RSDP->revision < 2) {
+               /*
+                * Get the next table pointer, handle RSDT vs. XSDT
+                * RSDT pointers are 32 bits, XSDT pointers are 64 bits
+                */
+               if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
                        address.pointer.value = (ACPI_CAST_PTR (
                                RSDT_DESCRIPTOR, rsdt_info->pointer))->table_offset_entry[i];
                }
@@ -331,8 +370,10 @@ acpi_get_firmware_table (
 
 
 cleanup:
-       acpi_os_unmap_memory (rsdt_info->pointer,
-               (acpi_size) rsdt_info->pointer->length);
+       if (rsdt_info->pointer) {
+               acpi_os_unmap_memory (rsdt_info->pointer,
+                       (acpi_size) rsdt_info->pointer->length);
+       }
        ACPI_MEM_FREE (rsdt_info);
 
        if (header) {
@@ -410,9 +451,9 @@ acpi_tb_scan_memory_for_rsdp (
        u8                              *start_address,
        u32                             length)
 {
+       acpi_status                     status;
        u8                              *mem_rover;
        u8                              *end_address;
-       u8                              checksum;
 
 
        ACPI_FUNCTION_TRACE ("tb_scan_memory_for_rsdp");
@@ -424,45 +465,25 @@ acpi_tb_scan_memory_for_rsdp (
 
        for (mem_rover = start_address; mem_rover < end_address;
                 mem_rover += ACPI_RSDP_SCAN_STEP) {
-               /* The signature and checksum must both be correct */
-
-               if (ACPI_STRNCMP ((char *) mem_rover,
-                               RSDP_SIG, sizeof (RSDP_SIG) - 1) != 0) {
-                       /* No signature match, keep looking */
-
-                       continue;
-               }
-
-               /* Signature matches, check the appropriate checksum */
-
-               if ((ACPI_CAST_PTR (struct rsdp_descriptor, mem_rover))->revision < 2) {
-                       /* ACPI version 1.0 */
+               /* The RSDP signature and checksum must both be correct */
 
-                       checksum = acpi_tb_checksum (mem_rover, ACPI_RSDP_CHECKSUM_LENGTH);
-               }
-               else {
-                       /* Post ACPI 1.0, use extended_checksum */
-
-                       checksum = acpi_tb_checksum (mem_rover, ACPI_RSDP_XCHECKSUM_LENGTH);
-               }
-
-               if (checksum == 0) {
-                       /* Checksum valid, we have found a valid RSDP */
+               status = acpi_tb_validate_rsdp (ACPI_CAST_PTR (struct rsdp_descriptor, mem_rover));
+               if (ACPI_SUCCESS (status)) {
+                       /* Sig and checksum valid, we have found a real RSDP */
 
                        ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
                                "RSDP located at physical address %p\n", mem_rover));
                        return_PTR (mem_rover);
                }
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-                       "Found an RSDP at physical address %p, but it has a bad checksum\n",
-                       mem_rover));
+               /* No sig match or bad checksum, keep searching */
        }
 
        /* Searched entire block, no RSDP was found */
 
        ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-               "Searched entire block, no valid RSDP was found.\n"));
+               "Searched entire block from %p, valid RSDP was not found\n",
+               start_address));
        return_PTR (NULL);
 }
 
@@ -550,7 +571,7 @@ acpi_tb_find_rsdp (
                        acpi_os_unmap_memory (table_ptr, ACPI_EBDA_WINDOW_SIZE);
 
                        if (mem_rover) {
-                               /* Found it, return the physical address */
+                               /* Return the physical address */
 
                                physical_address += ACPI_PTR_DIFF (mem_rover, table_ptr);
 
@@ -579,7 +600,7 @@ acpi_tb_find_rsdp (
                acpi_os_unmap_memory (table_ptr, ACPI_HI_RSDP_WINDOW_SIZE);
 
                if (mem_rover) {
-                       /* Found it, return the physical address */
+                       /* Return the physical address */
 
                        physical_address =
                                ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (mem_rover, table_ptr);
@@ -610,7 +631,7 @@ acpi_tb_find_rsdp (
                                          ACPI_PHYSADDR_TO_PTR (physical_address),
                                          ACPI_EBDA_WINDOW_SIZE);
                        if (mem_rover) {
-                               /* Found it, return the physical address */
+                               /* Return the physical address */
 
                                table_info->physical_address = ACPI_TO_INTEGER (mem_rover);
                                return_ACPI_STATUS (AE_OK);
@@ -630,8 +651,9 @@ acpi_tb_find_rsdp (
                }
        }
 
-       /* RSDP signature was not found */
+       /* A valid RSDP was not found */
 
+       ACPI_REPORT_ERROR (("No valid RSDP was found\n"));
        return_ACPI_STATUS (AE_NOT_FOUND);
 }
 
index 939c447dd52a9d8f4f8842d481f67e98c99f9c40..e87108b7338ade83486c66bf142a90a487b5f825 100644 (file)
@@ -3,6 +3,6 @@
 #
 
 obj-y := utalloc.o  utdebug.o   uteval.o    utinit.o  utmisc.o    utxface.o \
-        utcopy.o   utdelete.o  utglobal.o  utmath.o  utobject.o
+        utcopy.o   utdelete.o  utglobal.o  utmath.o  utobject.o utstate.o utmutex.o utobject.o utcache.o
 
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
index c4e7f989a2bdce3762faa502d4f5887bf492d9d4..78270f50e625bda9bc73e3277cc2e220c47db68f 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Module Name: utalloc - local cache and memory allocation routines
+ * Module Name: utalloc - local memory allocation routines
  *
  *****************************************************************************/
 
 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
 static struct acpi_debug_mem_block *
 acpi_ut_find_allocation (
-       u32                             list_id,
        void                            *allocation);
 
 static acpi_status
 acpi_ut_track_allocation (
-       u32                             list_id,
        struct acpi_debug_mem_block     *address,
        acpi_size                       size,
        u8                              alloc_type,
@@ -67,206 +65,118 @@ acpi_ut_track_allocation (
 
 static acpi_status
 acpi_ut_remove_allocation (
-       u32                             list_id,
        struct acpi_debug_mem_block     *address,
        u32                             component,
        char                            *module,
        u32                             line);
 #endif /* ACPI_DBG_TRACK_ALLOCATIONS */
 
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_release_to_cache
- *
- * PARAMETERS:  list_id             - Memory list/cache ID
- *              Object              - The object to be released
- *
- * RETURN:      None
- *
- * DESCRIPTION: Release an object to the specified cache.  If cache is full,
- *              the object is deleted.
- *
- ******************************************************************************/
-
-void
-acpi_ut_release_to_cache (
-       u32                             list_id,
-       void                            *object)
-{
-       struct acpi_memory_list         *cache_info;
-
-
-       ACPI_FUNCTION_ENTRY ();
-
-
-       cache_info = &acpi_gbl_memory_lists[list_id];
-
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-
-       /* If walk cache is full, just free this wallkstate object */
-
-       if (cache_info->cache_depth >= cache_info->max_cache_depth) {
-               ACPI_MEM_FREE (object);
-               ACPI_MEM_TRACKING (cache_info->total_freed++);
-       }
-
-       /* Otherwise put this object back into the cache */
-
-       else {
-               if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES))) {
-                       return;
-               }
-
-               /* Mark the object as cached */
-
-               ACPI_MEMSET (object, 0xCA, cache_info->object_size);
-               ACPI_SET_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_CACHED);
-
-               /* Put the object at the head of the cache list */
-
-               * (ACPI_CAST_INDIRECT_PTR (char,
-                       &(((char *) object)[cache_info->link_offset]))) = cache_info->list_head;
-               cache_info->list_head = object;
-               cache_info->cache_depth++;
-
-               (void) acpi_ut_release_mutex (ACPI_MTX_CACHES);
-       }
-
-#else
-
-       /* Object cache is disabled; just free the object */
-
-       ACPI_MEM_FREE (object);
-       ACPI_MEM_TRACKING (cache_info->total_freed++);
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+static acpi_status
+acpi_ut_create_list (
+       char                            *list_name,
+       u16                             object_size,
+       struct acpi_memory_list         **return_cache);
 #endif
-}
 
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_ut_acquire_from_cache
+ * FUNCTION:    acpi_ut_create_caches
  *
- * PARAMETERS:  list_id             - Memory list ID
+ * PARAMETERS:  None
  *
- * RETURN:      A requested object.  NULL if the object could not be
- *              allocated.
+ * RETURN:      Status
  *
- * DESCRIPTION: Get an object from the specified cache.  If cache is empty,
- *              the object is allocated.
+ * DESCRIPTION: Create all local caches
  *
  ******************************************************************************/
 
-void *
-acpi_ut_acquire_from_cache (
-       u32                             list_id)
+acpi_status
+acpi_ut_create_caches (
+       void)
 {
-       struct acpi_memory_list         *cache_info;
-       void                            *object;
-
-
-       ACPI_FUNCTION_NAME ("ut_acquire_from_cache");
+       acpi_status                     status;
 
 
-       cache_info = &acpi_gbl_memory_lists[list_id];
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
 
-#ifdef ACPI_ENABLE_OBJECT_CACHE
+       /* Memory allocation lists */
 
-       if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES))) {
-               return (NULL);
+       status = acpi_ut_create_list ("Acpi-Global", 0,
+                        &acpi_gbl_global_list);
+       if (ACPI_FAILURE (status)) {
+               return (status);
        }
 
-       ACPI_MEM_TRACKING (cache_info->cache_requests++);
-
-       /* Check the cache first */
-
-       if (cache_info->list_head) {
-               /* There is an object available, use it */
-
-               object = cache_info->list_head;
-               cache_info->list_head = *(ACPI_CAST_INDIRECT_PTR (char,
-                                &(((char *) object)[cache_info->link_offset])));
-
-               ACPI_MEM_TRACKING (cache_info->cache_hits++);
-               cache_info->cache_depth--;
-
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object %p from %s\n",
-                       object, acpi_gbl_memory_lists[list_id].list_name));
+       status = acpi_ut_create_list ("Acpi-Namespace", sizeof (struct acpi_namespace_node),
+                        &acpi_gbl_ns_node_list);
+       if (ACPI_FAILURE (status)) {
+               return (status);
+       }
 #endif
 
-               if (ACPI_FAILURE (acpi_ut_release_mutex (ACPI_MTX_CACHES))) {
-                       return (NULL);
-               }
-
-               /* Clear (zero) the previously used Object */
+       /* Object Caches, for frequently used objects */
 
-               ACPI_MEMSET (object, 0, cache_info->object_size);
+       status = acpi_os_create_cache ("acpi_state", sizeof (union acpi_generic_state),
+                        ACPI_MAX_STATE_CACHE_DEPTH, &acpi_gbl_state_cache);
+       if (ACPI_FAILURE (status)) {
+               return (status);
        }
 
-       else {
-               /* The cache is empty, create a new object */
-
-               /* Avoid deadlock with ACPI_MEM_CALLOCATE */
-
-               if (ACPI_FAILURE (acpi_ut_release_mutex (ACPI_MTX_CACHES))) {
-                       return (NULL);
-               }
-
-               object = ACPI_MEM_CALLOCATE (cache_info->object_size);
-               ACPI_MEM_TRACKING (cache_info->total_allocated++);
+       status = acpi_os_create_cache ("acpi_parse", sizeof (struct acpi_parse_obj_common),
+                        ACPI_MAX_PARSE_CACHE_DEPTH, &acpi_gbl_ps_node_cache);
+       if (ACPI_FAILURE (status)) {
+               return (status);
        }
 
-#else
-
-       /* Object cache is disabled; just allocate the object */
+       status = acpi_os_create_cache ("acpi_parse_ext", sizeof (struct acpi_parse_obj_named),
+                        ACPI_MAX_EXTPARSE_CACHE_DEPTH, &acpi_gbl_ps_node_ext_cache);
+       if (ACPI_FAILURE (status)) {
+               return (status);
+       }
 
-       object = ACPI_MEM_CALLOCATE (cache_info->object_size);
-       ACPI_MEM_TRACKING (cache_info->total_allocated++);
-#endif
+       status = acpi_os_create_cache ("acpi_operand", sizeof (union acpi_operand_object),
+                        ACPI_MAX_OBJECT_CACHE_DEPTH, &acpi_gbl_operand_cache);
+       if (ACPI_FAILURE (status)) {
+               return (status);
+       }
 
-       return (object);
+       return (AE_OK);
 }
 
 
-#ifdef ACPI_ENABLE_OBJECT_CACHE
 /*******************************************************************************
  *
- * FUNCTION:    acpi_ut_delete_generic_cache
+ * FUNCTION:    acpi_ut_delete_caches
  *
- * PARAMETERS:  list_id         - Memory list ID
+ * PARAMETERS:  None
  *
- * RETURN:      None
+ * RETURN:      Status
  *
- * DESCRIPTION: Free all objects within the requested cache.
+ * DESCRIPTION: Purge and delete all local caches
  *
  ******************************************************************************/
 
-void
-acpi_ut_delete_generic_cache (
-       u32                             list_id)
+acpi_status
+acpi_ut_delete_caches (
+       void)
 {
-       struct acpi_memory_list         *cache_info;
-       char                            *next;
 
+       (void) acpi_os_delete_cache (acpi_gbl_state_cache);
+       acpi_gbl_state_cache = NULL;
 
-       ACPI_FUNCTION_ENTRY ();
-
+       (void) acpi_os_delete_cache (acpi_gbl_operand_cache);
+       acpi_gbl_operand_cache = NULL;
 
-       cache_info = &acpi_gbl_memory_lists[list_id];
-       while (cache_info->list_head) {
-               /* Delete one cached state object */
+       (void) acpi_os_delete_cache (acpi_gbl_ps_node_cache);
+       acpi_gbl_ps_node_cache = NULL;
 
-               next = *(ACPI_CAST_INDIRECT_PTR (char,
-                                &(((char *) cache_info->list_head)[cache_info->link_offset])));
-               ACPI_MEM_FREE (cache_info->list_head);
+       (void) acpi_os_delete_cache (acpi_gbl_ps_node_ext_cache);
+       acpi_gbl_ps_node_ext_cache = NULL;
 
-               cache_info->list_head = next;
-               cache_info->cache_depth--;
-       }
+       return (AE_OK);
 }
-#endif
-
 
 /*******************************************************************************
  *
@@ -500,6 +410,43 @@ acpi_ut_callocate (
  * occurs in the body of acpi_ut_free.
  */
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_create_list
+ *
+ * PARAMETERS:  cache_name      - Ascii name for the cache
+ *              object_size     - Size of each cached object
+ *              return_cache    - Where the new cache obje