Skip to content

Commit

Permalink
Merge branch 'acpica' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
Len Brown committed Dec 16, 2009
2 parents 8bea867 + 88e5071 commit 173cc11
Show file tree
Hide file tree
Showing 26 changed files with 721 additions and 301 deletions.
9 changes: 6 additions & 3 deletions drivers/acpi/acpica/acnamesp.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,11 @@ acpi_ns_complex_repairs(struct acpi_predefined_data *data,
acpi_status validate_status,
union acpi_operand_object **return_object_ptr);

void
acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
u8 package_type,
union acpi_operand_object *obj_desc);

/*
* nssearch - Namespace searching and entry
*/
Expand Down Expand Up @@ -354,9 +359,7 @@ acpi_ns_externalize_name(u32 internal_name_length,
const char *internal_name,
u32 * converted_name_length, char **converted_name);

struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle);

acpi_handle acpi_ns_convert_entry_to_handle(struct acpi_namespace_node *node);
struct acpi_namespace_node *acpi_ns_validate_handle(acpi_handle handle);

void acpi_ns_terminate(void);

Expand Down
6 changes: 5 additions & 1 deletion drivers/acpi/acpica/acobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,11 @@ struct acpi_object_method {
u8 sync_level;
union acpi_operand_object *mutex;
u8 *aml_start;
ACPI_INTERNAL_METHOD implementation;
union {
ACPI_INTERNAL_METHOD implementation;
union acpi_operand_object *handler;
} extra;

u32 aml_length;
u8 thread_count;
acpi_owner_id owner_id;
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/acpica/dsmethod.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
/* Invoke an internal method if necessary */

if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) {
status = obj_desc->method.implementation(next_walk_state);
status = obj_desc->method.extra.implementation(next_walk_state);
if (status == AE_OK) {
status = AE_CTRL_TERMINATE;
}
Expand Down
64 changes: 39 additions & 25 deletions drivers/acpi/acpica/dswload.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,18 +212,19 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
case ACPI_TYPE_BUFFER:

/*
* These types we will allow, but we will change the type. This
* enables some existing code of the form:
* These types we will allow, but we will change the type.
* This enables some existing code of the form:
*
* Name (DEB, 0)
* Scope (DEB) { ... }
*
* Note: silently change the type here. On the second pass, we will report
* a warning
* Note: silently change the type here. On the second pass,
* we will report a warning
*/
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
path,
"Type override - [%4.4s] had invalid type (%s) "
"for Scope operator, changed to type ANY\n",
acpi_ut_get_node_name(node),
acpi_ut_get_type_name(node->type)));

node->type = ACPI_TYPE_ANY;
Expand All @@ -235,8 +236,10 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
/* All other types are an error */

ACPI_ERROR((AE_INFO,
"Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)",
acpi_ut_get_type_name(node->type), path));
"Invalid type (%s) for target of "
"Scope operator [%4.4s] (Cannot override)",
acpi_ut_get_type_name(node->type),
acpi_ut_get_node_name(node)));

return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
}
Expand Down Expand Up @@ -697,15 +700,16 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
case ACPI_TYPE_BUFFER:

/*
* These types we will allow, but we will change the type. This
* enables some existing code of the form:
* These types we will allow, but we will change the type.
* This enables some existing code of the form:
*
* Name (DEB, 0)
* Scope (DEB) { ... }
*/
ACPI_WARNING((AE_INFO,
"Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)",
buffer_ptr,
"Type override - [%4.4s] had invalid type (%s) "
"for Scope operator, changed to type ANY\n",
acpi_ut_get_node_name(node),
acpi_ut_get_type_name(node->type)));

node->type = ACPI_TYPE_ANY;
Expand All @@ -717,9 +721,10 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
/* All other types are an error */

ACPI_ERROR((AE_INFO,
"Invalid type (%s) for target of Scope operator [%4.4s]",
"Invalid type (%s) for target of "
"Scope operator [%4.4s] (Cannot override)",
acpi_ut_get_type_name(node->type),
buffer_ptr));
acpi_ut_get_node_name(node)));

