]> err.no Git - linux-2.6/commitdiff
[ACPI] ACPICA 20050729 from Bob Moore
authorRobert Moore <robert.moore@intel.com>
Fri, 29 Jul 2005 22:15:00 +0000 (15:15 -0700)
committerLen Brown <len.brown@intel.com>
Sat, 30 Jul 2005 04:51:39 +0000 (00:51 -0400)
Implemented support to ignore an attempt to install/load
a particular ACPI table more than once. Apparently there
exists BIOS code that repeatedly attempts to load the same
SSDT upon certain events. Thanks to Venkatesh Pallipadi.

Restructured the main interface to the AML parser in
order to correctly handle all exceptional conditions. This
will prevent leakage of the OwnerId resource and should
eliminate the AE_OWNER_ID_LIMIT exceptions seen on some
machines. Thanks to Alexey Starikovskiy.

Support for "module level code" has been disabled in this
version due to a number of issues that have appeared
on various machines. The support can be enabled by
defining ACPI_ENABLE_MODULE_LEVEL_CODE during subsystem
compilation. When the issues are fully resolved, the code
will be enabled by default again.

Modified the internal functions for debug print support
to define the FunctionName parameter as a (const char *)
for compatibility with compiler built-in macros such as
__FUNCTION__, etc.

Linted the entire ACPICA source tree for both 32-bit
and 64-bit.

Signed-off-by: Robert Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
34 files changed:
drivers/acpi/dispatcher/dsinit.c
drivers/acpi/dispatcher/dsmethod.c
drivers/acpi/dispatcher/dswstate.c
drivers/acpi/events/evmisc.c
drivers/acpi/executer/exconfig.c
drivers/acpi/executer/exdump.c
drivers/acpi/executer/exoparg1.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/parser/psloop.c
drivers/acpi/parser/psutils.c
drivers/acpi/parser/psxface.c
drivers/acpi/tables/tbinstal.c
drivers/acpi/tables/tbutils.c
drivers/acpi/tables/tbxface.c
drivers/acpi/tables/tbxfroot.c
drivers/acpi/utilities/utalloc.c
drivers/acpi/utilities/utdebug.c
drivers/acpi/utilities/utmisc.c
include/acpi/acconfig.h
include/acpi/acdispat.h
include/acpi/acmacros.h
include/acpi/acnames.h
include/acpi/acnamesp.h
include/acpi/acparser.h
include/acpi/acstruct.h
include/acpi/actables.h
include/acpi/acutils.h
include/acpi/platform/acenv.h
include/acpi/platform/acgcc.h

index ebc07aab710cb8585c1fa909c76c54e38c154d23..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->owner_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.owner_id);
+               info->method_count++;
                break;
 
 
index 1b90813cbde1faec5a4382d00f92374b694e018b..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;
        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);
@@ -169,10 +166,18 @@ acpi_ds_parse_method (
 
        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:
-       (void) acpi_ut_release_owner_id (obj_desc->method.owner_id);
+       acpi_ut_release_owner_id (&obj_desc->method.owner_id);
 
 cleanup:
        acpi_ps_delete_parse_tree (op);
@@ -391,7 +396,7 @@ acpi_ds_call_control_method (
        /* On error, we must delete the new walk state */
 
 cleanup:
-       (void) acpi_ut_release_owner_id (obj_desc->method.owner_id);
+       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 */
 
@@ -563,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);
                }
 
@@ -595,6 +599,8 @@ acpi_ds_terminate_control_method (
                 */
                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 d360d8e89544ab228728ec807446a7ec89f8ae03..5621665991b51bb0eacdf3f04796dba1ba5f2cb5 100644 (file)
@@ -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,7 +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 = (u8) pass_number;
+       walk_state->pass_number = pass_number;
 
        if (info) {
                if (info->parameter_type == ACPI_PARAM_GPE) {
index 38d7ab8aef3a5869586415f70e90717aad9ef53d..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;
        }
index 76c6ebd0231f2936336cfd70ac91bb1bd804bbfe..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);
 }
 
