Skip to content

Commit

Permalink
[ACPI] ACPICA 20060127
Browse files Browse the repository at this point in the history
Implemented support in the Resource Manager to allow
unresolved namestring references within resource package
objects for the _PRT method. This support is in addition
to the previously implemented unresolved reference
support within the AML parser. If the interpreter slack
mode is enabled (true on Linux unless acpi=strict),
these unresolved references will be passed through
to the caller as a NULL package entry.
http://bugzilla.kernel.org/show_bug.cgi?id=5741

Implemented and deployed new macros and functions for
error and warning messages across the subsystem. These
macros are simpler and generate less code than their
predecessors. The new macros ACPI_ERROR, ACPI_EXCEPTION,
ACPI_WARNING, and ACPI_INFO replace the ACPI_REPORT_*
macros.

Implemented the acpi_cpu_flags type to simplify host OS
integration of the Acquire/Release Lock OSL interfaces.
Suggested by Steven Rostedt and Andrew Morton.

Fixed a problem where Alias ASL operators are sometimes
not correctly resolved. causing AE_AML_INTERNAL
http://bugzilla.kernel.org/show_bug.cgi?id=5189
http://bugzilla.kernel.org/show_bug.cgi?id=5674

Fixed several problems with the implementation of the
ConcatenateResTemplate ASL operator. As per the ACPI
specification, zero length buffers are now treated as a
single EndTag. One-length buffers always cause a fatal
exception. Non-zero length buffers that do not end with
a full 2-byte EndTag cause a fatal exception.

Fixed a possible structure overwrite in the
AcpiGetObjectInfo external interface. (With assistance
from Thomas Renninger)

Signed-off-by: Bob Moore <[email protected]>
Signed-off-by: Len Brown <[email protected]>
  • Loading branch information
acpibob authored and lenb committed Jan 31, 2006
1 parent 292dd87 commit b8e4d89
Show file tree
Hide file tree
Showing 95 changed files with 1,345 additions and 821 deletions.
34 changes: 20 additions & 14 deletions drivers/acpi/dispatcher/dsfield.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op,
ACPI_IMODE_LOAD_PASS1, flags, walk_state,
&(node));
if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(arg->common.value.string, status);
ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
return_ACPI_STATUS(status);
}
}
Expand Down Expand Up @@ -232,7 +232,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
+ (acpi_integer) arg->common.value.size;

if (position > ACPI_UINT32_MAX) {
ACPI_REPORT_ERROR(("Bit offset within field too large (> 0xFFFFFFFF)\n"));
ACPI_ERROR((AE_INFO,
"Bit offset within field too large (> 0xFFFFFFFF)"));
return_ACPI_STATUS(AE_SUPPORT);
}

Expand Down Expand Up @@ -268,8 +269,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
ACPI_NS_DONT_OPEN_SCOPE,
walk_state, &info->field_node);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR((char *)&arg->named.name,
status);
ACPI_ERROR_NAMESPACE((char *)&arg->named.name,
status);
if (status != AE_ALREADY_EXISTS) {
return_ACPI_STATUS(status);
}
Expand All @@ -293,7 +294,11 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
+ (acpi_integer) arg->common.value.size;

if (position > ACPI_UINT32_MAX) {
ACPI_REPORT_ERROR(("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", ACPI_CAST_PTR(char, &info->field_node->name)));
ACPI_ERROR((AE_INFO,
"Field [%4.4s] bit offset too large (> 0xFFFFFFFF)",
ACPI_CAST_PTR(char,
&info->field_node->
name)));
return_ACPI_STATUS(AE_SUPPORT);
}

Expand All @@ -302,8 +307,9 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,

default:

ACPI_REPORT_ERROR(("Invalid opcode in field list: %X\n",
arg->common.aml_opcode));
ACPI_ERROR((AE_INFO,
"Invalid opcode in field list: %X",
arg->common.aml_opcode));
return_ACPI_STATUS(AE_AML_BAD_OPCODE);
}

