Commit 52fc0b02 authored by Bob Moore's avatar Bob Moore Committed by Len Brown

[ACPI] ACPICA 20060210

Removed a couple of extraneous ACPI_ERROR messages that
appeared during normal execution. These became apparent
after the conversion from ACPI_DEBUG_PRINT.

Fixed a problem where the CreateField operator could hang
if the BitIndex or NumBits parameter referred to a named
object. From Valery Podrezov.
http://bugzilla.kernel.org/show_bug.cgi?id=5359

Fixed a problem where a DeRefOf operation on a buffer
object incorrectly failed with an exception. This also
fixes a couple of related RefOf and DeRefOf issues.
From Valery Podrezov.
http://bugzilla.kernel.org/show_bug.cgi?id=5360
http://bugzilla.kernel.org/show_bug.cgi?id=5387
http://bugzilla.kernel.org/show_bug.cgi?id=5392

Fixed a problem where the AE_BUFFER_LIMIT exception was
returned instead of AE_STRING_LIMIT on an out-of-bounds
Index() operation. From Valery Podrezov.
http://bugzilla.kernel.org/show_bug.cgi?id=5480

Implemented a memory cleanup at the end of the execution
of each iteration of an AML While() loop, preventing the
accumulation of outstanding objects. From Valery Podrezov.
http://bugzilla.kernel.org/show_bug.cgi?id=5427

Eliminated a chunk of duplicate code in the object
resolution code. From Valery Podrezov.
http://bugzilla.kernel.org/show_bug.cgi?id=5336