@@ -488,6 +496,7 @@ acpi_ex_unload_table (
         * (Offset contains the 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 fd13cc3db01882f8a6e9bb30a46b2f6e369ad671..4f98dceed39a620a9d6527a7d060488b73ac342c 100644 (file)
@@ -598,7 +598,7 @@ acpi_ex_dump_reference (
                        acpi_os_printf ("Could not convert name to pathname\n");
                }
                else {
-                  acpi_os_printf ("%s\n", ret_buf.pointer);
+                  acpi_os_printf ("%s\n", (char *) ret_buf.pointer);
                   ACPI_MEM_FREE (ret_buf.pointer);
                }
        }
index c1ba8b48228e7c9aad1bf3674160cf13373a7f3a..48c30f80008358d9fad31c4204bbca43bc9fcb76 100644 (file)
@@ -955,7 +955,7 @@ acpi_ex_opcode_1A_0T_1R (
                                         */
                                        return_desc = *(operand[0]->reference.where);
                                        if (return_desc) {
-                           acpi_ut_add_reference (return_desc);
+                                               acpi_ut_add_reference (return_desc);
                                        }
 
                                        break;
index 0bda88d18685ccc5c994c60c44543ef694d27dd4..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 (param_count max is 7)
-                                */
-                               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 edbf1db36b6876099f26d71a0b3e25c5abb58865..21d560decbf9b3c10a2342ed754d7d2dc5e471bf 100644 (file)
@@ -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.
  *
  ******************************************************************************/
 
@@ -192,10 +191,6 @@ acpi_ns_install_node (
 {
        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 */
@@ -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;
@@ -635,59 +582,7 @@ acpi_ns_delete_namespace_by_owner (
                }
        }
 
-       (void) acpi_ut_release_owner_id (owner_id);
        return_VOID;
 }
 
 
-#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 d86ccbc8a1346579ad6bb5655a8df7759c76af79..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 (".");
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 64e0b2b9f55c19ab492896b9fcbf4f8e62ba2662..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;
index edf8aa5f86caf812709dcca31cb79b528c1fde47..551d54bdbec388708c321bd9ce1f17979b5555f2 100644 (file)
@@ -55,8 +55,6 @@
 #include <acpi/acparser.h>
 #include <acpi/acdispat.h>
 #include <acpi/amlcode.h>
-#include <acpi/acnamesp.h>
-#include <acpi/acinterp.h>
 
 #define _COMPONENT          ACPI_PARSER
         ACPI_MODULE_NAME    ("psloop")
@@ -410,11 +408,9 @@ acpi_ps_parse_loop (
 
                                /* Special processing for certain opcodes */
 
-#define ACPI_NO_MODULE_LEVEL_CODE
-
        /* TBD (remove): Temporary mechanism to disable this code if needed */
 
-#ifndef ACPI_NO_MODULE_LEVEL_CODE
+#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE
 
                         if ((walk_state->pass_number <= ACPI_IMODE_LOAD_PASS1) &&
                                   ((walk_state->parse_flags & ACPI_PARSE_DISASSEMBLE) == 0)) {
@@ -431,6 +427,9 @@ acpi_ps_parse_loop (
                                        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;
index 19a27020eeefe94e77fcedc271ed193f54308903..4221b41ae1a6ac4117ac2331c270eaee0b2eda40 100644 (file)
@@ -200,10 +200,10 @@ acpi_ps_free_op (
        }
 
        if (op->common.flags & ACPI_PARSEOP_GENERIC) {
-               acpi_os_release_object (acpi_gbl_ps_node_cache, op);
+               (void) acpi_os_release_object (acpi_gbl_ps_node_cache, op);
        }
        else {
-               acpi_os_release_object (acpi_gbl_ps_node_ext_cache, op);
+               (void) acpi_os_release_object (acpi_gbl_ps_node_ext_cache, op);
        }
 }
 
index 5279b51e77874d7693fe8d276a1c5a3fbe4bd796..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.
         */
-       status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id);
+       status = acpi_ut_allocate_owner_id (&info->obj_desc->method.owner_id);
        if (ACPI_FAILURE (status)) {
-               goto cleanup2;
-       }
-
-       /* Create and initialize a new walk state */
-
-       walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id,
-                          NULL, NULL, NULL);
-       if (!walk_state) {
-               status = AE_NO_MEMORY;
-               goto cleanup2;
+               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, NULL, 1);
-       if (ACPI_FAILURE (status)) {
-               goto cleanup3;
-       }
+       /*
+        * The caller "owns" the parameters, so give each one an extra
+        * reference
+        */
+       acpi_ps_update_parameter_list (info, REF_INCREMENT);
 
-       /* Parse the AML */
+       /*
+        * 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));
 
-       status = acpi_ps_parse_aml (walk_state);
-       acpi_ps_delete_parse_tree (op);
+       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 2ad72f20455123c178769a74cb82cba7ade45540..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);
 }
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 ca2dbdd23ed3053b47fc35239dc9654fcc5c60c7..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);
@@ -261,6 +274,7 @@ acpi_unload_table (
                 * simply a position within the hierarchy
                 */
                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 abb4c934656049360163c09c54037392975f0ab6..87dccdda9ae2c2c02913b0f8feb209699e1e12f3 100644 (file)
@@ -93,14 +93,14 @@ acpi_tb_validate_rsdp (
 
        /* Check the standard checksum */
 
-       if (acpi_tb_checksum (rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
+       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_checksum (rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)) {
+               (acpi_tb_generate_checksum (rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)) {
                return (AE_BAD_CHECKSUM);
        }
 
index 5061c6f0ee66ef016dcf7c1abf4509cb1ec0dbe1..78270f50e625bda9bc73e3277cc2e220c47db68f 100644 (file)
@@ -76,7 +76,7 @@ static acpi_status
 acpi_ut_create_list (
        char                            *list_name,
        u16                             object_size,
-       acpi_handle                     *return_cache);
+       struct acpi_memory_list         **return_cache);
 #endif
 
 
@@ -428,7 +428,7 @@ static acpi_status
 acpi_ut_create_list (
        char                            *list_name,
        u16                             object_size,
-       acpi_handle                     *return_cache)
+       struct acpi_memory_list         **return_cache)
 {
        struct acpi_memory_list         *cache;
 
index 3d5fbc810b0ba30ecfc12dcb80f7d982fd58a8f4..c27cbb7f5c540ba2d9fa443605a942bf800ed271 100644 (file)
@@ -55,6 +55,12 @@ static u32   acpi_gbl_prev_thread_id = 0xFFFFFFFF;
 static char     *acpi_gbl_fn_entry_str = "----Entry";
 static char     *acpi_gbl_fn_exit_str = "----Exit-";
 
+/* Local prototypes */
+
+static const char *
+acpi_ut_trim_function_name (
+       const char                      *function_name);
+
 
 /*******************************************************************************
  *
@@ -72,7 +78,7 @@ void
 acpi_ut_init_stack_ptr_trace (
        void)
 {
-       u32                         current_sp;
+       u32                             current_sp;
 
 
        acpi_gbl_entry_stack_pointer = ACPI_PTR_DIFF (&current_sp, NULL);
@@ -95,7 +101,7 @@ void
 acpi_ut_track_stack_ptr (
        void)
 {
-       acpi_size                   current_sp;
+       acpi_size                       current_sp;
 
 
        current_sp = ACPI_PTR_DIFF (&current_sp, NULL);
@@ -110,6 +116,43 @@ acpi_ut_track_stack_ptr (
 }
 
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_trim_function_name
+ *
+ * PARAMETERS:  function_name       - Ascii string containing a procedure name
+ *
+ * RETURN:      Updated pointer to the function name
+ *
+ * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present.
+ *              This allows compiler macros such as __FUNCTION__ to be used
+ *              with no change to the debug output.
+ *
+ ******************************************************************************/
+
+static const char *
+acpi_ut_trim_function_name (
+       const char                      *function_name)
+{
+
+       /* All Function names are longer than 4 chars, check is safe */
+
+       if (*(ACPI_CAST_PTR (u32, function_name)) == ACPI_FUNCTION_PREFIX1) {
+               /* This is the case where the original source has not been modified */
+
+               return (function_name + 4);
+       }
+
+       if (*(ACPI_CAST_PTR (u32, function_name)) == ACPI_FUNCTION_PREFIX2) {
+               /* This is the case where the source has been 'linuxized' */
+
+               return (function_name + 5);
+       }
+
+       return (function_name);
+}
+
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_debug_print
@@ -133,7 +176,7 @@ void  ACPI_INTERNAL_VAR_XFACE
 acpi_ut_debug_print (
        u32                             requested_debug_level,
        u32                             line_number,
-       char                            *function_name,
+       const char                      *function_name,
        char                            *module_name,
        u32                             component_id,
        char                            *format,
@@ -177,7 +220,7 @@ acpi_ut_debug_print (
        }
 
        acpi_os_printf ("[%02ld] %-22.22s: ",
-               acpi_gbl_nesting_level, function_name);
+               acpi_gbl_nesting_level, acpi_ut_trim_function_name (function_name));
 
        va_start (args, format);
        acpi_os_vprintf (format, args);
@@ -208,7 +251,7 @@ void  ACPI_INTERNAL_VAR_XFACE
 acpi_ut_debug_print_raw (
        u32                             requested_debug_level,
        u32                             line_number,
-       char                            *function_name,
+       const char                      *function_name,
        char                            *module_name,
        u32                             component_id,
        char                            *format,
@@ -247,7 +290,7 @@ EXPORT_SYMBOL(acpi_ut_debug_print_raw);
 void
 acpi_ut_trace (
        u32                             line_number,
-       char                            *function_name,
+       const char                      *function_name,
        char                            *module_name,
        u32                             component_id)
 {
@@ -282,7 +325,7 @@ EXPORT_SYMBOL(acpi_ut_trace);
 void
 acpi_ut_trace_ptr (
        u32                             line_number,
-       char                            *function_name,
+       const char                      *function_name,
        char                            *module_name,
        u32                             component_id,
        void                            *pointer)
@@ -316,7 +359,7 @@ acpi_ut_trace_ptr (
 void
 acpi_ut_trace_str (
        u32                             line_number,
-       char                            *function_name,
+       const char                      *function_name,
        char                            *module_name,
        u32                             component_id,
        char                            *string)
@@ -351,7 +394,7 @@ acpi_ut_trace_str (
 void
 acpi_ut_trace_u32 (
        u32                             line_number,
-       char                            *function_name,
+       const char                      *function_name,
        char                            *module_name,
        u32                             component_id,
        u32                             integer)
@@ -385,7 +428,7 @@ acpi_ut_trace_u32 (
 void
 acpi_ut_exit (
        u32                             line_number,
-       char                            *function_name,
+       const char                      *function_name,
        char                            *module_name,
        u32                             component_id)
 {
@@ -419,7 +462,7 @@ EXPORT_SYMBOL(acpi_ut_exit);
 void
 acpi_ut_status_exit (
        u32                             line_number,
-       char                            *function_name,
+       const char                      *function_name,
        char                            *module_name,
        u32                             component_id,
        acpi_status                     status)
@@ -463,7 +506,7 @@ EXPORT_SYMBOL(acpi_ut_status_exit);
 void
 acpi_ut_value_exit (
        u32                             line_number,
-       char                            *function_name,
+       const char                      *function_name,
        char                            *module_name,
        u32                             component_id,
        acpi_integer                    value)
@@ -499,7 +542,7 @@ EXPORT_SYMBOL(acpi_ut_value_exit);
 void
 acpi_ut_ptr_exit (
        u32                             line_number,
-       char                            *function_name,
+       const char                      *function_name,
        char                            *module_name,
        u32                             component_id,
        u8                              *ptr)
@@ -607,8 +650,8 @@ acpi_ut_dump_buffer (
                }
 
                /*
-                * Print the ASCII equivalent characters
-                * But watch out for the bad unprintable ones...
+                * Print the ASCII equivalent characters but watch out for the bad
+                * unprintable ones (printable chars are 0x20 through 0x7E)
                 */
                acpi_os_printf (" ");
                for (j = 0; j < 16; j++) {
@@ -618,9 +661,7 @@ acpi_ut_dump_buffer (
                        }
 
                        buf_char = buffer[i + j];
-                       if ((buf_char > 0x1F && buf_char < 0x2E) ||
-                               (buf_char > 0x2F && buf_char < 0x61) ||
-                               (buf_char > 0x60 && buf_char < 0x7F)) {
+                       if (ACPI_IS_PRINT (buf_char)) {
                                acpi_os_printf ("%c", buf_char);
                        }
                        else {
index df715cd89105ca5e4805209f3b65c99990fb2fa1..1d350b302a34bc5950033217bb99a9db9bc1443f 100644 (file)
  *
  * PARAMETERS:  owner_id        - Where the new owner ID is returned
  *
- * DESCRIPTION: Allocate a table or method owner id
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Allocate a table or method owner ID. The owner ID is used to
+ *              track objects created by the table or method, to be deleted
+ *              when the method exits or the table is unloaded.
  *
  ******************************************************************************/
 
@@ -71,6 +75,8 @@ acpi_ut_allocate_owner_id (
        ACPI_FUNCTION_TRACE ("ut_allocate_owner_id");
 
 
+       /* Mutex for the global ID mask */
+
        status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
        if (ACPI_FAILURE (status)) {
                return_ACPI_STATUS (status);
@@ -81,7 +87,7 @@ acpi_ut_allocate_owner_id (
        for (i = 0; i < 32; i++) {
                if (!(acpi_gbl_owner_id_mask & (1 << i))) {
                        acpi_gbl_owner_id_mask |= (1 << i);
-                       *owner_id = (acpi_owner_id) i;
+                       *owner_id = (acpi_owner_id) (i + 1);
                        goto exit;
                }
        }
@@ -93,6 +99,7 @@ acpi_ut_allocate_owner_id (
         * they are released when a table is unloaded or a method completes
         * execution.
         */
+       *owner_id = 0;
        status = AE_OWNER_ID_LIMIT;
        ACPI_REPORT_ERROR ((
                "Could not allocate new owner_id (32 max), AE_OWNER_ID_LIMIT\n"));
@@ -107,40 +114,55 @@ exit:
  *
  * FUNCTION:    acpi_ut_release_owner_id
  *
- * PARAMETERS:  owner_id        - A previously allocated owner ID
+ * PARAMETERS:  owner_id_ptr        - Pointer to a previously allocated owner_iD
  *
- * DESCRIPTION: Release a table or method owner id
+ * RETURN:      None. No error is returned because we are either exiting a
+ *              control method or unloading a table. Either way, we would
+ *              ignore any error anyway.
+ *
+ * DESCRIPTION: Release a table or method owner ID.  Valid IDs are 1 - 32
  *
  ******************************************************************************/
 
-acpi_status
+void
 acpi_ut_release_owner_id (
-       acpi_owner_id                   owner_id)
+       acpi_owner_id                   *owner_id_ptr)
 {
+       acpi_owner_id                   owner_id = *owner_id_ptr;
        acpi_status                     status;
 
 
        ACPI_FUNCTION_TRACE ("ut_release_owner_id");
 
 
+       /* Always clear the input owner_id (zero is an invalid ID) */
+
+       *owner_id_ptr = 0;
+
+       /* Zero is not a valid owner_iD */
+
+       if ((owner_id == 0) || (owner_id > 32)) {
+               ACPI_REPORT_ERROR (("Invalid owner_id: %2.2X\n", owner_id));
+               return_VOID;
+       }
+
+       /* Mutex for the global ID mask */
+
        status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
        if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+               return_VOID;
        }
 
-       /* Free the owner ID */
+       owner_id--; /* Normalize to zero */
+
+       /* Free the owner ID only if it is valid */
 
        if (acpi_gbl_owner_id_mask & (1 << owner_id)) {
                acpi_gbl_owner_id_mask ^= (1 << owner_id);
        }
-       else {
-               /* This owner_id has not been allocated */
-
-               status = AE_NOT_EXIST;
-       }
 
        (void) acpi_ut_release_mutex (ACPI_MTX_CACHES);
-       return_ACPI_STATUS (status);
+       return_VOID;
 }
 
 
@@ -150,7 +172,7 @@ acpi_ut_release_owner_id (
  *
  * PARAMETERS:  src_string      - The source string to convert
  *
- * RETURN:      Converted src_string (same as input pointer)
+ * RETURN:      None
  *
  * DESCRIPTION: Convert string to uppercase
  *
@@ -158,7 +180,7 @@ acpi_ut_release_owner_id (
  *
  ******************************************************************************/
 
-char *
+void
 acpi_ut_strupr (
        char                            *src_string)
 {
@@ -169,7 +191,7 @@ acpi_ut_strupr (
 
 
        if (!src_string) {
-               return (NULL);
+               return;
        }
 
        /* Walk entire string, uppercasing the letters */
@@ -178,7 +200,7 @@ acpi_ut_strupr (
                *string = (char) ACPI_TOUPPER (*string);
        }
 
-       return (src_string);
+       return;
 }
 
 
index aa3c08c6da41cb34d4ea0499c76d79307fd48022..d62af72939237a51029ffd0dd72b4851ba2821a9 100644 (file)
@@ -64,7 +64,7 @@
 
 /* Version string */
 
-#define ACPI_CA_VERSION                 0x20050708
+#define ACPI_CA_VERSION                 0x20050729
 
 /*
  * OS name, used for the _OS object.  The _OS object is essentially obsolete,
index fde6aa9fcd02ce15eda226e3365f4529eb818f0f..90b7d30bd255f2013f50a101cc2f3dbdcda1e5cc 100644 (file)
@@ -236,7 +236,7 @@ acpi_ds_method_data_init (
  */
 acpi_status
 acpi_ds_parse_method (
-       acpi_handle                     obj_handle);
+       struct acpi_namespace_node      *node);
 
 acpi_status
 acpi_ds_call_control_method (
@@ -391,7 +391,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
 acpi_ds_obj_stack_pop_and_delete (
index 5b100cef8dfcf2ea5c8d5599df85640eab6f4657..fcdef0a4b01b835a54a359581aa6fb44b38108fe 100644 (file)
  * The Name parameter should be the procedure name as a quoted string.
  * This is declared as a local string ("my_function_name") so that it can
  * be also used by the function exit macros below.
+ * Note: (const char) is used to be compatible with the debug interfaces
+ * and macros such as __FUNCTION__.
  */
-#define ACPI_FUNCTION_NAME(name)        char *_acpi_function_name = name;
+#define ACPI_FUNCTION_NAME(name)        const char *_acpi_function_name = name;
 
 #else
 /* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */
index deb7cb06f5f0a0639e50bb6498d4d0d866990307..280e9ed76674c53c9c319fdc1e184fd8570f1147 100644 (file)
 #define ACPI_NS_ROOT_PATH       "\\"
 #define ACPI_NS_SYSTEM_BUS      "_SB_"
 
+/*! [Begin] no source code translation (not handled by acpisrc) */
+#define ACPI_FUNCTION_PREFIX1   'ipcA'
+#define ACPI_FUNCTION_PREFIX2   'ipca'
+/*! [End] no source code translation !*/
+
 
 #endif  /* __ACNAMES_H__  */
 
index 870e2544bd9b61cc8f31a6ad81fd35b698d4e0fd..0c9ba707925bbf107bd6582a8a4be8436d90e14e 100644 (file)
@@ -124,7 +124,7 @@ acpi_ns_parse_table (
 
 acpi_status
 acpi_ns_one_complete_parse (
-       u32                             pass_number,
+       u                             pass_number,
        struct acpi_table_desc          *table_desc);
 
 
index ba9548f94dead0d417413f99135a1c641be98fcd..f692ad56cd823364d100475d8c87fb49f6b26a81 100644 (file)
  * psxface - Parser external interfaces
  */
 acpi_status
-acpi_psx_load_table (
-       u8                              *pcode_addr,
-       u32                             pcode_length);
-
-acpi_status
-acpi_psx_execute (
+acpi_ps_execute_method (
        struct acpi_parameter_info      *info);
 
 
index f375c17ad0b60bc2e91130c371918d1c51b26104..27b22bb3d2299745f7af2d8581d6f5e95d88ba6e 100644 (file)
@@ -153,6 +153,7 @@ struct acpi_device_walk_info
 struct acpi_walk_info
 {
        u32                             debug_level;
+       u32                             count;
        acpi_owner_id                   owner_id;
        u8                              display_type;
 };
@@ -209,8 +210,10 @@ union acpi_aml_operands
 struct acpi_parameter_info
 {
        struct acpi_namespace_node      *node;
+       union acpi_operand_object       *obj_desc;
        union acpi_operand_object       **parameters;
        union acpi_operand_object       *return_object;
+       u8                              pass_number;
        u8                              parameter_type;
        u8                              return_object_type;
 };
index 97e6f12da5275960808776e2c53d77aa71ec0ddb..e6ceb18196439ff153ebe80976f446cc00617717 100644 (file)
@@ -178,11 +178,15 @@ acpi_tb_validate_rsdp (
  * tbutils - common table utilities
  */
 acpi_status
+acpi_tb_is_table_installed (
+       struct acpi_table_desc          *new_table_desc);
+
+acpi_status
 acpi_tb_verify_table_checksum (
        struct acpi_table_header        *table_header);
 
 u8
-acpi_tb_checksum (
+acpi_tb_generate_checksum (
        void                            *buffer,
        u32                             length);
 
index 9c05c10e379aac1f99a01b7d8b6f4d51d0c2ec22..0e7b0a3e3b5ebd93d457821a8e662a60066923c2 100644 (file)
@@ -302,14 +302,14 @@ acpi_ut_track_stack_ptr (
 void
 acpi_ut_trace (
        u32                             line_number,
-       char                            *function_name,
+       const char                      *function_name,
        char                            *module_name,
        u32                             component_id);
 
 void
 acpi_ut_trace_ptr (
        u32                             line_number,
-       char                            *function_name,
+       const char                      *function_name,
        char                            *module_name,
        u32                             component_id,
        void                            *pointer);
@@ -317,7 +317,7 @@ acpi_ut_trace_ptr (
 void
 acpi_ut_trace_u32 (
        u32                             line_number,
-       char                            *function_name,
+       const char                      *function_name,
        char                            *module_name,
        u32                             component_id,
        u32                             integer);
@@ -325,7 +325,7 @@ acpi_ut_trace_u32 (
 void
 acpi_ut_trace_str (
        u32                             line_number,
-       char                            *function_name,
+       const char                      *function_name,
        char                            *module_name,
        u32                             component_id,
        char                            *string);
@@ -333,14 +333,14 @@ acpi_ut_trace_str (
 void
 acpi_ut_exit (
        u32                             line_number,
-       char                            *function_name,
+       const char                      *function_name,
        char                            *module_name,
        u32                             component_id);
 
 void
 acpi_ut_status_exit (
        u32                             line_number,
-       char                            *function_name,
+       const char                      *function_name,
        char                            *module_name,
        u32                             component_id,
        acpi_status                     status);
@@ -348,7 +348,7 @@ acpi_ut_status_exit (
 void
 acpi_ut_value_exit (
        u32                             line_number,
-       char                            *function_name,
+       const char                      *function_name,
        char                            *module_name,
        u32                             component_id,
        acpi_integer                    value);
@@ -356,7 +356,7 @@ acpi_ut_value_exit (
 void
 acpi_ut_ptr_exit (
        u32                             line_number,
-       char                            *function_name,
+       const char                      *function_name,
        char                            *module_name,
        u32                             component_id,
        u8                              *ptr);
@@ -390,7 +390,7 @@ void ACPI_INTERNAL_VAR_XFACE
 acpi_ut_debug_print (
        u32                             requested_debug_level,
        u32                             line_number,
-       char                            *function_name,
+       const char                      *function_name,
        char                            *module_name,
        u32                             component_id,
        char                            *format,
@@ -400,7 +400,7 @@ void ACPI_INTERNAL_VAR_XFACE
 acpi_ut_debug_print_raw (
        u32                             requested_debug_level,
        u32                             line_number,
-       char                            *function_name,
+       const char                      *function_name,
        char                            *module_name,
        u32                             component_id,
        char                            *format,
@@ -598,9 +598,9 @@ acpi_status
 acpi_ut_allocate_owner_id (
        acpi_owner_id                   *owner_id);
 
-acpi_status
+void
 acpi_ut_release_owner_id (
-       acpi_owner_id                   owner_id);
+       acpi_owner_id                   *owner_id);
 
 acpi_status
 acpi_ut_walk_package_tree (
@@ -609,7 +609,7 @@ acpi_ut_walk_package_tree (
        acpi_pkg_callback               walk_callback,
        void                            *context);
 
-char *
+void
 acpi_ut_strupr (
        char                            *src_string);
 
index aa63202e8d5dc3d770fdb8d49f3744f789f6eb51..bae1fbed097af94afc01204dbe94adb1c9f5b9ef 100644 (file)
 #define ACPI_MEMCPY(d,s,n)      (void) memcpy((d), (s), (acpi_size)(n))
 #define ACPI_MEMSET(d,s,n)      (void) memset((d), (s), (acpi_size)(n))
 
-#define ACPI_TOUPPER            toupper
-#define ACPI_TOLOWER            tolower
-#define ACPI_IS_XDIGIT          isxdigit
-#define ACPI_IS_DIGIT           isdigit
-#define ACPI_IS_SPACE           isspace
-#define ACPI_IS_UPPER           isupper
-#define ACPI_IS_PRINT           isprint
-#define ACPI_IS_ALPHA           isalpha
-#define ACPI_IS_ASCII           isascii
+#define ACPI_TOUPPER(i)         toupper((int) (i))
+#define ACPI_TOLOWER(i)         tolower((int) (i))
+#define ACPI_IS_XDIGIT(i)       isxdigit((int) (i))
+#define ACPI_IS_DIGIT(i)        isdigit((int) (i))
+#define ACPI_IS_SPACE(i)        isspace((int) (i))
+#define ACPI_IS_UPPER(i)        isupper((int) (i))
+#define ACPI_IS_PRINT(i)        isprint((int) (i))
+#define ACPI_IS_ALPHA(i)        isalpha((int) (i))
+#define ACPI_IS_ASCII(i)        isascii((int) (i))
 
 #else
 
index e410e3b61415eab3509f3d3320440e5a2e73fba1..39264127574ccdb403c5122090f6fecaa6543d26 100644 (file)
@@ -46,7 +46,7 @@
 
 /* Function name is used for debug output. Non-ANSI, compiler-dependent */
 
-#define ACPI_GET_FUNCTION_NAME          (char *) __FUNCTION__
+#define ACPI_GET_FUNCTION_NAME          __FUNCTION__
 
 /* This macro is used to tag functions as "printf-like" because
  * some compilers (like GCC) can catch printf format string problems.