Expand Down Expand Up @@ -348,7 +354,7 @@ acpi_ds_create_field(union acpi_parse_object *op,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
walk_state, &region_node);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(arg->common.value.name, status);
ACPI_ERROR_NAMESPACE(arg->common.value.name, status);
return_ACPI_STATUS(status);
}
}
Expand Down Expand Up @@ -430,8 +436,8 @@ acpi_ds_init_field_objects(union acpi_parse_object *op,
ACPI_NS_ERROR_IF_FOUND,
walk_state, &node);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR((char *)&arg->named.name,
status);
ACPI_ERROR_NAMESPACE((char *)&arg->named.name,
status);
if (status != AE_ALREADY_EXISTS) {
return_ACPI_STATUS(status);
}
Expand Down Expand Up @@ -487,7 +493,7 @@ acpi_ds_create_bank_field(union acpi_parse_object *op,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
walk_state, &region_node);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(arg->common.value.name, status);
ACPI_ERROR_NAMESPACE(arg->common.value.name, status);
return_ACPI_STATUS(status);
}
}
Expand All @@ -501,7 +507,7 @@ acpi_ds_create_bank_field(union acpi_parse_object *op,
ACPI_NS_SEARCH_PARENT, walk_state,
&info.register_node);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(arg->common.value.string, status);
ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
return_ACPI_STATUS(status);
}

Expand Down Expand Up @@ -559,7 +565,7 @@ acpi_ds_create_index_field(union acpi_parse_object *op,
ACPI_NS_SEARCH_PARENT, walk_state,
&info.register_node);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(arg->common.value.string, status);
ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
return_ACPI_STATUS(status);
}

Expand All @@ -572,7 +578,7 @@ acpi_ds_create_index_field(union acpi_parse_object *op,
ACPI_NS_SEARCH_PARENT, walk_state,
&info.data_register_node);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(arg->common.value.string, status);
ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
return_ACPI_STATUS(status);
}

Expand Down
14 changes: 10 additions & 4 deletions drivers/acpi/dispatcher/dsinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ acpi_ds_init_one_object(acpi_handle obj_handle,

status = acpi_ds_initialize_region(obj_handle);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("Region %p [%4.4s] - Init failure, %s\n", obj_handle, acpi_ut_get_node_name(obj_handle), acpi_format_exception(status)));
ACPI_EXCEPTION((AE_INFO, status,
"During Region initialization %p [%4.4s]",
obj_handle,
acpi_ut_get_node_name(obj_handle)));
}

info->op_region_count++;
Expand Down Expand Up @@ -144,7 +147,11 @@ acpi_ds_init_one_object(acpi_handle obj_handle,
*/
status = acpi_ds_parse_method(obj_handle);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("\n+Method %p [%4.4s] - parse failure, %s\n", obj_handle, acpi_ut_get_node_name(obj_handle), acpi_format_exception(status)));
ACPI_ERROR((AE_INFO,
"Method %p [%4.4s] - parse failure, %s",
obj_handle,
acpi_ut_get_node_name(obj_handle),
acpi_format_exception(status)));

/* This parse failed, but we will continue parsing more methods */
}
Expand Down Expand Up @@ -206,8 +213,7 @@ acpi_ds_initialize_objects(struct acpi_table_desc * table_desc,
status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX,
acpi_ds_init_one_object, &info, NULL);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("walk_namespace failed, %s\n",
acpi_format_exception(status)));
ACPI_EXCEPTION((AE_INFO, status, "During walk_namespace"));
}

ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
Expand Down
6 changes: 4 additions & 2 deletions drivers/acpi/dispatcher/dsmethod.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node,
/* Prevent wraparound of thread count */

if (obj_desc->method.thread_count == ACPI_UINT8_MAX) {
ACPI_REPORT_ERROR(("Method reached maximum reentrancy limit (255)\n"));
ACPI_ERROR((AE_INFO,
"Method reached maximum reentrancy limit (255)"));
return_ACPI_STATUS(AE_AML_METHOD_LIMIT);
}

Expand Down Expand Up @@ -470,7 +471,8 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state)
acpi_os_signal_semaphore(walk_state->method_desc->method.
semaphore, 1);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("Could not signal method semaphore\n"));
ACPI_ERROR((AE_INFO,
"Could not signal method semaphore"));

