Skip to content

Commit

Permalink
[ACPI] ACPICA 20050729 from Bob Moore
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Robert Moore authored and Len Brown committed Jul 30, 2005
1 parent dd8f39b commit 0c9938c
Show file tree
Hide file tree
Showing 34 changed files with 470 additions and 397 deletions.
24 changes: 7 additions & 17 deletions drivers/acpi/dispatcher/dsinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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
Expand All @@ -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;
}

/*
Expand All @@ -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;


Expand Down
34 changes: 20 additions & 14 deletions drivers/acpi/dispatcher/dsmethod.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,43 +58,40 @@
*
* 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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 */

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/acpi/dispatcher/dswstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ acpi_ds_init_aml_walk (
u8 *aml_start,
u32 aml_length,
struct acpi_parameter_info *info,
u32 pass_number)
u8 pass_number)
{
acpi_status status;
struct acpi_parse_state *parser_state = &walk_state->parser_state;
Expand All @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions drivers/acpi/events/evmisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
19 changes: 14 additions & 5 deletions drivers/acpi/executer/exconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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;
}

Expand All @@ -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);
}

Expand Down Expand Up @@ -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 */

Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/executer/exdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/executer/exoparg1.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
13 changes: 7 additions & 6 deletions drivers/acpi/namespace/nsaccess.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Loading

0 comments on commit 0c9938c

Please sign in to comment.