return (AE_AML_OPERAND_TYPE);
}
Expand Down Expand Up @@ -1047,9 +1052,22 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
}

/*
* If we are executing a method, initialize the region
* The op_region is not fully parsed at this time. The only valid
* argument is the space_id. (We must save the address of the
* AML of the address and length operands)
*
* If we have a valid region, initialize it. The namespace is
* unlocked at this point.
*
* Need to unlock interpreter if it is locked (if we are running
* a control method), in order to allow _REG methods to be run
* during acpi_ev_initialize_region.
*/
if (walk_state->method_node) {
/*
* Executing a method: initialize the region and unlock
* the interpreter
*/
status =
acpi_ex_create_region(op->named.data,
op->named.length,
Expand All @@ -1058,21 +1076,17 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
if (ACPI_FAILURE(status)) {
return (status);
}
}

/*
* The op_region is not fully parsed at this time. Only valid
* argument is the space_id. (We must save the address of the
* AML of the address and length operands)
*/
acpi_ex_exit_interpreter();
}

/*
* If we have a valid region, initialize it
* Namespace is NOT locked at this point.
*/
status =
acpi_ev_initialize_region
(acpi_ns_get_attached_object(node), FALSE);
if (walk_state->method_node) {
acpi_ex_enter_interpreter();
}

