Commit 32bb850c authored by Andy Grover's avatar Andy Grover

ACPI: Interpreter update to 200201002

- Fix problem where a store/copy of a string did not set string length properly.
- Fix ToString operator
- Fix CopyObject not updating internal node type
- Fix a memory leak during implicit operand source conversion
- Enhanced error messages for namespace lookup problems
- Revamped Alias support
parent a62010a1
/****************************************************************************** /******************************************************************************
* *
* Module Name: dsfield - Dispatcher field routines * Module Name: dsfield - Dispatcher field routines
* $Revision: 67 $ * $Revision: 68 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -106,6 +106,7 @@ acpi_ds_create_buffer_field ( ...@@ -106,6 +106,7 @@ acpi_ds_create_buffer_field (
INTERNAL_TYPE_DEF_ANY, ACPI_IMODE_LOAD_PASS1, INTERNAL_TYPE_DEF_ANY, ACPI_IMODE_LOAD_PASS1,
flags, walk_state, &(node)); flags, walk_state, &(node));
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR (arg->common.value.string, status);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -245,12 +246,12 @@ acpi_ds_get_field_names ( ...@@ -245,12 +246,12 @@ acpi_ds_get_field_names (
info->field_type, ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, info->field_type, ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE,
walk_state, &info->field_node); walk_state, &info->field_node);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR ((char *) &arg->named.name, status);
if (status != AE_ALREADY_EXISTS) { if (status != AE_ALREADY_EXISTS) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
ACPI_REPORT_ERROR (("Field name [%4.4s] already exists in current scope\n", /* Already exists, ignore error */
(char *) &arg->named.name));
} }
else { else {
arg->common.node = info->field_node; arg->common.node = info->field_node;
...@@ -329,6 +330,7 @@ acpi_ds_create_field ( ...@@ -329,6 +330,7 @@ acpi_ds_create_field (
ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state, &region_node); ACPI_NS_SEARCH_PARENT, walk_state, &region_node);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR (arg->common.value.name, status);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
} }
...@@ -412,13 +414,11 @@ acpi_ds_init_field_objects ( ...@@ -412,13 +414,11 @@ acpi_ds_init_field_objects (
ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND, ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND,
walk_state, &node); walk_state, &node);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR ((char *) &arg->named.name, status);
if (status != AE_ALREADY_EXISTS) { if (status != AE_ALREADY_EXISTS) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
ACPI_REPORT_ERROR (("Field name [%4.4s] already exists in current scope\n",
(char *) &arg->named.name));
/* Name already exists, just ignore this error */ /* Name already exists, just ignore this error */
status = AE_OK; status = AE_OK;
...@@ -472,6 +472,7 @@ acpi_ds_create_bank_field ( ...@@ -472,6 +472,7 @@ acpi_ds_create_bank_field (
ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state, &region_node); ACPI_NS_SEARCH_PARENT, walk_state, &region_node);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR (arg->common.value.name, status);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
} }
...@@ -483,6 +484,7 @@ acpi_ds_create_bank_field ( ...@@ -483,6 +484,7 @@ acpi_ds_create_bank_field (
INTERNAL_TYPE_BANK_FIELD_DEFN, ACPI_IMODE_EXECUTE, INTERNAL_TYPE_BANK_FIELD_DEFN, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state, &info.register_node); ACPI_NS_SEARCH_PARENT, walk_state, &info.register_node);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR (arg->common.value.string, status);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -542,6 +544,7 @@ acpi_ds_create_index_field ( ...@@ -542,6 +544,7 @@ acpi_ds_create_index_field (
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state, &info.register_node); ACPI_NS_SEARCH_PARENT, walk_state, &info.register_node);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR (arg->common.value.string, status);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -552,6 +555,7 @@ acpi_ds_create_index_field ( ...@@ -552,6 +555,7 @@ acpi_ds_create_index_field (
INTERNAL_TYPE_INDEX_FIELD_DEFN, ACPI_IMODE_EXECUTE, INTERNAL_TYPE_INDEX_FIELD_DEFN, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state, &info.data_register_node); ACPI_NS_SEARCH_PARENT, walk_state, &info.data_register_node);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR (arg->common.value.string, status);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -560,7 +564,6 @@ acpi_ds_create_index_field ( ...@@ -560,7 +564,6 @@ acpi_ds_create_index_field (
arg = arg->common.next; arg = arg->common.next;
info.field_flags = arg->common.value.integer8; info.field_flags = arg->common.value.integer8;
/* Each remaining arg is a Named Field */ /* Each remaining arg is a Named Field */
info.field_type = INTERNAL_TYPE_INDEX_FIELD; info.field_type = INTERNAL_TYPE_INDEX_FIELD;
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: dsobject - Dispatcher object management routines * Module Name: dsobject - Dispatcher object management routines
* $Revision: 107 $ * $Revision: 108 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -240,12 +240,12 @@ acpi_ds_build_internal_object ( ...@@ -240,12 +240,12 @@ acpi_ds_build_internal_object (
{ {
acpi_operand_object *obj_desc; acpi_operand_object *obj_desc;
acpi_status status; acpi_status status;
char *name;
ACPI_FUNCTION_TRACE ("Ds_build_internal_object"); ACPI_FUNCTION_TRACE ("Ds_build_internal_object");
*obj_desc_ptr = NULL;
if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
/* /*
* This is an named object reference. If this name was * This is an named object reference. If this name was
...@@ -259,24 +259,8 @@ acpi_ds_build_internal_object ( ...@@ -259,24 +259,8 @@ acpi_ds_build_internal_object (
(acpi_namespace_node **) &(op->common.node)); (acpi_namespace_node **) &(op->common.node));
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
if (status == AE_NOT_FOUND) { ACPI_REPORT_NSERROR (op->common.value.string, status);
name = NULL; return_ACPI_STATUS (status);
status = acpi_ns_externalize_name (ACPI_UINT32_MAX, op->common.value.string, NULL, &name);
if (ACPI_SUCCESS (status)) {
ACPI_REPORT_WARNING (("Reference %s at AML %X not found\n",
name, op->common.aml_offset));
ACPI_MEM_FREE (name);
}
else {
ACPI_REPORT_WARNING (("Reference %s at AML %X not found\n",
op->common.value.string, op->common.aml_offset));
}
*obj_desc_ptr = NULL;
}
else {
return_ACPI_STATUS (status);
}
} }
} }
} }
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dsutils - Dispatcher utilities * Module Name: dsutils - Dispatcher utilities
* $Revision: 94 $ * $Revision: 95 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -300,7 +300,6 @@ acpi_ds_create_operand ( ...@@ -300,7 +300,6 @@ acpi_ds_create_operand (
u32 arg_index) u32 arg_index)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
acpi_status status2;
NATIVE_CHAR *name_string; NATIVE_CHAR *name_string;
u32 name_length; u32 name_length;
acpi_operand_object *obj_desc; acpi_operand_object *obj_desc;
...@@ -308,7 +307,6 @@ acpi_ds_create_operand ( ...@@ -308,7 +307,6 @@ acpi_ds_create_operand (
u16 opcode; u16 opcode;
acpi_interpreter_mode interpreter_mode; acpi_interpreter_mode interpreter_mode;
const acpi_opcode_info *op_info; const acpi_opcode_info *op_info;
char *name;
ACPI_FUNCTION_TRACE_PTR ("Ds_create_operand", arg); ACPI_FUNCTION_TRACE_PTR ("Ds_create_operand", arg);
...@@ -384,17 +382,13 @@ acpi_ds_create_operand ( ...@@ -384,17 +382,13 @@ acpi_ds_create_operand (
* very serious error at this point * very serious error at this point
*/ */
status = AE_AML_NAME_NOT_FOUND; status = AE_AML_NAME_NOT_FOUND;
name = NULL;
status2 = acpi_ns_externalize_name (ACPI_UINT32_MAX, name_string, NULL, &name);
if (ACPI_SUCCESS (status2)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Object name [%s] was not found in namespace\n", name));
ACPI_MEM_FREE (name);
}
} }
} }
if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR (name_string, status);
}
/* Free the namestring created above */ /* Free the namestring created above */
ACPI_MEM_FREE (name_string); ACPI_MEM_FREE (name_string);
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: dswload - Dispatcher namespace load callbacks * Module Name: dswload - Dispatcher namespace load callbacks
* $Revision: 73 $ * $Revision: 75 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -183,6 +183,7 @@ acpi_ds_load1_begin_op ( ...@@ -183,6 +183,7 @@ acpi_ds_load1_begin_op (
status = acpi_ns_lookup (walk_state->scope_info, path, object_type, status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
ACPI_IMODE_LOAD_PASS1, flags, walk_state, &(node)); ACPI_IMODE_LOAD_PASS1, flags, walk_state, &(node));
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR (path, status);
return (status); return (status);
} }
...@@ -194,7 +195,6 @@ acpi_ds_load1_begin_op ( ...@@ -194,7 +195,6 @@ acpi_ds_load1_begin_op (
switch (node->type) { switch (node->type) {
case ACPI_TYPE_ANY: /* Scope nodes are untyped (ANY) */ case ACPI_TYPE_ANY: /* Scope nodes are untyped (ANY) */
case ACPI_TYPE_DEVICE: case ACPI_TYPE_DEVICE:
case ACPI_TYPE_METHOD:
case ACPI_TYPE_POWER: case ACPI_TYPE_POWER:
case ACPI_TYPE_PROCESSOR: case ACPI_TYPE_PROCESSOR:
case ACPI_TYPE_THERMAL: case ACPI_TYPE_THERMAL:
...@@ -212,10 +212,12 @@ acpi_ds_load1_begin_op ( ...@@ -212,10 +212,12 @@ acpi_ds_load1_begin_op (
* *
* Name (DEB, 0) * Name (DEB, 0)
* Scope (DEB) { ... } * Scope (DEB) { ... }
*
* Note: silently change the type here. On the second pass, we will report a warning
*/ */
ACPI_REPORT_WARNING (("Invalid type (%s) for target of Scope operator [%4.4s], changing type to ANY\n", ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
acpi_ut_get_type_name (node->type), path)); path, acpi_ut_get_type_name (node->type)));
node->type = ACPI_TYPE_ANY; node->type = ACPI_TYPE_ANY;
walk_state->scope_info->common.value = ACPI_TYPE_ANY; walk_state->scope_info->common.value = ACPI_TYPE_ANY;
...@@ -225,7 +227,7 @@ acpi_ds_load1_begin_op ( ...@@ -225,7 +227,7 @@ acpi_ds_load1_begin_op (
/* All other types are an error */ /* All other types are an error */
ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s]\n", ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n",
acpi_ut_get_type_name (node->type), path)); acpi_ut_get_type_name (node->type), path));
return (AE_AML_OPERAND_TYPE); return (AE_AML_OPERAND_TYPE);
...@@ -458,77 +460,80 @@ acpi_ds_load2_begin_op ( ...@@ -458,77 +460,80 @@ acpi_ds_load2_begin_op (
ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, walk_state, &(node)); ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, walk_state, &(node));
} }
if (ACPI_SUCCESS (status)) { if (ACPI_FAILURE (status)) {
/* ACPI_REPORT_NSERROR (buffer_ptr, status);
* For the scope op, we must check to make sure that the target is return_ACPI_STATUS (status);
* one of the opcodes that actually opens a scope }
*/
if (walk_state->opcode == AML_SCOPE_OP) {
switch (node->type) {
case ACPI_TYPE_ANY: /* Scope nodes are untyped (ANY) */
case ACPI_TYPE_DEVICE:
case ACPI_TYPE_METHOD:
case ACPI_TYPE_POWER:
case ACPI_TYPE_PROCESSOR:
case ACPI_TYPE_THERMAL:
/* These are acceptable types */
break;
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
/* /*
* These types we will allow, but we will change the type. This * For the scope op, we must check to make sure that the target is
* enables some existing code of the form: * one of the opcodes that actually opens a scope
* */
* Name (DEB, 0) if (walk_state->opcode == AML_SCOPE_OP) {
* Scope (DEB) { ... } switch (node->type) {
*/ case ACPI_TYPE_ANY: /* Scope nodes are untyped (ANY) */
case ACPI_TYPE_DEVICE:
case ACPI_TYPE_POWER:
case ACPI_TYPE_PROCESSOR:
case ACPI_TYPE_THERMAL:
ACPI_REPORT_WARNING (("Invalid type (%s) for target of Scope operator [%4.4s], changing type to ANY\n", /* These are acceptable types */
acpi_ut_get_type_name (node->type), buffer_ptr)); break;
node->type = ACPI_TYPE_ANY; case ACPI_TYPE_INTEGER:
walk_state->scope_info->common.value = ACPI_TYPE_ANY; case ACPI_TYPE_STRING:
break; case ACPI_TYPE_BUFFER:
default: /*
* These types we will allow, but we will change the type. This
* enables some existing code of the form:
*
* Name (DEB, 0)
* Scope (DEB) { ... }
*/
/* All other types are an error */ ACPI_REPORT_WARNING (("Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
buffer_ptr, acpi_ut_get_type_name (node->type)));
ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s]\n", node->type = ACPI_TYPE_ANY;
acpi_ut_get_type_name (node->type), buffer_ptr)); walk_state->scope_info->common.value = ACPI_TYPE_ANY;
break;
return (AE_AML_OPERAND_TYPE); default:
}
}
if (!op) {
/* Create a new op */
op = acpi_ps_alloc_op (walk_state->opcode); /* All other types are an error */
if (!op) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Initialize the new op */ ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s]\n",
acpi_ut_get_type_name (node->type), buffer_ptr));
if (node) { return (AE_AML_OPERAND_TYPE);
op->named.name = node->name.integer;
}
if (out_op) {
*out_op = op;
}
} }
}
/* if (!op) {
* Put the Node in the "op" object that the parser uses, so we /* Create a new op */
* can get it again quickly when this scope is closed
*/ op = acpi_ps_alloc_op (walk_state->opcode);
op->common.node = node; if (!op) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Initialize the new op */
if (node) {
op->named.name = node->name.integer;
}
if (out_op) {
*out_op = op;
}
} }
/*
* Put the Node in the "op" object that the parser uses, so we
* can get it again quickly when this scope is closed
*/
op->common.node = node;
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -834,7 +839,9 @@ acpi_ds_load2_end_op ( ...@@ -834,7 +839,9 @@ acpi_ds_load2_end_op (
*/ */
op->common.node = new_node; op->common.node = new_node;
} }
else {
ACPI_REPORT_NSERROR (arg->common.value.string, status);
}
break; break;
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: dswscope - Scope stack manipulation * Module Name: dswscope - Scope stack manipulation
* $Revision: 52 $ * $Revision: 53 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -63,7 +63,7 @@ acpi_ds_scope_stack_clear ( ...@@ -63,7 +63,7 @@ acpi_ds_scope_stack_clear (
walk_state->scope_info = scope_info->scope.next; walk_state->scope_info = scope_info->scope.next;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Popped object type %X\n", scope_info->common.value)); "Popped object type (%s)\n", acpi_ut_get_type_name (scope_info->common.value)));
acpi_ut_delete_generic_state (scope_info); acpi_ut_delete_generic_state (scope_info);
} }
} }
...@@ -164,7 +164,7 @@ acpi_ds_scope_stack_pop ( ...@@ -164,7 +164,7 @@ acpi_ds_scope_stack_pop (
} }
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Popped object type %X\n", scope_info->common.value)); "Popped object type (%s)\n", acpi_ut_get_type_name (scope_info->common.value)));
acpi_ut_delete_generic_state (scope_info); acpi_ut_delete_generic_state (scope_info);
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: evevent - Fixed and General Purpose Even handling and dispatch * Module Name: evevent - Fixed and General Purpose Even handling and dispatch
* $Revision: 91 $ * $Revision: 92 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -202,8 +202,8 @@ acpi_ev_fixed_event_detect ( ...@@ -202,8 +202,8 @@ acpi_ev_fixed_event_detect (
void) void)
{ {
u32 int_status = ACPI_INTERRUPT_NOT_HANDLED; u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
u32 gpe_status; u32 fixed_status;
u32 gpe_enable; u32 fixed_enable;
NATIVE_UINT_MAX32 i; NATIVE_UINT_MAX32 i;
...@@ -214,12 +214,12 @@ acpi_ev_fixed_event_detect ( ...@@ -214,12 +214,12 @@ acpi_ev_fixed_event_detect (
* Read the fixed feature status and enable registers, as all the cases * Read the fixed feature status and enable registers, as all the cases
* depend on their values. Ignore errors here. * depend on their values. Ignore errors here.
*/ */
(void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, &gpe_status); (void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, &fixed_status);
(void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE, &gpe_enable); (void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE, &fixed_enable);
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
"Fixed Acpi_event Block: Enable %08X Status %08X\n", "Fixed Acpi_event Block: Enable %08X Status %08X\n",
gpe_enable, gpe_status)); fixed_enable, fixed_status));
/* /*
* Check for all possible Fixed Events and dispatch those that are active * Check for all possible Fixed Events and dispatch those that are active
...@@ -227,8 +227,8 @@ acpi_ev_fixed_event_detect ( ...@@ -227,8 +227,8 @@ acpi_ev_fixed_event_detect (
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 ((gpe_status & acpi_gbl_fixed_event_info[i].status_bit_mask) && if ((fixed_status & acpi_gbl_fixed_event_info[i].status_bit_mask) &&
(gpe_enable & acpi_gbl_fixed_event_info[i].enable_bit_mask)) { (fixed_enable & acpi_gbl_fixed_event_info[i].enable_bit_mask)) {
/* Found an active (signalled) event */ /* Found an active (signalled) event */
int_status |= acpi_ev_fixed_event_dispatch (i); int_status |= acpi_ev_fixed_event_dispatch (i);
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: exconvrt - Object conversion routines * Module Name: exconvrt - Object conversion routines
* $Revision: 38 $ * $Revision: 39 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -172,7 +172,7 @@ acpi_ex_convert_to_integer ( ...@@ -172,7 +172,7 @@ acpi_ex_convert_to_integer (
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Convert an ACPI Object to an Buffer * DESCRIPTION: Convert an ACPI Object to a Buffer
* *
******************************************************************************/ ******************************************************************************/
...@@ -256,7 +256,6 @@ acpi_ex_convert_to_buffer ( ...@@ -256,7 +256,6 @@ acpi_ex_convert_to_buffer (
/* Return the new buffer descriptor */ /* Return the new buffer descriptor */
*result_desc = ret_desc; *result_desc = ret_desc;
break; break;
...@@ -280,11 +279,13 @@ acpi_ex_convert_to_buffer ( ...@@ -280,11 +279,13 @@ acpi_ex_convert_to_buffer (
* *
* FUNCTION: Acpi_ex_convert_ascii * FUNCTION: Acpi_ex_convert_ascii
* *
* PARAMETERS: Integer * PARAMETERS: Integer - Value to be converted
* Base - 10 or 16
* String - Where the string is returned
* *
* RETURN: Actual string length * RETURN: Actual string length
* *
* DESCRIPTION: Convert an ACPI Integer to a hex string * DESCRIPTION: Convert an ACPI Integer to a hex or decimal string
* *
******************************************************************************/ ******************************************************************************/
...@@ -596,8 +597,8 @@ acpi_ex_convert_to_target_type ( ...@@ -596,8 +597,8 @@ acpi_ex_convert_to_target_type (
/* No conversion allowed for these types */ /* No conversion allowed for these types */
if (destination_type != ACPI_GET_OBJECT_TYPE (source_desc)) { if (destination_type != ACPI_GET_OBJECT_TYPE (source_desc)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Target does not allow conversion of type %s to %s\n", "Explicit operator, will store (%s) over existing type (%s)\n",
acpi_ut_get_object_type_name (source_desc), acpi_ut_get_object_type_name (source_desc),
acpi_ut_get_type_name (destination_type))); acpi_ut_get_type_name (destination_type)));
status = AE_TYPE; status = AE_TYPE;
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: excreate - Named object creation * Module Name: excreate - Named object creation
* $Revision: 93 $ * $Revision: 94 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -53,7 +53,8 @@ acpi_status ...@@ -53,7 +53,8 @@ acpi_status
acpi_ex_create_alias ( acpi_ex_create_alias (
acpi_walk_state *walk_state) acpi_walk_state *walk_state)
{ {
acpi_namespace_node *source_node; acpi_namespace_node *target_node;
acpi_namespace_node *alias_node;
acpi_status status; acpi_status status;
...@@ -62,25 +63,61 @@ acpi_ex_create_alias ( ...@@ -62,25 +63,61 @@ acpi_ex_create_alias (
/* Get the source/alias operands (both namespace nodes) */ /* Get the source/alias operands (both namespace nodes) */
source_node = (acpi_namespace_node *) walk_state->operands[1]; alias_node = (acpi_namespace_node *) walk_state->operands[0];
target_node = (acpi_namespace_node *) walk_state->operands[1];
if (target_node->type == INTERNAL_TYPE_ALIAS) {
/* Attach the original source object to the new Alias Node */ /*
* Dereference an existing alias so that we don't create a chain
status = acpi_ns_attach_object ((acpi_namespace_node *) walk_state->operands[0], * of aliases. With this code, we guarantee that an alias is
acpi_ns_get_attached_object (source_node), * always exactly one level of indirection away from the
source_node->type); * actual aliased name.
*/
target_node = (acpi_namespace_node *) target_node->object;
}
/* /*
* The new alias assumes the type of the source, but it points * For objects that can never change (i.e., the NS node will
* to the same object. The reference count of the object has an * permanently point to the same object), we can simply attach
* additional reference to prevent deletion out from under either the * the object to the new NS node. For other objects (such as
* source or the alias Node * Integers, buffers, etc.), we have to point the Alias node
* to the original Node.
*/ */
switch (target_node->type) {
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
case ACPI_TYPE_PACKAGE:
case ACPI_TYPE_BUFFER_FIELD:
/*
* The new alias has the type ALIAS and points to the original
* NS node, not the object itself. This is because for these
* types, the object can change dynamically via a Store.
*/
alias_node->type = INTERNAL_TYPE_ALIAS;
alias_node->object = (acpi_operand_object *) target_node;
break;
default:
/* Attach the original source object to the new Alias Node */
/*
* The new alias assumes the type of the target, and it points
* to the same object. The reference count of the object has an
* additional reference to prevent deletion out from under either the
* target node or the alias Node
*/
status = acpi_ns_attach_object (alias_node,
acpi_ns_get_attached_object (target_node),
target_node->type);
break;
}
/* Since both operands are Nodes, we don't need to delete them */ /* Since both operands are Nodes, we don't need to delete them */
return_ACPI_STATUS (status); return_ACPI_STATUS (AE_OK);
} }
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: exdump - Interpreter debug output routines * Module Name: exdump - Interpreter debug output routines
* $Revision: 159 $ * $Revision: 160 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -579,6 +579,14 @@ acpi_ex_dump_object_descriptor ( ...@@ -579,6 +579,14 @@ acpi_ex_dump_object_descriptor (
} }
} }
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED)
{
acpi_ex_dump_node ((acpi_namespace_node *) obj_desc, flags);
acpi_os_printf ("\nAttached Object (%p):\n", ((acpi_namespace_node *) obj_desc)->object);
acpi_ex_dump_object_descriptor (((acpi_namespace_node *) obj_desc)->object, flags);
return;
}
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND) if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND)
{ {
acpi_os_printf ("Ex_dump_object_descriptor: %p is not a valid ACPI object\n", obj_desc); acpi_os_printf ("Ex_dump_object_descriptor: %p is not a valid ACPI object\n", obj_desc);
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: exoparg2 - AML execution - opcodes with 2 arguments * Module Name: exoparg2 - AML execution - opcodes with 2 arguments
* $Revision: 110 $ * $Revision: 111 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -244,9 +244,10 @@ acpi_ex_opcode_2A_1T_1R ( ...@@ -244,9 +244,10 @@ acpi_ex_opcode_2A_1T_1R (
{ {
acpi_operand_object **operand = &walk_state->operands[0]; acpi_operand_object **operand = &walk_state->operands[0];
acpi_operand_object *return_desc = NULL; acpi_operand_object *return_desc = NULL;
acpi_operand_object *temp_desc; acpi_operand_object *temp_desc = NULL;
u32 index; u32 index;
acpi_status status = AE_OK; acpi_status status = AE_OK;
ACPI_SIZE length;
ACPI_FUNCTION_TRACE_STR ("Ex_opcode_2A_1T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); ACPI_FUNCTION_TRACE_STR ("Ex_opcode_2A_1T_1R", acpi_ps_get_opcode_name (walk_state->opcode));
...@@ -284,7 +285,6 @@ acpi_ex_opcode_2A_1T_1R ( ...@@ -284,7 +285,6 @@ acpi_ex_opcode_2A_1T_1R (
status = acpi_ut_divide (&operand[0]->integer.value, &operand[1]->integer.value, status = acpi_ut_divide (&operand[0]->integer.value, &operand[1]->integer.value,
NULL, &return_desc->integer.value); NULL, &return_desc->integer.value);
break; break;
...@@ -299,15 +299,15 @@ acpi_ex_opcode_2A_1T_1R ( ...@@ -299,15 +299,15 @@ acpi_ex_opcode_2A_1T_1R (
*/ */
switch (ACPI_GET_OBJECT_TYPE (operand[0])) { switch (ACPI_GET_OBJECT_TYPE (operand[0])) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
status = acpi_ex_convert_to_integer (operand[1], &operand[1], walk_state); status = acpi_ex_convert_to_integer (operand[1], &temp_desc, walk_state);
break; break;
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
status = acpi_ex_convert_to_string (operand[1], &operand[1], 16, ACPI_UINT32_MAX, walk_state); status = acpi_ex_convert_to_string (operand[1], &temp_desc, 16, ACPI_UINT32_MAX, walk_state);
break; break;
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
status = acpi_ex_convert_to_buffer (operand[1], &operand[1], walk_state); status = acpi_ex_convert_to_buffer (operand[1], &temp_desc, walk_state);
break; break;
default: default:
...@@ -323,14 +323,63 @@ acpi_ex_opcode_2A_1T_1R ( ...@@ -323,14 +323,63 @@ acpi_ex_opcode_2A_1T_1R (
* (Both are Integer, String, or Buffer), and we can now perform the * (Both are Integer, String, or Buffer), and we can now perform the
* concatenation. * concatenation.
*/ */
status = acpi_ex_do_concatenate (operand[0], operand[1], &return_desc, walk_state); status = acpi_ex_do_concatenate (operand[0], temp_desc, &return_desc, walk_state);
if (temp_desc != operand[1]) {
acpi_ut_remove_reference (temp_desc);
}
break; break;
case AML_TO_STRING_OP: /* To_string (Buffer, Length, Result) (ACPI 2.0) */ case AML_TO_STRING_OP: /* To_string (Buffer, Length, Result) (ACPI 2.0) */
status = acpi_ex_convert_to_string (operand[0], &return_desc, 16, /*
(u32) operand[1]->integer.value, walk_state); * Input object is guaranteed to be a buffer at this point (it may have
* been converted.) Copy the raw buffer data to a new object of type String.
*/
/* Get the length of the new string */
length = 0;
if (operand[1]->integer.value == 0) {
/* Handle optional length value */
operand[1]->integer.value = ACPI_INTEGER_MAX;
}
while ((length < operand[0]->buffer.length) &&
(length < operand[1]->integer.value) &&
(operand[0]->buffer.pointer[length])) {
length++;
}
if (length > ACPI_MAX_STRING_CONVERSION) {
status = AE_AML_STRING_LIMIT;
goto cleanup;
}
/* Create the internal return object */
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_STRING);
if (!return_desc) {
status = AE_NO_MEMORY;
goto cleanup;
}
/* Allocate a new string buffer (Length + 1 for null terminator) */
return_desc->string.pointer = ACPI_MEM_CALLOCATE (length + 1);
if (!return_desc->string.pointer) {
status = AE_NO_MEMORY;
goto cleanup;
}
/* Copy the raw buffer data with no transform */
ACPI_MEMCPY (return_desc->string.pointer, operand[0]->buffer.pointer, length);
/* Set the string length */
return_desc->string.length = length;
break; break;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: exresnte - AML Interpreter object resolution * Module Name: exresnte - AML Interpreter object resolution
* $Revision: 58 $ * $Revision: 59 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -88,6 +88,15 @@ acpi_ex_resolve_node_to_value ( ...@@ -88,6 +88,15 @@ acpi_ex_resolve_node_to_value (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Entry=%p Source_desc=%p Type=%X\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Entry=%p Source_desc=%p Type=%X\n",
node, source_desc, entry_type)); node, source_desc, entry_type));
if (entry_type == INTERNAL_TYPE_ALIAS) {
/* There is always exactly one level of indirection */
node = (acpi_namespace_node *) node->object;
source_desc = acpi_ns_get_attached_object (node);
entry_type = acpi_ns_get_type ((acpi_handle) node);
*object_ptr = node;
}
/* /*
* Several object types require no further processing: * Several object types require no further processing:
* 1) Devices rarely have an attached object, return the Node * 1) Devices rarely have an attached object, return the Node
...@@ -204,7 +213,7 @@ acpi_ex_resolve_node_to_value ( ...@@ -204,7 +213,7 @@ acpi_ex_resolve_node_to_value (
break; break;
/* TYPE_Any is untyped, and thus there is no object associated with it */ /* TYPE_ANY is untyped, and thus there is no object associated with it */
case ACPI_TYPE_ANY: case ACPI_TYPE_ANY:
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: exresop - AML Interpreter operand/object resolution * Module Name: exresop - AML Interpreter operand/object resolution
* $Revision: 57 $ * $Revision: 58 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -320,6 +320,10 @@ acpi_ex_resolve_operands ( ...@@ -320,6 +320,10 @@ acpi_ex_resolve_operands (
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
/* Get the resolved object */
obj_desc = *stack_ptr;
/* /*
* Check the resulting object (value) type * Check the resulting object (value) type
*/ */
...@@ -379,19 +383,28 @@ acpi_ex_resolve_operands ( ...@@ -379,19 +383,28 @@ acpi_ex_resolve_operands (
/* /*
* Need an operand of type ACPI_TYPE_INTEGER, * Need an operand of type ACPI_TYPE_INTEGER,
* But we can implicitly convert from a STRING or BUFFER * But we can implicitly convert from a STRING or BUFFER
* Aka - "Implicit Source Operand Conversion"
*/ */
status = acpi_ex_convert_to_integer (*stack_ptr, stack_ptr, walk_state); status = acpi_ex_convert_to_integer (obj_desc, stack_ptr, walk_state);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
if (status == AE_TYPE) { if (status == AE_TYPE) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Needed [Integer/String/Buffer], found [%s] %p\n", "Needed [Integer/String/Buffer], found [%s] %p\n",
acpi_ut_get_object_type_name (*stack_ptr), *stack_ptr)); acpi_ut_get_object_type_name (obj_desc), obj_desc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
} }
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
if (obj_desc != *stack_ptr) {
/*
* We just created a new object, remove a reference
* on the original operand object
*/
acpi_ut_remove_reference (obj_desc);
}
goto next_operand; goto next_operand;
...@@ -400,19 +413,28 @@ acpi_ex_resolve_operands ( ...@@ -400,19 +413,28 @@ acpi_ex_resolve_operands (
/* /*
* Need an operand of type ACPI_TYPE_BUFFER, * Need an operand of type ACPI_TYPE_BUFFER,
* But we can implicitly convert from a STRING or INTEGER * But we can implicitly convert from a STRING or INTEGER
* Aka - "Implicit Source Operand Conversion"
*/ */
status = acpi_ex_convert_to_buffer (*stack_ptr, stack_ptr, walk_state); status = acpi_ex_convert_to_buffer (obj_desc, stack_ptr, walk_state);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
if (status == AE_TYPE) { if (status == AE_TYPE) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Needed [Integer/String/Buffer], found [%s] %p\n", "Needed [Integer/String/Buffer], found [%s] %p\n",
acpi_ut_get_object_type_name (*stack_ptr), *stack_ptr)); acpi_ut_get_object_type_name (obj_desc), obj_desc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
} }
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
if (obj_desc != *stack_ptr) {
/*
* We just created a new object, remove a reference
* on the original operand object
*/
acpi_ut_remove_reference (obj_desc);
}
goto next_operand; goto next_operand;
...@@ -421,19 +443,28 @@ acpi_ex_resolve_operands ( ...@@ -421,19 +443,28 @@ acpi_ex_resolve_operands (
/* /*
* Need an operand of type ACPI_TYPE_STRING, * Need an operand of type ACPI_TYPE_STRING,
* But we can implicitly convert from a BUFFER or INTEGER * But we can implicitly convert from a BUFFER or INTEGER
* Aka - "Implicit Source Operand Conversion"
*/ */
status = acpi_ex_convert_to_string (*stack_ptr, stack_ptr, 16, ACPI_UINT32_MAX, walk_state); status = acpi_ex_convert_to_string (obj_desc, stack_ptr, 16, ACPI_UINT32_MAX, walk_state);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
if (status == AE_TYPE) { if (status == AE_TYPE) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Needed [Integer/String/Buffer], found [%s] %p\n", "Needed [Integer/String/Buffer], found [%s] %p\n",
acpi_ut_get_object_type_name (*stack_ptr), *stack_ptr)); acpi_ut_get_object_type_name (obj_desc), obj_desc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
} }
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
if (obj_desc != *stack_ptr) {
/*
* We just created a new object, remove a reference
* on the original operand object
*/
acpi_ut_remove_reference (obj_desc);
}
goto next_operand; goto next_operand;
...@@ -441,7 +472,7 @@ acpi_ex_resolve_operands ( ...@@ -441,7 +472,7 @@ acpi_ex_resolve_operands (
/* Need an operand of type INTEGER, STRING or BUFFER */ /* Need an operand of type INTEGER, STRING or BUFFER */
switch (ACPI_GET_OBJECT_TYPE (*stack_ptr)) { switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
...@@ -452,7 +483,7 @@ acpi_ex_resolve_operands ( ...@@ -452,7 +483,7 @@ acpi_ex_resolve_operands (
default: default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Needed [Integer/String/Buffer], found [%s] %p\n", "Needed [Integer/String/Buffer], found [%s] %p\n",
acpi_ut_get_object_type_name (*stack_ptr), *stack_ptr)); acpi_ut_get_object_type_name (obj_desc), obj_desc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
} }
...@@ -467,40 +498,7 @@ acpi_ex_resolve_operands ( ...@@ -467,40 +498,7 @@ acpi_ex_resolve_operands (
* The only reference allowed here is a direct reference to * The only reference allowed here is a direct reference to
* a namespace node. * a namespace node.
*/ */
#if 0 switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
if (ACPI_GET_OBJECT_TYPE (*stack_ptr) == INTERNAL_TYPE_REFERENCE) {
if (!(*stack_ptr)->reference.node) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Needed [Node Reference], found [%p]\n",
*stack_ptr));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/* Get the object attached to the node */
temp_node = acpi_ns_get_attached_object ((*stack_ptr)->reference.node);
if (!temp_node) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Node [%p] has no attached object\n",
(*stack_ptr)->reference.node));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/*
* Swap the reference object with the node's object. Must add
* a reference to the node object, and remove a reference from
* the original reference object.
*/
acpi_ut_add_reference (temp_node);
acpi_ut_remove_reference (*stack_ptr);
(*stack_ptr) = temp_node;
}
#endif
/* Need a buffer, string, package */
switch (ACPI_GET_OBJECT_TYPE (*stack_ptr)) {
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
...@@ -512,7 +510,7 @@ acpi_ex_resolve_operands ( ...@@ -512,7 +510,7 @@ acpi_ex_resolve_operands (
default: default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Needed [Buf/Str/Pkg], found [%s] %p\n", "Needed [Buf/Str/Pkg], found [%s] %p\n",
acpi_ut_get_object_type_name (*stack_ptr), *stack_ptr)); acpi_ut_get_object_type_name (obj_desc), obj_desc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
} }
...@@ -523,7 +521,7 @@ acpi_ex_resolve_operands ( ...@@ -523,7 +521,7 @@ acpi_ex_resolve_operands (
/* Need a buffer or package or (ACPI 2.0) String */ /* Need a buffer or package or (ACPI 2.0) String */
switch (ACPI_GET_OBJECT_TYPE (*stack_ptr)) { switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
...@@ -534,7 +532,7 @@ acpi_ex_resolve_operands ( ...@@ -534,7 +532,7 @@ acpi_ex_resolve_operands (
default: default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Needed [Buf/Str/Pkg], found [%s] %p\n", "Needed [Buf/Str/Pkg], found [%s] %p\n",
acpi_ut_get_object_type_name (*stack_ptr), *stack_ptr)); acpi_ut_get_object_type_name (obj_desc), obj_desc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
} }
...@@ -546,7 +544,7 @@ acpi_ex_resolve_operands ( ...@@ -546,7 +544,7 @@ acpi_ex_resolve_operands (
/* Unknown type */ /* Unknown type */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Internal - Unknown ARGI type %X\n", "Internal - Unknown ARGI (required operand) type %X\n",
this_arg_type)); this_arg_type));
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: exstore - AML Interpreter object store support * Module Name: exstore - AML Interpreter object store support
* $Revision: 171 $ * $Revision: 172 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -459,8 +459,12 @@ acpi_ex_store_object_to_node ( ...@@ -459,8 +459,12 @@ acpi_ex_store_object_to_node (
* Store the new New_desc as the new value of the Name, and set * Store the new New_desc as the new value of the Name, and set
* the Name's type to that of the value being stored in it. * the Name's type to that of the value being stored in it.
* Source_desc reference count is incremented by Attach_object. * Source_desc reference count is incremented by Attach_object.
*
* Note: This may change the type of the node if an explicit store
* has been performed such that the node/object type has been
* changed.
*/ */
status = acpi_ns_attach_object (node, new_desc, target_type); status = acpi_ns_attach_object (node, new_desc, new_desc->common.type);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Store %s into %s via Convert/Attach\n", "Store %s into %s via Convert/Attach\n",
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: exstorob - AML Interpreter object store support, store to object * Module Name: exstorob - AML Interpreter object store support, store to object
* $Revision: 44 $ * $Revision: 45 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -87,7 +87,6 @@ acpi_ex_store_buffer_to_buffer ( ...@@ -87,7 +87,6 @@ acpi_ex_store_buffer_to_buffer (
ACPI_MEMSET (target_desc->buffer.pointer, 0, target_desc->buffer.length); ACPI_MEMSET (target_desc->buffer.pointer, 0, target_desc->buffer.length);
ACPI_MEMCPY (target_desc->buffer.pointer, buffer, length); ACPI_MEMCPY (target_desc->buffer.pointer, buffer, length);
} }
else { else {
/* /*
* Truncate the source, copy only what will fit * Truncate the source, copy only what will fit
...@@ -102,7 +101,6 @@ acpi_ex_store_buffer_to_buffer ( ...@@ -102,7 +101,6 @@ acpi_ex_store_buffer_to_buffer (
/* Copy flags */ /* Copy flags */
target_desc->buffer.flags = source_desc->buffer.flags; target_desc->buffer.flags = source_desc->buffer.flags;
return (AE_OK); return (AE_OK);
} }
...@@ -142,15 +140,16 @@ acpi_ex_store_string_to_string ( ...@@ -142,15 +140,16 @@ acpi_ex_store_string_to_string (
* Setting a string value replaces the old string * Setting a string value replaces the old string
*/ */
if (length < target_desc->string.length) { if (length < target_desc->string.length) {
/* Clear old string and copy in the new one */ /*
* String will fit in existing buffer.
ACPI_MEMSET (target_desc->string.pointer, 0, target_desc->string.length); * Clear old string and copy in the new one
*/
ACPI_MEMSET (target_desc->string.pointer, 0, target_desc->string.length + 1);
ACPI_MEMCPY (target_desc->string.pointer, buffer, length); ACPI_MEMCPY (target_desc->string.pointer, buffer, length);
} }
else { else {
/* /*
* Free the current buffer, then allocate a buffer * Free the current buffer, then allocate a new buffer
* large enough to hold the value * large enough to hold the value
*/ */
if (target_desc->string.pointer && if (target_desc->string.pointer &&
...@@ -161,15 +160,17 @@ acpi_ex_store_string_to_string ( ...@@ -161,15 +160,17 @@ acpi_ex_store_string_to_string (
ACPI_MEM_FREE (target_desc->string.pointer); ACPI_MEM_FREE (target_desc->string.pointer);
} }
target_desc->string.pointer = ACPI_MEM_ALLOCATE ((ACPI_SIZE) length + 1); target_desc->string.pointer = ACPI_MEM_CALLOCATE ((ACPI_SIZE) length + 1);
if (!target_desc->string.pointer) { if (!target_desc->string.pointer) {
return (AE_NO_MEMORY); return (AE_NO_MEMORY);
} }
target_desc->string.length = length;
ACPI_MEMCPY (target_desc->string.pointer, buffer, length); ACPI_MEMCPY (target_desc->string.pointer, buffer, length);
} }
/* Set the new target length */
target_desc->string.length = length;
return (AE_OK); return (AE_OK);
} }
......
/****************************************************************************** /******************************************************************************
* *
* Name: acconfig.h - Global configuration constants * Name: acconfig.h - Global configuration constants
* $Revision: 111 $ * $Revision: 112 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
/* Version string */ /* Version string */
#define ACPI_CA_VERSION 0x20020918 #define ACPI_CA_VERSION 0x20021002
/* Version of ACPI supported */ /* Version of ACPI supported */
......
/****************************************************************************** /******************************************************************************
* *
* Name: acmacros.h - C macros for the entire subsystem. * Name: acmacros.h - C macros for the entire subsystem.
* $Revision: 128 $ * $Revision: 130 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -365,6 +365,7 @@ ...@@ -365,6 +365,7 @@
acpi_os_printf ACPI_PARAM_LIST(fp);} acpi_os_printf ACPI_PARAM_LIST(fp);}
#define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning(_THIS_MODULE,__LINE__,_COMPONENT); \ #define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning(_THIS_MODULE,__LINE__,_COMPONENT); \
acpi_os_printf ACPI_PARAM_LIST(fp);} acpi_os_printf ACPI_PARAM_LIST(fp);}
#define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error(_THIS_MODULE,__LINE__,_COMPONENT, s, e);
#else #else
...@@ -374,6 +375,7 @@ ...@@ -374,6 +375,7 @@
acpi_os_printf ACPI_PARAM_LIST(fp);} acpi_os_printf ACPI_PARAM_LIST(fp);}
#define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning("ACPI",__LINE__,_COMPONENT); \ #define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning("ACPI",__LINE__,_COMPONENT); \
acpi_os_printf ACPI_PARAM_LIST(fp);} acpi_os_printf ACPI_PARAM_LIST(fp);}
#define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error("ACPI",__LINE__,_COMPONENT, s, e);
#endif #endif
......
/****************************************************************************** /******************************************************************************
* *
* Name: acnamesp.h - Namespace subcomponent prototypes and defines * Name: acnamesp.h - Namespace subcomponent prototypes and defines
* $Revision: 126 $ * $Revision: 127 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -422,6 +422,14 @@ u32 ...@@ -422,6 +422,14 @@ u32
acpi_ns_local ( acpi_ns_local (
acpi_object_type type); acpi_object_type type);
void
acpi_ns_report_error (
NATIVE_CHAR *module_name,
u32 line_number,
u32 component_id,
char *internal_name,
acpi_status lookup_status);
acpi_status acpi_status
acpi_ns_build_internal_name ( acpi_ns_build_internal_name (
acpi_namestring_info *info); acpi_namestring_info *info);
......
/****************************************************************************** /******************************************************************************
* *
* Name: acutils.h -- prototypes for the common (subsystem-wide) procedures * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
* $Revision: 144 $ * $Revision: 146 $
* *
*****************************************************************************/ *****************************************************************************/
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: nsdump - table dumping routines for debug * Module Name: nsdump - table dumping routines for debug
* $Revision: 140 $ * $Revision: 141 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -387,6 +387,11 @@ acpi_ns_dump_one_object ( ...@@ -387,6 +387,11 @@ acpi_ns_dump_one_object (
break; break;
case INTERNAL_TYPE_ALIAS:
acpi_os_printf (" Target %4.4s (%p)\n", ((acpi_namespace_node *) obj_desc)->name.ascii, obj_desc);
break;
default: default:
acpi_os_printf (" Object %p\n", obj_desc); acpi_os_printf (" Object %p\n", obj_desc);
...@@ -477,9 +482,9 @@ acpi_ns_dump_one_object ( ...@@ -477,9 +482,9 @@ acpi_ns_dump_one_object (
/* If there is an attached object, display it */ /* If there is an attached object, display it */
dbg_level = acpi_dbg_level; dbg_level = acpi_dbg_level;
acpi_dbg_level = 0; acpi_dbg_level = 0;
obj_desc = acpi_ns_get_attached_object (this_node); obj_desc = acpi_ns_get_attached_object (this_node);
acpi_dbg_level = dbg_level; acpi_dbg_level = dbg_level;
/* Dump attached objects */ /* Dump attached objects */
...@@ -648,7 +653,7 @@ acpi_ns_dump_tables ( ...@@ -648,7 +653,7 @@ acpi_ns_dump_tables (
* If the name space has not been initialized, * If the name space has not been initialized,
* there is nothing to dump. * there is nothing to dump.
*/ */
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "name space not initialized!\n")); ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "namespace not initialized!\n"));
return_VOID; return_VOID;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* *
* Module Name: nsutils - Utilities for accessing ACPI namespace, accessing * Module Name: nsutils - Utilities for accessing ACPI namespace, accessing
* parents and siblings and Scope manipulation * parents and siblings and Scope manipulation
* $Revision: 112 $ * $Revision: 113 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -34,6 +34,54 @@ ...@@ -34,6 +34,54 @@
ACPI_MODULE_NAME ("nsutils") ACPI_MODULE_NAME ("nsutils")
/*******************************************************************************
*
* FUNCTION: Acpi_ns_report_error
*
* PARAMETERS: Module_name - Caller's module name (for error output)
* Line_number - Caller's line number (for error output)
* Component_id - Caller's component ID (for error output)
* Message - Error message to use on failure
*
* RETURN: None
*
* DESCRIPTION: Print warning message
*
******************************************************************************/
void
acpi_ns_report_error (
NATIVE_CHAR *module_name,
u32 line_number,
u32 component_id,
char *internal_name,
acpi_status lookup_status)
{
acpi_status status;
char *name;
status = acpi_ns_externalize_name (ACPI_UINT32_MAX, internal_name, NULL, &name);
acpi_os_printf ("%8s-%04d: *** Error: Looking up ",
module_name, line_number);
if (name) {
acpi_os_printf ("[%s]", name);
}
else {
acpi_os_printf ("[COULD NOT EXTERNALIZE NAME]");
}
acpi_os_printf (" in namespace, %s\n",
acpi_format_exception (lookup_status));
if (name) {
ACPI_MEM_FREE (name);
}
}
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: Acpi_ns_valid_root_prefix * FUNCTION: Acpi_ns_valid_root_prefix
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* *
* Module Name: tbxface - Public interfaces to the ACPI subsystem * Module Name: tbxface - Public interfaces to the ACPI subsystem
* ACPI table oriented interfaces * ACPI table oriented interfaces
* $Revision: 58 $ * $Revision: 59 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -96,7 +96,7 @@ acpi_load_tables (void) ...@@ -96,7 +96,7 @@ acpi_load_tables (void)
goto error_exit; goto error_exit;
} }
ACPI_DEBUG_PRINT ((ACPI_DB_OK, "ACPI Tables successfully loaded\n")); ACPI_DEBUG_PRINT ((ACPI_DB_OK, "ACPI Tables successfully acquired\n"));
/* Load the namespace from the tables */ /* Load the namespace from the tables */
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: utmisc - common utility procedures * Module Name: utmisc - common utility procedures
* $Revision: 81 $ * $Revision: 84 $
* *
******************************************************************************/ ******************************************************************************/
......
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