Skip to content

Commit

Permalink
/home/lenb/src/to-akpm branch 'acpi-2.6.12'
Browse files Browse the repository at this point in the history
  • Loading branch information
Len Brown committed Aug 4, 2005
2 parents 1c5ad84 + bd6dbdf commit 5d2a220
Show file tree
Hide file tree
Showing 91 changed files with 3,882 additions and 3,015 deletions.
3 changes: 3 additions & 0 deletions Documentation/acpi-hotkey.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ The result of the execution of this aml method is
attached to /proc/acpi/hotkey/poll_method, which is dnyamically
created. Please use command "cat /proc/acpi/hotkey/polling_method"
to retrieve it.

Note: Use cmdline "acpi_specific_hotkey" to enable legacy platform
specific drivers.
26 changes: 8 additions & 18 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->table_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.owning_id);
info->method_count++;
break;


Expand Down Expand Up @@ -237,7 +227,7 @@ acpi_ds_initialize_objects (

ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
table_desc->pointer->signature, table_desc->table_id, info.object_count,
table_desc->pointer->signature, table_desc->owner_id, info.object_count,
info.device_count, info.method_count, info.op_region_count));

ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
Expand Down
67 changes: 42 additions & 25 deletions drivers/acpi/dispatcher/dsmethod.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,44 +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;
acpi_owner_id owner_id;
struct acpi_walk_state *walk_state;


ACPI_FUNCTION_TRACE_PTR ("ds_parse_method", obj_handle);
ACPI_FUNCTION_TRACE_PTR ("ds_parse_method", node);


/* Parameter Validation */

if (!obj_handle) {
if (!node) {
return_ACPI_STATUS (AE_NULL_ENTRY);
}

ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** named_obj=%p\n",
acpi_ut_get_node_name (obj_handle), obj_handle));
acpi_ut_get_node_name (node), node));

/* Extract the method object from the method Node */

node = (struct acpi_namespace_node *) obj_handle;
obj_desc = acpi_ns_get_attached_object (node);
if (!obj_desc) {
return_ACPI_STATUS (AE_NULL_OBJECT);
Expand Down Expand Up @@ -132,22 +128,26 @@ acpi_ds_parse_method (
* objects (such as Operation Regions) can be created during the
* first pass parse.
*/
owner_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD);
obj_desc->method.owning_id = owner_id;
status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id);
if (ACPI_FAILURE (status)) {
goto cleanup;
}

/* Create and initialize a new walk state */

walk_state = acpi_ds_create_walk_state (owner_id, NULL, NULL, NULL);
walk_state = acpi_ds_create_walk_state (
obj_desc->method.owner_id, NULL, NULL, NULL);
if (!walk_state) {
return_ACPI_STATUS (AE_NO_MEMORY);
status = AE_NO_MEMORY;
goto cleanup2;
}

status = acpi_ds_init_aml_walk (walk_state, op, node,
obj_desc->method.aml_start,
obj_desc->method.aml_length, NULL, 1);
if (ACPI_FAILURE (status)) {
acpi_ds_delete_walk_state (walk_state);
return_ACPI_STATUS (status);
goto cleanup2;
}

/*
Expand All @@ -161,13 +161,25 @@ acpi_ds_parse_method (
*/
status = acpi_ps_parse_aml (walk_state);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
goto cleanup2;
}

ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"**** [%4.4s] Parsed **** named_obj=%p Op=%p\n",
acpi_ut_get_node_name (obj_handle), obj_handle, op));
acpi_ut_get_node_name (node), node, op));

/*
* Delete the parse tree. We simply re-parse the method for every
* execution since there isn't much overhead (compared to keeping lots
* of parse trees around)
*/
acpi_ns_delete_namespace_subtree (node);
acpi_ns_delete_namespace_by_owner (obj_desc->method.owner_id);

cleanup2:
acpi_ut_release_owner_id (&obj_desc->method.owner_id);

cleanup:
acpi_ps_delete_parse_tree (op);
return_ACPI_STATUS (status);
}
Expand Down Expand Up @@ -263,7 +275,7 @@ acpi_ds_call_control_method (
{
acpi_status status;
struct acpi_namespace_node *method_node;
struct acpi_walk_state *next_walk_state;
struct acpi_walk_state *next_walk_state = NULL;
union acpi_operand_object *obj_desc;
struct acpi_parameter_info info;
u32 i;
Expand All @@ -287,20 +299,23 @@ acpi_ds_call_control_method (
return_ACPI_STATUS (AE_NULL_OBJECT);
}

obj_desc->method.owning_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD);
status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}

/* Init for new method, wait on concurrency semaphore */

status = acpi_ds_begin_method_execution (method_node, obj_desc,
this_walk_state->method_node);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
goto cleanup;
}