if (ACPI_FAILURE(status)) {
/*
* If AE_NOT_EXIST is returned, it is not fatal
Expand Down
4 changes: 2 additions & 2 deletions drivers/acpi/acpica/evregion.c
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ acpi_ev_install_handler(acpi_handle obj_handle,

/* Convert and validate the device handle */

node = acpi_ns_map_handle_to_node(obj_handle);
node = acpi_ns_validate_handle(obj_handle);
if (!node) {
return (AE_BAD_PARAMETER);
}
Expand Down Expand Up @@ -1087,7 +1087,7 @@ acpi_ev_reg_run(acpi_handle obj_handle,

/* Convert and validate the device handle */

node = acpi_ns_map_handle_to_node(obj_handle);
node = acpi_ns_validate_handle(obj_handle);
if (!node) {
return (AE_BAD_PARAMETER);
}
Expand Down
15 changes: 15 additions & 0 deletions drivers/acpi/acpica/evrgnini.c
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,21 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
handler_obj = obj_desc->thermal_zone.handler;
break;

case ACPI_TYPE_METHOD:
/*
* If we are executing module level code, the original
* Node's object was replaced by this Method object and we
* saved the handler in the method object.
*
* See acpi_ns_exec_module_code
*/
if (obj_desc->method.
flags & AOPOBJ_MODULE_LEVEL) {
handler_obj =
obj_desc->method.extra.handler;
}
break;

default:
/* Ignore other objects */
break;
Expand Down
4 changes: 2 additions & 2 deletions drivers/acpi/acpica/evxface.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ acpi_install_notify_handler(acpi_handle device,

/* Convert and validate the device handle */

node = acpi_ns_map_handle_to_node(device);
node = acpi_ns_validate_handle(device);
if (!node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
Expand Down Expand Up @@ -425,7 +425,7 @@ acpi_remove_notify_handler(acpi_handle device,

/* Convert and validate the device handle */

node = acpi_ns_map_handle_to_node(device);
node = acpi_ns_validate_handle(device);
if (!node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
Expand Down
4 changes: 2 additions & 2 deletions drivers/acpi/acpica/evxfevnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ acpi_install_gpe_block(acpi_handle gpe_device,
return (status);
}

node = acpi_ns_map_handle_to_node(gpe_device);
node = acpi_ns_validate_handle(gpe_device);
if (!node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
Expand Down Expand Up @@ -698,7 +698,7 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device)
return (status);
}

node = acpi_ns_map_handle_to_node(gpe_device);
node = acpi_ns_validate_handle(gpe_device);
if (!node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
Expand Down
4 changes: 2 additions & 2 deletions drivers/acpi/acpica/evxfregn.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ acpi_install_address_space_handler(acpi_handle device,

/* Convert and validate the device handle */

node = acpi_ns_map_handle_to_node(device);
node = acpi_ns_validate_handle(device);
if (!node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
Expand Down Expand Up @@ -155,7 +155,7 @@ acpi_remove_address_space_handler(acpi_handle device,

/* Convert and validate the device handle */

node = acpi_ns_map_handle_to_node(device);
node = acpi_ns_validate_handle(device);
if (!node ||
((node->type != ACPI_TYPE_DEVICE) &&
(node->type != ACPI_TYPE_PROCESSOR) &&
Expand Down
18 changes: 9 additions & 9 deletions drivers/acpi/acpica/exmutex.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,15 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED);
}

/* Must have a valid thread ID */

if (!walk_state->thread) {
ACPI_ERROR((AE_INFO,
"Cannot release Mutex [%4.4s], null thread info",
acpi_ut_get_node_name(obj_desc->mutex.node)));
return_ACPI_STATUS(AE_AML_INTERNAL);
}

/*
* The Mutex is owned, but this thread must be the owner.
* Special case for Global Lock, any thread can release
Expand All @@ -392,15 +401,6 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
return_ACPI_STATUS(AE_AML_NOT_OWNER);
}

/* Must have a valid thread ID */

if (!walk_state->thread) {
ACPI_ERROR((AE_INFO,
"Cannot release Mutex [%4.4s], null thread info",
acpi_ut_get_node_name(obj_desc->mutex.node)));
return_ACPI_STATUS(AE_AML_INTERNAL);
}

/*
* The sync level of the mutex must be equal to the current sync level. In
* other words, the current level means that at least one mutex at that
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/acpica/nsaccess.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ acpi_status acpi_ns_root_initialize(void)

obj_desc->method.method_flags =
AML_METHOD_INTERNAL_ONLY;
obj_desc->method.implementation =
obj_desc->method.extra.implementation =
acpi_ut_osi_implementation;
#endif
break;
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/acpica/nsdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
return (AE_OK);
}

this_node = acpi_ns_map_handle_to_node(obj_handle);
this_node = acpi_ns_validate_handle(obj_handle);
if (!this_node) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Invalid object handle %p\n",
obj_handle));
Expand Down
18 changes: 18 additions & 0 deletions drivers/acpi/acpica/nseval.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,18 @@ acpi_ns_exec_module_code(union acpi_operand_object *method_obj,
method_obj->method.next_object);
type = acpi_ns_get_type(parent_node);

/*
* Get the region handler and save it in the method object. We may need
* this if an operation region declaration causes a _REG method to be run.
*
* We can't do this in acpi_ps_link_module_code because
* acpi_gbl_root_node->Object is NULL at PASS1.
*/
if ((type == ACPI_TYPE_DEVICE) && parent_node->object) {
method_obj->method.extra.handler =
parent_node->object->device.handler;
}

/* Must clear next_object (acpi_ns_attach_object needs the field) */

method_obj->method.next_object = NULL;
Expand Down Expand Up @@ -415,6 +427,12 @@ acpi_ns_exec_module_code(union acpi_operand_object *method_obj,
ACPI_DEBUG_PRINT((ACPI_DB_INIT, "Executed module-level code at %p\n",
method_obj->method.aml_start));

/* Delete a possible implicit return value (in slack mode) */

if (info->return_object) {
acpi_ut_remove_reference(info->return_object);
}

/* Detach the temporary method object */

acpi_ns_detach_object(parent_node);
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/acpica/nsnames.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ acpi_ns_handle_to_pathname(acpi_handle target_handle,

ACPI_FUNCTION_TRACE_PTR(ns_handle_to_pathname, target_handle);

node = acpi_ns_map_handle_to_node(target_handle);
node = acpi_ns_validate_handle(target_handle);
if (!node) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
Expand Down
Loading

0 comments on commit 173cc11

Please sign in to comment.