/* Ignore error and continue cleanup */
}
Expand Down
25 changes: 17 additions & 8 deletions drivers/acpi/dispatcher/dsmthdat.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@ acpi_ds_method_data_get_node(u16 opcode,
case AML_LOCAL_OP:

if (index > ACPI_METHOD_MAX_LOCAL) {
ACPI_REPORT_ERROR(("Local index %d is invalid (max %d)\n", index, ACPI_METHOD_MAX_LOCAL));
ACPI_ERROR((AE_INFO,
"Local index %d is invalid (max %d)",
index, ACPI_METHOD_MAX_LOCAL));
return_ACPI_STATUS(AE_AML_INVALID_INDEX);
}

Expand All @@ -272,8 +274,9 @@ acpi_ds_method_data_get_node(u16 opcode,
case AML_ARG_OP:

if (index > ACPI_METHOD_MAX_ARG) {
ACPI_REPORT_ERROR(("Arg index %d is invalid (max %d)\n",
index, ACPI_METHOD_MAX_ARG));
ACPI_ERROR((AE_INFO,
"Arg index %d is invalid (max %d)",
index, ACPI_METHOD_MAX_ARG));
return_ACPI_STATUS(AE_AML_INVALID_INDEX);
}

Expand All @@ -283,7 +286,7 @@ acpi_ds_method_data_get_node(u16 opcode,
break;

default:
ACPI_REPORT_ERROR(("Opcode %d is invalid\n", opcode));
ACPI_ERROR((AE_INFO, "Opcode %d is invalid", opcode));
return_ACPI_STATUS(AE_AML_BAD_OPCODE);
}

Expand Down Expand Up @@ -374,7 +377,7 @@ acpi_ds_method_data_get_value(u16 opcode,
/* Validate the object descriptor */

if (!dest_desc) {
ACPI_REPORT_ERROR(("Null object descriptor pointer\n"));
ACPI_ERROR((AE_INFO, "Null object descriptor pointer"));
return_ACPI_STATUS(AE_BAD_PARAMETER);
}

Expand Down Expand Up @@ -419,18 +422,24 @@ acpi_ds_method_data_get_value(u16 opcode,
switch (opcode) {
case AML_ARG_OP:

ACPI_REPORT_ERROR(("Uninitialized Arg[%d] at node %p\n", index, node));
ACPI_ERROR((AE_INFO,
"Uninitialized Arg[%d] at node %p",
index, node));

return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG);

case AML_LOCAL_OP:

ACPI_REPORT_ERROR(("Uninitialized Local[%d] at node %p\n", index, node));
ACPI_ERROR((AE_INFO,
"Uninitialized Local[%d] at node %p",
index, node));

return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL);

default:
ACPI_REPORT_ERROR(("Not a Arg/Local opcode: %X\n", opcode));
ACPI_ERROR((AE_INFO,
"Not a Arg/Local opcode: %X",
opcode));
return_ACPI_STATUS(AE_AML_INTERNAL);
}
}
Expand Down
20 changes: 12 additions & 8 deletions drivers/acpi/dispatcher/dsobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,

return_ACPI_STATUS(AE_OK);
} else {
ACPI_REPORT_NSERROR(op->common.value.
string, status);
ACPI_ERROR_NAMESPACE(op->common.value.
string, status);
}

return_ACPI_STATUS(status);
Expand Down Expand Up @@ -214,7 +214,9 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
byte_list = arg->named.next;
if (byte_list) {
if (byte_list->common.aml_opcode != AML_INT_BYTELIST_OP) {
ACPI_REPORT_ERROR(("Expecting bytelist, got AML opcode %X in op %p\n", byte_list->common.aml_opcode, byte_list));
ACPI_ERROR((AE_INFO,
"Expecting bytelist, got AML opcode %X in op %p",
byte_list->common.aml_opcode, byte_list));

acpi_ut_remove_reference(obj_desc);
return (AE_TYPE);
Expand Down Expand Up @@ -540,7 +542,9 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,

default:

ACPI_REPORT_ERROR(("Unknown constant opcode %X\n", opcode));
ACPI_ERROR((AE_INFO,
"Unknown constant opcode %X",
opcode));
status = AE_AML_OPERAND_TYPE;
break;
}
Expand All @@ -555,8 +559,8 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
break;

default:
ACPI_REPORT_ERROR(("Unknown Integer type %X\n",
op_info->type));
ACPI_ERROR((AE_INFO, "Unknown Integer type %X",
op_info->type));
status = AE_AML_OPERAND_TYPE;
break;
}
Expand Down Expand Up @@ -634,8 +638,8 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,

default:

ACPI_REPORT_ERROR(("Unimplemented data type: %X\n",
ACPI_GET_OBJECT_TYPE(obj_desc)));
ACPI_ERROR((AE_INFO, "Unimplemented data type: %X",
ACPI_GET_OBJECT_TYPE(obj_desc)));

status = AE_AML_OPERAND_TYPE;
break;
Expand Down
45 changes: 28 additions & 17 deletions drivers/acpi/dispatcher/dsopcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,9 @@ acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc)

node = obj_desc->buffer.node;
if (!node) {
ACPI_REPORT_ERROR(("No pointer back to NS node in buffer obj %p\n", obj_desc));
ACPI_ERROR((AE_INFO,
"No pointer back to NS node in buffer obj %p",
obj_desc));
return_ACPI_STATUS(AE_AML_INTERNAL);
}

