From 0c9938cc75057c0fca1af55a55dcfc2842436695 Mon Sep 17 00:00:00 2001 From: Robert Moore Date: Fri, 29 Jul 2005 15:15:00 -0700 Subject: [ACPI] ACPICA 20050729 from Bob Moore 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 Signed-off-by: Len Brown --- drivers/acpi/namespace/nsaccess.c | 13 ++-- drivers/acpi/namespace/nsalloc.c | 121 +++----------------------------------- drivers/acpi/namespace/nsdump.c | 11 +++- drivers/acpi/namespace/nseval.c | 10 ++-- drivers/acpi/namespace/nsload.c | 42 +++---------- drivers/acpi/namespace/nsparse.c | 2 +- 6 files changed, 38 insertions(+), 161 deletions(-) (limited to 'drivers/acpi/namespace') diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c index 0bda88d1868..7589e1fdf25 100644 --- a/drivers/acpi/namespace/nsaccess.c +++ b/drivers/acpi/namespace/nsaccess.c @@ -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; diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c index edbf1db36b6..21d560decbf 100644 --- a/drivers/acpi/namespace/nsalloc.c +++ b/drivers/acpi/namespace/nsalloc.c @@ -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 - - diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c index d86ccbc8a13..5d25add6b03 100644 --- a/drivers/acpi/namespace/nsdump.c +++ b/drivers/acpi/namespace/nsdump.c @@ -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 ("."); diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c index 1ae89a1c882..908cffd5e72 100644 --- a/drivers/acpi/namespace/nseval.c +++ b/drivers/acpi/namespace/nseval.c @@ -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); diff --git a/drivers/acpi/namespace/nsload.c b/drivers/acpi/namespace/nsload.c index 34e49701660..1428a84a31e 100644 --- a/drivers/acpi/namespace/nsload.c +++ b/drivers/acpi/namespace/nsload.c @@ -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; diff --git a/drivers/acpi/namespace/nsparse.c b/drivers/acpi/namespace/nsparse.c index 64e0b2b9f55..24bed931d39 100644 --- a/drivers/acpi/namespace/nsparse.c +++ b/drivers/acpi/namespace/nsparse.c @@ -67,7 +67,7 @@ acpi_status acpi_ns_one_complete_parse ( - u32 pass_number, + u8 pass_number, struct acpi_table_desc *table_desc) { union acpi_parse_object *parse_root; -- cgit v1.2.3