if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) {
/* 1) Parse: Create a new walk state for the preempting walk */

next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id,
op, obj_desc, NULL);
if (!next_walk_state) {
return_ACPI_STATUS (AE_NO_MEMORY);
Expand Down Expand Up @@ -330,7 +345,7 @@ acpi_ds_call_control_method (

/* 2) Execute: Create a new state for the preempting walk */

next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id,
NULL, obj_desc, thread);
if (!next_walk_state) {
status = AE_NO_MEMORY;
Expand Down Expand Up @@ -381,6 +396,7 @@ acpi_ds_call_control_method (
/* On error, we must delete the new walk state */

cleanup:
acpi_ut_release_owner_id (&obj_desc->method.owner_id);
if (next_walk_state && (next_walk_state->method_desc)) {
/* Decrement the thread count on the method parse tree */

Expand Down Expand Up @@ -552,8 +568,7 @@ acpi_ds_terminate_control_method (
*/
if ((walk_state->method_desc->method.concurrency == 1) &&
(!walk_state->method_desc->method.semaphore)) {
status = acpi_os_create_semaphore (1,
1,
status = acpi_os_create_semaphore (1, 1,
&walk_state->method_desc->method.semaphore);
}

Expand Down Expand Up @@ -582,8 +597,10 @@ acpi_ds_terminate_control_method (
* Delete any namespace entries created anywhere else within
* the namespace
*/
acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owning_id);
acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owner_id);
status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
acpi_ut_release_owner_id (&walk_state->method_desc->method.owner_id);

if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
Expand Down
15 changes: 2 additions & 13 deletions drivers/acpi/dispatcher/dsmthdat.c
Original file line number Diff line number Diff line change
Expand Up @@ -632,23 +632,12 @@ acpi_ds_store_object_to_local (
* Weird, but true.
*/
if (opcode == AML_ARG_OP) {
/*
* Make sure that the object is the correct type. This may be
* overkill, butit is here because references were NS nodes in
* the past. Now they are operand objects of type Reference.
*/
if (ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) != ACPI_DESC_TYPE_OPERAND) {
ACPI_REPORT_ERROR ((
"Invalid descriptor type while storing to method arg: [%s]\n",
acpi_ut_get_descriptor_name (current_obj_desc)));
return_ACPI_STATUS (AE_AML_INTERNAL);
}

/*
* If we have a valid reference object that came from ref_of(),
* do the indirect store
*/
if ((current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
if ((ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) == ACPI_DESC_TYPE_OPERAND) &&
(current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
(current_obj_desc->reference.opcode == AML_REF_OF_OP)) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Arg (%p) is an obj_ref(Node), storing in node %p\n",
Expand Down
3 changes: 3 additions & 0 deletions drivers/acpi/dispatcher/dsobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,9 @@ acpi_ds_init_object_from_op (
case AML_TYPE_LITERAL:

obj_desc->integer.value = op->common.value.integer;
#ifndef ACPI_NO_METHOD_EXECUTION
acpi_ex_truncate_for32bit_table (obj_desc);
#endif
break;


Expand Down
15 changes: 9 additions & 6 deletions drivers/acpi/dispatcher/dsopcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,15 @@ acpi_ds_execute_arguments (

walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL);
if (!walk_state) {
return_ACPI_STATUS (AE_NO_MEMORY);
status = AE_NO_MEMORY;
goto cleanup;
}

status = acpi_ds_init_aml_walk (walk_state, op, NULL, aml_start,
aml_length, NULL, 1);
if (ACPI_FAILURE (status)) {
acpi_ds_delete_walk_state (walk_state);
return_ACPI_STATUS (status);
goto cleanup;
}

/* Mark this parse as a deferred opcode */
Expand All @@ -138,8 +139,7 @@ acpi_ds_execute_arguments (

status = acpi_ps_parse_aml (walk_state);
if (ACPI_FAILURE (status)) {
acpi_ps_delete_parse_tree (op);
return_ACPI_STATUS (status);
goto cleanup;
}

/* Get and init the Op created above */
Expand All @@ -160,7 +160,8 @@ acpi_ds_execute_arguments (

walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL);
if (!walk_state) {
return_ACPI_STATUS (AE_NO_MEMORY);
status = AE_NO_MEMORY;
goto cleanup;
}

/* Execute the opcode and arguments */
Expand All @@ -169,13 +170,15 @@ acpi_ds_execute_arguments (
aml_length, NULL, 3);
if (ACPI_FAILURE (status)) {
acpi_ds_delete_walk_state (walk_state);
return_ACPI_STATUS (status);
goto cleanup;
}

/* Mark this execution as a deferred opcode */

walk_state->deferred_node = node;
status = acpi_ps_parse_aml (walk_state);

cleanup:
acpi_ps_delete_parse_tree (op);
return_ACPI_STATUS (status);
}
Expand Down
Loading

0 comments on commit 5d2a220

Please sign in to comment.