Expand Down Expand Up @@ -287,8 +289,9 @@ acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc)

node = obj_desc->package.node;
if (!node) {
ACPI_REPORT_ERROR(("No pointer back to NS node in package %p\n",
obj_desc));
ACPI_ERROR((AE_INFO,
"No pointer back to NS node in package %p",
obj_desc));
return_ACPI_STATUS(AE_AML_INTERNAL);
}

Expand Down Expand Up @@ -413,7 +416,9 @@ acpi_ds_init_buffer_field(u16 aml_opcode,
/* Host object must be a Buffer */

if (ACPI_GET_OBJECT_TYPE(buffer_desc) != ACPI_TYPE_BUFFER) {
ACPI_REPORT_ERROR(("Target of Create Field is not a Buffer object - %s\n", acpi_ut_get_object_type_name(buffer_desc)));
ACPI_ERROR((AE_INFO,
"Target of Create Field is not a Buffer object - %s",
acpi_ut_get_object_type_name(buffer_desc)));

status = AE_AML_OPERAND_TYPE;
goto cleanup;
Expand All @@ -425,9 +430,10 @@ acpi_ds_init_buffer_field(u16 aml_opcode,
* after resolution in acpi_ex_resolve_operands().
*/
if (ACPI_GET_DESCRIPTOR_TYPE(result_desc) != ACPI_DESC_TYPE_NAMED) {
ACPI_REPORT_ERROR(("(%s) destination not a NS Node [%s]\n",
acpi_ps_get_opcode_name(aml_opcode),
acpi_ut_get_descriptor_name(result_desc)));
ACPI_ERROR((AE_INFO,
"(%s) destination not a NS Node [%s]",
acpi_ps_get_opcode_name(aml_opcode),
acpi_ut_get_descriptor_name(result_desc)));

status = AE_AML_OPERAND_TYPE;
goto cleanup;
Expand All @@ -450,7 +456,8 @@ acpi_ds_init_buffer_field(u16 aml_opcode,
/* Must have a valid (>0) bit count */

if (bit_count == 0) {
ACPI_REPORT_ERROR(("Attempt to create_field of length 0\n"));
ACPI_ERROR((AE_INFO,
"Attempt to create_field of length zero"));
status = AE_AML_OPERAND_VALUE;
goto cleanup;
}
Expand Down Expand Up @@ -503,16 +510,21 @@ acpi_ds_init_buffer_field(u16 aml_opcode,

default:

ACPI_REPORT_ERROR(("Unknown field creation opcode %02x\n",
aml_opcode));
ACPI_ERROR((AE_INFO,
"Unknown field creation opcode %02x", aml_opcode));
status = AE_AML_BAD_OPCODE;
goto cleanup;
}

/* Entire field must fit within the current length of the buffer */

if ((bit_offset + bit_count) > (8 * (u32) buffer_desc->buffer.length)) {
ACPI_REPORT_ERROR(("Field [%4.4s] size %d exceeds Buffer [%4.4s] size %d (bits)\n", acpi_ut_get_node_name(result_desc), bit_offset + bit_count, acpi_ut_get_node_name(buffer_desc->buffer.node), 8 * (u32) buffer_desc->buffer.length));
ACPI_ERROR((AE_INFO,
"Field [%4.4s] at %d exceeds Buffer [%4.4s] size %d (bits)",
acpi_ut_get_node_name(result_desc),
bit_offset + bit_count,
acpi_ut_get_node_name(buffer_desc->buffer.node),
8 * (u32) buffer_desc->buffer.length));
status = AE_AML_BUFFER_LIMIT;
goto cleanup;
}
Expand Down Expand Up @@ -618,10 +630,9 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state,
"after acpi_ex_resolve_operands");

if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("(%s) bad operand(s) (%X)\n",
acpi_ps_get_opcode_name(op->common.
aml_opcode),
status));
ACPI_ERROR((AE_INFO, "(%s) bad operand(s) (%X)",
acpi_ps_get_opcode_name(op->common.aml_opcode),
status));

return_ACPI_STATUS(status);
}
Expand Down Expand Up @@ -1145,8 +1156,8 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,

default:

ACPI_REPORT_ERROR(("Unknown control opcode=%X Op=%p\n",
op->common.aml_opcode, op));
ACPI_ERROR((AE_INFO, "Unknown control opcode=%X Op=%p",
op->common.aml_opcode, op));

status = AE_AML_BAD_OPCODE;
break;
Expand Down
Loading

0 comments on commit b8e4d89

Please sign in to comment.