Fixed several warnings during the 64-bit code generation.
Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 46358614
...@@ -425,6 +425,7 @@ acpi_ds_init_field_objects(union acpi_parse_object *op, ...@@ -425,6 +425,7 @@ acpi_ds_init_field_objects(union acpi_parse_object *op,
* Walk the list of entries in the field_list * Walk the list of entries in the field_list
*/ */
while (arg) { while (arg) {
/* Ignore OFFSET and ACCESSAS terms here */ /* Ignore OFFSET and ACCESSAS terms here */
if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) { if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) {
......
...@@ -81,6 +81,7 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) ...@@ -81,6 +81,7 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state)
/* Invoke the global exception handler */ /* Invoke the global exception handler */
if (acpi_gbl_exception_handler) { if (acpi_gbl_exception_handler) {
/* Exit the interpreter, allow handler to execute methods */ /* Exit the interpreter, allow handler to execute methods */
acpi_ex_exit_interpreter(); acpi_ex_exit_interpreter();
...@@ -100,6 +101,7 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) ...@@ -100,6 +101,7 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state)
} }
#ifdef ACPI_DISASSEMBLER #ifdef ACPI_DISASSEMBLER
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
/* Display method locals/args if disassembler is present */ /* Display method locals/args if disassembler is present */
acpi_dm_dump_method_info(status, walk_state, walk_state->op); acpi_dm_dump_method_info(status, walk_state, walk_state->op);
...@@ -249,6 +251,7 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, ...@@ -249,6 +251,7 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
} }
if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) { if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) {
/* 1) Parse: Create a new walk state for the preempting walk */ /* 1) Parse: Create a new walk state for the preempting walk */
next_walk_state = next_walk_state =
...@@ -378,9 +381,11 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, ...@@ -378,9 +381,11 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state,
/* Did the called method return a value? */ /* Did the called method return a value? */
if (return_desc) { if (return_desc) {
/* Are we actually going to use the return value? */ /* Are we actually going to use the return value? */
if (walk_state->return_used) { if (walk_state->return_used) {
/* Save the return value from the previous method */ /* Save the return value from the previous method */
status = acpi_ds_result_push(return_desc, walk_state); status = acpi_ds_result_push(return_desc, walk_state);
......
...@@ -701,6 +701,7 @@ acpi_ds_method_data_get_type(u16 opcode, ...@@ -701,6 +701,7 @@ acpi_ds_method_data_get_type(u16 opcode,
object = acpi_ns_get_attached_object(node); object = acpi_ns_get_attached_object(node);
if (!object) { if (!object) {
/* Uninitialized local/arg, return TYPE_ANY */ /* Uninitialized local/arg, return TYPE_ANY */
return_VALUE(ACPI_TYPE_ANY); return_VALUE(ACPI_TYPE_ANY);
......
...@@ -103,6 +103,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, ...@@ -103,6 +103,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
common. common.
node))); node)));
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
/* Check if we are resolving a named reference within a package */ /* Check if we are resolving a named reference within a package */
if ((status == AE_NOT_FOUND) if ((status == AE_NOT_FOUND)
...@@ -195,6 +196,7 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, ...@@ -195,6 +196,7 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
*/ */
obj_desc = *obj_desc_ptr; obj_desc = *obj_desc_ptr;
if (!obj_desc) { if (!obj_desc) {
/* Create a new buffer object */ /* Create a new buffer object */
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER);
...@@ -355,6 +357,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, ...@@ -355,6 +357,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
arg = arg->common.next; arg = arg->common.next;
for (i = 0; arg; i++) { for (i = 0; arg; i++) {
if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) {
/* Object (package or buffer) is already built */ /* Object (package or buffer) is already built */
obj_desc->package.elements[i] = obj_desc->package.elements[i] =
...@@ -408,6 +411,7 @@ acpi_ds_create_node(struct acpi_walk_state *walk_state, ...@@ -408,6 +411,7 @@ acpi_ds_create_node(struct acpi_walk_state *walk_state,
} }
if (!op->common.value.arg) { if (!op->common.value.arg) {
/* No arguments, there is nothing to do */ /* No arguments, there is nothing to do */
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
...@@ -469,6 +473,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, ...@@ -469,6 +473,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
obj_desc = *ret_obj_desc; obj_desc = *ret_obj_desc;
op_info = acpi_ps_get_opcode_info(opcode); op_info = acpi_ps_get_opcode_info(opcode);
if (op_info->class == AML_CLASS_UNKNOWN) { if (op_info->class == AML_CLASS_UNKNOWN) {
/* Unknown opcode */ /* Unknown opcode */
return_ACPI_STATUS(AE_TYPE); return_ACPI_STATUS(AE_TYPE);
...@@ -626,6 +631,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, ...@@ -626,6 +631,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
default: /* Other literals, etc.. */ default: /* Other literals, etc.. */
if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
/* Node was saved in Op */ /* Node was saved in Op */
obj_desc->reference.node = op->common.node; obj_desc->reference.node = op->common.node;
......
...@@ -640,6 +640,7 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, ...@@ -640,6 +640,7 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state,
/* Initialize the Buffer Field */ /* Initialize the Buffer Field */
if (op->common.aml_opcode == AML_CREATE_FIELD_OP) { if (op->common.aml_opcode == AML_CREATE_FIELD_OP) {
/* NOTE: Slightly different operands for this opcode */ /* NOTE: Slightly different operands for this opcode */
status = status =
...@@ -984,6 +985,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, ...@@ -984,6 +985,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op)); ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op));
if (walk_state->control_state->common.value) { if (walk_state->control_state->common.value) {
/* Predicate was true, go back and evaluate it again! */ /* Predicate was true, go back and evaluate it again! */
status = AE_CTRL_PENDING; status = AE_CTRL_PENDING;
...@@ -1014,6 +1016,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, ...@@ -1014,6 +1016,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
* has been bubbled up the tree * has been bubbled up the tree
*/ */
if (op->common.value.arg) { if (op->common.value.arg) {
/* Since we have a real Return(), delete any implicit return */ /* Since we have a real Return(), delete any implicit return */
acpi_ds_clear_implicit_return(walk_state); acpi_ds_clear_implicit_return(walk_state);
...@@ -1047,6 +1050,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, ...@@ -1047,6 +1050,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
walk_state->return_desc = walk_state->operands[0]; walk_state->return_desc = walk_state->operands[0];
} else if ((walk_state->results) && } else if ((walk_state->results) &&
(walk_state->results->results.num_results > 0)) { (walk_state->results->results.num_results > 0)) {
/* Since we have a real Return(), delete any implicit return */ /* Since we have a real Return(), delete any implicit return */
acpi_ds_clear_implicit_return(walk_state); acpi_ds_clear_implicit_return(walk_state);
......
...@@ -202,6 +202,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, ...@@ -202,6 +202,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
*/ */
if ((!op->common.parent) || if ((!op->common.parent) ||
(op->common.parent->common.aml_opcode == AML_SCOPE_OP)) { (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) {
/* No parent, the return value cannot possibly be used */ /* No parent, the return value cannot possibly be used */
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
...@@ -352,6 +353,7 @@ acpi_ds_delete_result_if_not_used(union acpi_parse_object *op, ...@@ -352,6 +353,7 @@ acpi_ds_delete_result_if_not_used(union acpi_parse_object *op,
} }
if (!acpi_ds_is_result_used(op, walk_state)) { if (!acpi_ds_is_result_used(op, walk_state)) {
/* Must pop the result stack (obj_desc should be equal to result_obj) */ /* Must pop the result stack (obj_desc should be equal to result_obj) */
status = acpi_ds_result_pop(&obj_desc, walk_state); status = acpi_ds_result_pop(&obj_desc, walk_state);
...@@ -498,7 +500,9 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, ...@@ -498,7 +500,9 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
*/ */
if ((walk_state->deferred_node) && if ((walk_state->deferred_node) &&
(walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD)
&& (arg_index != 0)) { && (arg_index ==
(u32) ((walk_state->opcode ==
AML_CREATE_FIELD_OP) ? 3 : 2))) {
obj_desc = obj_desc =
ACPI_CAST_PTR(union acpi_operand_object, ACPI_CAST_PTR(union acpi_operand_object,
walk_state->deferred_node); walk_state->deferred_node);
...@@ -521,6 +525,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, ...@@ -521,6 +525,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
&& (parent_op->common.aml_opcode != AML_REGION_OP) && (parent_op->common.aml_opcode != AML_REGION_OP)
&& (parent_op->common.aml_opcode != && (parent_op->common.aml_opcode !=
AML_INT_NAMEPATH_OP)) { AML_INT_NAMEPATH_OP)) {
/* Enter name into namespace if not found */ /* Enter name into namespace if not found */
interpreter_mode = ACPI_IMODE_LOAD_PASS2; interpreter_mode = ACPI_IMODE_LOAD_PASS2;
......
...@@ -409,6 +409,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) ...@@ -409,6 +409,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
* being the object_type and size_of operators. * being the object_type and size_of operators.
*/ */
if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) { if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) {
/* Resolve all operands */ /* Resolve all operands */
status = acpi_ex_resolve_operands(walk_state->opcode, status = acpi_ex_resolve_operands(walk_state->opcode,
...@@ -548,6 +549,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) ...@@ -548,6 +549,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
*/ */
status = acpi_ds_resolve_operands(walk_state); status = acpi_ds_resolve_operands(walk_state);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
/* On error, clear all resolved operands */ /* On error, clear all resolved operands */
acpi_ds_clear_operands(walk_state); acpi_ds_clear_operands(walk_state);
...@@ -722,6 +724,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) ...@@ -722,6 +724,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
cleanup: cleanup:
if (walk_state->result_obj) { if (walk_state->result_obj) {
/* Break to debugger to display result */ /* Break to debugger to display result */
ACPI_DEBUGGER_EXEC(acpi_db_display_result_object ACPI_DEBUGGER_EXEC(acpi_db_display_result_object
......
...@@ -261,6 +261,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, ...@@ -261,6 +261,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
*/ */
if (walk_state->deferred_node) { if (walk_state->deferred_node) {
/* This name is already in the namespace, get the node */ /* This name is already in the namespace, get the node */
node = walk_state->deferred_node; node = walk_state->deferred_node;
...@@ -311,6 +312,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, ...@@ -311,6 +312,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
/* Common exit */ /* Common exit */
if (!op) { if (!op) {
/* Create a new op */ /* Create a new op */
op = acpi_ps_alloc_op(walk_state->opcode); op = acpi_ps_alloc_op(walk_state->opcode);
...@@ -413,6 +415,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) ...@@ -413,6 +415,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state)
#endif #endif
if (op->common.aml_opcode == AML_NAME_OP) { if (op->common.aml_opcode == AML_NAME_OP) {
/* For Name opcode, get the object type from the argument */ /* For Name opcode, get the object type from the argument */
if (op->common.value.arg) { if (op->common.value.arg) {
...@@ -521,6 +524,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, ...@@ -521,6 +524,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
if ((walk_state->control_state) && if ((walk_state->control_state) &&
(walk_state->control_state->common.state == (walk_state->control_state->common.state ==
ACPI_CONTROL_CONDITIONAL_EXECUTING)) { ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
/* We are executing a while loop outside of a method */ /* We are executing a while loop outside of a method */
status = acpi_ds_exec_begin_op(walk_state, out_op); status = acpi_ds_exec_begin_op(walk_state, out_op);
...@@ -554,10 +558,12 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, ...@@ -554,10 +558,12 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
/* Get the name we are going to enter or lookup in the namespace */ /* Get the name we are going to enter or lookup in the namespace */
if (walk_state->opcode == AML_INT_NAMEPATH_OP) { if (walk_state->opcode == AML_INT_NAMEPATH_OP) {
/* For Namepath op, get the path string */ /* For Namepath op, get the path string */
buffer_ptr = op->common.value.string; buffer_ptr = op->common.value.string;
if (!buffer_ptr) { if (!buffer_ptr) {
/* No name, just exit */ /* No name, just exit */
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
...@@ -680,6 +686,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, ...@@ -680,6 +686,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
/* All other opcodes */ /* All other opcodes */
if (op && op->common.node) { if (op && op->common.node) {
/* This op/node was previously entered into the namespace */ /* This op/node was previously entered into the namespace */
node = op->common.node; node = op->common.node;
...@@ -705,6 +712,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, ...@@ -705,6 +712,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
* Note: Name may already exist if we are executing a deferred opcode. * Note: Name may already exist if we are executing a deferred opcode.
*/ */
if (walk_state->deferred_node) { if (walk_state->deferred_node) {
/* This name is already in the namespace, get the node */ /* This name is already in the namespace, get the node */
node = walk_state->deferred_node; node = walk_state->deferred_node;
...@@ -727,6 +735,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, ...@@ -727,6 +735,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
} }
if (!op) { if (!op) {
/* Create a new op */ /* Create a new op */
op = acpi_ps_alloc_op(walk_state->opcode); op = acpi_ps_alloc_op(walk_state->opcode);
......
...@@ -66,6 +66,7 @@ void acpi_ds_scope_stack_clear(struct acpi_walk_state *walk_state) ...@@ -66,6 +66,7 @@ void acpi_ds_scope_stack_clear(struct acpi_walk_state *walk_state)
ACPI_FUNCTION_NAME("ds_scope_stack_clear"); ACPI_FUNCTION_NAME("ds_scope_stack_clear");
while (walk_state->scope_info) { while (walk_state->scope_info) {
/* Pop a scope off the stack */ /* Pop a scope off the stack */
scope_info = walk_state->scope_info; scope_info = walk_state->scope_info;
...@@ -105,6 +106,7 @@ acpi_ds_scope_stack_push(struct acpi_namespace_node *node, ...@@ -105,6 +106,7 @@ acpi_ds_scope_stack_push(struct acpi_namespace_node *node,
ACPI_FUNCTION_TRACE("ds_scope_stack_push"); ACPI_FUNCTION_TRACE("ds_scope_stack_push");
if (!node) { if (!node) {
/* Invalid scope */ /* Invalid scope */
ACPI_ERROR((AE_INFO, "Null scope parameter")); ACPI_ERROR((AE_INFO, "Null scope parameter"));
......
...@@ -170,6 +170,7 @@ acpi_ds_result_pop(union acpi_operand_object ** object, ...@@ -170,6 +170,7 @@ acpi_ds_result_pop(union acpi_operand_object ** object,
state->results.num_results--; state->results.num_results--;
for (index = ACPI_OBJ_NUM_OPERANDS; index; index--) { for (index = ACPI_OBJ_NUM_OPERANDS; index; index--) {
/* Check for a valid result object */ /* Check for a valid result object */
if (state->results.obj_desc[index - 1]) { if (state->results.obj_desc[index - 1]) {
...@@ -448,6 +449,7 @@ acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state * walk_state) ...@@ -448,6 +449,7 @@ acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state * walk_state)
ACPI_FUNCTION_NAME("ds_obj_stack_pop"); ACPI_FUNCTION_NAME("ds_obj_stack_pop");
for (i = 0; i < pop_count; i++) { for (i = 0; i < pop_count; i++) {
/* Check for stack underflow */ /* Check for stack underflow */
if (walk_state->num_operands == 0) { if (walk_state->num_operands == 0) {
...@@ -494,6 +496,7 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count, ...@@ -494,6 +496,7 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count,
ACPI_FUNCTION_NAME("ds_obj_stack_pop_and_delete"); ACPI_FUNCTION_NAME("ds_obj_stack_pop_and_delete");
for (i = 0; i < pop_count; i++) { for (i = 0; i < pop_count; i++) {
/* Check for stack underflow */ /* Check for stack underflow */
if (walk_state->num_operands == 0) { if (walk_state->num_operands == 0) {
...@@ -598,6 +601,7 @@ struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state *thread) ...@@ -598,6 +601,7 @@ struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state *thread)
walk_state = thread->walk_state_list; walk_state = thread->walk_state_list;
if (walk_state) { if (walk_state) {
/* Next walk state becomes the current walk state */ /* Next walk state becomes the current walk state */
thread->walk_state_list = walk_state->next; thread->walk_state_list = walk_state->next;
...@@ -778,6 +782,7 @@ acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state, ...@@ -778,6 +782,7 @@ acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state,
} }
if (parser_state->start_node) { if (parser_state->start_node) {
/* Push start scope on scope stack and make it current */ /* Push start scope on scope stack and make it current */
status = status =
......
...@@ -260,12 +260,14 @@ u32 acpi_ev_fixed_event_detect(void) ...@@ -260,12 +260,14 @@ u32 acpi_ev_fixed_event_detect(void)
* Check for all possible Fixed Events and dispatch those that are active * Check for all possible Fixed Events and dispatch those that are active
*/ */
for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
/* Both the status and enable bits must be on for this event */ /* Both the status and enable bits must be on for this event */
if ((fixed_status & acpi_gbl_fixed_event_info[i]. if ((fixed_status & acpi_gbl_fixed_event_info[i].
status_bit_mask) status_bit_mask)
&& (fixed_enable & acpi_gbl_fixed_event_info[i]. && (fixed_enable & acpi_gbl_fixed_event_info[i].
enable_bit_mask)) { enable_bit_mask)) {
/* Found an active (signalled) event */ /* Found an active (signalled) event */
int_status |= acpi_ev_fixed_event_dispatch((u32) i); int_status |= acpi_ev_fixed_event_dispatch((u32) i);
......
...@@ -207,6 +207,7 @@ acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info, ...@@ -207,6 +207,7 @@ acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info,
ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED); ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED);
if (write_to_hardware) { if (write_to_hardware) {
/* Clear the GPE (of stale events), then enable it */ /* Clear the GPE (of stale events), then enable it */
status = acpi_hw_clear_gpe(gpe_event_info); status = acpi_hw_clear_gpe(gpe_event_info);
...@@ -313,6 +314,7 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, ...@@ -313,6 +314,7 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
/* A NULL gpe_block means use the FADT-defined GPE block(s) */ /* A NULL gpe_block means use the FADT-defined GPE block(s) */
if (!gpe_device) { if (!gpe_device) {
/* Examine GPE Block 0 and 1 (These blocks are permanent) */ /* Examine GPE Block 0 and 1 (These blocks are permanent) */
for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) { for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) {
...@@ -402,6 +404,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) ...@@ -402,6 +404,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
* Find all currently active GP events. * Find all currently active GP events.
*/ */
for (i = 0; i < gpe_block->register_count; i++) { for (i = 0; i < gpe_block->register_count; i++) {
/* Get the next status/enable pair */ /* Get the next status/enable pair */
gpe_register_info = &gpe_block->register_info[i]; gpe_register_info = &gpe_block->register_info[i];
...@@ -437,6 +440,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) ...@@ -437,6 +440,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
enabled_status_byte = (u8) (status_reg & enable_reg); enabled_status_byte = (u8) (status_reg & enable_reg);
if (!enabled_status_byte) { if (!enabled_status_byte) {
/* No active GPEs in this register, move on */ /* No active GPEs in this register, move on */
continue; continue;
...@@ -445,6 +449,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) ...@@ -445,6 +449,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
/* Now look at the individual GPEs in this byte register */ /* Now look at the individual GPEs in this byte register */
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
/* Examine one GPE bit */ /* Examine one GPE bit */
if (enabled_status_byte & if (enabled_status_byte &
......
...@@ -146,10 +146,12 @@ acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback) ...@@ -146,10 +146,12 @@ acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback)
gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head;
while (gpe_xrupt_info) { while (gpe_xrupt_info) {
/* Walk all Gpe Blocks attached to this interrupt level */ /* Walk all Gpe Blocks attached to this interrupt level */
gpe_block = gpe_xrupt_info->gpe_block_list_head; gpe_block = gpe_xrupt_info->gpe_block_list_head;
while (gpe_block) { while (gpe_block) {
/* One callback per GPE block */ /* One callback per GPE block */
status = gpe_walk_callback(gpe_xrupt_info, gpe_block); status = gpe_walk_callback(gpe_xrupt_info, gpe_block);
...@@ -195,6 +197,7 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, ...@@ -195,6 +197,7 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
/* Examine each GPE Register within the block */ /* Examine each GPE Register within the block */
for (i = 0; i < gpe_block->register_count; i++) { for (i = 0; i < gpe_block->register_count; i++) {
/* Now look at the individual GPEs in this byte register */ /* Now look at the individual GPEs in this byte register */
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
...@@ -289,6 +292,7 @@ acpi_ev_save_method_info(acpi_handle obj_handle, ...@@ -289,6 +292,7 @@ acpi_ev_save_method_info(acpi_handle obj_handle,
gpe_number = ACPI_STRTOUL(&name[2], NULL, 16); gpe_number = ACPI_STRTOUL(&name[2], NULL, 16);
if (gpe_number == ACPI_UINT32_MAX) { if (gpe_number == ACPI_UINT32_MAX) {
/* Conversion failed; invalid method, just ignore it */ /* Conversion failed; invalid method, just ignore it */
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
...@@ -371,6 +375,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, ...@@ -371,6 +375,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
status = acpi_ut_evaluate_object(obj_handle, METHOD_NAME__PRW, status = acpi_ut_evaluate_object(obj_handle, METHOD_NAME__PRW,
ACPI_BTYPE_PACKAGE, &pkg_desc); ACPI_BTYPE_PACKAGE, &pkg_desc);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
/* Ignore all errors from _PRW, we don't want to abort the subsystem */ /* Ignore all errors from _PRW, we don't want to abort the subsystem */
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
...@@ -394,6 +399,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, ...@@ -394,6 +399,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
obj_desc = pkg_desc->package.elements[0]; obj_desc = pkg_desc->package.elements[0];
if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
/* Use FADT-defined GPE device (from definition of _PRW) */ /* Use FADT-defined GPE device (from definition of _PRW) */
target_gpe_device = acpi_gbl_fadt_gpe_device; target_gpe_device = acpi_gbl_fadt_gpe_device;
...@@ -402,6 +408,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, ...@@ -402,6 +408,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
gpe_number = (u32) obj_desc->integer.value; gpe_number = (u32) obj_desc->integer.value;
} else if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { } else if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) {
/* Package contains a GPE reference and GPE number within a GPE block */ /* Package contains a GPE reference and GPE number within a GPE block */
if ((obj_desc->package.count < 2) || if ((obj_desc->package.count < 2) ||
...@@ -679,6 +686,7 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) ...@@ -679,6 +686,7 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block)
status = acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block); status = acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block);
if (!gpe_block->previous && !gpe_block->next) { if (!gpe_block->previous && !gpe_block->next) {
/* This is the last gpe_block on this interrupt */ /* This is the last gpe_block on this interrupt */
status = acpi_ev_delete_gpe_xrupt(gpe_block->xrupt_block); status = acpi_ev_delete_gpe_xrupt(gpe_block->xrupt_block);
...@@ -780,6 +788,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) ...@@ -780,6 +788,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
this_event = gpe_event_info; this_event = gpe_event_info;
for (i = 0; i < gpe_block->register_count; i++) { for (i = 0; i < gpe_block->register_count; i++) {
/* Init the register_info for this GPE register (8 GPEs) */ /* Init the register_info for this GPE register (8 GPEs) */
this_register->base_gpe_number = this_register->base_gpe_number =
...@@ -1013,6 +1022,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, ...@@ -1013,6 +1022,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
for (i = 0; i < gpe_block->register_count; i++) { for (i = 0; i < gpe_block->register_count; i++) {
for (j = 0; j < 8; j++) { for (j = 0; j < 8; j++) {
/* Get the info block for this particular GPE */ /* Get the info block for this particular GPE */
gpe_event_info = gpe_event_info =
...@@ -1099,6 +1109,7 @@ acpi_status acpi_ev_gpe_initialize(void) ...@@ -1099,6 +1109,7 @@ acpi_status acpi_ev_gpe_initialize(void)
* particular block is not supported. * particular block is not supported.
*/ */
if (acpi_gbl_FADT->gpe0_blk_len && acpi_gbl_FADT->xgpe0_blk.address) { if (acpi_gbl_FADT->gpe0_blk_len && acpi_gbl_FADT->xgpe0_blk.address) {
/* GPE block 0 exists (has both length and address > 0) */ /* GPE block 0 exists (has both length and address > 0) */
register_count0 = (u16) (acpi_gbl_FADT->gpe0_blk_len / 2); register_count0 = (u16) (acpi_gbl_FADT->gpe0_blk_len / 2);
...@@ -1121,6 +1132,7 @@ acpi_status acpi_ev_gpe_initialize(void) ...@@ -1121,6 +1132,7 @@ acpi_status acpi_ev_gpe_initialize(void)
} }
if (acpi_gbl_FADT->gpe1_blk_len && acpi_gbl_FADT->xgpe1_blk.address) { if (acpi_gbl_FADT->gpe1_blk_len && acpi_gbl_FADT->xgpe1_blk.address) {
/* GPE block 1 exists (has both length and address > 0) */ /* GPE block 1 exists (has both length and address > 0) */
register_count1 = (u16) (acpi_gbl_FADT->gpe1_blk_len / 2); register_count1 = (u16) (acpi_gbl_FADT->gpe1_blk_len / 2);
...@@ -1168,6 +1180,7 @@ acpi_status acpi_ev_gpe_initialize(void) ...@@ -1168,6 +1180,7 @@ acpi_status acpi_ev_gpe_initialize(void)
/* Exit if there are no GPE registers */ /* Exit if there are no GPE registers */
if ((register_count0 + register_count1) == 0) { if ((register_count0 + register_count1) == 0) {
/* GPEs are not required by ACPI, this is OK */ /* GPEs are not required by ACPI, this is OK */
ACPI_DEBUG_PRINT((ACPI_DB_INIT, ACPI_DEBUG_PRINT((ACPI_DB_INIT,
......
...@@ -150,6 +150,7 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, ...@@ -150,6 +150,7 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
obj_desc = acpi_ns_get_attached_object(node); obj_desc = acpi_ns_get_attached_object(node);
if (obj_desc) { if (obj_desc) {
/* We have the notify object, Get the right handler */ /* We have the notify object, Get the right handler */
switch (node->type) { switch (node->type) {
...@@ -240,6 +241,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context) ...@@ -240,6 +241,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context)
* to the device. * to the device.
*/ */
if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) { if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) {
/* Global system notification handler */ /* Global system notification handler */
if (acpi_gbl_system_notify.handler) { if (acpi_gbl_system_notify.handler) {
...@@ -297,6 +299,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context) ...@@ -297,6 +299,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context)
/* Signal threads that are waiting for the lock */ /* Signal threads that are waiting for the lock */
if (acpi_gbl_global_lock_thread_count) { if (acpi_gbl_global_lock_thread_count) {
/* Send sufficient units to the semaphore */ /* Send sufficient units to the semaphore */
status = status =
...@@ -335,6 +338,7 @@ static u32 acpi_ev_global_lock_handler(void *context) ...@@ -335,6 +338,7 @@ static u32 acpi_ev_global_lock_handler(void *context)
*/ */
ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired); ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired);
if (acquired) { if (acquired) {
/* Got the lock, now wake all threads waiting for it */ /* Got the lock, now wake all threads waiting for it */
acpi_gbl_global_lock_acquired = TRUE; acpi_gbl_global_lock_acquired = TRUE;
...@@ -439,6 +443,7 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) ...@@ -439,6 +443,7 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout)
ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired); ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired);
if (acquired) { if (acquired) {
/* We got the lock */ /* We got the lock */
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
...@@ -492,6 +497,7 @@ acpi_status acpi_ev_release_global_lock(void) ...@@ -492,6 +497,7 @@ acpi_status acpi_ev_release_global_lock(void)
acpi_gbl_global_lock_thread_count--; acpi_gbl_global_lock_thread_count--;
if (acpi_gbl_global_lock_thread_count) { if (acpi_gbl_global_lock_thread_count) {
/* There are still some threads holding the lock, cannot release */ /* There are still some threads holding the lock, cannot release */
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
......
...@@ -164,6 +164,7 @@ acpi_status acpi_ev_initialize_op_regions(void) ...@@ -164,6 +164,7 @@ acpi_status acpi_ev_initialize_op_regions(void)
* Run the _REG methods for op_regions in each default address space * Run the _REG methods for op_regions in each default address space
*/ */
for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) { for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) {
/* TBD: Make sure handler is the DEFAULT handler, otherwise /* TBD: Make sure handler is the DEFAULT handler, otherwise
* _REG will have already been run. * _REG will have already been run.
*/ */
...@@ -315,6 +316,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, ...@@ -315,6 +316,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
*/ */
region_setup = handler_desc->address_space.setup; region_setup = handler_desc->address_space.setup;
if (!region_setup) { if (!region_setup) {
/* No initialization routine, exit with error */ /* No initialization routine, exit with error */
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
...@@ -361,6 +363,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, ...@@ -361,6 +363,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE; region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE;
if (region_obj2->extra.region_context) { if (region_obj2->extra.region_context) {
/* The handler for this region was already installed */ /* The handler for this region was already installed */
ACPI_MEM_FREE(region_context); ACPI_MEM_FREE(region_context);
...@@ -463,6 +466,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, ...@@ -463,6 +466,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
handler_obj = region_obj->region.handler; handler_obj = region_obj->region.handler;
if (!handler_obj) { if (!handler_obj) {
/* This region has no handler, all done */ /* This region has no handler, all done */
return_VOID; return_VOID;
...@@ -474,6 +478,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, ...@@ -474,6 +478,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
last_obj_ptr = &handler_obj->address_space.region_list; last_obj_ptr = &handler_obj->address_space.region_list;
while (obj_desc) { while (obj_desc) {
/* Is this the correct Region? */ /* Is this the correct Region? */
if (obj_desc == region_obj) { if (obj_desc == region_obj) {
...@@ -666,6 +671,7 @@ acpi_ev_install_handler(acpi_handle obj_handle, ...@@ -666,6 +671,7 @@ acpi_ev_install_handler(acpi_handle obj_handle,
obj_desc = acpi_ns_get_attached_object(node); obj_desc = acpi_ns_get_attached_object(node);
if (!obj_desc) { if (!obj_desc) {
/* No object, just exit */ /* No object, just exit */
return (AE_OK); return (AE_OK);
...@@ -674,10 +680,12 @@ acpi_ev_install_handler(acpi_handle obj_handle, ...@@ -674,10 +680,12 @@ acpi_ev_install_handler(acpi_handle obj_handle,
/* Devices are handled different than regions */ /* Devices are handled different than regions */
if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_DEVICE) { if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_DEVICE) {
/* Check if this Device already has a handler for this address space */ /* Check if this Device already has a handler for this address space */
next_handler_obj = obj_desc->device.handler; next_handler_obj = obj_desc->device.handler;
while (next_handler_obj) { while (next_handler_obj) {
/* Found a handler, is it for the same address space? */ /* Found a handler, is it for the same address space? */
if (next_handler_obj->address_space.space_id == if (next_handler_obj->address_space.space_id ==
...@@ -839,6 +847,7 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, ...@@ -839,6 +847,7 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
/* Walk the handler list for this device */ /* Walk the handler list for this device */
while (handler_obj) { while (handler_obj) {
/* Same space_id indicates a handler already installed */ /* Same space_id indicates a handler already installed */
if (handler_obj->address_space.space_id == space_id) { if (handler_obj->address_space.space_id == space_id) {
...@@ -1035,6 +1044,7 @@ acpi_ev_reg_run(acpi_handle obj_handle, ...@@ -1035,6 +1044,7 @@ acpi_ev_reg_run(acpi_handle obj_handle,
obj_desc = acpi_ns_get_attached_object(node); obj_desc = acpi_ns_get_attached_object(node);
if (!obj_desc) { if (!obj_desc) {
/* No object, just exit */ /* No object, just exit */
return (AE_OK); return (AE_OK);
......
...@@ -199,6 +199,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, ...@@ -199,6 +199,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
* handlers with that device. * handlers with that device.
*/ */
if (handler_obj->address_space.node == acpi_gbl_root_node) { if (handler_obj->address_space.node == acpi_gbl_root_node) {
/* Start search from the parent object */ /* Start search from the parent object */
pci_root_node = parent_node; pci_root_node = parent_node;
...@@ -220,6 +221,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, ...@@ -220,6 +221,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
PCI_EXPRESS_ROOT_HID_STRING, PCI_EXPRESS_ROOT_HID_STRING,
sizeof(PCI_EXPRESS_ROOT_HID_STRING))))) sizeof(PCI_EXPRESS_ROOT_HID_STRING)))))
{ {
/* Install a handler for this PCI root bridge */ /* Install a handler for this PCI root bridge */
status = status =
...@@ -478,11 +480,13 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, ...@@ -478,11 +480,13 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
* ie: acpi_gbl_root_node->parent_entry being set to NULL * ie: acpi_gbl_root_node->parent_entry being set to NULL
*/ */
while (node) { while (node) {
/* Check to see if a handler exists */ /* Check to see if a handler exists */
handler_obj = NULL; handler_obj = NULL;
obj_desc = acpi_ns_get_attached_object(node); obj_desc = acpi_ns_get_attached_object(node);
if (obj_desc) { if (obj_desc) {
/* Can only be a handler if the object exists */ /* Can only be a handler if the object exists */
switch (node->type) { switch (node->type) {
...@@ -507,10 +511,12 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, ...@@ -507,10 +511,12 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
} }
while (handler_obj) { while (handler_obj) {
/* Is this handler of the correct type? */ /* Is this handler of the correct type? */
if (handler_obj->address_space.space_id == if (handler_obj->address_space.space_id ==
space_id) { space_id) {
/* Found correct handler */ /* Found correct handler */
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
......
...@@ -275,6 +275,7 @@ acpi_install_notify_handler(acpi_handle device, ...@@ -275,6 +275,7 @@ acpi_install_notify_handler(acpi_handle device,
* only one <external> global handler can be regsitered (per notify type). * only one <external> global handler can be regsitered (per notify type).
*/ */
if (device == ACPI_ROOT_OBJECT) { if (device == ACPI_ROOT_OBJECT) {
/* Make sure the handler is not already installed */ /* Make sure the handler is not already installed */
if (((handler_type & ACPI_SYSTEM_NOTIFY) && if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
...@@ -317,6 +318,7 @@ acpi_install_notify_handler(acpi_handle device, ...@@ -317,6 +318,7 @@ acpi_install_notify_handler(acpi_handle device,
obj_desc = acpi_ns_get_attached_object(node); obj_desc = acpi_ns_get_attached_object(node);
if (obj_desc) { if (obj_desc) {
/* Object exists - make sure there's no handler */ /* Object exists - make sure there's no handler */
if (((handler_type & ACPI_SYSTEM_NOTIFY) && if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
...@@ -370,6 +372,7 @@ acpi_install_notify_handler(acpi_handle device, ...@@ -370,6 +372,7 @@ acpi_install_notify_handler(acpi_handle device,
} }
if (handler_type == ACPI_ALL_NOTIFY) { if (handler_type == ACPI_ALL_NOTIFY) {
/* Extra ref if installed in both */ /* Extra ref if installed in both */
acpi_ut_add_reference(notify_obj); acpi_ut_add_reference(notify_obj);
......
...@@ -636,6 +636,7 @@ acpi_install_gpe_block(acpi_handle gpe_device, ...@@ -636,6 +636,7 @@ acpi_install_gpe_block(acpi_handle gpe_device,
obj_desc = acpi_ns_get_attached_object(node); obj_desc = acpi_ns_get_attached_object(node);
if (!obj_desc) { if (!obj_desc) {
/* No object, create a new one */ /* No object, create a new one */
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_DEVICE); obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_DEVICE);
......
...@@ -176,9 +176,11 @@ acpi_remove_address_space_handler(acpi_handle device, ...@@ -176,9 +176,11 @@ acpi_remove_address_space_handler(acpi_handle device,
handler_obj = obj_desc->device.handler; handler_obj = obj_desc->device.handler;
last_obj_ptr = &obj_desc->device.handler; last_obj_ptr = &obj_desc->device.handler;
while (handler_obj) { while (handler_obj) {
/* We have a handler, see if user requested this one */ /* We have a handler, see if user requested this one */
if (handler_obj->address_space.space_id == space_id) { if (handler_obj->address_space.space_id == space_id) {
/* Matched space_id, first dereference this in the Regions */ /* Matched space_id, first dereference this in the Regions */
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
......
...@@ -110,6 +110,7 @@ acpi_ex_add_table(struct acpi_table_header *table, ...@@ -110,6 +110,7 @@ acpi_ex_add_table(struct acpi_table_header *table,
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
if (status == AE_ALREADY_EXISTS) { if (status == AE_ALREADY_EXISTS) {
/* Table already exists, just return the handle */ /* Table already exists, just return the handle */
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
...@@ -121,6 +122,7 @@ acpi_ex_add_table(struct acpi_table_header *table, ...@@ -121,6 +122,7 @@ acpi_ex_add_table(struct acpi_table_header *table,
status = acpi_ns_load_table(table_info.installed_desc, parent_node); status = acpi_ns_load_table(table_info.installed_desc, parent_node);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
/* Uninstall table on error */ /* Uninstall table on error */
(void)acpi_tb_uninstall_table(table_info.installed_desc); (void)acpi_tb_uninstall_table(table_info.installed_desc);
...@@ -169,6 +171,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, ...@@ -169,6 +171,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
*/ */
status = acpi_tb_match_signature(operand[0]->string.pointer, NULL); status = acpi_tb_match_signature(operand[0]->string.pointer, NULL);
if (status == AE_OK) { if (status == AE_OK) {
/* Signature matched -- don't allow override */ /* Signature matched -- don't allow override */
return_ACPI_STATUS(AE_ALREADY_EXISTS); return_ACPI_STATUS(AE_ALREADY_EXISTS);
...@@ -252,6 +255,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, ...@@ -252,6 +255,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
/* Parameter Data (optional) */ /* Parameter Data (optional) */
if (parameter_node) { if (parameter_node) {
/* Store the parameter data into the optional parameter object */ /* Store the parameter data into the optional parameter object */
status = acpi_ex_store(operand[5], status = acpi_ex_store(operand[5],
...@@ -424,6 +428,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, ...@@ -424,6 +428,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
status = acpi_ex_add_table(table_ptr, acpi_gbl_root_node, &ddb_handle); status = acpi_ex_add_table(table_ptr, acpi_gbl_root_node, &ddb_handle);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
/* On error, table_ptr was deallocated above */ /* On error, table_ptr was deallocated above */
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
......
...@@ -319,6 +319,7 @@ acpi_ex_convert_to_ascii(acpi_integer integer, ...@@ -319,6 +319,7 @@ acpi_ex_convert_to_ascii(acpi_integer integer,
remainder = 0; remainder = 0;
for (i = decimal_length; i > 0; i--) { for (i = decimal_length; i > 0; i--) {
/* Divide by nth factor of 10 */ /* Divide by nth factor of 10 */
digit = integer; digit = integer;
...@@ -346,6 +347,7 @@ acpi_ex_convert_to_ascii(acpi_integer integer, ...@@ -346,6 +347,7 @@ acpi_ex_convert_to_ascii(acpi_integer integer,
hex_length = (acpi_native_uint) ACPI_MUL_2(data_width); hex_length = (acpi_native_uint) ACPI_MUL_2(data_width);
for (i = 0, j = (hex_length - 1); i < hex_length; i++, j--) { for (i = 0, j = (hex_length - 1); i < hex_length; i++, j--) {
/* Get one hex digit, most significant digits first */ /* Get one hex digit, most significant digits first */
string[k] = string[k] =
......
...@@ -463,6 +463,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) ...@@ -463,6 +463,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
} }
if (!obj_desc) { if (!obj_desc) {
/* This could be a null element of a package */ /* This could be a null element of a package */
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Null Object Descriptor\n")); ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Null Object Descriptor\n"));
...@@ -532,6 +533,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) ...@@ -532,6 +533,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
obj_desc->reference.offset); obj_desc->reference.offset);
if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
/* Value is an Integer */ /* Value is an Integer */
acpi_os_printf(" value is [%8.8X%8.8x]", acpi_os_printf(" value is [%8.8X%8.8x]",
......
...@@ -142,6 +142,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, ...@@ -142,6 +142,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
length = length =
(acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length); (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length);
if (length > acpi_gbl_integer_byte_width) { if (length > acpi_gbl_integer_byte_width) {
/* Field is too large for an Integer, create a Buffer instead */ /* Field is too large for an Integer, create a Buffer instead */
buffer_desc = acpi_ut_create_buffer_object(length); buffer_desc = acpi_ut_create_buffer_object(length);
...@@ -329,6 +330,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, ...@@ -329,6 +330,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length); ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length);
if (length < required_length) { if (length < required_length) {
/* We need to create a new buffer */ /* We need to create a new buffer */
new_buffer = ACPI_MEM_CALLOCATE(required_length); new_buffer = ACPI_MEM_CALLOCATE(required_length);
......
...@@ -113,6 +113,7 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, ...@@ -113,6 +113,7 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
} }
if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS) { if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS) {
/* SMBus has a non-linear address space */ /* SMBus has a non-linear address space */
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
...@@ -491,6 +492,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, ...@@ -491,6 +492,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
value)); value));
if (read_write == ACPI_READ) { if (read_write == ACPI_READ) {
/* Read the datum from the data_register */ /* Read the datum from the data_register */
status = status =
...@@ -568,6 +570,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, ...@@ -568,6 +570,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
/* If the mask is all ones, we don't need to worry about the update rule */ /* If the mask is all ones, we don't need to worry about the update rule */
if (mask != ACPI_INTEGER_MAX) { if (mask != ACPI_INTEGER_MAX) {
/* Decode the update rule */ /* Decode the update rule */
switch (obj_desc->common_field. switch (obj_desc->common_field.
...@@ -704,6 +707,7 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, ...@@ -704,6 +707,7 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc,
/* Read the rest of the field */ /* Read the rest of the field */
for (i = 1; i < field_datum_count; i++) { for (i = 1; i < field_datum_count; i++) {
/* Get next input datum from the field */ /* Get next input datum from the field */
field_offset += obj_desc->common_field.access_byte_width; field_offset += obj_desc->common_field.access_byte_width;
...@@ -817,6 +821,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, ...@@ -817,6 +821,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
/* Write the entire field */ /* Write the entire field */
for (i = 1; i < field_datum_count; i++) { for (i = 1; i < field_datum_count; i++) {
/* Write merged datum to the target field */ /* Write merged datum to the target field */
merged_datum &= mask; merged_datum &= mask;
......
...@@ -649,6 +649,7 @@ acpi_ex_do_logical_op(u16 opcode, ...@@ -649,6 +649,7 @@ acpi_ex_do_logical_op(u16 opcode,
/* Length and all bytes must be equal */ /* Length and all bytes must be equal */
if ((length0 == length1) && (compare == 0)) { if ((length0 == length1) && (compare == 0)) {
/* Length and all bytes match ==> TRUE */ /* Length and all bytes match ==> TRUE */
local_result = TRUE; local_result = TRUE;
......
...@@ -173,6 +173,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, ...@@ -173,6 +173,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
/* Support for multiple acquires by the owning thread */ /* Support for multiple acquires by the owning thread */
if (obj_desc->mutex.owner_thread) { if (obj_desc->mutex.owner_thread) {
/* Special case for Global Lock, allow all threads */ /* Special case for Global Lock, allow all threads */
if ((obj_desc->mutex.owner_thread->thread_id == if ((obj_desc->mutex.owner_thread->thread_id ==
...@@ -192,6 +193,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, ...@@ -192,6 +193,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
status = acpi_ex_system_acquire_mutex(time_desc, obj_desc); status = acpi_ex_system_acquire_mutex(time_desc, obj_desc);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
/* Includes failure from a timeout on time_desc */ /* Includes failure from a timeout on time_desc */
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
...@@ -286,6 +288,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, ...@@ -286,6 +288,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
obj_desc->mutex.acquisition_depth--; obj_desc->mutex.acquisition_depth--;
if (obj_desc->mutex.acquisition_depth != 0) { if (obj_desc->mutex.acquisition_depth != 0) {
/* Just decrement the depth and return */ /* Just decrement the depth and return */
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
......
...@@ -85,6 +85,7 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) ...@@ -85,6 +85,7 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs)
* This may actually be somewhat longer than needed. * This may actually be somewhat longer than needed.
*/ */
if (prefix_count == ACPI_UINT32_MAX) { if (prefix_count == ACPI_UINT32_MAX) {
/* Special case for root */ /* Special case for root */
size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1; size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1;
...@@ -119,11 +120,13 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) ...@@ -119,11 +120,13 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs)
/* Set up Dual or Multi prefixes if needed */ /* Set up Dual or Multi prefixes if needed */
if (num_name_segs > 2) { if (num_name_segs > 2) {
/* Set up multi prefixes */ /* Set up multi prefixes */
*temp_ptr++ = AML_MULTI_NAME_PREFIX_OP; *temp_ptr++ = AML_MULTI_NAME_PREFIX_OP;
*temp_ptr++ = (char)num_name_segs; *temp_ptr++ = (char)num_name_segs;
} else if (2 == num_name_segs) { } else if (2 == num_name_segs) {
/* Set up dual prefixes */ /* Set up dual prefixes */
*temp_ptr++ = AML_DUAL_NAME_PREFIX; *temp_ptr++ = AML_DUAL_NAME_PREFIX;
...@@ -184,6 +187,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) ...@@ -184,6 +187,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string)
/* Valid name segment */ /* Valid name segment */
if (index == 4) { if (index == 4) {
/* Found 4 valid characters */ /* Found 4 valid characters */
char_buf[4] = '\0'; char_buf[4] = '\0';
...@@ -254,6 +258,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, ...@@ -254,6 +258,7 @@ acpi_ex_get_name_string(acpi_object_type data_type,
if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type || if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type ||
ACPI_TYPE_LOCAL_BANK_FIELD == data_type || ACPI_TYPE_LOCAL_BANK_FIELD == data_type ||
ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) { ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) {
/* Disallow prefixes for types associated with field_unit names */ /* Disallow prefixes for types associated with field_unit names */
name_string = acpi_ex_allocate_name_string(0, 1); name_string = acpi_ex_allocate_name_string(0, 1);
...@@ -410,6 +415,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, ...@@ -410,6 +415,7 @@ acpi_ex_get_name_string(acpi_object_type data_type,
} }
if (AE_CTRL_PENDING == status && has_prefix) { if (AE_CTRL_PENDING == status && has_prefix) {
/* Ran out of segments after processing a prefix */ /* Ran out of segments after processing a prefix */
ACPI_ERROR((AE_INFO, "Malformed Name at %p", name_string)); ACPI_ERROR((AE_INFO, "Malformed Name at %p", name_string));
......
...@@ -342,6 +342,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) ...@@ -342,6 +342,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
for (i = 0; for (i = 0;
(i < acpi_gbl_integer_nybble_width) && (digit > 0); (i < acpi_gbl_integer_nybble_width) && (digit > 0);
i++) { i++) {
/* Get the least significant 4-bit BCD digit */ /* Get the least significant 4-bit BCD digit */
temp32 = ((u32) digit) & 0xF; temp32 = ((u32) digit) & 0xF;
...@@ -487,6 +488,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) ...@@ -487,6 +488,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
status = acpi_ex_convert_to_string(operand[0], &return_desc, status = acpi_ex_convert_to_string(operand[0], &return_desc,
ACPI_EXPLICIT_CONVERT_DECIMAL); ACPI_EXPLICIT_CONVERT_DECIMAL);
if (return_desc == operand[0]) { if (return_desc == operand[0]) {
/* No conversion performed, add ref to handle return value */ /* No conversion performed, add ref to handle return value */
acpi_ut_add_reference(return_desc); acpi_ut_add_reference(return_desc);
} }
...@@ -497,6 +499,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) ...@@ -497,6 +499,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
status = acpi_ex_convert_to_string(operand[0], &return_desc, status = acpi_ex_convert_to_string(operand[0], &return_desc,
ACPI_EXPLICIT_CONVERT_HEX); ACPI_EXPLICIT_CONVERT_HEX);
if (return_desc == operand[0]) { if (return_desc == operand[0]) {
/* No conversion performed, add ref to handle return value */ /* No conversion performed, add ref to handle return value */
acpi_ut_add_reference(return_desc); acpi_ut_add_reference(return_desc);
} }
...@@ -506,6 +509,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) ...@@ -506,6 +509,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
status = acpi_ex_convert_to_buffer(operand[0], &return_desc); status = acpi_ex_convert_to_buffer(operand[0], &return_desc);
if (return_desc == operand[0]) { if (return_desc == operand[0]) {
/* No conversion performed, add ref to handle return value */ /* No conversion performed, add ref to handle return value */
acpi_ut_add_reference(return_desc); acpi_ut_add_reference(return_desc);
} }
...@@ -516,6 +520,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) ...@@ -516,6 +520,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
status = acpi_ex_convert_to_integer(operand[0], &return_desc, status = acpi_ex_convert_to_integer(operand[0], &return_desc,
ACPI_ANY_BASE); ACPI_ANY_BASE);
if (return_desc == operand[0]) { if (return_desc == operand[0]) {
/* No conversion performed, add ref to handle return value */ /* No conversion performed, add ref to handle return value */
acpi_ut_add_reference(return_desc); acpi_ut_add_reference(return_desc);
} }
...@@ -541,6 +546,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) ...@@ -541,6 +546,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
} }
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
/* Store the return value computed above into the target object */ /* Store the return value computed above into the target object */
status = acpi_ex_store(return_desc, operand[1], walk_state); status = acpi_ex_store(return_desc, operand[1], walk_state);
...@@ -625,6 +631,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) ...@@ -625,6 +631,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
temp_desc = operand[0]; temp_desc = operand[0];
if (ACPI_GET_DESCRIPTOR_TYPE(temp_desc) == if (ACPI_GET_DESCRIPTOR_TYPE(temp_desc) ==
ACPI_DESC_TYPE_OPERAND) { ACPI_DESC_TYPE_OPERAND) {
/* Internal reference object - prevent deletion */ /* Internal reference object - prevent deletion */
acpi_ut_add_reference(temp_desc); acpi_ut_add_reference(temp_desc);
...@@ -777,8 +784,25 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) ...@@ -777,8 +784,25 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
/* Check for a method local or argument, or standalone String */ /* Check for a method local or argument, or standalone String */
if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) != if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) ==
ACPI_DESC_TYPE_NAMED) { ACPI_DESC_TYPE_NAMED) {
temp_desc =
acpi_ns_get_attached_object((struct
acpi_namespace_node *)
operand[0]);
if (temp_desc
&&
((ACPI_GET_OBJECT_TYPE(temp_desc) ==
ACPI_TYPE_STRING)
|| (ACPI_GET_OBJECT_TYPE(temp_desc) ==
ACPI_TYPE_LOCAL_REFERENCE))) {
operand[0] = temp_desc;
acpi_ut_add_reference(temp_desc);
} else {
status = AE_AML_OPERAND_TYPE;
goto cleanup;
}
} else {
switch (ACPI_GET_OBJECT_TYPE(operand[0])) { switch (ACPI_GET_OBJECT_TYPE(operand[0])) {
case ACPI_TYPE_LOCAL_REFERENCE: case ACPI_TYPE_LOCAL_REFERENCE:
/* /*
...@@ -827,13 +851,24 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) ...@@ -827,13 +851,24 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
break; break;
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
break;
default:
status = AE_AML_OPERAND_TYPE;
goto cleanup;
}
}
if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) !=
ACPI_DESC_TYPE_NAMED) {
if (ACPI_GET_OBJECT_TYPE(operand[0]) ==
ACPI_TYPE_STRING) {
/* /*
* This is a deref_of (String). The string is a reference * This is a deref_of (String). The string is a reference
* to a named ACPI object. * to a named ACPI object.
* *
* 1) Find the owning Node * 1) Find the owning Node
* 2) Dereference the node to an actual object. Could be a * 2) Dereference the node to an actual object. Could be a
* Field, so we need to resolve the node to a value. * Field, so we need to resolve the node to a value.
*/ */
status = status =
...@@ -857,11 +892,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) ...@@ -857,11 +892,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
(struct acpi_namespace_node, &return_desc), (struct acpi_namespace_node, &return_desc),
walk_state); walk_state);
goto cleanup; goto cleanup;
default:
status = AE_AML_OPERAND_TYPE;
goto cleanup;
} }
} }
......
...@@ -138,6 +138,7 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state) ...@@ -138,6 +138,7 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state)
acpi_ev_check_for_wake_only_gpe(walk_state-> acpi_ev_check_for_wake_only_gpe(walk_state->
gpe_event_info); gpe_event_info);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
/* AE_WAKE_ONLY_GPE only error, means ignore this notify */ /* AE_WAKE_ONLY_GPE only error, means ignore this notify */
return_ACPI_STATUS(AE_OK) return_ACPI_STATUS(AE_OK)
...@@ -252,6 +253,7 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state) ...@@ -252,6 +253,7 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state)
acpi_ut_remove_reference(return_desc2); acpi_ut_remove_reference(return_desc2);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
/* Delete the return object */ /* Delete the return object */
acpi_ut_remove_reference(return_desc1); acpi_ut_remove_reference(return_desc1);
...@@ -287,6 +289,7 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) ...@@ -287,6 +289,7 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
/* Execute the opcode */ /* Execute the opcode */
if (walk_state->op_info->flags & AML_MATH) { if (walk_state->op_info->flags & AML_MATH) {
/* All simple math opcodes (add, etc.) */ /* All simple math opcodes (add, etc.) */
return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
...@@ -383,54 +386,70 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) ...@@ -383,54 +386,70 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
goto cleanup; goto cleanup;
} }
/* Initialize the Index reference object */
index = operand[1]->integer.value; index = operand[1]->integer.value;
return_desc->reference.offset = (u32) index;
return_desc->reference.opcode = AML_INDEX_OP;
return_desc->reference.object = operand[0];
/* At this point, the Source operand is a Package, Buffer, or String */ /*
* At this point, the Source operand is a String, Buffer, or Package.
* Verify that the index is within range.
*/
switch (ACPI_GET_OBJECT_TYPE(operand[0])) {
case ACPI_TYPE_STRING:
if (ACPI_GET_OBJECT_TYPE(operand[0]) == ACPI_TYPE_PACKAGE) { if (index >= operand[0]->string.length) {
/* Object to be indexed is a Package */ status = AE_AML_STRING_LIMIT;
}
return_desc->reference.target_type =
ACPI_TYPE_BUFFER_FIELD;
break;
case ACPI_TYPE_BUFFER:
if (index >= operand[0]->buffer.length) {
status = AE_AML_BUFFER_LIMIT;
}
return_desc->reference.target_type =
ACPI_TYPE_BUFFER_FIELD;
break;
case ACPI_TYPE_PACKAGE:
if (index >= operand[0]->package.count) { if (index >= operand[0]->package.count) {
ACPI_ERROR((AE_INFO,
"Index value (%X%8.8X) beyond package end (%X)",
ACPI_FORMAT_UINT64(index),
operand[0]->package.count));
status = AE_AML_PACKAGE_LIMIT; status = AE_AML_PACKAGE_LIMIT;
goto cleanup;
} }
return_desc->reference.target_type = ACPI_TYPE_PACKAGE; return_desc->reference.target_type = ACPI_TYPE_PACKAGE;
return_desc->reference.object = operand[0];
return_desc->reference.where = return_desc->reference.where =
&operand[0]->package.elements[index]; &operand[0]->package.elements[index];
} else { break;
/* Object to be indexed is a Buffer/String */
if (index >= operand[0]->buffer.length) { default:
ACPI_ERROR((AE_INFO,
"Index value (%X%8.8X) beyond end of buffer (%X)",
ACPI_FORMAT_UINT64(index),
operand[0]->buffer.length));
status = AE_AML_BUFFER_LIMIT;
goto cleanup;
}
return_desc->reference.target_type = status = AE_AML_INTERNAL;
ACPI_TYPE_BUFFER_FIELD; goto cleanup;
return_desc->reference.object = operand[0]; }
/* Failure means that the Index was beyond the end of the object */
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status,
"Index (%X%8.8X) is beyond end of object",
ACPI_FORMAT_UINT64(index)));
goto cleanup;
} }
/* /*
* Add a reference to the target package/buffer/string for the life * Add a reference to the target package/buffer/string for the life
* of the index. * of the index
*/ */
acpi_ut_add_reference(operand[0]); acpi_ut_add_reference(operand[0]);
/* Complete the Index reference object */
return_desc->reference.opcode = AML_INDEX_OP;
return_desc->reference.offset = (u32) index;
/* Store the reference to the Target */ /* Store the reference to the Target */
status = acpi_ex_store(return_desc, operand[2], walk_state); status = acpi_ex_store(return_desc, operand[2], walk_state);
...@@ -509,6 +528,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) ...@@ -509,6 +528,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state)
/* Execute the Opcode */ /* Execute the Opcode */
if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) { if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) {
/* logical_op (Operand0, Operand1) */ /* logical_op (Operand0, Operand1) */
status = acpi_ex_do_logical_numeric_op(walk_state->opcode, status = acpi_ex_do_logical_numeric_op(walk_state->opcode,
...@@ -518,6 +538,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) ...@@ -518,6 +538,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state)
value, &logical_result); value, &logical_result);
goto store_logical_result; goto store_logical_result;
} else if (walk_state->op_info->flags & AML_LOGICAL) { } else if (walk_state->op_info->flags & AML_LOGICAL) {
/* logical_op (Operand0, Operand1) */ /* logical_op (Operand0, Operand1) */
status = acpi_ex_do_logical_op(walk_state->opcode, operand[0], status = acpi_ex_do_logical_op(walk_state->opcode, operand[0],
......
...@@ -208,6 +208,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) ...@@ -208,6 +208,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
/* If the requested length is zero, don't allocate a buffer */ /* If the requested length is zero, don't allocate a buffer */
if (length > 0) { if (length > 0) {
/* Allocate a new buffer for the Buffer */ /* Allocate a new buffer for the Buffer */
buffer = ACPI_MEM_CALLOCATE(length); buffer = ACPI_MEM_CALLOCATE(length);
...@@ -225,6 +226,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) ...@@ -225,6 +226,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
} }
if (buffer) { if (buffer) {
/* We have a buffer, copy the portion requested */ /* We have a buffer, copy the portion requested */
ACPI_MEMCPY(buffer, operand[0]->string.pointer + index, ACPI_MEMCPY(buffer, operand[0]->string.pointer + index,
......
...@@ -276,6 +276,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) ...@@ -276,6 +276,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state)
* match was found. * match was found.
*/ */
for (; index < operand[0]->package.count; index++) { for (; index < operand[0]->package.count; index++) {
/* Get the current package element */ /* Get the current package element */
this_element = operand[0]->package.elements[index]; this_element = operand[0]->package.elements[index];
......
...@@ -135,6 +135,7 @@ acpi_ex_system_memory_space_handler(u32 function, ...@@ -135,6 +135,7 @@ acpi_ex_system_memory_space_handler(u32 function,
* Delete the existing mapping and create a new one. * Delete the existing mapping and create a new one.
*/ */
if (mem_info->mapped_length) { if (mem_info->mapped_length) {
/* Valid mapping, delete it */ /* Valid mapping, delete it */
acpi_os_unmap_memory(mem_info->mapped_logical_address, acpi_os_unmap_memory(mem_info->mapped_logical_address,
......
...@@ -103,6 +103,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, ...@@ -103,6 +103,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
if ((entry_type == ACPI_TYPE_LOCAL_ALIAS) || if ((entry_type == ACPI_TYPE_LOCAL_ALIAS) ||
(entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) { (entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) {
/* There is always exactly one level of indirection */ /* There is always exactly one level of indirection */
node = ACPI_CAST_PTR(struct acpi_namespace_node, node->object); node = ACPI_CAST_PTR(struct acpi_namespace_node, node->object);
...@@ -141,6 +142,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, ...@@ -141,6 +142,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
status = acpi_ds_get_package_arguments(source_desc); status = acpi_ds_get_package_arguments(source_desc);
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
/* Return an additional reference to the object */ /* Return an additional reference to the object */
obj_desc = source_desc; obj_desc = source_desc;
...@@ -158,6 +160,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, ...@@ -158,6 +160,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
status = acpi_ds_get_buffer_arguments(source_desc); status = acpi_ds_get_buffer_arguments(source_desc);
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
/* Return an additional reference to the object */ /* Return an additional reference to the object */
obj_desc = source_desc; obj_desc = source_desc;
...@@ -240,6 +243,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, ...@@ -240,6 +243,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
/* This is a ddb_handle */ /* This is a ddb_handle */
/* Return an additional reference to the object */ /* Return an additional reference to the object */
case AML_REF_OF_OP:
obj_desc = source_desc; obj_desc = source_desc;
acpi_ut_add_reference(obj_desc); acpi_ut_add_reference(obj_desc);
break; break;
......
...@@ -382,10 +382,16 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, ...@@ -382,10 +382,16 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) { while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) {
switch (obj_desc->reference.opcode) { switch (obj_desc->reference.opcode) {
case AML_REF_OF_OP: case AML_REF_OF_OP:
case AML_INT_NAMEPATH_OP:
/* Dereference the reference pointer */ /* Dereference the reference pointer */
node = obj_desc->reference.object; if (obj_desc->reference.opcode == AML_REF_OF_OP) {
node = obj_desc->reference.object;
} else { /* AML_INT_NAMEPATH_OP */
node = obj_desc->reference.node;
}
/* All "References" point to a NS node */ /* All "References" point to a NS node */
...@@ -401,6 +407,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, ...@@ -401,6 +407,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
obj_desc = acpi_ns_get_attached_object(node); obj_desc = acpi_ns_get_attached_object(node);
if (!obj_desc) { if (!obj_desc) {
/* No object, use the NS node type */ /* No object, use the NS node type */
type = acpi_ns_get_type(node); type = acpi_ns_get_type(node);
...@@ -432,6 +439,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, ...@@ -432,6 +439,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
*/ */
obj_desc = *(obj_desc->reference.where); obj_desc = *(obj_desc->reference.where);
if (!obj_desc) { if (!obj_desc) {
/* NULL package elements are allowed */ /* NULL package elements are allowed */
type = 0; /* Uninitialized */ type = 0; /* Uninitialized */
...@@ -439,39 +447,6 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, ...@@ -439,39 +447,6 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
} }
break; break;
case AML_INT_NAMEPATH_OP:
/* Dereference the reference pointer */
node = obj_desc->reference.node;
/* All "References" point to a NS node */
if (ACPI_GET_DESCRIPTOR_TYPE(node) !=
ACPI_DESC_TYPE_NAMED) {
ACPI_ERROR((AE_INFO, "Not a NS node %p [%s]",
node,
acpi_ut_get_descriptor_name(node)));
return_ACPI_STATUS(AE_AML_INTERNAL);
}
/* Get the attached object */
obj_desc = acpi_ns_get_attached_object(node);
if (!obj_desc) {
/* No object, use the NS node type */
type = acpi_ns_get_type(node);
goto exit;
}
/* Check for circular references */
if (obj_desc == operand) {
return_ACPI_STATUS(AE_AML_CIRCULAR_REFERENCE);
}
break;
case AML_LOCAL_OP: case AML_LOCAL_OP:
case AML_ARG_OP: case AML_ARG_OP:
......
...@@ -77,6 +77,7 @@ acpi_ex_check_object_type(acpi_object_type type_needed, ...@@ -77,6 +77,7 @@ acpi_ex_check_object_type(acpi_object_type type_needed,
ACPI_FUNCTION_ENTRY(); ACPI_FUNCTION_ENTRY();
if (type_needed == ACPI_TYPE_ANY) { if (type_needed == ACPI_TYPE_ANY) {
/* All types OK, so we don't perform any typechecks */ /* All types OK, so we don't perform any typechecks */
return (AE_OK); return (AE_OK);
...@@ -224,6 +225,7 @@ acpi_ex_resolve_operands(u16 opcode, ...@@ -224,6 +225,7 @@ acpi_ex_resolve_operands(u16 opcode,
} }
if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) {
/* Decode the Reference */ /* Decode the Reference */
op_info = acpi_ps_get_opcode_info(opcode); op_info = acpi_ps_get_opcode_info(opcode);
...@@ -332,6 +334,7 @@ acpi_ex_resolve_operands(u16 opcode, ...@@ -332,6 +334,7 @@ acpi_ex_resolve_operands(u16 opcode,
} }
if (obj_desc->reference.opcode == AML_NAME_OP) { if (obj_desc->reference.opcode == AML_NAME_OP) {
/* Convert a named reference to the actual named object */ /* Convert a named reference to the actual named object */
temp_node = obj_desc->reference.object; temp_node = obj_desc->reference.object;
...@@ -662,6 +665,7 @@ acpi_ex_resolve_operands(u16 opcode, ...@@ -662,6 +665,7 @@ acpi_ex_resolve_operands(u16 opcode,
} }
if (target_op == AML_DEBUG_OP) { if (target_op == AML_DEBUG_OP) {
/* Allow store of any object to the Debug object */ /* Allow store of any object to the Debug object */
break; break;
......
...@@ -423,6 +423,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, ...@@ -423,6 +423,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
} }
if (obj_desc) { if (obj_desc) {
/* Decrement reference count by the ref count of the parent package */ /* Decrement reference count by the ref count of the parent package */
for (i = 0; i < ((union acpi_operand_object *) for (i = 0; i < ((union acpi_operand_object *)
...@@ -572,6 +573,7 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, ...@@ -572,6 +573,7 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
/* If no implicit conversion, drop into the default case below */ /* If no implicit conversion, drop into the default case below */
if ((!implicit_conversion) || (walk_state->opcode == AML_COPY_OP)) { if ((!implicit_conversion) || (walk_state->opcode == AML_COPY_OP)) {
/* Force execution of default (no implicit conversion) */ /* Force execution of default (no implicit conversion) */
target_type = ACPI_TYPE_ANY; target_type = ACPI_TYPE_ANY;
......
...@@ -97,6 +97,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr, ...@@ -97,6 +97,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
*/ */
if (ACPI_GET_OBJECT_TYPE(source_desc) == if (ACPI_GET_OBJECT_TYPE(source_desc) ==
ACPI_TYPE_LOCAL_REFERENCE) { ACPI_TYPE_LOCAL_REFERENCE) {
/* Resolve a reference object first */ /* Resolve a reference object first */
status = status =
...@@ -121,6 +122,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr, ...@@ -121,6 +122,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
!((ACPI_GET_OBJECT_TYPE(source_desc) == !((ACPI_GET_OBJECT_TYPE(source_desc) ==
ACPI_TYPE_LOCAL_REFERENCE) ACPI_TYPE_LOCAL_REFERENCE)
&& (source_desc->reference.opcode == AML_LOAD_OP))) { && (source_desc->reference.opcode == AML_LOAD_OP))) {
/* Conversion successful but still not a valid type */ /* Conversion successful but still not a valid type */
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
...@@ -289,6 +291,7 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc, ...@@ -289,6 +291,7 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,
} }
if (actual_src_desc != source_desc) { if (actual_src_desc != source_desc) {
/* Delete the intermediate (temporary) source object */ /* Delete the intermediate (temporary) source object */
acpi_ut_remove_reference(actual_src_desc); acpi_ut_remove_reference(actual_src_desc);
......
...@@ -91,6 +91,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, ...@@ -91,6 +91,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
/* Copy source buffer to target buffer */ /* Copy source buffer to target buffer */
if (length <= target_desc->buffer.length) { if (length <= target_desc->buffer.length) {
/* Clear existing buffer and copy in the new one */ /* Clear existing buffer and copy in the new one */
ACPI_MEMSET(target_desc->buffer.pointer, 0, ACPI_MEMSET(target_desc->buffer.pointer, 0,
...@@ -113,6 +114,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, ...@@ -113,6 +114,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
* copy must not truncate the original buffer. * copy must not truncate the original buffer.
*/ */
if (original_src_type == ACPI_TYPE_STRING) { if (original_src_type == ACPI_TYPE_STRING) {
/* Set the new length of the target */ /* Set the new length of the target */
target_desc->buffer.length = length; target_desc->buffer.length = length;
...@@ -183,6 +185,7 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc, ...@@ -183,6 +185,7 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
*/ */
if (target_desc->string.pointer && if (target_desc->string.pointer &&
(!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) { (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
/* Only free if not a pointer into the DSDT */ /* Only free if not a pointer into the DSDT */
ACPI_MEM_FREE(target_desc->string.pointer); ACPI_MEM_FREE(target_desc->string.pointer);
......
...@@ -76,6 +76,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout) ...@@ -76,6 +76,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout)
} }
if (status == AE_TIME) { if (status == AE_TIME) {
/* We must wait, so unlock the interpreter */ /* We must wait, so unlock the interpreter */
acpi_ex_exit_interpreter(); acpi_ex_exit_interpreter();
...@@ -90,6 +91,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout) ...@@ -90,6 +91,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout)
status2 = acpi_ex_enter_interpreter(); status2 = acpi_ex_enter_interpreter();
if (ACPI_FAILURE(status2)) { if (ACPI_FAILURE(status2)) {
/* Report fatal error, could not acquire interpreter */ /* Report fatal error, could not acquire interpreter */
return_ACPI_STATUS(status2); return_ACPI_STATUS(status2);
......
...@@ -194,6 +194,7 @@ u8 acpi_ex_acquire_global_lock(u32 field_flags) ...@@ -194,6 +194,7 @@ u8 acpi_ex_acquire_global_lock(u32 field_flags)
/* Only attempt lock if the always_lock bit is set */ /* Only attempt lock if the always_lock bit is set */
if (field_flags & AML_FIELD_LOCK_RULE_MASK) { if (field_flags & AML_FIELD_LOCK_RULE_MASK) {
/* We should attempt to get the lock, wait forever */ /* We should attempt to get the lock, wait forever */
status = acpi_ev_acquire_global_lock(ACPI_WAIT_FOREVER); status = acpi_ev_acquire_global_lock(ACPI_WAIT_FOREVER);
...@@ -230,10 +231,12 @@ void acpi_ex_release_global_lock(u8 locked_by_me) ...@@ -230,10 +231,12 @@ void acpi_ex_release_global_lock(u8 locked_by_me)
/* Only attempt unlock if the caller locked it */ /* Only attempt unlock if the caller locked it */
if (locked_by_me) { if (locked_by_me) {
/* OK, now release the lock */ /* OK, now release the lock */
status = acpi_ev_release_global_lock(); status = acpi_ev_release_global_lock();
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
/* Report the error, but there isn't much else we can do */ /* Report the error, but there isn't much else we can do */
ACPI_EXCEPTION((AE_INFO, status, ACPI_EXCEPTION((AE_INFO, status,
......
...@@ -214,6 +214,7 @@ acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, ...@@ -214,6 +214,7 @@ acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
/* Examine each GPE Register within the block */ /* Examine each GPE Register within the block */
for (i = 0; i < gpe_block->register_count; i++) { for (i = 0; i < gpe_block->register_count; i++) {
/* Disable all GPEs in this register */ /* Disable all GPEs in this register */
status = acpi_hw_low_level_write(8, 0x00, status = acpi_hw_low_level_write(8, 0x00,
...@@ -250,6 +251,7 @@ acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, ...@@ -250,6 +251,7 @@ acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
/* Examine each GPE Register within the block */ /* Examine each GPE Register within the block */
for (i = 0; i < gpe_block->register_count; i++) { for (i = 0; i < gpe_block->register_count; i++) {
/* Clear status on all GPEs in this register */ /* Clear status on all GPEs in this register */
status = acpi_hw_low_level_write(8, 0xFF, status = acpi_hw_low_level_write(8, 0xFF,
......
...@@ -295,6 +295,7 @@ acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags) ...@@ -295,6 +295,7 @@ acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags)
} }
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
/* Normalize the value that was read */ /* Normalize the value that was read */
register_value = register_value =
......
...@@ -490,6 +490,7 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state) ...@@ -490,6 +490,7 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state)
ACPI_REGISTER_PM1_CONTROL, ACPI_REGISTER_PM1_CONTROL,
&PM1Acontrol); &PM1Acontrol);
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
/* Clear SLP_EN and SLP_TYP fields */ /* Clear SLP_EN and SLP_TYP fields */
PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask | PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask |
......
...@@ -155,6 +155,7 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) ...@@ -155,6 +155,7 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed)
delta_ticks = end_ticks - start_ticks; delta_ticks = end_ticks - start_ticks;
} else if (start_ticks > end_ticks) { } else if (start_ticks > end_ticks) {
if (0 == acpi_gbl_FADT->tmr_val_ext) { if (0 == acpi_gbl_FADT->tmr_val_ext) {
/* 24-bit Timer */ /* 24-bit Timer */
delta_ticks = delta_ticks =
......
...@@ -98,6 +98,7 @@ acpi_status acpi_ns_root_initialize(void) ...@@ -98,6 +98,7 @@ acpi_status acpi_ns_root_initialize(void)
"Entering predefined entries into namespace\n")); "Entering predefined entries into namespace\n"));
for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) { for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) {
/* _OSI is optional for now, will be permanent later */ /* _OSI is optional for now, will be permanent later */
if (!ACPI_STRCMP(init_val->name, "_OSI") if (!ACPI_STRCMP(init_val->name, "_OSI")
...@@ -365,6 +366,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, ...@@ -365,6 +366,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
* Begin examination of the actual pathname * Begin examination of the actual pathname
*/ */
if (!pathname) { if (!pathname) {
/* A Null name_path is allowed and refers to the root */ /* A Null name_path is allowed and refers to the root */
num_segments = 0; num_segments = 0;
...@@ -389,6 +391,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, ...@@ -389,6 +391,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
* to the current scope). * to the current scope).
*/ */
if (*path == (u8) AML_ROOT_PREFIX) { if (*path == (u8) AML_ROOT_PREFIX) {
/* Pathname is fully qualified, start from the root */ /* Pathname is fully qualified, start from the root */
this_node = acpi_gbl_root_node; this_node = acpi_gbl_root_node;
...@@ -416,6 +419,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, ...@@ -416,6 +419,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
this_node = prefix_node; this_node = prefix_node;
num_carats = 0; num_carats = 0;
while (*path == (u8) AML_PARENT_PREFIX) { while (*path == (u8) AML_PARENT_PREFIX) {
/* Name is fully qualified, no search rules apply */ /* Name is fully qualified, no search rules apply */
search_parent_flag = ACPI_NS_NO_UPSEARCH; search_parent_flag = ACPI_NS_NO_UPSEARCH;
...@@ -430,6 +434,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, ...@@ -430,6 +434,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
num_carats++; num_carats++;
this_node = acpi_ns_get_parent_node(this_node); this_node = acpi_ns_get_parent_node(this_node);
if (!this_node) { if (!this_node) {
/* Current scope has no parent scope */ /* Current scope has no parent scope */
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
...@@ -569,6 +574,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, ...@@ -569,6 +574,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
&this_node); &this_node);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
if (status == AE_NOT_FOUND) { if (status == AE_NOT_FOUND) {
/* Name not found in ACPI namespace */ /* Name not found in ACPI namespace */
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
...@@ -602,6 +608,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, ...@@ -602,6 +608,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
(type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) && (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) &&
(this_node->type != ACPI_TYPE_ANY) && (this_node->type != ACPI_TYPE_ANY) &&
(this_node->type != type_to_check_for)) { (this_node->type != type_to_check_for)) {
/* Complain about a type mismatch */ /* Complain about a type mismatch */
ACPI_WARNING((AE_INFO, ACPI_WARNING((AE_INFO,
......
...@@ -115,6 +115,7 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node) ...@@ -115,6 +115,7 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node)
} }
if (prev_node) { if (prev_node) {
/* Node is not first child, unlink it */ /* Node is not first child, unlink it */
prev_node->peer = next_node->peer; prev_node->peer = next_node->peer;
...@@ -125,6 +126,7 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node) ...@@ -125,6 +126,7 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node)
/* Node is first child (has no previous peer) */ /* Node is first child (has no previous peer) */
if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { if (next_node->flags & ANOBJ_END_OF_PEER_LIST) {
/* No peers at all */ /* No peers at all */
parent_node->child = NULL; parent_node->child = NULL;
...@@ -264,6 +266,7 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) ...@@ -264,6 +266,7 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)
* Deallocate all children at this level * Deallocate all children at this level
*/ */
do { do {
/* Get the things we need */ /* Get the things we need */
next_node = child_node->peer; next_node = child_node->peer;
...@@ -352,11 +355,13 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node) ...@@ -352,11 +355,13 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node)
* to where we started. * to where we started.
*/ */
while (level > 0) { while (level > 0) {
/* Get the next node in this scope (NULL if none) */ /* Get the next node in this scope (NULL if none) */
child_node = acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node, child_node = acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node,
child_node); child_node);
if (child_node) { if (child_node) {
/* Found a child node - detach any attached object */ /* Found a child node - detach any attached object */
acpi_ns_detach_object(child_node); acpi_ns_detach_object(child_node);
...@@ -427,6 +432,7 @@ static void acpi_ns_remove_reference(struct acpi_namespace_node *node) ...@@ -427,6 +432,7 @@ static void acpi_ns_remove_reference(struct acpi_namespace_node *node)
*/ */
this_node = node; this_node = node;
while (this_node) { while (this_node) {
/* Prepare to move up to parent */ /* Prepare to move up to parent */
parent_node = acpi_ns_get_parent_node(this_node); parent_node = acpi_ns_get_parent_node(this_node);
...@@ -438,6 +444,7 @@ static void acpi_ns_remove_reference(struct acpi_namespace_node *node) ...@@ -438,6 +444,7 @@ static void acpi_ns_remove_reference(struct acpi_namespace_node *node)
/* Delete the node if no more references */ /* Delete the node if no more references */
if (!this_node->reference_count) { if (!this_node->reference_count) {
/* Delete all children and delete the node */ /* Delete all children and delete the node */
acpi_ns_delete_children(this_node); acpi_ns_delete_children(this_node);
...@@ -500,6 +507,7 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id) ...@@ -500,6 +507,7 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id)
if (child_node) { if (child_node) {
if (child_node->owner_id == owner_id) { if (child_node->owner_id == owner_id) {
/* Found a matching child node - detach any attached object */ /* Found a matching child node - detach any attached object */
acpi_ns_detach_object(child_node); acpi_ns_detach_object(child_node);
......
...@@ -191,6 +191,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, ...@@ -191,6 +191,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
} }
if (!(info->display_type & ACPI_DISPLAY_SHORT)) { if (!(info->display_type & ACPI_DISPLAY_SHORT)) {
/* Indent the object according to the level */ /* Indent the object according to the level */
acpi_os_printf("%2d%*s", (u32) level - 1, (int)level * 2, " "); acpi_os_printf("%2d%*s", (u32) level - 1, (int)level * 2, " ");
...@@ -226,6 +227,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, ...@@ -226,6 +227,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
case ACPI_DISPLAY_SUMMARY: case ACPI_DISPLAY_SUMMARY:
if (!obj_desc) { if (!obj_desc) {
/* No attached object, we are done */ /* No attached object, we are done */
acpi_os_printf("\n"); acpi_os_printf("\n");
...@@ -419,6 +421,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, ...@@ -419,6 +421,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
acpi_os_printf("O:%p", obj_desc); acpi_os_printf("O:%p", obj_desc);
if (!obj_desc) { if (!obj_desc) {
/* No attached object, we are done */ /* No attached object, we are done */
acpi_os_printf("\n"); acpi_os_printf("\n");
...@@ -682,6 +685,7 @@ void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth) ...@@ -682,6 +685,7 @@ void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth)
} }
if (ACPI_NS_ALL == search_base) { if (ACPI_NS_ALL == search_base) {
/* Entire namespace */ /* Entire namespace */
search_handle = acpi_gbl_root_node; search_handle = acpi_gbl_root_node;
......
...@@ -326,6 +326,7 @@ acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info) ...@@ -326,6 +326,7 @@ acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info)
* Check if there is a return value on the stack that must be dealt with * Check if there is a return value on the stack that must be dealt with
*/ */
if (status == AE_CTRL_RETURN_VALUE) { if (status == AE_CTRL_RETURN_VALUE) {
/* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */ /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */
status = AE_OK; status = AE_OK;
......
...@@ -366,6 +366,7 @@ acpi_ns_init_one_device(acpi_handle obj_handle, ...@@ -366,6 +366,7 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
status = acpi_ns_search_node(*ACPI_CAST_PTR(u32, METHOD_NAME__INI), status = acpi_ns_search_node(*ACPI_CAST_PTR(u32, METHOD_NAME__INI),
device_node, ACPI_TYPE_METHOD, &ini_node); device_node, ACPI_TYPE_METHOD, &ini_node);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
/* No _INI method found - move on to next device */ /* No _INI method found - move on to next device */
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
...@@ -386,6 +387,7 @@ acpi_ns_init_one_device(acpi_handle obj_handle, ...@@ -386,6 +387,7 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
status = acpi_ut_execute_STA(pinfo.node, &flags); status = acpi_ut_execute_STA(pinfo.node, &flags);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
/* Ignore error and move on to next device */ /* Ignore error and move on to next device */
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
...@@ -396,6 +398,7 @@ acpi_ns_init_one_device(acpi_handle obj_handle, ...@@ -396,6 +398,7 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
} }
if (!(flags & ACPI_STA_DEVICE_PRESENT)) { if (!(flags & ACPI_STA_DEVICE_PRESENT)) {
/* Don't look at children of a not present device */ /* Don't look at children of a not present device */
return_ACPI_STATUS(AE_CTRL_DEPTH); return_ACPI_STATUS(AE_CTRL_DEPTH);
...@@ -412,6 +415,7 @@ acpi_ns_init_one_device(acpi_handle obj_handle, ...@@ -412,6 +415,7 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
pinfo.node = ini_node; pinfo.node = ini_node;
status = acpi_ns_evaluate_by_handle(&pinfo); status = acpi_ns_evaluate_by_handle(&pinfo);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
/* Ignore error and move on to next device */ /* Ignore error and move on to next device */
#ifdef ACPI_DEBUG_OUTPUT #ifdef ACPI_DEBUG_OUTPUT
...@@ -435,6 +439,7 @@ acpi_ns_init_one_device(acpi_handle obj_handle, ...@@ -435,6 +439,7 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
} }
if (acpi_gbl_init_handler) { if (acpi_gbl_init_handler) {
/* External initialization handler is present, call it */ /* External initialization handler is present, call it */
status = status =
......
...@@ -84,6 +84,7 @@ acpi_ns_load_table(struct acpi_table_desc *table_desc, ...@@ -84,6 +84,7 @@ acpi_ns_load_table(struct acpi_table_desc *table_desc,
if (! if (!
(acpi_gbl_table_data[table_desc->type]. (acpi_gbl_table_data[table_desc->type].
flags & ACPI_TABLE_EXECUTABLE)) { flags & ACPI_TABLE_EXECUTABLE)) {
/* Just ignore this table */ /* Just ignore this table */
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
...@@ -325,6 +326,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle) ...@@ -325,6 +326,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle)
* to where we started. * to where we started.
*/ */
while (level > 0) { while (level > 0) {
/* Attempt to get the next object in this scope */ /* Attempt to get the next object in this scope */
status = acpi_get_next_object(ACPI_TYPE_ANY, parent_handle, status = acpi_get_next_object(ACPI_TYPE_ANY, parent_handle,
...@@ -335,6 +337,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle) ...@@ -335,6 +337,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle)
/* Did we get a new object? */ /* Did we get a new object? */
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
/* Check if this object has any children */ /* Check if this object has any children */
if (ACPI_SUCCESS if (ACPI_SUCCESS
......
...@@ -82,6 +82,7 @@ acpi_ns_attach_object(struct acpi_namespace_node *node, ...@@ -82,6 +82,7 @@ acpi_ns_attach_object(struct acpi_namespace_node *node,
* Parameter validation * Parameter validation
*/ */
if (!node) { if (!node) {
/* Invalid handle */ /* Invalid handle */
ACPI_ERROR((AE_INFO, "Null named_obj handle")); ACPI_ERROR((AE_INFO, "Null named_obj handle"));
...@@ -89,6 +90,7 @@ acpi_ns_attach_object(struct acpi_namespace_node *node, ...@@ -89,6 +90,7 @@ acpi_ns_attach_object(struct acpi_namespace_node *node,
} }
if (!object && (ACPI_TYPE_ANY != type)) { if (!object && (ACPI_TYPE_ANY != type)) {
/* Null object */ /* Null object */
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
...@@ -97,6 +99,7 @@ acpi_ns_attach_object(struct acpi_namespace_node *node, ...@@ -97,6 +99,7 @@ acpi_ns_attach_object(struct acpi_namespace_node *node,
} }
if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) {
/* Not a name handle */ /* Not a name handle */
ACPI_ERROR((AE_INFO, "Invalid handle %p [%s]", ACPI_ERROR((AE_INFO, "Invalid handle %p [%s]",
......
...@@ -114,9 +114,11 @@ acpi_ns_search_node(u32 target_name, ...@@ -114,9 +114,11 @@ acpi_ns_search_node(u32 target_name,
*/ */
next_node = node->child; next_node = node->child;
while (next_node) { while (next_node) {
/* Check for match against the name */ /* Check for match against the name */
if (next_node->name.integer == target_name) { if (next_node->name.integer == target_name) {
/* Resolve a control method alias if any */ /* Resolve a control method alias if any */
if (acpi_ns_get_type(next_node) == if (acpi_ns_get_type(next_node) ==
...@@ -146,6 +148,7 @@ acpi_ns_search_node(u32 target_name, ...@@ -146,6 +148,7 @@ acpi_ns_search_node(u32 target_name,
* so a flag is used to indicate the end-of-list * so a flag is used to indicate the end-of-list
*/ */
if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { if (next_node->flags & ANOBJ_END_OF_PEER_LIST) {
/* Searched entire list, we are done */ /* Searched entire list, we are done */
break; break;
......
...@@ -83,6 +83,7 @@ acpi_ns_report_error(char *module_name, ...@@ -83,6 +83,7 @@ acpi_ns_report_error(char *module_name,
acpi_ut_report_error(module_name, line_number); acpi_ut_report_error(module_name, line_number);
if (lookup_status == AE_BAD_CHARACTER) { if (lookup_status == AE_BAD_CHARACTER) {
/* There is a non-ascii character in the name */ /* There is a non-ascii character in the name */
acpi_os_printf("[0x%4.4X] (NON-ASCII)", acpi_os_printf("[0x%4.4X] (NON-ASCII)",
...@@ -267,6 +268,7 @@ u32 acpi_ns_local(acpi_object_type type) ...@@ -267,6 +268,7 @@ u32 acpi_ns_local(acpi_object_type type)
ACPI_FUNCTION_TRACE("ns_local"); ACPI_FUNCTION_TRACE("ns_local");
if (!acpi_ut_valid_object_type(type)) { if (!acpi_ut_valid_object_type(type)) {
/* Type code out of range */ /* Type code out of range */
ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type)); ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type));
...@@ -411,6 +413,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info) ...@@ -411,6 +413,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info)
for (i = 0; i < ACPI_NAME_SIZE; i++) { for (i = 0; i < ACPI_NAME_SIZE; i++) {
if (acpi_ns_valid_path_separator(*external_name) || if (acpi_ns_valid_path_separator(*external_name) ||
(*external_name == 0)) { (*external_name == 0)) {
/* Pad the segment with underscore(s) if segment is short */ /* Pad the segment with underscore(s) if segment is short */
result[i] = '_'; result[i] = '_';
...@@ -795,6 +798,7 @@ u32 acpi_ns_opens_scope(acpi_object_type type) ...@@ -795,6 +798,7 @@ u32 acpi_ns_opens_scope(acpi_object_type type)
ACPI_FUNCTION_TRACE_STR("ns_opens_scope", acpi_ut_get_type_name(type)); ACPI_FUNCTION_TRACE_STR("ns_opens_scope", acpi_ut_get_type_name(type));
if (!acpi_ut_valid_object_type(type)) { if (!acpi_ut_valid_object_type(type)) {
/* type code out of range */ /* type code out of range */
ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type)); ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type));
...@@ -838,6 +842,7 @@ acpi_ns_get_node_by_path(char *pathname, ...@@ -838,6 +842,7 @@ acpi_ns_get_node_by_path(char *pathname,
ACPI_FUNCTION_TRACE_PTR("ns_get_node_by_path", pathname); ACPI_FUNCTION_TRACE_PTR("ns_get_node_by_path", pathname);
if (pathname) { if (pathname) {
/* Convert path to internal representation */ /* Convert path to internal representation */
status = acpi_ns_internalize_name(pathname, &internal_path); status = acpi_ns_internalize_name(pathname, &internal_path);
...@@ -963,6 +968,7 @@ acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node * child_node) ...@@ -963,6 +968,7 @@ acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node * child_node)
ACPI_FUNCTION_TRACE("ns_find_parent_name"); ACPI_FUNCTION_TRACE("ns_find_parent_name");
if (child_node) { if (child_node) {
/* Valid entry. Get the parent Node */ /* Valid entry. Get the parent Node */
parent_node = acpi_ns_get_parent_node(child_node); parent_node = acpi_ns_get_parent_node(child_node);
......
...@@ -76,6 +76,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, ...@@ -76,6 +76,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type,
ACPI_FUNCTION_ENTRY(); ACPI_FUNCTION_ENTRY();
if (!child_node) { if (!child_node) {
/* It's really the parent's _scope_ that we want */ /* It's really the parent's _scope_ that we want */
if (parent_node->child) { if (parent_node->child) {
...@@ -92,6 +93,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, ...@@ -92,6 +93,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type,
/* If any type is OK, we are done */ /* If any type is OK, we are done */
if (type == ACPI_TYPE_ANY) { if (type == ACPI_TYPE_ANY) {
/* next_node is NULL if we are at the end-of-list */ /* next_node is NULL if we are at the end-of-list */
return (next_node); return (next_node);
...@@ -100,6 +102,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, ...@@ -100,6 +102,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type,
/* Must search for the node -- but within this scope only */ /* Must search for the node -- but within this scope only */
while (next_node) { while (next_node) {
/* If type matches, we are done */ /* If type matches, we are done */
if (next_node->type == type) { if (next_node->type == type) {
...@@ -182,6 +185,7 @@ acpi_ns_walk_namespace(acpi_object_type type, ...@@ -182,6 +185,7 @@ acpi_ns_walk_namespace(acpi_object_type type,
* bubbled up to (and passed) the original parent handle (start_entry) * bubbled up to (and passed) the original parent handle (start_entry)
*/ */
while (level > 0) { while (level > 0) {
/* Get the next node in this scope. Null if not found */ /* Get the next node in this scope. Null if not found */
status = AE_OK; status = AE_OK;
......
...@@ -110,6 +110,7 @@ acpi_evaluate_object_typed(acpi_handle handle, ...@@ -110,6 +110,7 @@ acpi_evaluate_object_typed(acpi_handle handle,
} }
if (return_buffer->length == 0) { if (return_buffer->length == 0) {
/* Error because caller specifically asked for a return value */ /* Error because caller specifically asked for a return value */
ACPI_ERROR((AE_INFO, "No return value")); ACPI_ERROR((AE_INFO, "No return value"));
...@@ -131,6 +132,7 @@ acpi_evaluate_object_typed(acpi_handle handle, ...@@ -131,6 +132,7 @@ acpi_evaluate_object_typed(acpi_handle handle,
acpi_ut_get_type_name(return_type))); acpi_ut_get_type_name(return_type)));
if (must_free) { if (must_free) {
/* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */
acpi_os_free(return_buffer->pointer); acpi_os_free(return_buffer->pointer);
...@@ -224,9 +226,9 @@ acpi_evaluate_object(acpi_handle handle, ...@@ -224,9 +226,9 @@ acpi_evaluate_object(acpi_handle handle,
* 3) Valid handle * 3) Valid handle
*/ */
if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) { if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) {
/*
* The path is fully qualified, just evaluate by name /* The path is fully qualified, just evaluate by name */
*/
status = acpi_ns_evaluate_by_name(pathname, &info); status = acpi_ns_evaluate_by_name(pathname, &info);
} else if (!handle) { } else if (!handle) {
/* /*
...@@ -235,11 +237,12 @@ acpi_evaluate_object(acpi_handle handle, ...@@ -235,11 +237,12 @@ acpi_evaluate_object(acpi_handle handle,
* qualified names above, this is an error * qualified names above, this is an error
*/ */
if (!pathname) { if (!pathname) {
ACPI_ERROR((AE_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Both Handle and Pathname are NULL")); "Both Handle and Pathname are NULL"));
} else { } else {
ACPI_ERROR((AE_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Handle is NULL and Pathname is relative")); "Null Handle with relative pathname [%s]",
pathname));
} }
status = AE_BAD_PARAMETER; status = AE_BAD_PARAMETER;
...@@ -256,9 +259,8 @@ acpi_evaluate_object(acpi_handle handle, ...@@ -256,9 +259,8 @@ acpi_evaluate_object(acpi_handle handle,
*/ */
status = acpi_ns_evaluate_by_handle(&info); status = acpi_ns_evaluate_by_handle(&info);
} else { } else {
/* /* Both a Handle and a relative Pathname */
* Both a Handle and a relative Pathname
*/
status = acpi_ns_evaluate_relative(pathname, &info); status = acpi_ns_evaluate_relative(pathname, &info);
} }
} }
...@@ -295,6 +297,7 @@ acpi_evaluate_object(acpi_handle handle, ...@@ -295,6 +297,7 @@ acpi_evaluate_object(acpi_handle handle,
acpi_ut_get_object_size(info.return_object, acpi_ut_get_object_size(info.return_object,
&buffer_space_needed); &buffer_space_needed);
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
/* Validate/Allocate/Clear caller buffer */ /* Validate/Allocate/Clear caller buffer */
status = status =
...@@ -303,7 +306,8 @@ acpi_evaluate_object(acpi_handle handle, ...@@ -303,7 +306,8 @@ acpi_evaluate_object(acpi_handle handle,
buffer_space_needed); buffer_space_needed);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
/* /*
* Caller's buffer is too small or a new one can't be allocated * Caller's buffer is too small or a new one can't
* be allocated
*/ */
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Needed buffer size %X, %s\n", "Needed buffer size %X, %s\n",
...@@ -312,9 +316,8 @@ acpi_evaluate_object(acpi_handle handle, ...@@ -312,9 +316,8 @@ acpi_evaluate_object(acpi_handle handle,
acpi_format_exception acpi_format_exception
(status))); (status)));
} else { } else {
/* /* We have enough space for the object, build it */
* We have enough space for the object, build it
*/
status = status =
acpi_ut_copy_iobject_to_eobject acpi_ut_copy_iobject_to_eobject
(info.return_object, (info.return_object,
...@@ -341,10 +344,10 @@ acpi_evaluate_object(acpi_handle handle, ...@@ -341,10 +344,10 @@ acpi_evaluate_object(acpi_handle handle,
} }
} }
/* /* Free the input parameter list (if we created one) */
* Free the input parameter list (if we created one),
*/
if (info.parameters) { if (info.parameters) {
/* Free the allocated parameter block */ /* Free the allocated parameter block */
acpi_ut_delete_internal_object_list(info.parameters); acpi_ut_delete_internal_object_list(info.parameters);
...@@ -473,6 +476,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, ...@@ -473,6 +476,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
} }
if (!(flags & ACPI_STA_DEVICE_PRESENT)) { if (!(flags & ACPI_STA_DEVICE_PRESENT)) {
/* Don't examine children of the device if not present */ /* Don't examine children of the device if not present */
return (AE_CTRL_DEPTH); return (AE_CTRL_DEPTH);
...@@ -489,6 +493,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, ...@@ -489,6 +493,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
} }
if (ACPI_STRNCMP(hid.value, info->hid, sizeof(hid.value)) != 0) { if (ACPI_STRNCMP(hid.value, info->hid, sizeof(hid.value)) != 0) {
/* Get the list of Compatible IDs */ /* Get the list of Compatible IDs */
status = acpi_ut_execute_CID(node, &cid); status = acpi_ut_execute_CID(node, &cid);
...@@ -563,9 +568,9 @@ acpi_get_devices(char *HID, ...@@ -563,9 +568,9 @@ acpi_get_devices(char *HID,
* We're going to call their callback from OUR callback, so we need * We're going to call their callback from OUR callback, so we need
* to know what it is, and their context parameter. * to know what it is, and their context parameter.
*/ */
info.hid = HID;
info.context = context; info.context = context;
info.user_function = user_function; info.user_function = user_function;
info.hid = HID;
/* /*
* Lock the namespace around the walk. * Lock the namespace around the walk.
...@@ -578,9 +583,8 @@ acpi_get_devices(char *HID, ...@@ -578,9 +583,8 @@ acpi_get_devices(char *HID,
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
ACPI_NS_WALK_UNLOCK,
acpi_ns_get_device_callback, &info, acpi_ns_get_device_callback, &info,
return_value); return_value);
......
...@@ -162,6 +162,7 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) ...@@ -162,6 +162,7 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer)
} }
if (name_type == ACPI_FULL_PATHNAME) { if (name_type == ACPI_FULL_PATHNAME) {
/* Get the full pathname (From the namespace root) */ /* Get the full pathname (From the namespace root) */
status = acpi_ns_handle_to_pathname(handle, buffer); status = acpi_ns_handle_to_pathname(handle, buffer);
......
...@@ -206,6 +206,7 @@ acpi_get_next_object(acpi_object_type type, ...@@ -206,6 +206,7 @@ acpi_get_next_object(acpi_object_type type,
/* If null handle, use the parent */ /* If null handle, use the parent */
if (!child) { if (!child) {
/* Start search at the beginning of the specified scope */ /* Start search at the beginning of the specified scope */
parent_node = acpi_ns_map_handle_to_node(parent); parent_node = acpi_ns_map_handle_to_node(parent);
......
...@@ -275,6 +275,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, ...@@ -275,6 +275,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
*/ */
if (ACPI_SUCCESS(status) && if (ACPI_SUCCESS(status) &&
possible_method_call && (node->type == ACPI_TYPE_METHOD)) { possible_method_call && (node->type == ACPI_TYPE_METHOD)) {
/* This name is actually a control method invocation */ /* This name is actually a control method invocation */
method_desc = acpi_ns_get_attached_object(node); method_desc = acpi_ns_get_attached_object(node);
...@@ -319,6 +320,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, ...@@ -319,6 +320,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
* some not_found cases are allowed * some not_found cases are allowed
*/ */
if (status == AE_NOT_FOUND) { if (status == AE_NOT_FOUND) {
/* 1) not_found is ok during load pass 1/2 (allow forward references) */ /* 1) not_found is ok during load pass 1/2 (allow forward references) */
if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) != if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) !=
...@@ -354,6 +356,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, ...@@ -354,6 +356,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) ==
ACPI_PARSE_EXECUTE) { ACPI_PARSE_EXECUTE) {
/* Report a control method execution error */ /* Report a control method execution error */
status = acpi_ds_method_error(status, walk_state); status = acpi_ds_method_error(status, walk_state);
...@@ -620,6 +623,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, ...@@ -620,6 +623,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
case ARGP_FIELDLIST: case ARGP_FIELDLIST:
if (parser_state->aml < parser_state->pkg_end) { if (parser_state->aml < parser_state->pkg_end) {
/* Non-empty list */ /* Non-empty list */
while (parser_state->aml < parser_state->pkg_end) { while (parser_state->aml < parser_state->pkg_end) {
...@@ -645,6 +649,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, ...@@ -645,6 +649,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
case ARGP_BYTELIST: case ARGP_BYTELIST:
if (parser_state->aml < parser_state->pkg_end) { if (parser_state->aml < parser_state->pkg_end) {
/* Non-empty list */ /* Non-empty list */
arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP); arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP);
...@@ -673,6 +678,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, ...@@ -673,6 +678,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
if (subop == 0 || if (subop == 0 ||
acpi_ps_is_leading_char(subop) || acpi_ps_is_leading_char(subop) ||
acpi_ps_is_prefix_char(subop)) { acpi_ps_is_prefix_char(subop)) {
/* null_name or name_string */ /* null_name or name_string */
arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP); arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP);
...@@ -703,6 +709,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, ...@@ -703,6 +709,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
case ARGP_OBJLIST: case ARGP_OBJLIST:
if (parser_state->aml < parser_state->pkg_end) { if (parser_state->aml < parser_state->pkg_end) {
/* Non-empty list of variable arguments, nothing returned */ /* Non-empty list of variable arguments, nothing returned */
walk_state->arg_count = ACPI_VAR_ARGS; walk_state->arg_count = ACPI_VAR_ARGS;
......
...@@ -95,6 +95,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) ...@@ -95,6 +95,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) #if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) { if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) {
/* We are restarting a preempted control method */ /* We are restarting a preempted control method */
if (acpi_ps_has_completed_scope(parser_state)) { if (acpi_ps_has_completed_scope(parser_state)) {
...@@ -143,6 +144,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) ...@@ -143,6 +144,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
ACPI_DEBUG_PRINT((ACPI_DB_PARSE, ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
"Popped scope, Op=%p\n", op)); "Popped scope, Op=%p\n", op));
} else if (walk_state->prev_op) { } else if (walk_state->prev_op) {
/* We were in the middle of an op */ /* We were in the middle of an op */
op = walk_state->prev_op; op = walk_state->prev_op;
...@@ -156,6 +158,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) ...@@ -156,6 +158,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
while ((parser_state->aml < parser_state->aml_end) || (op)) { while ((parser_state->aml < parser_state->aml_end) || (op)) {
aml_op_start = parser_state->aml; aml_op_start = parser_state->aml;
if (!op) { if (!op) {
/* Get the next opcode from the AML stream */ /* Get the next opcode from the AML stream */
walk_state->aml_offset = walk_state->aml_offset =
...@@ -213,6 +216,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) ...@@ -213,6 +216,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
/* Create Op structure and append to parent's argument list */ /* Create Op structure and append to parent's argument list */
if (walk_state->op_info->flags & AML_NAMED) { if (walk_state->op_info->flags & AML_NAMED) {
/* Allocate a new pre_op if necessary */ /* Allocate a new pre_op if necessary */
if (!pre_op) { if (!pre_op) {
...@@ -388,6 +392,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) ...@@ -388,6 +392,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
/* Are there any arguments that must be processed? */ /* Are there any arguments that must be processed? */
if (walk_state->arg_types) { if (walk_state->arg_types) {
/* Get arguments */ /* Get arguments */
switch (op->common.aml_opcode) { switch (op->common.aml_opcode) {
...@@ -853,6 +858,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) ...@@ -853,6 +858,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
} }
else if (ACPI_FAILURE(status)) { else if (ACPI_FAILURE(status)) {
/* First error is most important */ /* First error is most important */
(void) (void)
......
...@@ -731,6 +731,7 @@ const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode) ...@@ -731,6 +731,7 @@ const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode)
* Detect normal 8-bit opcode or extended 16-bit opcode * Detect normal 8-bit opcode or extended 16-bit opcode
*/ */
if (!(opcode & 0xFF00)) { if (!(opcode & 0xFF00)) {
/* Simple (8-bit) opcode: 0-255, can't index beyond table */ /* Simple (8-bit) opcode: 0-255, can't index beyond table */
return (&acpi_gbl_aml_op_info return (&acpi_gbl_aml_op_info
...@@ -739,6 +740,7 @@ const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode) ...@@ -739,6 +740,7 @@ const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode)
if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) && if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) &&
(((u8) opcode) <= MAX_EXTENDED_OPCODE)) { (((u8) opcode) <= MAX_EXTENDED_OPCODE)) {
/* Valid extended (16-bit) opcode */ /* Valid extended (16-bit) opcode */
return (&acpi_gbl_aml_op_info return (&acpi_gbl_aml_op_info
......
...@@ -106,6 +106,7 @@ u16 acpi_ps_peek_opcode(struct acpi_parse_state * parser_state) ...@@ -106,6 +106,7 @@ u16 acpi_ps_peek_opcode(struct acpi_parse_state * parser_state)
opcode = (u16) ACPI_GET8(aml); opcode = (u16) ACPI_GET8(aml);
if (opcode == AML_EXTENDED_OP_PREFIX) { if (opcode == AML_EXTENDED_OP_PREFIX) {
/* Extended opcode, get the second opcode byte */ /* Extended opcode, get the second opcode byte */
aml++; aml++;
...@@ -158,6 +159,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, ...@@ -158,6 +159,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
if (op->common.parent) { if (op->common.parent) {
prev = op->common.parent->common.value.arg; prev = op->common.parent->common.value.arg;
if (!prev) { if (!prev) {
/* Nothing more to do */ /* Nothing more to do */
goto cleanup; goto cleanup;
...@@ -245,6 +247,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, ...@@ -245,6 +247,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
/* We must unlink this op from the parent tree */ /* We must unlink this op from the parent tree */
if (prev == op) { if (prev == op) {
/* This op is the first in the list */ /* This op is the first in the list */
if (replacement_op) { if (replacement_op) {
...@@ -265,6 +268,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, ...@@ -265,6 +268,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
else else
while (prev) { while (prev) {
/* Traverse all siblings in the parent's argument list */ /* Traverse all siblings in the parent's argument list */
next = prev->common.next; next = prev->common.next;
...@@ -510,6 +514,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) ...@@ -510,6 +514,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
} else if (status == AE_CTRL_TERMINATE) { } else if (status == AE_CTRL_TERMINATE) {
status = AE_OK; status = AE_OK;
} else if ((status != AE_OK) && (walk_state->method_desc)) { } else if ((status != AE_OK) && (walk_state->method_desc)) {
/* Either the method parse or actual execution failed */ /* Either the method parse or actual execution failed */
ACPI_ERROR_METHOD("Method parse/execution failed", ACPI_ERROR_METHOD("Method parse/execution failed",
...@@ -551,6 +556,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) ...@@ -551,6 +556,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
if (((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == if (((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) ==
ACPI_PARSE_EXECUTE) || (ACPI_FAILURE(status))) { ACPI_PARSE_EXECUTE) || (ACPI_FAILURE(status))) {
if (walk_state->method_desc) { if (walk_state->method_desc) {
/* Decrement the thread count on the method parse tree */ /* Decrement the thread count on the method parse tree */
if (walk_state->method_desc->method. if (walk_state->method_desc->method.
...@@ -633,12 +639,14 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) ...@@ -633,12 +639,14 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
} }
} else { } else {
if (previous_walk_state->return_desc) { if (previous_walk_state->return_desc) {
/* Caller doesn't want it, must delete it */ /* Caller doesn't want it, must delete it */
acpi_ut_remove_reference(previous_walk_state-> acpi_ut_remove_reference(previous_walk_state->
return_desc); return_desc);
} }
if (previous_walk_state->implicit_return_obj) { if (previous_walk_state->implicit_return_obj) {
/* Caller doesn't want it, must delete it */ /* Caller doesn't want it, must delete it */
acpi_ut_remove_reference(previous_walk_state-> acpi_ut_remove_reference(previous_walk_state->
......
...@@ -165,6 +165,7 @@ acpi_ps_push_scope(struct acpi_parse_state *parser_state, ...@@ -165,6 +165,7 @@ acpi_ps_push_scope(struct acpi_parse_state *parser_state,
acpi_ut_push_generic_state(&parser_state->scope, scope); acpi_ut_push_generic_state(&parser_state->scope, scope);
if (arg_count == ACPI_VAR_ARGS) { if (arg_count == ACPI_VAR_ARGS) {
/* Multiple arguments */ /* Multiple arguments */
scope->parse_scope.arg_end = parser_state->pkg_end; scope->parse_scope.arg_end = parser_state->pkg_end;
......
...@@ -77,6 +77,7 @@ union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn) ...@@ -77,6 +77,7 @@ union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn)
op_info = acpi_ps_get_opcode_info(op->common.aml_opcode); op_info = acpi_ps_get_opcode_info(op->common.aml_opcode);
if (op_info->class == AML_CLASS_UNKNOWN) { if (op_info->class == AML_CLASS_UNKNOWN) {
/* Invalid opcode or ASCII character */ /* Invalid opcode or ASCII character */
return (NULL); return (NULL);
...@@ -85,6 +86,7 @@ union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn) ...@@ -85,6 +86,7 @@ union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn)
/* Check if this opcode requires argument sub-objects */ /* Check if this opcode requires argument sub-objects */
if (!(op_info->flags & AML_HAS_ARGS)) { if (!(op_info->flags & AML_HAS_ARGS)) {
/* Has no linked argument objects */ /* Has no linked argument objects */
return (NULL); return (NULL);
...@@ -130,6 +132,7 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg) ...@@ -130,6 +132,7 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg)
op_info = acpi_ps_get_opcode_info(op->common.aml_opcode); op_info = acpi_ps_get_opcode_info(op->common.aml_opcode);
if (op_info->class == AML_CLASS_UNKNOWN) { if (op_info->class == AML_CLASS_UNKNOWN) {
/* Invalid opcode */ /* Invalid opcode */
ACPI_ERROR((AE_INFO, "Invalid AML Opcode: 0x%2.2X", ACPI_ERROR((AE_INFO, "Invalid AML Opcode: 0x%2.2X",
...@@ -140,6 +143,7 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg) ...@@ -140,6 +143,7 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg)
/* Check if this opcode requires argument sub-objects */ /* Check if this opcode requires argument sub-objects */
if (!(op_info->flags & AML_HAS_ARGS)) { if (!(op_info->flags & AML_HAS_ARGS)) {
/* Has no linked argument objects */ /* Has no linked argument objects */
return; return;
...@@ -148,6 +152,7 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg) ...@@ -148,6 +152,7 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg)
/* Append the argument to the linked argument list */ /* Append the argument to the linked argument list */
if (op->common.value.arg) { if (op->common.value.arg) {
/* Append to existing argument list */ /* Append to existing argument list */
prev_arg = op->common.value.arg; prev_arg = op->common.value.arg;
...@@ -222,12 +227,14 @@ union acpi_parse_object *acpi_ps_get_depth_next(union acpi_parse_object *origin, ...@@ -222,12 +227,14 @@ union acpi_parse_object *acpi_ps_get_depth_next(union acpi_parse_object *origin,
} }
if (arg == origin) { if (arg == origin) {
/* Reached parent of origin, end search */ /* Reached parent of origin, end search */
return (NULL); return (NULL);
} }
if (parent->common.next) { if (parent->common.next) {
/* Found sibling of parent */ /* Found sibling of parent */
return (parent->common.next); return (parent->common.next);
......
...@@ -135,6 +135,7 @@ union acpi_parse_object *acpi_ps_alloc_op(u16 opcode) ...@@ -135,6 +135,7 @@ union acpi_parse_object *acpi_ps_alloc_op(u16 opcode)
/* Allocate the minimum required size object */ /* Allocate the minimum required size object */
if (flags == ACPI_PARSEOP_GENERIC) { if (flags == ACPI_PARSEOP_GENERIC) {
/* The generic op (default) is by far the most common (16 to 1) */ /* The generic op (default) is by far the most common (16 to 1) */
op = acpi_os_acquire_object(acpi_gbl_ps_node_cache); op = acpi_os_acquire_object(acpi_gbl_ps_node_cache);
......
...@@ -69,13 +69,16 @@ void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root) ...@@ -69,13 +69,16 @@ void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root)
/* Visit all nodes in the subtree */ /* Visit all nodes in the subtree */
while (op) { while (op) {
/* Check if we are not ascending */ /* Check if we are not ascending */
if (op != parent) { if (op != parent) {
/* Look for an argument or child of the current op */ /* Look for an argument or child of the current op */
next = acpi_ps_get_arg(op, 0); next = acpi_ps_get_arg(op, 0);
if (next) { if (next) {
/* Still going downward in tree (Op is not completed yet) */ /* Still going downward in tree (Op is not completed yet) */
op = next; op = next;
......
...@@ -317,9 +317,11 @@ acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action) ...@@ -317,9 +317,11 @@ acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action)
acpi_native_uint i; acpi_native_uint i;
if ((info->parameter_type == ACPI_PARAM_ARGS) && (info->parameters)) { if ((info->parameter_type == ACPI_PARAM_ARGS) && (info->parameters)) {
/* Update reference count for each parameter */ /* Update reference count for each parameter */
for (i = 0; info->parameters[i]; i++) { for (i = 0; info->parameters[i]; i++) {
/* Ignore errors, just do them all */ /* Ignore errors, just do them all */
(void)acpi_ut_update_object_reference(info-> (void)acpi_ut_update_object_reference(info->
......
...@@ -78,6 +78,7 @@ static u8 acpi_rs_count_set_bits(u16 bit_field) ...@@ -78,6 +78,7 @@ static u8 acpi_rs_count_set_bits(u16 bit_field)
ACPI_FUNCTION_ENTRY(); ACPI_FUNCTION_ENTRY();
for (bits_set = 0; bit_field; bits_set++) { for (bits_set = 0; bit_field; bits_set++) {
/* Zero the least significant bit that is set */ /* Zero the least significant bit that is set */
bit_field &= (bit_field - 1); bit_field &= (bit_field - 1);
...@@ -154,6 +155,7 @@ acpi_rs_stream_option_length(u32 resource_length, ...@@ -154,6 +155,7 @@ acpi_rs_stream_option_length(u32 resource_length,
* length, minus one byte for the resource_source_index itself. * length, minus one byte for the resource_source_index itself.
*/ */
if (resource_length > minimum_aml_resource_length) { if (resource_length > minimum_aml_resource_length) {
/* Compute the length of the optional string */ /* Compute the length of the optional string */
string_length = string_length =
...@@ -162,7 +164,7 @@ acpi_rs_stream_option_length(u32 resource_length, ...@@ -162,7 +164,7 @@ acpi_rs_stream_option_length(u32 resource_length,
/* Round up length to 32 bits for internal structure alignment */ /* Round up length to 32 bits for internal structure alignment */
return (ACPI_ROUND_UP_to_32_bITS(string_length)); return ((u32) ACPI_ROUND_UP_to_32_bITS(string_length));
} }
/******************************************************************************* /*******************************************************************************
...@@ -191,6 +193,7 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) ...@@ -191,6 +193,7 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
/* Traverse entire list of internal resource descriptors */ /* Traverse entire list of internal resource descriptors */
while (resource) { while (resource) {
/* Validate the descriptor type */ /* Validate the descriptor type */
if (resource->type > ACPI_RESOURCE_TYPE_MAX) { if (resource->type > ACPI_RESOURCE_TYPE_MAX) {
...@@ -214,6 +217,7 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) ...@@ -214,6 +217,7 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
* is a Large Resource data type. * is a Large Resource data type.
*/ */
if (resource->data.vendor.byte_length > 7) { if (resource->data.vendor.byte_length > 7) {
/* Base size of a Large resource descriptor */ /* Base size of a Large resource descriptor */
total_size = total_size =
...@@ -346,6 +350,7 @@ acpi_rs_get_list_length(u8 * aml_buffer, ...@@ -346,6 +350,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
/* Walk the list of AML resource descriptors */ /* Walk the list of AML resource descriptors */
while (aml_buffer < end_aml) { while (aml_buffer < end_aml) {
/* Validate the Resource Type and Resource Length */ /* Validate the Resource Type and Resource Length */
status = acpi_ut_validate_resource(aml_buffer, &resource_index); status = acpi_ut_validate_resource(aml_buffer, &resource_index);
...@@ -390,7 +395,7 @@ acpi_rs_get_list_length(u8 * aml_buffer, ...@@ -390,7 +395,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
* Vendor Resource: * Vendor Resource:
* Ensure a 32-bit boundary for the structure * Ensure a 32-bit boundary for the structure
*/ */
extra_struct_bytes = extra_struct_bytes = (u32)
ACPI_ROUND_UP_to_32_bITS(resource_length) - ACPI_ROUND_UP_to_32_bITS(resource_length) -
resource_length; resource_length;
break; break;
...@@ -407,7 +412,7 @@ acpi_rs_get_list_length(u8 * aml_buffer, ...@@ -407,7 +412,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
* Vendor Resource: * Vendor Resource:
* Add vendor data and ensure a 32-bit boundary for the structure * Add vendor data and ensure a 32-bit boundary for the structure
*/ */
extra_struct_bytes = extra_struct_bytes = (u32)
ACPI_ROUND_UP_to_32_bITS(resource_length) - ACPI_ROUND_UP_to_32_bITS(resource_length) -
resource_length; resource_length;
break; break;
...@@ -431,7 +436,7 @@ acpi_rs_get_list_length(u8 * aml_buffer, ...@@ -431,7 +436,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
*/ */
buffer++; buffer++;
extra_struct_bytes = extra_struct_bytes = (u32)
/* /*
* Add 4 bytes for each additional interrupt. Note: at * Add 4 bytes for each additional interrupt. Note: at
* least one interrupt is required and is included in * least one interrupt is required and is included in
...@@ -450,7 +455,7 @@ acpi_rs_get_list_length(u8 * aml_buffer, ...@@ -450,7 +455,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
* Add the size of any optional data (resource_source) * Add the size of any optional data (resource_source)
* Ensure a 64-bit boundary for the structure * Ensure a 64-bit boundary for the structure
*/ */
extra_struct_bytes = extra_struct_bytes = (u32)
ACPI_ROUND_UP_to_64_bITS ACPI_ROUND_UP_to_64_bITS
(acpi_rs_stream_option_length (acpi_rs_stream_option_length
(resource_length, minimum_aml_resource_length)); (resource_length, minimum_aml_resource_length));
...@@ -525,6 +530,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, ...@@ -525,6 +530,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
top_object_list = package_object->package.elements; top_object_list = package_object->package.elements;
for (index = 0; index < number_of_elements; index++) { for (index = 0; index < number_of_elements; index++) {
/* Dereference the sub-package */ /* Dereference the sub-package */
package_element = *top_object_list; package_element = *top_object_list;
......
...@@ -77,6 +77,7 @@ acpi_rs_convert_aml_to_resources(u8 * aml, u32 aml_length, u8 * output_buffer) ...@@ -77,6 +77,7 @@ acpi_rs_convert_aml_to_resources(u8 * aml, u32 aml_length, u8 * output_buffer)
/* Loop until end-of-buffer or an end_tag is found */ /* Loop until end-of-buffer or an end_tag is found */
while (aml < end_aml) { while (aml < end_aml) {
/* Validate the Resource Type and Resource Length */ /* Validate the Resource Type and Resource Length */
status = acpi_ut_validate_resource(aml, &resource_index); status = acpi_ut_validate_resource(aml, &resource_index);
...@@ -155,6 +156,7 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, ...@@ -155,6 +156,7 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
/* Walk the resource descriptor list, convert each descriptor */ /* Walk the resource descriptor list, convert each descriptor */
while (aml < end_aml) { while (aml < end_aml) {
/* Validate the (internal) Resource Type */ /* Validate the (internal) Resource Type */
if (resource->type > ACPI_RESOURCE_TYPE_MAX) { if (resource->type > ACPI_RESOURCE_TYPE_MAX) {
...@@ -191,6 +193,7 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, ...@@ -191,6 +193,7 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
/* Check for end-of-list, normal exit */ /* Check for end-of-list, normal exit */
if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) {
/* An End Tag indicates the end of the input Resource Template */ /* An End Tag indicates the end of the input Resource Template */
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
......
...@@ -84,6 +84,7 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, ...@@ -84,6 +84,7 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
ACPI_FUNCTION_TRACE("rs_get_resource"); ACPI_FUNCTION_TRACE("rs_get_resource");
if (((acpi_native_uint) resource) & 0x3) { if (((acpi_native_uint) resource) & 0x3) {
/* Each internal resource struct is expected to be 32-bit aligned */ /* Each internal resource struct is expected to be 32-bit aligned */
ACPI_WARNING((AE_INFO, ACPI_WARNING((AE_INFO,
...@@ -295,9 +296,11 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, ...@@ -295,9 +296,11 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
exit: exit:
if (!flags_mode) { if (!flags_mode) {
/* Round the resource struct length up to the next 32-bit boundary */ /* Round the resource struct length up to the next 32-bit boundary */
resource->length = ACPI_ROUND_UP_to_32_bITS(resource->length); resource->length =
(u32) ACPI_ROUND_UP_to_32_bITS(resource->length);
} }
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
} }
...@@ -535,6 +538,7 @@ if (((aml->irq.flags & 0x09) == 0x00) || ((aml->irq.flags & 0x09) == 0x09)) { ...@@ -535,6 +538,7 @@ if (((aml->irq.flags & 0x09) == 0x00) || ((aml->irq.flags & 0x09) == 0x09)) {
resource->data.extended_irq.interrupt_count = temp8; resource->data.extended_irq.interrupt_count = temp8;
if (temp8 < 1) { if (temp8 < 1) {
/* Must have at least one IRQ */ /* Must have at least one IRQ */
return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
......
...@@ -205,6 +205,7 @@ acpi_rs_set_resource_length(acpi_rsdesc_size total_length, ...@@ -205,6 +205,7 @@ acpi_rs_set_resource_length(acpi_rsdesc_size total_length,
/* Length is stored differently for large and small descriptors */ /* Length is stored differently for large and small descriptors */
if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) {
/* Large descriptor -- bytes 1-2 contain the 16-bit length */ /* Large descriptor -- bytes 1-2 contain the 16-bit length */
ACPI_MOVE_16_TO_16(&aml->large_header.resource_length, ACPI_MOVE_16_TO_16(&aml->large_header.resource_length,
...@@ -328,6 +329,7 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length, ...@@ -328,6 +329,7 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length,
* we add 1 to the minimum length. * we add 1 to the minimum length.
*/ */
if (total_length > (acpi_rsdesc_size) (minimum_length + 1)) { if (total_length > (acpi_rsdesc_size) (minimum_length + 1)) {
/* Get the resource_source_index */ /* Get the resource_source_index */
resource_source->index = aml_resource_source[0]; resource_source->index = aml_resource_source[0];
...@@ -351,16 +353,20 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length, ...@@ -351,16 +353,20 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length,
* Zero the entire area of the buffer. * Zero the entire area of the buffer.
*/ */
total_length = total_length =
(u32)
ACPI_ROUND_UP_to_32_bITS(ACPI_STRLEN ACPI_ROUND_UP_to_32_bITS(ACPI_STRLEN
((char *)&aml_resource_source[1]) + (ACPI_CAST_PTR
1); (char,
&aml_resource_source[1])) + 1);
ACPI_MEMSET(resource_source->string_ptr, 0, total_length); ACPI_MEMSET(resource_source->string_ptr, 0, total_length);
/* Copy the resource_source string to the destination */ /* Copy the resource_source string to the destination */
resource_source->string_length = resource_source->string_length =
acpi_rs_strcpy(resource_source->string_ptr, acpi_rs_strcpy(resource_source->string_ptr,
(char *)&aml_resource_source[1]); ACPI_CAST_PTR(char,
&aml_resource_source[1]));
return ((acpi_rs_length) total_length); return ((acpi_rs_length) total_length);
} }
...@@ -405,6 +411,7 @@ acpi_rs_set_resource_source(union aml_resource * aml, ...@@ -405,6 +411,7 @@ acpi_rs_set_resource_source(union aml_resource * aml,
/* Non-zero string length indicates presence of a resource_source */ /* Non-zero string length indicates presence of a resource_source */
if (resource_source->string_length) { if (resource_source->string_length) {
/* Point to the end of the AML descriptor */ /* Point to the end of the AML descriptor */
aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length); aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length);
...@@ -415,7 +422,7 @@ acpi_rs_set_resource_source(union aml_resource * aml, ...@@ -415,7 +422,7 @@ acpi_rs_set_resource_source(union aml_resource * aml,
/* Copy the resource_source string */ /* Copy the resource_source string */
ACPI_STRCPY((char *)&aml_resource_source[1], ACPI_STRCPY(ACPI_CAST_PTR(char, &aml_resource_source[1]),
resource_source->string_ptr); resource_source->string_ptr);
/* /*
...@@ -435,9 +442,9 @@ acpi_rs_set_resource_source(union aml_resource * aml, ...@@ -435,9 +442,9 @@ acpi_rs_set_resource_source(union aml_resource * aml,
* *
* FUNCTION: acpi_rs_get_prt_method_data * FUNCTION: acpi_rs_get_prt_method_data
* *
* PARAMETERS: Handle - a handle to the containing object * PARAMETERS: Handle - Handle to the containing object
* ret_buffer - a pointer to a buffer structure for the * ret_buffer - Pointer to a buffer structure for the
* results * results
* *
* RETURN: Status * RETURN: Status
* *
...@@ -483,9 +490,9 @@ acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer * ret_buffer) ...@@ -483,9 +490,9 @@ acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer * ret_buffer)
* *
* FUNCTION: acpi_rs_get_crs_method_data * FUNCTION: acpi_rs_get_crs_method_data
* *
* PARAMETERS: Handle - a handle to the containing object * PARAMETERS: Handle - Handle to the containing object
* ret_buffer - a pointer to a buffer structure for the * ret_buffer - Pointer to a buffer structure for the
* results * results
* *
* RETURN: Status * RETURN: Status
* *
...@@ -532,9 +539,9 @@ acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) ...@@ -532,9 +539,9 @@ acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer)
* *
* FUNCTION: acpi_rs_get_prs_method_data * FUNCTION: acpi_rs_get_prs_method_data
* *
* PARAMETERS: Handle - a handle to the containing object * PARAMETERS: Handle - Handle to the containing object
* ret_buffer - a pointer to a buffer structure for the * ret_buffer - Pointer to a buffer structure for the
* results * results
* *
* RETURN: Status * RETURN: Status
* *
...@@ -583,10 +590,10 @@ acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) ...@@ -583,10 +590,10 @@ acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer)
* *
* FUNCTION: acpi_rs_get_method_data * FUNCTION: acpi_rs_get_method_data
* *
* PARAMETERS: Handle - a handle to the containing object * PARAMETERS: Handle - Handle to the containing object
* Path - Path to method, relative to Handle * Path - Path to method, relative to Handle
* ret_buffer - a pointer to a buffer structure for the * ret_buffer - Pointer to a buffer structure for the
* results * results
* *
* RETURN: Status * RETURN: Status
* *
...@@ -634,9 +641,9 @@ acpi_rs_get_method_data(acpi_handle handle, ...@@ -634,9 +641,9 @@ acpi_rs_get_method_data(acpi_handle handle,
* *
* FUNCTION: acpi_rs_set_srs_method_data * FUNCTION: acpi_rs_set_srs_method_data
* *
* PARAMETERS: Handle - a handle to the containing object * PARAMETERS: Handle - Handle to the containing object
* in_buffer - a pointer to a buffer structure of the * in_buffer - Pointer to a buffer structure of the
* parameter * parameter
* *
* RETURN: Status * RETURN: Status
* *
...@@ -696,6 +703,7 @@ acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *in_buffer) ...@@ -696,6 +703,7 @@ acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *in_buffer)
status = acpi_ns_evaluate_relative(METHOD_NAME__SRS, &info); status = acpi_ns_evaluate_relative(METHOD_NAME__SRS, &info);
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
/* Delete any return object (especially if implicit_return is enabled) */ /* Delete any return object (especially if implicit_return is enabled) */
if (info.return_object) { if (info.return_object) {
......
...@@ -279,6 +279,7 @@ acpi_walk_resources(acpi_handle device_handle, ...@@ -279,6 +279,7 @@ acpi_walk_resources(acpi_handle device_handle,
/* Walk the resource list until the end_tag is found (or buffer end) */ /* Walk the resource list until the end_tag is found (or buffer end) */
while (resource < resource_end) { while (resource < resource_end) {
/* Sanity check the resource */ /* Sanity check the resource */
if (resource->type > ACPI_RESOURCE_TYPE_MAX) { if (resource->type > ACPI_RESOURCE_TYPE_MAX) {
...@@ -291,6 +292,7 @@ acpi_walk_resources(acpi_handle device_handle, ...@@ -291,6 +292,7 @@ acpi_walk_resources(acpi_handle device_handle,
status = user_function(resource, context); status = user_function(resource, context);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
if (status == AE_CTRL_TERMINATE) { if (status == AE_CTRL_TERMINATE) {
/* This is an OK termination by the user function */ /* This is an OK termination by the user function */
status = AE_OK; status = AE_OK;
......
...@@ -147,6 +147,7 @@ acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info) ...@@ -147,6 +147,7 @@ acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info)
/* Copy the table pointers */ /* Copy the table pointers */
for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { for (i = 0; i < acpi_gbl_rsdt_table_count; i++) {
/* RSDT pointers are 32 bits, XSDT pointers are 64 bits */ /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */
if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
...@@ -515,6 +516,7 @@ acpi_status acpi_tb_convert_table_fadt(void) ...@@ -515,6 +516,7 @@ acpi_status acpi_tb_convert_table_fadt(void)
if (acpi_gbl_FADT->revision >= FADT2_REVISION_ID) { if (acpi_gbl_FADT->revision >= FADT2_REVISION_ID) {
if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor_rev2)) { if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor_rev2)) {
/* Length is too short to be a V2.0 table */ /* Length is too short to be a V2.0 table */
ACPI_WARNING((AE_INFO, ACPI_WARNING((AE_INFO,
...@@ -603,6 +605,7 @@ acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info) ...@@ -603,6 +605,7 @@ acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info)
if ((acpi_gbl_RSDP->revision < 2) || if ((acpi_gbl_RSDP->revision < 2) ||
(acpi_gbl_FACS->length < 32) || (acpi_gbl_FACS->length < 32) ||
(!(acpi_gbl_FACS->xfirmware_waking_vector))) { (!(acpi_gbl_FACS->xfirmware_waking_vector))) {
/* ACPI 1.0 FACS or short table or optional X_ field is zero */ /* ACPI 1.0 FACS or short table or optional X_ field is zero */
acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR(u64, acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR(u64,
......
...@@ -148,6 +148,10 @@ acpi_tb_get_table_header(struct acpi_pointer *address, ...@@ -148,6 +148,10 @@ acpi_tb_get_table_header(struct acpi_pointer *address,
sizeof(struct acpi_table_header), sizeof(struct acpi_table_header),
(void *)&header); (void *)&header);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_ERROR((AE_INFO,
"Could not map memory at %8.8X%8.8X for table header",
ACPI_FORMAT_UINT64(address->pointer.
physical)));
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
...@@ -208,6 +212,7 @@ acpi_tb_get_table_body(struct acpi_pointer *address, ...@@ -208,6 +212,7 @@ acpi_tb_get_table_body(struct acpi_pointer *address,
status = acpi_tb_table_override(header, table_info); status = acpi_tb_table_override(header, table_info);
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
/* Table was overridden by the host OS */ /* Table was overridden by the host OS */
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
...@@ -250,6 +255,7 @@ acpi_tb_table_override(struct acpi_table_header *header, ...@@ -250,6 +255,7 @@ acpi_tb_table_override(struct acpi_table_header *header,
*/ */
status = acpi_os_table_override(header, &new_table); status = acpi_os_table_override(header, &new_table);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
/* Some severe error from the OSL, but we basically ignore it */ /* Some severe error from the OSL, but we basically ignore it */
ACPI_EXCEPTION((AE_INFO, status, ACPI_EXCEPTION((AE_INFO, status,
...@@ -258,6 +264,7 @@ acpi_tb_table_override(struct acpi_table_header *header, ...@@ -258,6 +264,7 @@ acpi_tb_table_override(struct acpi_table_header *header,
} }
if (!new_table) { if (!new_table) {
/* No table override */ /* No table override */
return_ACPI_STATUS(AE_NO_ACPI_TABLES); return_ACPI_STATUS(AE_NO_ACPI_TABLES);
...@@ -381,6 +388,7 @@ acpi_tb_get_this_table(struct acpi_pointer *address, ...@@ -381,6 +388,7 @@ acpi_tb_get_this_table(struct acpi_pointer *address,
#if (!ACPI_CHECKSUM_ABORT) #if (!ACPI_CHECKSUM_ABORT)
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
/* Ignore the error if configuration says so */ /* Ignore the error if configuration says so */
status = AE_OK; status = AE_OK;
...@@ -440,6 +448,7 @@ acpi_tb_get_table_ptr(acpi_table_type table_type, ...@@ -440,6 +448,7 @@ acpi_tb_get_table_ptr(acpi_table_type table_type,
* instance is always in the list head. * instance is always in the list head.
*/ */
if (instance == 1) { if (instance == 1) {
/* Get the first */ /* Get the first */
*table_ptr_loc = NULL; *table_ptr_loc = NULL;
......
...@@ -223,6 +223,7 @@ acpi_status acpi_tb_get_required_tables(void) ...@@ -223,6 +223,7 @@ acpi_status acpi_tb_get_required_tables(void)
* any SSDTs. * any SSDTs.
*/ */
for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { for (i = 0; i < acpi_gbl_rsdt_table_count; i++) {
/* Get the table address from the common internal XSDT */ /* Get the table address from the common internal XSDT */
address.pointer.value = acpi_gbl_XSDT->table_offset_entry[i]; address.pointer.value = acpi_gbl_XSDT->table_offset_entry[i];
......
...@@ -84,6 +84,7 @@ acpi_tb_match_signature(char *signature, ...@@ -84,6 +84,7 @@ acpi_tb_match_signature(char *signature,
if (!ACPI_STRNCMP(signature, acpi_gbl_table_data[i].signature, if (!ACPI_STRNCMP(signature, acpi_gbl_table_data[i].signature,
acpi_gbl_table_data[i].sig_length)) { acpi_gbl_table_data[i].sig_length)) {
/* Found a signature match, return index if requested */ /* Found a signature match, return index if requested */
if (table_info) { if (table_info) {
......
...@@ -190,6 +190,7 @@ acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr) ...@@ -190,6 +190,7 @@ acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr)
} }
if (no_match) { if (no_match) {
/* Invalid RSDT or XSDT signature */ /* Invalid RSDT or XSDT signature */
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
......
...@@ -96,6 +96,7 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc) ...@@ -96,6 +96,7 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc)
(!ACPI_MEMCMP (!ACPI_MEMCMP
(table_desc->pointer, new_table_desc->pointer, (table_desc->pointer, new_table_desc->pointer,
new_table_desc->pointer->length))) { new_table_desc->pointer->length))) {
/* Match: this table is already installed */ /* Match: this table is already installed */
ACPI_DEBUG_PRINT((ACPI_DB_TABLES, ACPI_DEBUG_PRINT((ACPI_DB_TABLES,
...@@ -249,6 +250,7 @@ u8 acpi_tb_generate_checksum(void *buffer, u32 length) ...@@ -249,6 +250,7 @@ u8 acpi_tb_generate_checksum(void *buffer, u32 length)
u8 sum = 0; u8 sum = 0;
if (buffer && length) { if (buffer && length) {
/* Buffer and Length are valid */ /* Buffer and Length are valid */
end_buffer = ACPI_ADD_PTR(u8, buffer, length); end_buffer = ACPI_ADD_PTR(u8, buffer, length);
......
...@@ -174,6 +174,7 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr) ...@@ -174,6 +174,7 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr)
status = acpi_tb_install_table(&table_info); status = acpi_tb_install_table(&table_info);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
if (status == AE_ALREADY_EXISTS) { if (status == AE_ALREADY_EXISTS) {
/* Table already exists, no error */ /* Table already exists, no error */
status = AE_OK; status = AE_OK;
...@@ -208,6 +209,7 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr) ...@@ -208,6 +209,7 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr)
} }
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
/* Uninstall table and free the buffer */ /* Uninstall table and free the buffer */
(void)acpi_tb_uninstall_table(table_info.installed_desc); (void)acpi_tb_uninstall_table(table_info.installed_desc);
...@@ -397,6 +399,7 @@ acpi_get_table(acpi_table_type table_type, ...@@ -397,6 +399,7 @@ acpi_get_table(acpi_table_type table_type,
/* Get the table length */ /* Get the table length */
if (table_type == ACPI_TABLE_RSDP) { if (table_type == ACPI_TABLE_RSDP) {
/* RSD PTR is the only "table" without a header */ /* RSD PTR is the only "table" without a header */
table_length = sizeof(struct rsdp_descriptor); table_length = sizeof(struct rsdp_descriptor);
......
...@@ -75,6 +75,7 @@ acpi_status acpi_tb_validate_rsdp(struct rsdp_descriptor *rsdp) ...@@ -75,6 +75,7 @@ acpi_status acpi_tb_validate_rsdp(struct rsdp_descriptor *rsdp)
* The signature and checksum must both be correct * The signature and checksum must both be correct
*/ */
if (ACPI_STRNCMP((char *)rsdp, RSDP_SIG, sizeof(RSDP_SIG) - 1) != 0) { if (ACPI_STRNCMP((char *)rsdp, RSDP_SIG, sizeof(RSDP_SIG) - 1) != 0) {
/* Nope, BAD Signature */ /* Nope, BAD Signature */
return (AE_BAD_SIGNATURE); return (AE_BAD_SIGNATURE);
...@@ -217,6 +218,7 @@ acpi_get_firmware_table(acpi_string signature, ...@@ -217,6 +218,7 @@ acpi_get_firmware_table(acpi_string signature,
/* Ensure that we have a RSDP */ /* Ensure that we have a RSDP */
if (!acpi_gbl_RSDP) { if (!acpi_gbl_RSDP) {
/* Get the RSDP */ /* Get the RSDP */
status = acpi_os_get_root_pointer(flags, &address); status = acpi_os_get_root_pointer(flags, &address);
...@@ -327,10 +329,12 @@ acpi_get_firmware_table(acpi_string signature, ...@@ -327,10 +329,12 @@ acpi_get_firmware_table(acpi_string signature,
/* Compare table signatures and table instance */ /* Compare table signatures and table instance */
if (!ACPI_STRNCMP(header->signature, signature, ACPI_NAME_SIZE)) { if (!ACPI_STRNCMP(header->signature, signature, ACPI_NAME_SIZE)) {
/* An instance of the table was found */ /* An instance of the table was found */
j++; j++;
if (j >= instance) { if (j >= instance) {
/* Found the correct instance, get the entire table */ /* Found the correct instance, get the entire table */
status = status =
...@@ -434,12 +438,14 @@ static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length) ...@@ -434,12 +438,14 @@ static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length)
for (mem_rover = start_address; mem_rover < end_address; for (mem_rover = start_address; mem_rover < end_address;
mem_rover += ACPI_RSDP_SCAN_STEP) { mem_rover += ACPI_RSDP_SCAN_STEP) {
/* The RSDP signature and checksum must both be correct */ /* The RSDP signature and checksum must both be correct */
status = status =
acpi_tb_validate_rsdp(ACPI_CAST_PTR acpi_tb_validate_rsdp(ACPI_CAST_PTR
(struct rsdp_descriptor, mem_rover)); (struct rsdp_descriptor, mem_rover));
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
/* Sig and checksum valid, we have found a real RSDP */ /* Sig and checksum valid, we have found a real RSDP */
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
...@@ -495,6 +501,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) ...@@ -495,6 +501,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags)
* Scan supports either logical addressing or physical addressing * Scan supports either logical addressing or physical addressing
*/ */
if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) {
/* 1a) Get the location of the Extended BIOS Data Area (EBDA) */ /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */
status = acpi_os_map_memory((acpi_physical_address) status = acpi_os_map_memory((acpi_physical_address)
...@@ -542,6 +549,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) ...@@ -542,6 +549,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags)
acpi_os_unmap_memory(table_ptr, ACPI_EBDA_WINDOW_SIZE); acpi_os_unmap_memory(table_ptr, ACPI_EBDA_WINDOW_SIZE);
if (mem_rover) { if (mem_rover) {
/* Return the physical address */ /* Return the physical address */
physical_address += physical_address +=
...@@ -576,6 +584,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) ...@@ -576,6 +584,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags)
acpi_os_unmap_memory(table_ptr, ACPI_HI_RSDP_WINDOW_SIZE); acpi_os_unmap_memory(table_ptr, ACPI_HI_RSDP_WINDOW_SIZE);
if (mem_rover) { if (mem_rover) {
/* Return the physical address */ /* Return the physical address */
physical_address = physical_address =
...@@ -609,6 +618,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) ...@@ -609,6 +618,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags)
(physical_address), (physical_address),
ACPI_EBDA_WINDOW_SIZE); ACPI_EBDA_WINDOW_SIZE);
if (mem_rover) { if (mem_rover) {
/* Return the physical address */ /* Return the physical address */
table_info->physical_address = table_info->physical_address =
...@@ -624,6 +634,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) ...@@ -624,6 +634,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags)
(ACPI_HI_RSDP_WINDOW_BASE), (ACPI_HI_RSDP_WINDOW_BASE),
ACPI_HI_RSDP_WINDOW_SIZE); ACPI_HI_RSDP_WINDOW_SIZE);
if (mem_rover) { if (mem_rover) {
/* Found it, return the physical address */ /* Found it, return the physical address */
table_info->physical_address = table_info->physical_address =
......
...@@ -308,6 +308,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) ...@@ -308,6 +308,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line)
allocation = acpi_os_allocate(size); allocation = acpi_os_allocate(size);
if (!allocation) { if (!allocation) {
/* Report allocation error */ /* Report allocation error */
ACPI_ERROR((module, line, ACPI_ERROR((module, line,
...@@ -351,6 +352,7 @@ void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line) ...@@ -351,6 +352,7 @@ void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line)
allocation = acpi_os_allocate(size); allocation = acpi_os_allocate(size);
if (!allocation) { if (!allocation) {
/* Report allocation error */ /* Report allocation error */
ACPI_ERROR((module, line, ACPI_ERROR((module, line,
...@@ -477,6 +479,7 @@ void *acpi_ut_callocate_and_track(acpi_size size, ...@@ -477,6 +479,7 @@ void *acpi_ut_callocate_and_track(acpi_size size,
acpi_ut_callocate(size + sizeof(struct acpi_debug_mem_header), acpi_ut_callocate(size + sizeof(struct acpi_debug_mem_header),
component, module, line); component, module, line);
if (!allocation) { if (!allocation) {
/* Report allocation error */ /* Report allocation error */
ACPI_ERROR((module, line, ACPI_ERROR((module, line,
...@@ -681,6 +684,7 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation, ...@@ -681,6 +684,7 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation,
mem_list = acpi_gbl_global_list; mem_list = acpi_gbl_global_list;
if (NULL == mem_list->list_head) { if (NULL == mem_list->list_head) {
/* No allocations! */ /* No allocations! */
ACPI_ERROR((module, line, ACPI_ERROR((module, line,
...@@ -807,6 +811,7 @@ void acpi_ut_dump_allocations(u32 component, char *module) ...@@ -807,6 +811,7 @@ void acpi_ut_dump_allocations(u32 component, char *module)
if ((element->component & component) && if ((element->component & component) &&
((module == NULL) ((module == NULL)
|| (0 == ACPI_STRCMP(module, element->module)))) { || (0 == ACPI_STRCMP(module, element->module)))) {
/* Ignore allocated objects that are in a cache */ /* Ignore allocated objects that are in a cache */
descriptor = descriptor =
......
...@@ -118,6 +118,7 @@ acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache) ...@@ -118,6 +118,7 @@ acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache)
/* Walk the list of objects in this cache */ /* Walk the list of objects in this cache */
while (cache->list_head) { while (cache->list_head) {
/* Delete and unlink one cached state object */ /* Delete and unlink one cached state object */
next = *(ACPI_CAST_INDIRECT_PTR(char, next = *(ACPI_CAST_INDIRECT_PTR(char,
...@@ -259,6 +260,7 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache) ...@@ -259,6 +260,7 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache)
/* Check the cache first */ /* Check the cache first */
if (cache->list_head) { if (cache->list_head) {
/* There is an object available, use it */ /* There is an object available, use it */
object = cache->list_head; object = cache->list_head;
......
...@@ -882,6 +882,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj, ...@@ -882,6 +882,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj,
acpi_ut_copy_ielement_to_ielement, acpi_ut_copy_ielement_to_ielement,
walk_state); walk_state);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
/* On failure, delete the destination package object */ /* On failure, delete the destination package object */
acpi_ut_remove_reference(dest_obj); acpi_ut_remove_reference(dest_obj);
......
...@@ -123,12 +123,14 @@ static const char *acpi_ut_trim_function_name(const char *function_name) ...@@ -123,12 +123,14 @@ static const char *acpi_ut_trim_function_name(const char *function_name)
/* All Function names are longer than 4 chars, check is safe */ /* All Function names are longer than 4 chars, check is safe */
if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_MIXED) { if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_MIXED) {
/* This is the case where the original source has not been modified */ /* This is the case where the original source has not been modified */
return (function_name + 4); return (function_name + 4);
} }
if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_LOWER) { if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_LOWER) {
/* This is the case where the source has been 'linuxized' */ /* This is the case where the source has been 'linuxized' */
return (function_name + 5); return (function_name + 5);
...@@ -545,6 +547,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) ...@@ -545,6 +547,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
/* Nasty little dump buffer routine! */ /* Nasty little dump buffer routine! */
while (i < count) { while (i < count) {
/* Print current offset */ /* Print current offset */
acpi_os_printf("%6.4X: ", (u32) i); acpi_os_printf("%6.4X: ", (u32) i);
...@@ -553,6 +556,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) ...@@ -553,6 +556,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
for (j = 0; j < 16;) { for (j = 0; j < 16;) {
if (i + j >= count) { if (i + j >= count) {
/* Dump fill spaces */ /* Dump fill spaces */
acpi_os_printf("%*s", ((display * 2) + 1), " "); acpi_os_printf("%*s", ((display * 2) + 1), " ");
......
...@@ -96,6 +96,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) ...@@ -96,6 +96,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
/* Free the actual string buffer */ /* Free the actual string buffer */
if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) {
/* But only if it is NOT a pointer into an ACPI table */ /* But only if it is NOT a pointer into an ACPI table */
obj_pointer = object->string.pointer; obj_pointer = object->string.pointer;
...@@ -111,6 +112,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) ...@@ -111,6 +112,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
/* Free the actual buffer */ /* Free the actual buffer */
if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) {
/* But only if it is NOT a pointer into an ACPI table */ /* But only if it is NOT a pointer into an ACPI table */
obj_pointer = object->buffer.pointer; obj_pointer = object->buffer.pointer;
...@@ -415,6 +417,7 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) ...@@ -415,6 +417,7 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action)
ACPI_FUNCTION_TRACE_PTR("ut_update_object_reference", object); ACPI_FUNCTION_TRACE_PTR("ut_update_object_reference", object);
while (object) { while (object) {
/* Make sure that this isn't a namespace handle */ /* Make sure that this isn't a namespace handle */
if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) { if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) {
......
...@@ -98,6 +98,7 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) ...@@ -98,6 +98,7 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)
ACPI_CAST_PTR(char, ACPI_CAST_PTR(char,
acpi_gbl_valid_osi_strings[i]))) acpi_gbl_valid_osi_strings[i])))
{ {
/* This string is supported */ /* This string is supported */
return_desc->integer.value = 0xFFFFFFFF; return_desc->integer.value = 0xFFFFFFFF;
...@@ -343,6 +344,7 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node, ...@@ -343,6 +344,7 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
} }
if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
/* Convert the Numeric HID to string */ /* Convert the Numeric HID to string */
acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value, acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value,
...@@ -479,6 +481,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node, ...@@ -479,6 +481,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node,
/* The _CID object can be either a single CID or a package (list) of CIDs */ /* The _CID object can be either a single CID or a package (list) of CIDs */
if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) {
/* Translate each package element */ /* Translate each package element */
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
...@@ -543,6 +546,7 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node, ...@@ -543,6 +546,7 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
} }
if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
/* Convert the Numeric UID to string */ /* Convert the Numeric UID to string */
acpi_ex_unsigned_integer_to_string(obj_desc->integer.value, acpi_ex_unsigned_integer_to_string(obj_desc->integer.value,
......
...@@ -119,6 +119,7 @@ const char *acpi_format_exception(acpi_status status) ...@@ -119,6 +119,7 @@ const char *acpi_format_exception(acpi_status status)
} }
if (!exception) { if (!exception) {
/* Exception code was not recognized */ /* Exception code was not recognized */
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
...@@ -747,6 +748,7 @@ u8 acpi_ut_valid_object_type(acpi_object_type type) ...@@ -747,6 +748,7 @@ u8 acpi_ut_valid_object_type(acpi_object_type type)
{ {
if (type > ACPI_TYPE_LOCAL_MAX) { if (type > ACPI_TYPE_LOCAL_MAX) {
/* Note: Assumes all TYPEs are contiguous (external/local) */ /* Note: Assumes all TYPEs are contiguous (external/local) */
return (FALSE); return (FALSE);
......
...@@ -97,6 +97,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) ...@@ -97,6 +97,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
for (k = acpi_gbl_next_owner_id_offset; k < 32; k++) { for (k = acpi_gbl_next_owner_id_offset; k < 32; k++) {
if (acpi_gbl_owner_id_mask[j] == ACPI_UINT32_MAX) { if (acpi_gbl_owner_id_mask[j] == ACPI_UINT32_MAX) {
/* There are no free IDs in this mask */ /* There are no free IDs in this mask */
break; break;
...@@ -273,6 +274,7 @@ void acpi_ut_print_string(char *string, u8 max_length) ...@@ -273,6 +274,7 @@ void acpi_ut_print_string(char *string, u8 max_length)
acpi_os_printf("\""); acpi_os_printf("\"");
for (i = 0; string[i] && (i < max_length); i++) { for (i = 0; string[i] && (i < max_length); i++) {
/* Escape sequences */ /* Escape sequences */
switch (string[i]) { switch (string[i]) {
...@@ -601,11 +603,13 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) ...@@ -601,11 +603,13 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer)
while (*string) { while (*string) {
if (ACPI_IS_DIGIT(*string)) { if (ACPI_IS_DIGIT(*string)) {
/* Convert ASCII 0-9 to Decimal value */ /* Convert ASCII 0-9 to Decimal value */
this_digit = ((u8) * string) - '0'; this_digit = ((u8) * string) - '0';
} else { } else {
if (base == 10) { if (base == 10) {
/* Digit is out of range */ /* Digit is out of range */
goto error_exit; goto error_exit;
...@@ -613,6 +617,7 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) ...@@ -613,6 +617,7 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer)
this_digit = (u8) ACPI_TOUPPER(*string); this_digit = (u8) ACPI_TOUPPER(*string);
if (ACPI_IS_XDIGIT((char)this_digit)) { if (ACPI_IS_XDIGIT((char)this_digit)) {
/* Convert ASCII Hex char to value */ /* Convert ASCII Hex char to value */
this_digit = this_digit - 'A' + 10; this_digit = this_digit - 'A' + 10;
...@@ -727,6 +732,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, ...@@ -727,6 +732,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object,
} }
while (state) { while (state) {
/* Get one element of the package */ /* Get one element of the package */
this_index = state->pkg.index; this_index = state->pkg.index;
...@@ -812,31 +818,6 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, ...@@ -812,31 +818,6 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object,
return_ACPI_STATUS(AE_AML_INTERNAL); return_ACPI_STATUS(AE_AML_INTERNAL);
} }
/*******************************************************************************
*
* FUNCTION: acpi_ut_generate_checksum
*
* PARAMETERS: Buffer - Buffer to be scanned
* Length - number of bytes to examine
*
* RETURN: The generated checksum
*
* DESCRIPTION: Generate a checksum on a raw buffer
*
******************************************************************************/
u8 acpi_ut_generate_checksum(u8 * buffer, u32 length)
{
u32 i;
signed char sum = 0;
for (i = 0; i < length; i++) {
sum = (signed char)(sum + buffer[i]);
}
return ((u8) (0 - sum));
}
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ut_error, acpi_ut_warning, acpi_ut_info * FUNCTION: acpi_ut_error, acpi_ut_warning, acpi_ut_info
......
...@@ -173,6 +173,7 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size) ...@@ -173,6 +173,7 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size)
/* Create an actual buffer only if size > 0 */ /* Create an actual buffer only if size > 0 */
if (buffer_size > 0) { if (buffer_size > 0) {
/* Allocate the actual buffer */ /* Allocate the actual buffer */
buffer = ACPI_MEM_CALLOCATE(buffer_size); buffer = ACPI_MEM_CALLOCATE(buffer_size);
...@@ -397,6 +398,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, ...@@ -397,6 +398,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
length = sizeof(union acpi_object); length = sizeof(union acpi_object);
if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) { if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) {
/* Object is a named object (reference), just return the length */ /* Object is a named object (reference), just return the length */
*obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length); *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length);
......
...@@ -273,6 +273,7 @@ acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index) ...@@ -273,6 +273,7 @@ acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index)
* Examine the large/small bit in the resource header * Examine the large/small bit in the resource header
*/ */
if (resource_type & ACPI_RESOURCE_NAME_LARGE) { if (resource_type & ACPI_RESOURCE_NAME_LARGE) {
/* Verify the large resource type (name) against the max */ /* Verify the large resource type (name) against the max */
if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) { if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) {
...@@ -376,6 +377,7 @@ u8 acpi_ut_get_resource_type(void *aml) ...@@ -376,6 +377,7 @@ u8 acpi_ut_get_resource_type(void *aml)
* Examine the large/small bit in the resource header * Examine the large/small bit in the resource header
*/ */
if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) {
/* Large Resource Type -- bits 6:0 contain the name */ /* Large Resource Type -- bits 6:0 contain the name */
return (ACPI_GET8(aml)); return (ACPI_GET8(aml));
...@@ -411,6 +413,7 @@ u16 acpi_ut_get_resource_length(void *aml) ...@@ -411,6 +413,7 @@ u16 acpi_ut_get_resource_length(void *aml)
* Examine the large/small bit in the resource header * Examine the large/small bit in the resource header
*/ */
if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) {
/* Large Resource type -- bytes 1-2 contain the 16-bit length */ /* Large Resource type -- bytes 1-2 contain the 16-bit length */
ACPI_MOVE_16_TO_16(&resource_length, ACPI_ADD_PTR(u8, aml, 1)); ACPI_MOVE_16_TO_16(&resource_length, ACPI_ADD_PTR(u8, aml, 1));
...@@ -515,6 +518,7 @@ acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc, ...@@ -515,6 +518,7 @@ acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc,
/* Walk the resource template, one descriptor per iteration */ /* Walk the resource template, one descriptor per iteration */
while (aml < end_aml) { while (aml < end_aml) {
/* Validate the Resource Type and Resource Length */ /* Validate the Resource Type and Resource Length */
status = acpi_ut_validate_resource(aml, NULL); status = acpi_ut_validate_resource(aml, NULL);
......
...@@ -129,6 +129,7 @@ union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state ...@@ -129,6 +129,7 @@ union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state
state = *list_head; state = *list_head;
if (state) { if (state) {
/* Update the list head */ /* Update the list head */
*list_head = state->common.next; *list_head = state->common.next;
...@@ -158,6 +159,7 @@ union acpi_generic_state *acpi_ut_create_generic_state(void) ...@@ -158,6 +159,7 @@ union acpi_generic_state *acpi_ut_create_generic_state(void)
state = acpi_os_acquire_object(acpi_gbl_state_cache); state = acpi_os_acquire_object(acpi_gbl_state_cache);
if (state) { if (state) {
/* Initialize */ /* Initialize */
memset(state, 0, sizeof(union acpi_generic_state)); memset(state, 0, sizeof(union acpi_generic_state));
state->common.data_type = ACPI_DESC_TYPE_STATE; state->common.data_type = ACPI_DESC_TYPE_STATE;
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */ /* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20060127 #define ACPI_CA_VERSION 0x20060210
/* /*
* OS name, used for the _OS object. The _OS object is essentially obsolete, * OS name, used for the _OS object. The _OS object is essentially obsolete,
......
...@@ -70,6 +70,7 @@ extern const char *acpi_gbl_match_ops[ACPI_NUM_MATCH_OPS]; ...@@ -70,6 +70,7 @@ extern const char *acpi_gbl_match_ops[ACPI_NUM_MATCH_OPS];
struct acpi_op_walk_info { struct acpi_op_walk_info {
u32 level; u32 level;
u32 bit_offset; u32 bit_offset;
u32 flags;
struct acpi_walk_state *walk_state; struct acpi_walk_state *walk_state;
}; };
......
...@@ -483,8 +483,6 @@ acpi_status ...@@ -483,8 +483,6 @@ acpi_status
acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc,
u8 ** end_tag); u8 ** end_tag);
u8 acpi_ut_generate_checksum(u8 * buffer, u32 length);
u32 acpi_ut_dword_byte_swap(u32 value); u32 acpi_ut_dword_byte_swap(u32 value);
void acpi_ut_set_integer_width(u8 revision); void acpi_ut_set_integer_width(u8 revision);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment