Commit bbdd8222 authored by Andy Grover's avatar Andy Grover Committed by Linus Torvalds

[PATCH] ACPI [3/3]

ACPI interpreter update
Change non-interpreter code to account for the interpreter changes.
parent 044aff7a
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dbcmds - debug commands and output routines * Module Name: dbcmds - debug commands and output routines
* $Revision: 83 $ * $Revision: 84 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -663,7 +663,7 @@ acpi_db_walk_for_specific_objects ( ...@@ -663,7 +663,7 @@ acpi_db_walk_for_specific_objects (
/* Display short information about the object */ /* Display short information about the object */
if (obj_desc) { if (obj_desc) {
switch (obj_desc->common.type) { switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_METHOD: case ACPI_TYPE_METHOD:
acpi_os_printf (" #Args %d Concurrency %X", obj_desc->method.param_count, obj_desc->method.concurrency); acpi_os_printf (" #Args %d Concurrency %X", obj_desc->method.param_count, obj_desc->method.concurrency);
break; break;
...@@ -729,7 +729,8 @@ acpi_db_display_objects ( ...@@ -729,7 +729,8 @@ acpi_db_display_objects (
} }
acpi_db_set_output_destination (ACPI_DB_DUPLICATE_OUTPUT); acpi_db_set_output_destination (ACPI_DB_DUPLICATE_OUTPUT);
acpi_os_printf ("Objects of type [%s] defined in the current ACPI Namespace: \n", acpi_ut_get_type_name (type)); acpi_os_printf ("Objects of type [%s] defined in the current ACPI Namespace: \n",
acpi_ut_get_type_name (type));
acpi_db_set_output_destination (ACPI_DB_REDIRECTABLE_OUTPUT); acpi_db_set_output_destination (ACPI_DB_REDIRECTABLE_OUTPUT);
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dbdisply - debug display commands * Module Name: dbdisply - debug display commands
* $Revision: 73 $ * $Revision: 75 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -300,9 +300,9 @@ acpi_db_decode_internal_object ( ...@@ -300,9 +300,9 @@ acpi_db_decode_internal_object (
return; return;
} }
acpi_os_printf (" %s", acpi_ut_get_type_name (obj_desc->common.type)); acpi_os_printf (" %s", acpi_ut_get_object_type_name (obj_desc));
switch (obj_desc->common.type) { switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
acpi_os_printf (" %8.8X%8.8X", ACPI_HIDWORD (obj_desc->integer.value), acpi_os_printf (" %8.8X%8.8X", ACPI_HIDWORD (obj_desc->integer.value),
...@@ -396,7 +396,7 @@ acpi_db_display_internal_object ( ...@@ -396,7 +396,7 @@ acpi_db_display_internal_object (
case ACPI_DESC_TYPE_OPERAND: case ACPI_DESC_TYPE_OPERAND:
type = obj_desc->common.type; type = ACPI_GET_OBJECT_TYPE (obj_desc);
if (type > INTERNAL_TYPE_MAX) { if (type > INTERNAL_TYPE_MAX) {
acpi_os_printf (" Type %hX [Invalid Type]", type); acpi_os_printf (" Type %hX [Invalid Type]", type);
return; return;
...@@ -404,25 +404,9 @@ acpi_db_display_internal_object ( ...@@ -404,25 +404,9 @@ acpi_db_display_internal_object (
/* Decode the ACPI object type */ /* Decode the ACPI object type */
switch (obj_desc->common.type) { switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case INTERNAL_TYPE_REFERENCE: case INTERNAL_TYPE_REFERENCE:
switch (obj_desc->reference.opcode) { switch (obj_desc->reference.opcode) {
case AML_ZERO_OP:
acpi_os_printf ("[Const] Zero (0) [Null Target]", 0);
break;
case AML_ONES_OP:
acpi_os_printf ("[Const] Ones (0xFFFFFFFFFFFFFFFF) [No Limit]");
break;
case AML_ONE_OP:
acpi_os_printf ("[Const] One (1)");
break;
case AML_REVISION_OP:
acpi_os_printf ("[Const] Revision (%X)", ACPI_CA_SUPPORT_LEVEL);
break;
case AML_LOCAL_OP: case AML_LOCAL_OP:
acpi_os_printf ("[Local%d] ", obj_desc->reference.offset); acpi_os_printf ("[Local%d] ", obj_desc->reference.offset);
if (walk_state) { if (walk_state) {
...@@ -451,6 +435,8 @@ acpi_db_display_internal_object ( ...@@ -451,6 +435,8 @@ acpi_db_display_internal_object (
break; break;
default: default:
acpi_os_printf ("Unknown Reference opcode %X\n",
obj_desc->reference.opcode);
break; break;
} }
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dbstats - Generation and display of ACPI table statistics * Module Name: dbstats - Generation and display of ACPI table statistics
* $Revision: 59 $ * $Revision: 60 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -87,18 +87,18 @@ acpi_db_enumerate_object ( ...@@ -87,18 +87,18 @@ acpi_db_enumerate_object (
acpi_gbl_num_objects++; acpi_gbl_num_objects++;
if (obj_desc->common.type > INTERNAL_TYPE_NODE_MAX) if (ACPI_GET_OBJECT_TYPE (obj_desc) > INTERNAL_TYPE_NODE_MAX)
{ {
acpi_gbl_obj_type_count_misc++; acpi_gbl_obj_type_count_misc++;
} }
else else
{ {
acpi_gbl_obj_type_count [obj_desc->common.type]++; acpi_gbl_obj_type_count [ACPI_GET_OBJECT_TYPE (obj_desc)]++;
} }
/* Count the sub-objects */ /* Count the sub-objects */
switch (obj_desc->common.type) switch (ACPI_GET_OBJECT_TYPE (obj_desc))
{ {
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
for (i = 0; i < obj_desc->package.count; i++) for (i = 0; i < obj_desc->package.count; i++)
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dsmthdat - control method arguments and local variables * Module Name: dsmthdat - control method arguments and local variables
* $Revision: 61 $ * $Revision: 62 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -354,7 +354,7 @@ acpi_ds_method_data_get_type ( ...@@ -354,7 +354,7 @@ acpi_ds_method_data_get_type (
/* Get the object type */ /* Get the object type */
return_VALUE (object->common.type); return_VALUE (ACPI_GET_OBJECT_TYPE (object));
} }
...@@ -602,7 +602,7 @@ acpi_ds_store_object_to_local ( ...@@ -602,7 +602,7 @@ acpi_ds_store_object_to_local (
* (perform the indirect store) * (perform the indirect store)
*/ */
status = acpi_ns_attach_object ((acpi_namespace_node *) current_obj_desc, status = acpi_ns_attach_object ((acpi_namespace_node *) current_obj_desc,
obj_desc, obj_desc->common.type); obj_desc, ACPI_GET_OBJECT_TYPE (obj_desc));
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: dsobject - Dispatcher object management routines * Module Name: dsobject - Dispatcher object management routines
* $Revision: 99 $ * $Revision: 103 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "amlcode.h" #include "amlcode.h"
#include "acdispat.h" #include "acdispat.h"
#include "acnamesp.h" #include "acnamesp.h"
#include "acinterp.h"
#define _COMPONENT ACPI_DISPATCHER #define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsobject") ACPI_MODULE_NAME ("dsobject")
...@@ -241,9 +242,10 @@ acpi_ds_init_object_from_op ( ...@@ -241,9 +242,10 @@ acpi_ds_init_object_from_op (
{ {
const acpi_opcode_info *op_info; const acpi_opcode_info *op_info;
acpi_operand_object *obj_desc; acpi_operand_object *obj_desc;
acpi_status status = AE_OK;
ACPI_FUNCTION_NAME ("Ds_init_object_from_op"); ACPI_FUNCTION_TRACE ("Ds_init_object_from_op");
obj_desc = *ret_obj_desc; obj_desc = *ret_obj_desc;
...@@ -251,12 +253,12 @@ acpi_ds_init_object_from_op ( ...@@ -251,12 +253,12 @@ acpi_ds_init_object_from_op (
if (op_info->class == AML_CLASS_UNKNOWN) { if (op_info->class == AML_CLASS_UNKNOWN) {
/* Unknown opcode */ /* Unknown opcode */
return (AE_TYPE); return_ACPI_STATUS (AE_TYPE);
} }
/* Perform per-object initialization */ /* Perform per-object initialization */
switch (obj_desc->common.type) { switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
/* /*
...@@ -281,10 +283,65 @@ acpi_ds_init_object_from_op ( ...@@ -281,10 +283,65 @@ acpi_ds_init_object_from_op (
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
switch (op_info->type) {
case AML_TYPE_CONSTANT:
/*
* Resolve AML Constants here - AND ONLY HERE!
* All constants are integers.
* We mark the integer with a flag that indicates that it started life
* as a constant -- so that stores to constants will perform as expected (noop).
* (Zero_op is used as a placeholder for optional target operands.)
*/
obj_desc->common.flags = AOPOBJ_AML_CONSTANT;
switch (opcode) {
case AML_ZERO_OP:
obj_desc->integer.value = 0;
break;
case AML_ONE_OP:
obj_desc->integer.value = 1;
break;
case AML_ONES_OP:
obj_desc->integer.value = ACPI_INTEGER_MAX;
/* Truncate value if we are executing from a 32-bit ACPI table */
acpi_ex_truncate_for32bit_table (obj_desc);
break;
case AML_REVISION_OP:
obj_desc->integer.value = ACPI_CA_SUPPORT_LEVEL;
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown constant opcode %X\n", opcode));
status = AE_AML_OPERAND_TYPE;
break;
}
break;
case AML_TYPE_LITERAL:
obj_desc->integer.value = op->common.value.integer; obj_desc->integer.value = op->common.value.integer;
break; break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n", op_info->type));
status = AE_AML_OPERAND_TYPE;
break;
}
break;
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
obj_desc->string.pointer = op->common.value.string; obj_desc->string.pointer = op->common.value.string;
...@@ -323,7 +380,7 @@ acpi_ds_init_object_from_op ( ...@@ -323,7 +380,7 @@ acpi_ds_init_object_from_op (
break; break;
default: /* Constants, 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 */
...@@ -340,12 +397,13 @@ acpi_ds_init_object_from_op ( ...@@ -340,12 +397,13 @@ acpi_ds_init_object_from_op (
default: default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type: %X\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type: %X\n",
obj_desc->common.type)); ACPI_GET_OBJECT_TYPE (obj_desc)));
status = AE_AML_OPERAND_TYPE;
break; break;
} }
return (AE_OK); return_ACPI_STATUS (status);
} }
...@@ -380,7 +438,7 @@ acpi_ds_build_internal_object ( ...@@ -380,7 +438,7 @@ acpi_ds_build_internal_object (
if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
/* /*
* This is an object reference. If this name was * This is an named object reference. If this name was
* previously looked up in the namespace, it was stored in this op. * previously looked up in the namespace, it was stored in this op.
* Otherwise, go ahead and look it up now * Otherwise, go ahead and look it up now
*/ */
...@@ -435,7 +493,9 @@ acpi_ds_build_internal_object ( ...@@ -435,7 +493,9 @@ acpi_ds_build_internal_object (
* *
* FUNCTION: Acpi_ds_build_internal_buffer_obj * FUNCTION: Acpi_ds_build_internal_buffer_obj
* *
* PARAMETERS: Op - Parser object to be translated * PARAMETERS: Walk_state - Current walk state
* Op - Parser object to be translated
* Buffer_length - Length of the buffer
* Obj_desc_ptr - Where the ACPI internal object is returned * Obj_desc_ptr - Where the ACPI internal object is returned
* *
* RETURN: Status * RETURN: Status
...@@ -541,7 +601,9 @@ acpi_ds_build_internal_buffer_obj ( ...@@ -541,7 +601,9 @@ acpi_ds_build_internal_buffer_obj (
* *
* FUNCTION: Acpi_ds_build_internal_package_obj * FUNCTION: Acpi_ds_build_internal_package_obj
* *
* PARAMETERS: Op - Parser object to be translated * PARAMETERS: Walk_state - Current walk state
* Op - Parser object to be translated
* Package_length - Number of elements in the package
* Obj_desc_ptr - Where the ACPI internal object is returned * Obj_desc_ptr - Where the ACPI internal object is returned
* *
* RETURN: Status * RETURN: Status
...@@ -658,12 +720,13 @@ acpi_ds_build_internal_package_obj ( ...@@ -658,12 +720,13 @@ acpi_ds_build_internal_package_obj (
* *
* FUNCTION: Acpi_ds_create_node * FUNCTION: Acpi_ds_create_node
* *
* PARAMETERS: Op - Parser object to be translated * PARAMETERS: Walk_state - Current walk state
* Obj_desc_ptr - Where the ACPI internal object is returned * Node - NS Node to be initialized
* Op - Parser object to be translated
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: * DESCRIPTION: Create the object to be associated with a namespace node
* *
****************************************************************************/ ****************************************************************************/
...@@ -704,7 +767,7 @@ acpi_ds_create_node ( ...@@ -704,7 +767,7 @@ acpi_ds_create_node (
/* Re-type the object according to it's argument */ /* Re-type the object according to it's argument */
node->type = obj_desc->common.type; node->type = ACPI_GET_OBJECT_TYPE (obj_desc);
/* Attach obj to node */ /* Attach obj to node */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* *
* Module Name: dsopcode - Dispatcher Op Region support and handling of * Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes * "control" opcodes
* $Revision: 79 $ * $Revision: 80 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -396,10 +396,10 @@ acpi_ds_init_buffer_field ( ...@@ -396,10 +396,10 @@ acpi_ds_init_buffer_field (
/* Host object must be a Buffer */ /* Host object must be a Buffer */
if (buffer_desc->common.type != ACPI_TYPE_BUFFER) { if (ACPI_GET_OBJECT_TYPE (buffer_desc) != ACPI_TYPE_BUFFER) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Target of Create Field is not a Buffer object - %s\n", "Target of Create Field is not a Buffer object - %s\n",
acpi_ut_get_type_name (buffer_desc->common.type))); acpi_ut_get_object_type_name (buffer_desc)));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
goto cleanup; goto cleanup;
...@@ -1021,7 +1021,7 @@ acpi_ds_exec_end_control_op ( ...@@ -1021,7 +1021,7 @@ acpi_ds_exec_end_control_op (
* Allow references created by the Index operator to return unchanged. * Allow references created by the Index operator to return unchanged.
*/ */
if ((ACPI_GET_DESCRIPTOR_TYPE (walk_state->results->results.obj_desc[0]) == ACPI_DESC_TYPE_OPERAND) && if ((ACPI_GET_DESCRIPTOR_TYPE (walk_state->results->results.obj_desc[0]) == ACPI_DESC_TYPE_OPERAND) &&
((walk_state->results->results.obj_desc [0])->common.type == INTERNAL_TYPE_REFERENCE) && (ACPI_GET_OBJECT_TYPE (walk_state->results->results.obj_desc [0]) == INTERNAL_TYPE_REFERENCE) &&
((walk_state->results->results.obj_desc [0])->reference.opcode != AML_INDEX_OP)) { ((walk_state->results->results.obj_desc [0])->reference.opcode != AML_INDEX_OP)) {
status = acpi_ex_resolve_to_value (&walk_state->results->results.obj_desc [0], walk_state); status = acpi_ex_resolve_to_value (&walk_state->results->results.obj_desc [0], walk_state);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dsutils - Dispatcher utilities * Module Name: dsutils - Dispatcher utilities
* $Revision: 92 $ * $Revision: 93 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -380,8 +380,8 @@ acpi_ds_create_operand ( ...@@ -380,8 +380,8 @@ acpi_ds_create_operand (
/* /*
* If the name is null, this means that this is an * If the name is null, this means that this is an
* optional result parameter that was not specified * optional result parameter that was not specified
* in the original ASL. Create an Reference for a * in the original ASL. Create a Zero Constant for a
* placeholder * placeholder. (Store to a constant is a Noop.)
*/ */
opcode = AML_ZERO_OP; /* Has no arguments! */ opcode = AML_ZERO_OP; /* Has no arguments! */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* *
* Module Name: dswexec - Dispatcher method execution callbacks; * Module Name: dswexec - Dispatcher method execution callbacks;
* dispatch to interpreter. * dispatch to interpreter.
* $Revision: 92 $ * $Revision: 94 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -113,10 +113,10 @@ acpi_ds_get_predicate_value ( ...@@ -113,10 +113,10 @@ acpi_ds_get_predicate_value (
* Result of predicate evaluation currently must * Result of predicate evaluation currently must
* be a number * be a number
*/ */
if (obj_desc->common.type != ACPI_TYPE_INTEGER) { if (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_INTEGER) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Bad predicate (not a number) Obj_desc=%p State=%p Type=%X\n", "Bad predicate (not a number) Obj_desc=%p State=%p Type=%X\n",
obj_desc, walk_state, obj_desc->common.type)); obj_desc, walk_state, ACPI_GET_OBJECT_TYPE (obj_desc)));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
goto cleanup; goto cleanup;
...@@ -124,7 +124,7 @@ acpi_ds_get_predicate_value ( ...@@ -124,7 +124,7 @@ acpi_ds_get_predicate_value (
/* Truncate the predicate to 32-bits if necessary */ /* Truncate the predicate to 32-bits if necessary */
acpi_ex_truncate_for32bit_table (obj_desc, walk_state); acpi_ex_truncate_for32bit_table (obj_desc);
/* /*
* Save the result of the predicate evaluation on * Save the result of the predicate evaluation on
...@@ -605,7 +605,7 @@ acpi_ds_exec_end_op ( ...@@ -605,7 +605,7 @@ acpi_ds_exec_end_op (
* ACPI 2.0 support for 64-bit integers: Truncate numeric * ACPI 2.0 support for 64-bit integers: Truncate numeric
* result value if we are executing from a 32-bit ACPI table * result value if we are executing from a 32-bit ACPI table
*/ */
acpi_ex_truncate_for32bit_table (walk_state->result_obj, walk_state); acpi_ex_truncate_for32bit_table (walk_state->result_obj);
/* /*
* Check if we just completed the evaluation of a * Check if we just completed the evaluation of a
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: dswstate - Dispatcher parse tree walk management routines * Module Name: dswstate - Dispatcher parse tree walk management routines
* $Revision: 64 $ * $Revision: 65 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -84,7 +84,7 @@ acpi_ds_result_insert ( ...@@ -84,7 +84,7 @@ acpi_ds_result_insert (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Obj=%p [%s] State=%p Num=%X Cur=%X\n", "Obj=%p [%s] State=%p Num=%X Cur=%X\n",
object, object ? acpi_ut_get_type_name (((acpi_operand_object *) object)->common.type) : "NULL", object, object ? acpi_ut_get_object_type_name ((acpi_operand_object *) object) : "NULL",
walk_state, state->results.num_results, walk_state->current_result)); walk_state, state->results.num_results, walk_state->current_result));
return (AE_OK); return (AE_OK);
...@@ -148,7 +148,7 @@ acpi_ds_result_remove ( ...@@ -148,7 +148,7 @@ acpi_ds_result_remove (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Obj=%p [%s] Index=%X State=%p Num=%X\n", "Obj=%p [%s] Index=%X State=%p Num=%X\n",
*object, (*object) ? acpi_ut_get_type_name ((*object)->common.type) : "NULL", *object, (*object) ? acpi_ut_get_object_type_name (*object) : "NULL",
index, walk_state, state->results.num_results)); index, walk_state, state->results.num_results));
return (AE_OK); return (AE_OK);
...@@ -204,7 +204,7 @@ acpi_ds_result_pop ( ...@@ -204,7 +204,7 @@ acpi_ds_result_pop (
state->results.obj_desc [index -1] = NULL; state->results.obj_desc [index -1] = NULL;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Index=%X State=%p Num=%X\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Index=%X State=%p Num=%X\n",
*object, (*object) ? acpi_ut_get_type_name ((*object)->common.type) : "NULL", *object, (*object) ? acpi_ut_get_object_type_name (*object) : "NULL",
index -1, walk_state, state->results.num_results)); index -1, walk_state, state->results.num_results));
return (AE_OK); return (AE_OK);
...@@ -274,7 +274,7 @@ acpi_ds_result_pop_from_bottom ( ...@@ -274,7 +274,7 @@ acpi_ds_result_pop_from_bottom (
} }
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s], Results=%p State=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s], Results=%p State=%p\n",
*object, (*object) ? acpi_ut_get_type_name ((*object)->common.type) : "NULL", *object, (*object) ? acpi_ut_get_object_type_name (*object) : "NULL",
state, walk_state)); state, walk_state));
...@@ -329,7 +329,7 @@ acpi_ds_result_push ( ...@@ -329,7 +329,7 @@ acpi_ds_result_push (
state->results.num_results++; state->results.num_results++;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n",
object, object ? acpi_ut_get_type_name (((acpi_operand_object *) object)->common.type) : "NULL", object, object ? acpi_ut_get_object_type_name ((acpi_operand_object *) object) : "NULL",
walk_state, state->results.num_results, walk_state->current_result)); walk_state, state->results.num_results, walk_state->current_result));
return (AE_OK); return (AE_OK);
...@@ -487,7 +487,7 @@ acpi_ds_obj_stack_push ( ...@@ -487,7 +487,7 @@ acpi_ds_obj_stack_push (
walk_state->num_operands++; walk_state->num_operands++;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
object, acpi_ut_get_type_name (((acpi_operand_object *) object)->common.type), object, acpi_ut_get_object_type_name ((acpi_operand_object *) object),
walk_state, walk_state->num_operands)); walk_state, walk_state->num_operands));
return (AE_OK); return (AE_OK);
...@@ -547,7 +547,7 @@ acpi_ds_obj_stack_pop_object ( ...@@ -547,7 +547,7 @@ acpi_ds_obj_stack_pop_object (
walk_state->operands [walk_state->num_operands] = NULL; walk_state->operands [walk_state->num_operands] = NULL;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
*object, acpi_ut_get_type_name ((*object)->common.type), *object, acpi_ut_get_object_type_name (*object),
walk_state, walk_state->num_operands)); walk_state, walk_state->num_operands));
return (AE_OK); return (AE_OK);
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: evregion - ACPI Address_space (Op_region) handler dispatch * Module Name: evregion - ACPI Address_space (Op_region) handler dispatch
* $Revision: 133 $ * $Revision: 134 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -624,7 +624,7 @@ acpi_ev_addr_handler_helper ( ...@@ -624,7 +624,7 @@ acpi_ev_addr_handler_helper (
/* /*
* Devices are handled different than regions * Devices are handled different than regions
*/ */
if (obj_desc->common.type == ACPI_TYPE_DEVICE) { if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_DEVICE) {
/* /*
* See if this guy has any handlers * See if this guy has any handlers
*/ */
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: evrgnini- ACPI Address_space (Op_region) init * Module Name: evrgnini- ACPI Address_space (Op_region) init
* $Revision: 61 $ * $Revision: 62 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -36,8 +36,8 @@ ...@@ -36,8 +36,8 @@
* *
* FUNCTION: Acpi_ev_system_memory_region_setup * FUNCTION: Acpi_ev_system_memory_region_setup
* *
* PARAMETERS: Region_obj - region we are interested in * PARAMETERS: Region_obj - Region we are interested in
* Function - start or stop * Function - Start or stop
* Handler_context - Address space handler context * Handler_context - Address space handler context
* Region_context - Region specific context * Region_context - Region specific context
* *
...@@ -57,6 +57,7 @@ acpi_ev_system_memory_region_setup ( ...@@ -57,6 +57,7 @@ acpi_ev_system_memory_region_setup (
acpi_operand_object *region_desc = (acpi_operand_object *) handle; acpi_operand_object *region_desc = (acpi_operand_object *) handle;
acpi_mem_space_context *local_region_context; acpi_mem_space_context *local_region_context;
ACPI_FUNCTION_TRACE ("Ev_system_memory_region_setup"); ACPI_FUNCTION_TRACE ("Ev_system_memory_region_setup");
...@@ -68,8 +69,7 @@ acpi_ev_system_memory_region_setup ( ...@@ -68,8 +69,7 @@ acpi_ev_system_memory_region_setup (
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
/* Create a new context */
/* Activate. Create a new context */
local_region_context = ACPI_MEM_CALLOCATE (sizeof (acpi_mem_space_context)); local_region_context = ACPI_MEM_CALLOCATE (sizeof (acpi_mem_space_context));
if (!(local_region_context)) { if (!(local_region_context)) {
...@@ -90,8 +90,8 @@ acpi_ev_system_memory_region_setup ( ...@@ -90,8 +90,8 @@ acpi_ev_system_memory_region_setup (
* *
* FUNCTION: Acpi_ev_io_space_region_setup * FUNCTION: Acpi_ev_io_space_region_setup
* *
* PARAMETERS: Region_obj - region we are interested in * PARAMETERS: Region_obj - Region we are interested in
* Function - start or stop * Function - Start or stop
* Handler_context - Address space handler context * Handler_context - Address space handler context
* Region_context - Region specific context * Region_context - Region specific context
* *
...@@ -126,8 +126,8 @@ acpi_ev_io_space_region_setup ( ...@@ -126,8 +126,8 @@ acpi_ev_io_space_region_setup (
* *
* FUNCTION: Acpi_ev_pci_config_region_setup * FUNCTION: Acpi_ev_pci_config_region_setup
* *
* PARAMETERS: Region_obj - region we are interested in * PARAMETERS: Region_obj - Region we are interested in
* Function - start or stop * Function - Start or stop
* Handler_context - Address space handler context * Handler_context - Address space handler context
* Region_context - Region specific context * Region_context - Region specific context
* *
...@@ -178,7 +178,6 @@ acpi_ev_pci_config_region_setup ( ...@@ -178,7 +178,6 @@ acpi_ev_pci_config_region_setup (
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
/* Create a new context */ /* Create a new context */
pci_id = ACPI_MEM_CALLOCATE (sizeof (acpi_pci_id)); pci_id = ACPI_MEM_CALLOCATE (sizeof (acpi_pci_id));
...@@ -197,8 +196,7 @@ acpi_ev_pci_config_region_setup ( ...@@ -197,8 +196,7 @@ acpi_ev_pci_config_region_setup (
*/ */
node = acpi_ns_get_parent_node (region_obj->region.node); node = acpi_ns_get_parent_node (region_obj->region.node);
/* Evaluate the _ADR object */
/* Acpi_evaluate the _ADR object */
status = acpi_ut_evaluate_numeric_object (METHOD_NAME__ADR, node, &temp); status = acpi_ut_evaluate_numeric_object (METHOD_NAME__ADR, node, &temp);
...@@ -231,13 +229,17 @@ acpi_ev_pci_config_region_setup ( ...@@ -231,13 +229,17 @@ acpi_ev_pci_config_region_setup (
while (node != acpi_gbl_root_node) { while (node != acpi_gbl_root_node) {
status = acpi_ut_execute_HID (node, &object_hID); status = acpi_ut_execute_HID (node, &object_hID);
if (ACPI_SUCCESS (status)) { if (ACPI_SUCCESS (status)) {
/* Got a valid _HID, check if this is a PCI root */
if (!(ACPI_STRNCMP (object_hID.buffer, PCI_ROOT_HID_STRING, if (!(ACPI_STRNCMP (object_hID.buffer, PCI_ROOT_HID_STRING,
sizeof (PCI_ROOT_HID_STRING)))) { sizeof (PCI_ROOT_HID_STRING)))) {
/* Install a handler for this PCI root bridge */
status = acpi_install_address_space_handler ((acpi_handle) node, status = acpi_install_address_space_handler ((acpi_handle) node,
ACPI_ADR_SPACE_PCI_CONFIG, ACPI_ADR_SPACE_PCI_CONFIG,
ACPI_DEFAULT_HANDLER, NULL, NULL); ACPI_DEFAULT_HANDLER, NULL, NULL);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Could not install handler for %4.4s, %s\n", ACPI_REPORT_ERROR (("Could not install Pci_config handler for %4.4s, %s\n",
node->name.ascii, acpi_format_exception (status))); node->name.ascii, acpi_format_exception (status)));
} }
break; break;
...@@ -276,8 +278,8 @@ acpi_ev_pci_config_region_setup ( ...@@ -276,8 +278,8 @@ acpi_ev_pci_config_region_setup (
* *
* FUNCTION: Acpi_ev_pci_bar_region_setup * FUNCTION: Acpi_ev_pci_bar_region_setup
* *
* PARAMETERS: Region_obj - region we are interested in * PARAMETERS: Region_obj - Region we are interested in
* Function - start or stop * Function - Start or stop
* Handler_context - Address space handler context * Handler_context - Address space handler context
* Region_context - Region specific context * Region_context - Region specific context
* *
...@@ -296,7 +298,6 @@ acpi_ev_pci_bar_region_setup ( ...@@ -296,7 +298,6 @@ acpi_ev_pci_bar_region_setup (
void *handler_context, void *handler_context,
void **region_context) void **region_context)
{ {
ACPI_FUNCTION_TRACE ("Ev_pci_bar_region_setup"); ACPI_FUNCTION_TRACE ("Ev_pci_bar_region_setup");
...@@ -308,8 +309,8 @@ acpi_ev_pci_bar_region_setup ( ...@@ -308,8 +309,8 @@ acpi_ev_pci_bar_region_setup (
* *
* FUNCTION: Acpi_ev_cmos_region_setup * FUNCTION: Acpi_ev_cmos_region_setup
* *
* PARAMETERS: Region_obj - region we are interested in * PARAMETERS: Region_obj - Region we are interested in
* Function - start or stop * Function - Start or stop
* Handler_context - Address space handler context * Handler_context - Address space handler context
* Region_context - Region specific context * Region_context - Region specific context
* *
...@@ -328,7 +329,6 @@ acpi_ev_cmos_region_setup ( ...@@ -328,7 +329,6 @@ acpi_ev_cmos_region_setup (
void *handler_context, void *handler_context,
void **region_context) void **region_context)
{ {
ACPI_FUNCTION_TRACE ("Ev_cmos_region_setup"); ACPI_FUNCTION_TRACE ("Ev_cmos_region_setup");
...@@ -340,8 +340,8 @@ acpi_ev_cmos_region_setup ( ...@@ -340,8 +340,8 @@ acpi_ev_cmos_region_setup (
* *
* FUNCTION: Acpi_ev_default_region_setup * FUNCTION: Acpi_ev_default_region_setup
* *
* PARAMETERS: Region_obj - region we are interested in * PARAMETERS: Region_obj - Region we are interested in
* Function - start or stop * Function - Start or stop
* Handler_context - Address space handler context * Handler_context - Address space handler context
* Region_context - Region specific context * Region_context - Region specific context
* *
...@@ -377,6 +377,7 @@ acpi_ev_default_region_setup ( ...@@ -377,6 +377,7 @@ acpi_ev_default_region_setup (
* FUNCTION: Acpi_ev_initialize_region * FUNCTION: Acpi_ev_initialize_region
* *
* PARAMETERS: Region_obj - Region we are initializing * PARAMETERS: Region_obj - Region we are initializing
* Acpi_ns_locked - Is namespace locked?
* *
* RETURN: Status * RETURN: Status
* *
...@@ -423,9 +424,8 @@ acpi_ev_initialize_region ( ...@@ -423,9 +424,8 @@ acpi_ev_initialize_region (
if (!region_obj2) { if (!region_obj2) {
return_ACPI_STATUS (AE_NOT_EXIST); return_ACPI_STATUS (AE_NOT_EXIST);
} }
node = acpi_ns_get_parent_node (region_obj->region.node);
node = acpi_ns_get_parent_node (region_obj->region.node);
space_id = region_obj->region.space_id; space_id = region_obj->region.space_id;
region_obj->region.addr_handler = NULL; region_obj->region.addr_handler = NULL;
...@@ -434,7 +434,7 @@ acpi_ev_initialize_region ( ...@@ -434,7 +434,7 @@ acpi_ev_initialize_region (
region_obj->common.flags |= AOPOBJ_OBJECT_INITIALIZED; region_obj->common.flags |= AOPOBJ_OBJECT_INITIALIZED;
/* /*
* Find any "_REG" associated with this region definition * Find any "_REG" method associated with this region definition
*/ */
status = acpi_ns_search_node (*reg_name_ptr, node, status = acpi_ns_search_node (*reg_name_ptr, node,
ACPI_TYPE_METHOD, &method_node); ACPI_TYPE_METHOD, &method_node);
...@@ -483,36 +483,33 @@ acpi_ev_initialize_region ( ...@@ -483,36 +483,33 @@ acpi_ev_initialize_region (
} }
while (handler_obj) { while (handler_obj) {
/* /* Is this handler of the correct type? */
* This guy has at least one address handler
* see if it has the type we want
*/
if (handler_obj->addr_handler.space_id == space_id) { if (handler_obj->addr_handler.space_id == space_id) {
/* Found correct handler */
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Found handler %p for region %p in obj %p\n", "Found handler %p for region %p in obj %p\n",
handler_obj, region_obj, obj_desc)); handler_obj, region_obj, obj_desc));
/*
* Found it! Now update the region and the handler
*/
status = acpi_ev_attach_region (handler_obj, region_obj, status = acpi_ev_attach_region (handler_obj, region_obj,
acpi_ns_locked); acpi_ns_locked);
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
handler_obj = handler_obj->addr_handler.next; /* Try next handler in the list */
} /* while handlerobj */ handler_obj = handler_obj->addr_handler.next;
}
} }
/* /*
* This one does not have the handler we need * This node does not have the handler we need;
* Pop up one level * Pop up one level
*/ */
node = acpi_ns_get_parent_node (node); node = acpi_ns_get_parent_node (node);
}
} /* while Node != ROOT */
/* /*
* If we get here, there is no handler for this region * If we get here, there is no handler for this region
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: evxface - External interfaces for ACPI events * Module Name: evxface - External interfaces for ACPI events
* $Revision: 128 $ * $Revision: 129 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -79,7 +79,6 @@ acpi_install_fixed_event_handler ( ...@@ -79,7 +79,6 @@ acpi_install_fixed_event_handler (
goto cleanup; goto cleanup;
} }
/* Install the handler before enabling the event */ /* Install the handler before enabling the event */
acpi_gbl_fixed_event_handlers[event].handler = handler; acpi_gbl_fixed_event_handlers[event].handler = handler;
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes) * Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
* $Revision: 65 $ * $Revision: 66 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -274,7 +274,7 @@ acpi_ex_load_op ( ...@@ -274,7 +274,7 @@ acpi_ex_load_op (
case ACPI_TYPE_REGION: case ACPI_TYPE_REGION:
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Region %p %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Region %p %s\n",
obj_desc, acpi_ut_get_type_name (obj_desc->common.type))); obj_desc, acpi_ut_get_object_type_name (obj_desc)));
/* Get the table header */ /* Get the table header */
...@@ -319,7 +319,7 @@ acpi_ex_load_op ( ...@@ -319,7 +319,7 @@ acpi_ex_load_op (
case INTERNAL_TYPE_INDEX_FIELD: case INTERNAL_TYPE_INDEX_FIELD:
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Field %p %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Field %p %s\n",
obj_desc, acpi_ut_get_type_name (obj_desc->common.type))); obj_desc, acpi_ut_get_object_type_name (obj_desc)));
/* /*
* The length of the field must be at least as large as the table. * The length of the field must be at least as large as the table.
...@@ -415,8 +415,7 @@ acpi_ex_unload_table ( ...@@ -415,8 +415,7 @@ acpi_ex_unload_table (
*/ */
if ((!ddb_handle) || if ((!ddb_handle) ||
(ACPI_GET_DESCRIPTOR_TYPE (ddb_handle) != ACPI_DESC_TYPE_OPERAND) || (ACPI_GET_DESCRIPTOR_TYPE (ddb_handle) != ACPI_DESC_TYPE_OPERAND) ||
(((acpi_operand_object *)ddb_handle)->common.type != (ACPI_GET_OBJECT_TYPE (ddb_handle) != INTERNAL_TYPE_REFERENCE)) {
INTERNAL_TYPE_REFERENCE)) {
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
} }
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: exconvrt - Object conversion routines * Module Name: exconvrt - Object conversion routines
* $Revision: 35 $ * $Revision: 37 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -64,7 +64,7 @@ acpi_ex_convert_to_integer ( ...@@ -64,7 +64,7 @@ acpi_ex_convert_to_integer (
ACPI_FUNCTION_TRACE_PTR ("Ex_convert_to_integer", obj_desc); ACPI_FUNCTION_TRACE_PTR ("Ex_convert_to_integer", obj_desc);
switch (obj_desc->common.type) { switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
*result_desc = obj_desc; *result_desc = obj_desc;
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
...@@ -103,7 +103,7 @@ acpi_ex_convert_to_integer ( ...@@ -103,7 +103,7 @@ acpi_ex_convert_to_integer (
/* /*
* String conversion is different than Buffer conversion * String conversion is different than Buffer conversion
*/ */
switch (obj_desc->common.type) { switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
/* /*
...@@ -190,11 +190,11 @@ acpi_ex_convert_to_buffer ( ...@@ -190,11 +190,11 @@ acpi_ex_convert_to_buffer (
ACPI_FUNCTION_TRACE_PTR ("Ex_convert_to_buffer", obj_desc); ACPI_FUNCTION_TRACE_PTR ("Ex_convert_to_buffer", obj_desc);
switch (obj_desc->common.type) { switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
/* /*
* Create a new Buffer * Create a new Buffer object
*/ */
ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER); ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
if (!ret_desc) { if (!ret_desc) {
...@@ -203,7 +203,6 @@ acpi_ex_convert_to_buffer ( ...@@ -203,7 +203,6 @@ acpi_ex_convert_to_buffer (
/* Need enough space for one integer */ /* Need enough space for one integer */
ret_desc->buffer.length = acpi_gbl_integer_byte_width;
new_buf = ACPI_MEM_CALLOCATE (acpi_gbl_integer_byte_width); new_buf = ACPI_MEM_CALLOCATE (acpi_gbl_integer_byte_width);
if (!new_buf) { if (!new_buf) {
ACPI_REPORT_ERROR ACPI_REPORT_ERROR
...@@ -217,7 +216,12 @@ acpi_ex_convert_to_buffer ( ...@@ -217,7 +216,12 @@ acpi_ex_convert_to_buffer (
for (i = 0; i < acpi_gbl_integer_byte_width; i++) { for (i = 0; i < acpi_gbl_integer_byte_width; i++) {
new_buf[i] = (u8) (obj_desc->integer.value >> (i * 8)); new_buf[i] = (u8) (obj_desc->integer.value >> (i * 8));
} }
/* Complete buffer object initialization */
ret_desc->buffer.flags |= AOPOBJ_DATA_VALID;
ret_desc->buffer.pointer = new_buf; ret_desc->buffer.pointer = new_buf;
ret_desc->buffer.length = acpi_gbl_integer_byte_width;
/* Return the new buffer descriptor */ /* Return the new buffer descriptor */
...@@ -373,7 +377,7 @@ acpi_ex_convert_to_string ( ...@@ -373,7 +377,7 @@ acpi_ex_convert_to_string (
ACPI_FUNCTION_TRACE_PTR ("Ex_convert_to_string", obj_desc); ACPI_FUNCTION_TRACE_PTR ("Ex_convert_to_string", obj_desc);
switch (obj_desc->common.type) { switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
string_length = acpi_gbl_integer_byte_width * 2; string_length = acpi_gbl_integer_byte_width * 2;
...@@ -565,10 +569,10 @@ acpi_ex_convert_to_target_type ( ...@@ -565,10 +569,10 @@ acpi_ex_convert_to_target_type (
default: default:
/* No conversion allowed for these types */ /* No conversion allowed for these types */
if (destination_type != source_desc->common.type) { if (destination_type != ACPI_GET_OBJECT_TYPE (source_desc)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Target does not allow conversion of type %s to %s\n", "Target does not allow conversion of type %s to %s\n",
acpi_ut_get_type_name ((source_desc)->common.type), 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: 91 $ * $Revision: 92 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -40,8 +40,7 @@ ...@@ -40,8 +40,7 @@
* *
* FUNCTION: Acpi_ex_create_alias * FUNCTION: Acpi_ex_create_alias
* *
* PARAMETERS: Walk_state - Current state, contains List of * PARAMETERS: Walk_state - Current state, contains operands
* operands for the opcode
* *
* RETURN: Status * RETURN: Status
* *
...@@ -392,9 +391,7 @@ acpi_ex_create_table_region ( ...@@ -392,9 +391,7 @@ acpi_ex_create_table_region (
* *
* FUNCTION: Acpi_ex_create_processor * FUNCTION: Acpi_ex_create_processor
* *
* PARAMETERS: Op - Op containing the Processor definition and * PARAMETERS: Walk_state - Current state
* args
* Processor_node - Parent Node for the processor object
* *
* RETURN: Status * RETURN: Status
* *
...@@ -447,9 +444,7 @@ acpi_ex_create_processor ( ...@@ -447,9 +444,7 @@ acpi_ex_create_processor (
* *
* FUNCTION: Acpi_ex_create_power_resource * FUNCTION: Acpi_ex_create_power_resource
* *
* PARAMETERS: Op - Op containing the Power_resource definition * PARAMETERS: Walk_state - Current state
* and args
* Power_node - Parent Node for the power object
* *
* RETURN: Status * RETURN: Status
* *
...@@ -502,8 +497,7 @@ acpi_ex_create_power_resource ( ...@@ -502,8 +497,7 @@ acpi_ex_create_power_resource (
* *
* PARAMETERS: Aml_start - First byte of the method's AML * PARAMETERS: Aml_start - First byte of the method's AML
* Aml_length - AML byte count for this method * Aml_length - AML byte count for this method
* Method_flags - AML method flag byte * Walk_state - Current state
* Method - Method Node
* *
* RETURN: Status * RETURN: Status
* *
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: exdump - Interpreter debug output routines * Module Name: exdump - Interpreter debug output routines
* $Revision: 153 $ * $Revision: 155 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -96,34 +96,10 @@ acpi_ex_dump_operand ( ...@@ -96,34 +96,10 @@ acpi_ex_dump_operand (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", obj_desc)); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", obj_desc));
switch (obj_desc->common.type) { switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case INTERNAL_TYPE_REFERENCE: case INTERNAL_TYPE_REFERENCE:
switch (obj_desc->reference.opcode) { switch (obj_desc->reference.opcode) {
case AML_ZERO_OP:
acpi_os_printf ("Reference: Zero\n");
break;
case AML_ONE_OP:
acpi_os_printf ("Reference: One\n");
break;
case AML_ONES_OP:
acpi_os_printf ("Reference: Ones\n");
break;
case AML_REVISION_OP:
acpi_os_printf ("Reference: Revision\n");
break;
case AML_DEBUG_OP: case AML_DEBUG_OP:
acpi_os_printf ("Reference: Debug\n"); acpi_os_printf ("Reference: Debug\n");
...@@ -150,7 +126,7 @@ acpi_ex_dump_operand ( ...@@ -150,7 +126,7 @@ acpi_ex_dump_operand (
acpi_os_printf ("Reference: Arg%d", acpi_os_printf ("Reference: Arg%d",
obj_desc->reference.offset); obj_desc->reference.offset);
if (ACPI_TYPE_INTEGER == obj_desc->common.type) { if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) {
/* Value is a Number */ /* Value is a Number */
acpi_os_printf (" value is [%8.8X%8.8x]", acpi_os_printf (" value is [%8.8X%8.8x]",
...@@ -167,7 +143,7 @@ acpi_ex_dump_operand ( ...@@ -167,7 +143,7 @@ acpi_ex_dump_operand (
acpi_os_printf ("Reference: Local%d", acpi_os_printf ("Reference: Local%d",
obj_desc->reference.offset); obj_desc->reference.offset);
if (ACPI_TYPE_INTEGER == obj_desc->common.type) { if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) {
/* Value is a Number */ /* Value is a Number */
...@@ -189,7 +165,7 @@ acpi_ex_dump_operand ( ...@@ -189,7 +165,7 @@ acpi_ex_dump_operand (
/* unknown opcode */ /* unknown opcode */
acpi_os_printf ("Unknown opcode=%X\n", acpi_os_printf ("Unknown Reference opcode=%X\n",
obj_desc->reference.opcode); obj_desc->reference.opcode);
break; break;
...@@ -340,8 +316,7 @@ acpi_ex_dump_operand ( ...@@ -340,8 +316,7 @@ acpi_ex_dump_operand (
{ {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL* \n")); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL* \n"));
} }
else if (ACPI_TYPE_BUFFER != else if (ACPI_GET_OBJECT_TYPE (obj_desc->buffer_field.buffer_obj) != ACPI_TYPE_BUFFER)
obj_desc->buffer_field.buffer_obj->common.type)
{ {
acpi_os_printf ("*not a Buffer* \n"); acpi_os_printf ("*not a Buffer* \n");
} }
...@@ -399,9 +374,9 @@ acpi_ex_dump_operand ( ...@@ -399,9 +374,9 @@ acpi_ex_dump_operand (
default: default:
/* Unknown Obj_desc->Common.Type value */ /* Unknown Type */
acpi_os_printf ("Unknown Type %X\n", obj_desc->common.type); acpi_os_printf ("Unknown Type %X\n", ACPI_GET_OBJECT_TYPE (obj_desc));
break; break;
} }
...@@ -603,13 +578,13 @@ acpi_ex_dump_object_descriptor ( ...@@ -603,13 +578,13 @@ acpi_ex_dump_object_descriptor (
/* Common Fields */ /* Common Fields */
acpi_ex_out_string ("Type", acpi_ut_get_type_name (obj_desc->common.type)); acpi_ex_out_string ("Type", acpi_ut_get_object_type_name (obj_desc));
acpi_ex_out_integer ("Reference Count", obj_desc->common.reference_count); acpi_ex_out_integer ("Reference Count", obj_desc->common.reference_count);
acpi_ex_out_integer ("Flags", obj_desc->common.flags); acpi_ex_out_integer ("Flags", obj_desc->common.flags);
/* Object-specific Fields */ /* Object-specific Fields */
switch (obj_desc->common.type) switch (ACPI_GET_OBJECT_TYPE (obj_desc))
{ {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
...@@ -649,7 +624,7 @@ acpi_ex_dump_object_descriptor ( ...@@ -649,7 +624,7 @@ acpi_ex_dump_object_descriptor (
acpi_os_printf ("[%.3d] %p", i, obj_desc->package.elements[i]); acpi_os_printf ("[%.3d] %p", i, obj_desc->package.elements[i]);
if (obj_desc->package.elements[i]) if (obj_desc->package.elements[i])
{ {
acpi_os_printf (" %s", acpi_ut_get_type_name ((obj_desc->package.elements[i])->common.type)); acpi_os_printf (" %s", acpi_ut_get_object_type_name (obj_desc->package.elements[i]));
} }
acpi_os_printf ("\n"); acpi_os_printf ("\n");
} }
...@@ -745,7 +720,7 @@ acpi_ex_dump_object_descriptor ( ...@@ -745,7 +720,7 @@ acpi_ex_dump_object_descriptor (
acpi_ex_out_integer ("End_buf_valid_bits", obj_desc->common_field.end_buffer_valid_bits); acpi_ex_out_integer ("End_buf_valid_bits", obj_desc->common_field.end_buffer_valid_bits);
acpi_ex_out_pointer ("Parent_node", obj_desc->common_field.node); acpi_ex_out_pointer ("Parent_node", obj_desc->common_field.node);
switch (obj_desc->common.type) switch (ACPI_GET_OBJECT_TYPE (obj_desc))
{ {
case ACPI_TYPE_BUFFER_FIELD: case ACPI_TYPE_BUFFER_FIELD:
acpi_ex_out_pointer ("Buffer_obj", obj_desc->buffer_field.buffer_obj); acpi_ex_out_pointer ("Buffer_obj", obj_desc->buffer_field.buffer_obj);
...@@ -813,15 +788,10 @@ acpi_ex_dump_object_descriptor ( ...@@ -813,15 +788,10 @@ acpi_ex_dump_object_descriptor (
case INTERNAL_TYPE_DEF_ANY: case INTERNAL_TYPE_DEF_ANY:
case INTERNAL_TYPE_EXTRA: case INTERNAL_TYPE_EXTRA:
case INTERNAL_TYPE_DATA: case INTERNAL_TYPE_DATA:
acpi_os_printf ("Ex_dump_object_descriptor: Display not implemented for object type %X\n",
obj_desc->common.type);
break;
default: default:
acpi_os_printf ("Ex_dump_object_descriptor: Unknown object type %X\n", obj_desc->common.type); acpi_os_printf ("Ex_dump_object_descriptor: Display not implemented for object type %s\n",
acpi_ut_get_object_type_name (obj_desc));
break; break;
} }
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: exfield - ACPI AML (p-code) execution - field manipulation * Module Name: exfield - ACPI AML (p-code) execution - field manipulation
* $Revision: 110 $ * $Revision: 112 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -70,7 +70,7 @@ acpi_ex_read_data_from_field ( ...@@ -70,7 +70,7 @@ acpi_ex_read_data_from_field (
return_ACPI_STATUS (AE_AML_NO_OPERAND); return_ACPI_STATUS (AE_AML_NO_OPERAND);
} }
if (obj_desc->common.type == ACPI_TYPE_BUFFER_FIELD) { if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
/* /*
* If the Buffer_field arguments have not been previously evaluated, * If the Buffer_field arguments have not been previously evaluated,
* evaluate them now and save the results. * evaluate them now and save the results.
...@@ -110,6 +110,8 @@ acpi_ex_read_data_from_field ( ...@@ -110,6 +110,8 @@ acpi_ex_read_data_from_field (
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
} }
/* Complete the buffer object initialization */
buffer_desc->common.flags = AOPOBJ_DATA_VALID; buffer_desc->common.flags = AOPOBJ_DATA_VALID;
buffer_desc->buffer.length = length; buffer_desc->buffer.length = length;
buffer = buffer_desc->buffer.pointer; buffer = buffer_desc->buffer.pointer;
...@@ -129,7 +131,7 @@ acpi_ex_read_data_from_field ( ...@@ -129,7 +131,7 @@ acpi_ex_read_data_from_field (
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Obj=%p Type=%X Buf=%p Len=%X\n", "Obj=%p Type=%X Buf=%p Len=%X\n",
obj_desc, obj_desc->common.type, buffer, length)); obj_desc, ACPI_GET_OBJECT_TYPE (obj_desc), buffer, length));
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Field_write: Bit_len=%X Bit_off=%X Byte_off=%X\n", "Field_write: Bit_len=%X Bit_off=%X Byte_off=%X\n",
obj_desc->common_field.bit_length, obj_desc->common_field.bit_length,
...@@ -193,7 +195,7 @@ acpi_ex_write_data_to_field ( ...@@ -193,7 +195,7 @@ acpi_ex_write_data_to_field (
return_ACPI_STATUS (AE_AML_NO_OPERAND); return_ACPI_STATUS (AE_AML_NO_OPERAND);
} }
if (obj_desc->common.type == ACPI_TYPE_BUFFER_FIELD) { if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
/* /*
* If the Buffer_field arguments have not been previously evaluated, * If the Buffer_field arguments have not been previously evaluated,
* evaluate them now and save the results. * evaluate them now and save the results.
...@@ -209,7 +211,7 @@ acpi_ex_write_data_to_field ( ...@@ -209,7 +211,7 @@ acpi_ex_write_data_to_field (
/* /*
* Get a pointer to the data to be written * Get a pointer to the data to be written
*/ */
switch (source_desc->common.type) { switch (ACPI_GET_OBJECT_TYPE (source_desc)) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
buffer = &source_desc->integer.value; buffer = &source_desc->integer.value;
length = sizeof (source_desc->integer.value); length = sizeof (source_desc->integer.value);
...@@ -258,7 +260,7 @@ acpi_ex_write_data_to_field ( ...@@ -258,7 +260,7 @@ acpi_ex_write_data_to_field (
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Obj=%p Type=%X Buf=%p Len=%X\n", "Obj=%p Type=%X Buf=%p Len=%X\n",
obj_desc, obj_desc->common.type, buffer, length)); obj_desc, ACPI_GET_OBJECT_TYPE (obj_desc), buffer, length));
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Field_read: Bit_len=%X Bit_off=%X Byte_off=%X\n", "Field_read: Bit_len=%X Bit_off=%X Byte_off=%X\n",
obj_desc->common_field.bit_length, obj_desc->common_field.bit_length,
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: exfldio - Aml Field I/O * Module Name: exfldio - Aml Field I/O
* $Revision: 86 $ * $Revision: 87 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -64,9 +64,11 @@ acpi_ex_setup_region ( ...@@ -64,9 +64,11 @@ acpi_ex_setup_region (
rgn_desc = obj_desc->common_field.region_obj; rgn_desc = obj_desc->common_field.region_obj;
if (ACPI_TYPE_REGION != rgn_desc->common.type) { if (ACPI_GET_OBJECT_TYPE (rgn_desc) != ACPI_TYPE_REGION) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed Region, found type %X (%s)\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed Region, found type %X (%s)\n",
rgn_desc->common.type, acpi_ut_get_type_name (rgn_desc->common.type))); ACPI_GET_OBJECT_TYPE (rgn_desc),
acpi_ut_get_object_type_name (rgn_desc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
} }
...@@ -298,7 +300,7 @@ acpi_ex_field_datum_io ( ...@@ -298,7 +300,7 @@ acpi_ex_field_datum_io (
* Bank_fields - Write to a Bank Register, then read/write from/to an Op_region * Bank_fields - Write to a Bank Register, then read/write from/to an Op_region
* Index_fields - Write to an Index Register, then read/write from/to a Data Register * Index_fields - Write to an Index Register, then read/write from/to a Data Register
*/ */
switch (obj_desc->common.type) { switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_BUFFER_FIELD: case ACPI_TYPE_BUFFER_FIELD:
/* /*
* If the Buffer_field arguments have not been previously evaluated, * If the Buffer_field arguments have not been previously evaluated,
...@@ -416,7 +418,7 @@ acpi_ex_field_datum_io ( ...@@ -416,7 +418,7 @@ acpi_ex_field_datum_io (
default: default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p, Wrong object type - %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p, Wrong object type - %s\n",
obj_desc, acpi_ut_get_type_name (obj_desc->common.type))); obj_desc, acpi_ut_get_object_type_name (obj_desc)));
status = AE_AML_INTERNAL; status = AE_AML_INTERNAL;
break; break;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes * Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
* $Revision: 104 $ * $Revision: 106 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -64,7 +64,7 @@ acpi_ex_get_object_reference ( ...@@ -64,7 +64,7 @@ acpi_ex_get_object_reference (
switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) { switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
case ACPI_DESC_TYPE_OPERAND: case ACPI_DESC_TYPE_OPERAND:
if (obj_desc->common.type != INTERNAL_TYPE_REFERENCE) { if (ACPI_GET_OBJECT_TYPE (obj_desc) != INTERNAL_TYPE_REFERENCE) {
*return_desc = NULL; *return_desc = NULL;
status = AE_TYPE; status = AE_TYPE;
goto cleanup; goto cleanup;
...@@ -184,9 +184,9 @@ acpi_ex_concat_template ( ...@@ -184,9 +184,9 @@ acpi_ex_concat_template (
ACPI_MEMCPY (new_buf, obj_desc1->buffer.pointer, length1); ACPI_MEMCPY (new_buf, obj_desc1->buffer.pointer, length1);
ACPI_MEMCPY (new_buf + length1, obj_desc2->buffer.pointer, length2); ACPI_MEMCPY (new_buf + length1, obj_desc2->buffer.pointer, length2);
/* /* Complete the buffer object initialization */
* Point the return object to the new buffer
*/ return_desc->common.flags = AOPOBJ_DATA_VALID;
return_desc->buffer.pointer = (u8 *) new_buf; return_desc->buffer.pointer = (u8 *) new_buf;
return_desc->buffer.length = (u32) (length1 + length2); return_desc->buffer.length = (u32) (length1 + length2);
...@@ -243,21 +243,22 @@ acpi_ex_do_concatenate ( ...@@ -243,21 +243,22 @@ acpi_ex_do_concatenate (
/* /*
* There are three cases to handle: * There are three cases to handle:
* 1) Two Integers concatenated to produce a buffer *
* 2) Two Strings concatenated to produce a string * 1) Two Integers concatenated to produce a new Buffer
* 3) Two Buffers concatenated to produce a buffer * 2) Two Strings concatenated to produce a new String
* 3) Two Buffers concatenated to produce a new Buffer
*/ */
switch (obj_desc1->common.type) { switch (ACPI_GET_OBJECT_TYPE (obj_desc1)) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
/* Result of two integers is a buffer */ /* Result of two Integers is a Buffer */
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER); return_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
if (!return_desc) { if (!return_desc) {
return (AE_NO_MEMORY); return (AE_NO_MEMORY);
} }
/* Need enough space for two integers */ /* Need enough buffer space for two integers */
return_desc->buffer.length = acpi_gbl_integer_byte_width * 2; return_desc->buffer.length = acpi_gbl_integer_byte_width * 2;
new_buf = ACPI_MEM_CALLOCATE (return_desc->buffer.length); new_buf = ACPI_MEM_CALLOCATE (return_desc->buffer.length);
...@@ -268,8 +269,6 @@ acpi_ex_do_concatenate ( ...@@ -268,8 +269,6 @@ acpi_ex_do_concatenate (
goto cleanup; goto cleanup;
} }
return_desc->buffer.pointer = (u8 *) new_buf;
/* Convert the first integer */ /* Convert the first integer */
this_integer = obj_desc1->integer.value; this_integer = obj_desc1->integer.value;
...@@ -286,11 +285,17 @@ acpi_ex_do_concatenate ( ...@@ -286,11 +285,17 @@ acpi_ex_do_concatenate (
this_integer >>= 8; this_integer >>= 8;
} }
/* Complete the buffer object initialization */
return_desc->common.flags = AOPOBJ_DATA_VALID;
return_desc->buffer.pointer = (u8 *) new_buf;
break; break;
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
/* Result of two Strings is a String */
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_STRING); return_desc = acpi_ut_create_internal_object (ACPI_TYPE_STRING);
if (!return_desc) { if (!return_desc) {
return (AE_NO_MEMORY); return (AE_NO_MEMORY);
...@@ -307,11 +312,13 @@ acpi_ex_do_concatenate ( ...@@ -307,11 +312,13 @@ acpi_ex_do_concatenate (
goto cleanup; goto cleanup;
} }
/* Concatenate the strings */
ACPI_STRCPY (new_buf, obj_desc1->string.pointer); ACPI_STRCPY (new_buf, obj_desc1->string.pointer);
ACPI_STRCPY (new_buf + obj_desc1->string.length, ACPI_STRCPY (new_buf + obj_desc1->string.length,
obj_desc2->string.pointer); obj_desc2->string.pointer);
/* Point the return object to the new string */ /* Complete the String object initialization */
return_desc->string.pointer = new_buf; return_desc->string.pointer = new_buf;
return_desc->string.length = obj_desc1->string.length + return_desc->string.length = obj_desc1->string.length +
...@@ -321,7 +328,7 @@ acpi_ex_do_concatenate ( ...@@ -321,7 +328,7 @@ acpi_ex_do_concatenate (
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
/* Operand0 is a buffer */ /* Result of two Buffers is a Buffer */
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER); return_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
if (!return_desc) { if (!return_desc) {
...@@ -337,15 +344,16 @@ acpi_ex_do_concatenate ( ...@@ -337,15 +344,16 @@ acpi_ex_do_concatenate (
goto cleanup; goto cleanup;
} }
/* Concatenate the buffers */
ACPI_MEMCPY (new_buf, obj_desc1->buffer.pointer, ACPI_MEMCPY (new_buf, obj_desc1->buffer.pointer,
obj_desc1->buffer.length); obj_desc1->buffer.length);
ACPI_MEMCPY (new_buf + obj_desc1->buffer.length, obj_desc2->buffer.pointer, ACPI_MEMCPY (new_buf + obj_desc1->buffer.length, obj_desc2->buffer.pointer,
obj_desc2->buffer.length); obj_desc2->buffer.length);
/* /* Complete the buffer object initialization */
* Point the return object to the new buffer
*/
return_desc->common.flags = AOPOBJ_DATA_VALID;
return_desc->buffer.pointer = (u8 *) new_buf; return_desc->buffer.pointer = (u8 *) new_buf;
return_desc->buffer.length = obj_desc1->buffer.length + return_desc->buffer.length = obj_desc1->buffer.length +
obj_desc2->buffer.length; obj_desc2->buffer.length;
...@@ -353,6 +361,9 @@ acpi_ex_do_concatenate ( ...@@ -353,6 +361,9 @@ acpi_ex_do_concatenate (
default: default:
/* Invalid object type, should not happen here */
status = AE_AML_INTERNAL; status = AE_AML_INTERNAL;
return_desc = NULL; return_desc = NULL;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: exoparg1 - AML execution - opcodes with 1 argument * Module Name: exoparg1 - AML execution - opcodes with 1 argument
* $Revision: 137 $ * $Revision: 139 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -560,23 +560,12 @@ acpi_ex_opcode_1A_0T_1R ( ...@@ -560,23 +560,12 @@ acpi_ex_opcode_1A_0T_1R (
case AML_TYPE_OP: /* Object_type (Source_object) */ case AML_TYPE_OP: /* Object_type (Source_object) */
if (INTERNAL_TYPE_REFERENCE == operand[0]->common.type) { if (ACPI_GET_OBJECT_TYPE (operand[0]) == INTERNAL_TYPE_REFERENCE) {
/* /*
* Not a Name -- an indirect name pointer would have * Not a Name -- an indirect name pointer would have
* been converted to a direct name pointer in Resolve_operands * been converted to a direct name pointer in Resolve_operands
*/ */
switch (operand[0]->reference.opcode) { switch (operand[0]->reference.opcode) {
case AML_ZERO_OP:
case AML_ONE_OP:
case AML_ONES_OP:
case AML_REVISION_OP:
/* Constants are of type Integer */
type = ACPI_TYPE_INTEGER;
break;
case AML_DEBUG_OP: case AML_DEBUG_OP:
/* The Debug Object is of type "Debug_object" */ /* The Debug Object is of type "Debug_object" */
...@@ -596,7 +585,7 @@ acpi_ex_opcode_1A_0T_1R ( ...@@ -596,7 +585,7 @@ acpi_ex_opcode_1A_0T_1R (
* of the individual package element that is referenced by * of the individual package element that is referenced by
* the index. * the index.
*/ */
type = (*(operand[0]->reference.where))->common.type; type = ACPI_GET_OBJECT_TYPE (*(operand[0]->reference.where));
} }
break; break;
...@@ -611,7 +600,7 @@ acpi_ex_opcode_1A_0T_1R ( ...@@ -611,7 +600,7 @@ acpi_ex_opcode_1A_0T_1R (
default: default:
ACPI_REPORT_ERROR (("Acpi_ex_opcode_1A_0T_1R/Type_op: Internal error - Unknown Reference subtype %X\n", ACPI_REPORT_ERROR (("Acpi_ex_opcode_1A_0T_1R/Type_op: Unknown Reference subtype %X\n",
operand[0]->reference.opcode)); operand[0]->reference.opcode));
status = AE_AML_INTERNAL; status = AE_AML_INTERNAL;
goto cleanup; goto cleanup;
...@@ -668,7 +657,7 @@ acpi_ex_opcode_1A_0T_1R ( ...@@ -668,7 +657,7 @@ acpi_ex_opcode_1A_0T_1R (
* point (even if the original operand was an object reference, it * point (even if the original operand was an object reference, it
* will be resolved and typechecked during operand resolution.) * will be resolved and typechecked during operand resolution.)
*/ */
switch (temp_desc->common.type) { switch (ACPI_GET_OBJECT_TYPE (temp_desc)) {
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
value = temp_desc->buffer.length; value = temp_desc->buffer.length;
break; break;
...@@ -683,7 +672,7 @@ acpi_ex_opcode_1A_0T_1R ( ...@@ -683,7 +672,7 @@ acpi_ex_opcode_1A_0T_1R (
default: default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Size_of, Not Buf/Str/Pkg - found type %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Size_of, Not Buf/Str/Pkg - found type %s\n",
acpi_ut_get_type_name (temp_desc->common.type))); acpi_ut_get_object_type_name (temp_desc)));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
goto cleanup; goto cleanup;
} }
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: exoparg2 - AML execution - opcodes with 2 arguments * Module Name: exoparg2 - AML execution - opcodes with 2 arguments
* $Revision: 106 $ * $Revision: 108 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -297,7 +297,7 @@ acpi_ex_opcode_2A_1T_1R ( ...@@ -297,7 +297,7 @@ acpi_ex_opcode_2A_1T_1R (
* guaranteed to be either Integer/String/Buffer by the operand * guaranteed to be either Integer/String/Buffer by the operand
* resolution mechanism above. * resolution mechanism above.
*/ */
switch (operand[0]->common.type) { 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], &operand[1], walk_state);
break; break;
...@@ -355,7 +355,7 @@ acpi_ex_opcode_2A_1T_1R ( ...@@ -355,7 +355,7 @@ acpi_ex_opcode_2A_1T_1R (
/* /*
* At this point, the Source operand is either a Package or a Buffer * At this point, the Source operand is either a Package or a Buffer
*/ */
if (operand[0]->common.type == ACPI_TYPE_PACKAGE) { if (ACPI_GET_OBJECT_TYPE (operand[0]) == ACPI_TYPE_PACKAGE) {
/* Object to be indexed is a Package */ /* Object to be indexed is a Package */
if (index >= operand[0]->package.count) { if (index >= operand[0]->package.count) {
...@@ -364,10 +364,10 @@ acpi_ex_opcode_2A_1T_1R ( ...@@ -364,10 +364,10 @@ acpi_ex_opcode_2A_1T_1R (
goto cleanup; goto cleanup;
} }
if ((operand[2]->common.type == INTERNAL_TYPE_REFERENCE) && if ((ACPI_GET_OBJECT_TYPE (operand[2]) == ACPI_TYPE_INTEGER) &&
(operand[2]->reference.opcode == AML_ZERO_OP)) { (operand[2]->common.flags & AOPOBJ_AML_CONSTANT)) {
/* /*
* There is no actual result descriptor (the Zero_op Result * There is no actual result descriptor (the Zero_op/Constant Result
* descriptor is a placeholder), so just delete the placeholder and * descriptor is a placeholder), so just delete the placeholder and
* return a reference to the package element * return a reference to the package element
*/ */
...@@ -381,7 +381,7 @@ acpi_ex_opcode_2A_1T_1R ( ...@@ -381,7 +381,7 @@ acpi_ex_opcode_2A_1T_1R (
*/ */
temp_desc = operand[0]->package.elements [index]; temp_desc = operand[0]->package.elements [index];
return_desc->reference.opcode = AML_INDEX_OP; return_desc->reference.opcode = AML_INDEX_OP;
return_desc->reference.target_type = temp_desc->common.type; return_desc->reference.target_type = ACPI_GET_OBJECT_TYPE (temp_desc);
return_desc->reference.object = temp_desc; return_desc->reference.object = temp_desc;
status = acpi_ex_store (return_desc, operand[2], walk_state); status = acpi_ex_store (return_desc, operand[2], walk_state);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: exoparg3 - AML execution - opcodes with 3 arguments * Module Name: exoparg3 - AML execution - opcodes with 3 arguments
* $Revision: 13 $ * $Revision: 14 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -159,7 +159,7 @@ acpi_ex_opcode_3A_1T_1R ( ...@@ -159,7 +159,7 @@ acpi_ex_opcode_3A_1T_1R (
* Create the return object. The Source operand is guaranteed to be * Create the return object. The Source operand is guaranteed to be
* either a String or a Buffer, so just use its type. * either a String or a Buffer, so just use its type.
*/ */
return_desc = acpi_ut_create_internal_object (operand[0]->common.type); return_desc = acpi_ut_create_internal_object (ACPI_GET_OBJECT_TYPE (operand[0]));
if (!return_desc) { if (!return_desc) {
status = AE_NO_MEMORY; status = AE_NO_MEMORY;
goto cleanup; goto cleanup;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: exoparg6 - AML execution - opcodes with 6 arguments * Module Name: exoparg6 - AML execution - opcodes with 6 arguments
* $Revision: 10 $ * $Revision: 11 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -212,7 +212,7 @@ acpi_ex_opcode_6A_0T_1R ( ...@@ -212,7 +212,7 @@ acpi_ex_opcode_6A_0T_1R (
* Treat any NULL or non-numeric elements as non-matching. * Treat any NULL or non-numeric elements as non-matching.
*/ */
if (!this_element || if (!this_element ||
this_element->common.type != ACPI_TYPE_INTEGER) { ACPI_GET_OBJECT_TYPE (this_element) != ACPI_TYPE_INTEGER) {
continue; continue;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: exprep - ACPI AML (p-code) execution - field prep utilities * Module Name: exprep - ACPI AML (p-code) execution - field prep utilities
* $Revision: 117 $ * $Revision: 118 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -140,7 +140,7 @@ acpi_ex_decode_field_access ( ...@@ -140,7 +140,7 @@ acpi_ex_decode_field_access (
return (0); return (0);
} }
if (obj_desc->common.type == ACPI_TYPE_BUFFER_FIELD) { if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
/* /*
* Buffer_field access can be on any byte boundary, so the * Buffer_field access can be on any byte boundary, so the
* Byte_alignment is always 1 byte -- regardless of any Byte_alignment * Byte_alignment is always 1 byte -- regardless of any Byte_alignment
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: exresnte - AML Interpreter object resolution * Module Name: exresnte - AML Interpreter object resolution
* $Revision: 53 $ * $Revision: 56 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -73,7 +73,6 @@ acpi_ex_resolve_node_to_value ( ...@@ -73,7 +73,6 @@ acpi_ex_resolve_node_to_value (
acpi_operand_object *obj_desc = NULL; acpi_operand_object *obj_desc = NULL;
acpi_namespace_node *node; acpi_namespace_node *node;
acpi_object_type entry_type; acpi_object_type entry_type;
acpi_integer temp_val;
ACPI_FUNCTION_TRACE ("Ex_resolve_node_to_value"); ACPI_FUNCTION_TRACE ("Ex_resolve_node_to_value");
...@@ -113,9 +112,9 @@ acpi_ex_resolve_node_to_value ( ...@@ -113,9 +112,9 @@ acpi_ex_resolve_node_to_value (
switch (entry_type) { switch (entry_type) {
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
if (ACPI_TYPE_PACKAGE != source_desc->common.type) { if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_PACKAGE) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Package, type %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Package, type %s\n",
acpi_ut_get_type_name (source_desc->common.type))); acpi_ut_get_object_type_name (source_desc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
} }
...@@ -131,9 +130,9 @@ acpi_ex_resolve_node_to_value ( ...@@ -131,9 +130,9 @@ acpi_ex_resolve_node_to_value (
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
if (ACPI_TYPE_BUFFER != source_desc->common.type) { if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Buffer, type %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Buffer, type %s\n",
acpi_ut_get_type_name (source_desc->common.type))); acpi_ut_get_object_type_name (source_desc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
} }
...@@ -149,9 +148,9 @@ acpi_ex_resolve_node_to_value ( ...@@ -149,9 +148,9 @@ acpi_ex_resolve_node_to_value (
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
if (ACPI_TYPE_STRING != source_desc->common.type) { if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a String, type %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a String, type %s\n",
acpi_ut_get_type_name (source_desc->common.type))); acpi_ut_get_object_type_name (source_desc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
} }
...@@ -164,9 +163,9 @@ acpi_ex_resolve_node_to_value ( ...@@ -164,9 +163,9 @@ acpi_ex_resolve_node_to_value (
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
if (ACPI_TYPE_INTEGER != source_desc->common.type) { if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Integer, type %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Integer, type %s\n",
acpi_ut_get_type_name (source_desc->common.type))); acpi_ut_get_object_type_name (source_desc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
} }
...@@ -216,61 +215,14 @@ acpi_ex_resolve_node_to_value ( ...@@ -216,61 +215,14 @@ acpi_ex_resolve_node_to_value (
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */ return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */
/*
* The only named references allowed are named constants
* e.g. -- Name (\OSFL, Ones)
*/
case INTERNAL_TYPE_REFERENCE: case INTERNAL_TYPE_REFERENCE:
switch (source_desc->reference.opcode) { /* No named references are allowed here */
case AML_ZERO_OP:
temp_val = 0;
break;
case AML_ONE_OP:
temp_val = 1;
break;
case AML_ONES_OP:
temp_val = ACPI_INTEGER_MAX;
break;
case AML_REVISION_OP:
temp_val = ACPI_CA_SUPPORT_LEVEL;
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported reference opcode %X\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported reference opcode %X\n",
source_desc->reference.opcode)); source_desc->reference.opcode));
return_ACPI_STATUS (AE_AML_BAD_OPCODE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/* Create object for result */
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
if (!obj_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
obj_desc->integer.value = temp_val;
/*
* Truncate value if we are executing from a 32-bit ACPI table
* AND actually executing AML code. If we are resolving
* an object in the namespace via an external call to the
* subsystem, we will have a null Walk_state
*/
if (walk_state) {
acpi_ex_truncate_for32bit_table (obj_desc, walk_state);
}
break;
/* Default case is for unknown types */ /* Default case is for unknown types */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: exresolv - AML Interpreter object resolution * Module Name: exresolv - AML Interpreter object resolution
* $Revision: 111 $ * $Revision: 114 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -130,7 +130,7 @@ acpi_ex_resolve_object_to_value ( ...@@ -130,7 +130,7 @@ acpi_ex_resolve_object_to_value (
/* This is an acpi_operand_object */ /* This is an acpi_operand_object */
switch (stack_desc->common.type) { switch (ACPI_GET_OBJECT_TYPE (stack_desc)) {
case INTERNAL_TYPE_REFERENCE: case INTERNAL_TYPE_REFERENCE:
opcode = stack_desc->reference.opcode; opcode = stack_desc->reference.opcode;
...@@ -178,56 +178,6 @@ acpi_ex_resolve_object_to_value ( ...@@ -178,56 +178,6 @@ acpi_ex_resolve_object_to_value (
stack_desc->reference.offset, obj_desc)); stack_desc->reference.offset, obj_desc));
break; break;
/*
* For constants, we must change the reference/constant object
* to a real integer object
*/
case AML_ZERO_OP:
case AML_ONE_OP:
case AML_ONES_OP:
case AML_REVISION_OP:
/* Create a new integer object */
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
if (!obj_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
switch (opcode) {
case AML_ZERO_OP:
obj_desc->integer.value = 0;
break;
case AML_ONE_OP:
obj_desc->integer.value = 1;
break;
case AML_ONES_OP:
obj_desc->integer.value = ACPI_INTEGER_MAX;
/* Truncate value if we are executing from a 32-bit ACPI table */
acpi_ex_truncate_for32bit_table (obj_desc, walk_state);
break;
case AML_REVISION_OP:
obj_desc->integer.value = ACPI_CA_SUPPORT_LEVEL;
break;
default:
/* No other opcodes can get here */
break;
}
/*
* Remove a reference from the original reference object
* and put the new object in its place
*/
acpi_ut_remove_reference (stack_desc);
*stack_ptr = obj_desc;
break;
case AML_INDEX_OP: case AML_INDEX_OP:
...@@ -239,6 +189,7 @@ acpi_ex_resolve_object_to_value ( ...@@ -239,6 +189,7 @@ acpi_ex_resolve_object_to_value (
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
obj_desc = *stack_desc->reference.where; obj_desc = *stack_desc->reference.where;
if (obj_desc) { if (obj_desc) {
/* /*
...@@ -262,7 +213,9 @@ acpi_ex_resolve_object_to_value ( ...@@ -262,7 +213,9 @@ acpi_ex_resolve_object_to_value (
} }
break; break;
default: default:
/* Invalid reference object */ /* Invalid reference object */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
...@@ -282,14 +235,12 @@ acpi_ex_resolve_object_to_value ( ...@@ -282,14 +235,12 @@ acpi_ex_resolve_object_to_value (
default: default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference object subtype %02X in %p\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference opcode %X in %p\n",
opcode, stack_desc)); opcode, stack_desc));
status = AE_AML_INTERNAL; status = AE_AML_INTERNAL;
break; break;
}
} /* switch (Opcode) */ break;
break; /* case INTERNAL_TYPE_REFERENCE */
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
...@@ -313,7 +264,7 @@ acpi_ex_resolve_object_to_value ( ...@@ -313,7 +264,7 @@ acpi_ex_resolve_object_to_value (
case INTERNAL_TYPE_INDEX_FIELD: case INTERNAL_TYPE_INDEX_FIELD:
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Field_read Source_desc=%p Type=%X\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Field_read Source_desc=%p Type=%X\n",
stack_desc, stack_desc->common.type)); stack_desc, ACPI_GET_OBJECT_TYPE (stack_desc)));
status = acpi_ex_read_data_from_field (walk_state, stack_desc, &obj_desc); status = acpi_ex_read_data_from_field (walk_state, stack_desc, &obj_desc);
*stack_ptr = (void *) obj_desc; *stack_ptr = (void *) obj_desc;
......
...@@ -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: 50 $ * $Revision: 53 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -65,6 +65,18 @@ acpi_ex_check_object_type ( ...@@ -65,6 +65,18 @@ acpi_ex_check_object_type (
return (AE_OK); return (AE_OK);
} }
if (type_needed == INTERNAL_TYPE_REFERENCE) {
/*
* Allow the AML "Constant" opcodes (Zero, One, etc.) to be reference
* objects and thus allow them to be targets. (As per the ACPI
* specification, a store to a constant is a noop.)
*/
if ((this_type == ACPI_TYPE_INTEGER) &&
(((acpi_operand_object *) object)->common.flags & AOPOBJ_AML_CONSTANT)) {
return (AE_OK);
}
}
if (type_needed != this_type) { if (type_needed != this_type) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Needed [%s], found [%s] %p\n", "Needed [%s], found [%s] %p\n",
...@@ -85,18 +97,17 @@ acpi_ex_check_object_type ( ...@@ -85,18 +97,17 @@ acpi_ex_check_object_type (
* PARAMETERS: Opcode - Opcode being interpreted * PARAMETERS: Opcode - Opcode being interpreted
* Stack_ptr - Pointer to the operand stack to be * Stack_ptr - Pointer to the operand stack to be
* resolved * resolved
* Walk_state - Current stateu * Walk_state - Current state
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Convert multiple input operands to the types required by the * DESCRIPTION: Convert multiple input operands to the types required by the
* target operator. * target operator.
* *
* Each nibble (actually 5 bits) in Arg_types represents one required * Each 5-bit group in Arg_types represents one required
* operand and indicates the required Type: * operand and indicates the required Type. The corresponding operand
* * will be converted to the required type if possible, otherwise we
* The corresponding operand will be converted to the required type if * abort with an exception.
* possible, otherwise we abort with an exception.
* *
******************************************************************************/ ******************************************************************************/
...@@ -169,7 +180,7 @@ acpi_ex_resolve_operands ( ...@@ -169,7 +180,7 @@ acpi_ex_resolve_operands (
/* ACPI internal object */ /* ACPI internal object */
object_type = obj_desc->common.type; object_type = ACPI_GET_OBJECT_TYPE (obj_desc);
/* Check for bad acpi_object_type */ /* Check for bad acpi_object_type */
...@@ -190,15 +201,11 @@ acpi_ex_resolve_operands ( ...@@ -190,15 +201,11 @@ acpi_ex_resolve_operands (
} }
switch (obj_desc->reference.opcode) { switch (obj_desc->reference.opcode) {
case AML_ZERO_OP:
case AML_ONE_OP:
case AML_ONES_OP:
case AML_DEBUG_OP: case AML_DEBUG_OP:
case AML_NAME_OP: case AML_NAME_OP:
case AML_INDEX_OP: case AML_INDEX_OP:
case AML_ARG_OP: case AML_ARG_OP:
case AML_LOCAL_OP: case AML_LOCAL_OP:
case AML_REVISION_OP:
ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Reference Opcode: %s\n", op_info->name))); "Reference Opcode: %s\n", op_info->name)));
...@@ -206,7 +213,7 @@ acpi_ex_resolve_operands ( ...@@ -206,7 +213,7 @@ acpi_ex_resolve_operands (
default: default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Reference Opcode: Unknown [%02x]\n", "Unknown Reference Opcode %X\n",
obj_desc->reference.opcode)); obj_desc->reference.opcode));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
...@@ -293,7 +300,7 @@ acpi_ex_resolve_operands ( ...@@ -293,7 +300,7 @@ acpi_ex_resolve_operands (
* -- All others must be resolved below. * -- All others must be resolved below.
*/ */
if ((opcode == AML_STORE_OP) && if ((opcode == AML_STORE_OP) &&
((*stack_ptr)->common.type == INTERNAL_TYPE_REFERENCE) && (ACPI_GET_OBJECT_TYPE (*stack_ptr) == INTERNAL_TYPE_REFERENCE) &&
((*stack_ptr)->reference.opcode == AML_INDEX_OP)) { ((*stack_ptr)->reference.opcode == AML_INDEX_OP)) {
goto next_operand; goto next_operand;
} }
...@@ -378,7 +385,7 @@ acpi_ex_resolve_operands ( ...@@ -378,7 +385,7 @@ acpi_ex_resolve_operands (
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_type_name ((*stack_ptr)->common.type), *stack_ptr)); acpi_ut_get_object_type_name (*stack_ptr), *stack_ptr));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
} }
...@@ -399,7 +406,7 @@ acpi_ex_resolve_operands ( ...@@ -399,7 +406,7 @@ acpi_ex_resolve_operands (
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_type_name ((*stack_ptr)->common.type), *stack_ptr)); acpi_ut_get_object_type_name (*stack_ptr), *stack_ptr));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
} }
...@@ -420,7 +427,7 @@ acpi_ex_resolve_operands ( ...@@ -420,7 +427,7 @@ acpi_ex_resolve_operands (
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_type_name ((*stack_ptr)->common.type), *stack_ptr)); acpi_ut_get_object_type_name (*stack_ptr), *stack_ptr));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
} }
...@@ -434,7 +441,7 @@ acpi_ex_resolve_operands ( ...@@ -434,7 +441,7 @@ acpi_ex_resolve_operands (
/* Need an operand of type INTEGER, STRING or BUFFER */ /* Need an operand of type INTEGER, STRING or BUFFER */
switch ((*stack_ptr)->common.type) { switch (ACPI_GET_OBJECT_TYPE (*stack_ptr)) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
...@@ -445,7 +452,7 @@ acpi_ex_resolve_operands ( ...@@ -445,7 +452,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_type_name ((*stack_ptr)->common.type), *stack_ptr)); acpi_ut_get_object_type_name (*stack_ptr), *stack_ptr));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
} }
...@@ -460,7 +467,7 @@ acpi_ex_resolve_operands ( ...@@ -460,7 +467,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 ((*stack_ptr)->common.type == INTERNAL_TYPE_REFERENCE) { if (ACPI_GET_OBJECT_TYPE (*stack_ptr) == INTERNAL_TYPE_REFERENCE) {
if (!(*stack_ptr)->reference.node) { if (!(*stack_ptr)->reference.node) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Needed [Node Reference], found [%p]\n", "Needed [Node Reference], found [%p]\n",
...@@ -492,7 +499,7 @@ acpi_ex_resolve_operands ( ...@@ -492,7 +499,7 @@ acpi_ex_resolve_operands (
/* Need a buffer, string, package */ /* Need a buffer, string, package */
switch ((*stack_ptr)->common.type) { 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:
...@@ -503,7 +510,7 @@ acpi_ex_resolve_operands ( ...@@ -503,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_type_name ((*stack_ptr)->common.type), *stack_ptr)); acpi_ut_get_object_type_name (*stack_ptr), *stack_ptr));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
} }
...@@ -514,7 +521,7 @@ acpi_ex_resolve_operands ( ...@@ -514,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 ((*stack_ptr)->common.type) { 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:
...@@ -525,7 +532,7 @@ acpi_ex_resolve_operands ( ...@@ -525,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_type_name ((*stack_ptr)->common.type), *stack_ptr)); acpi_ut_get_object_type_name (*stack_ptr), *stack_ptr));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
} }
...@@ -548,7 +555,7 @@ acpi_ex_resolve_operands ( ...@@ -548,7 +555,7 @@ acpi_ex_resolve_operands (
* required object type (Simple cases only). * required object type (Simple cases only).
*/ */
status = acpi_ex_check_object_type (type_needed, status = acpi_ex_check_object_type (type_needed,
(*stack_ptr)->common.type, *stack_ptr); ACPI_GET_OBJECT_TYPE (*stack_ptr), *stack_ptr);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
......
...@@ -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: 164 $ * $Revision: 167 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -89,18 +89,33 @@ acpi_ex_store ( ...@@ -89,18 +89,33 @@ acpi_ex_store (
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
/* Destination object must be an object of type Reference */ /* Destination object must be a Reference or a Constant object */
switch (ACPI_GET_OBJECT_TYPE (dest_desc)) {
case INTERNAL_TYPE_REFERENCE:
break;
case ACPI_TYPE_INTEGER:
/* Allow stores to Constants -- a Noop as per ACPI spec */
if (dest_desc->common.flags & AOPOBJ_AML_CONSTANT) {
return_ACPI_STATUS (AE_OK);
}
/*lint: -fallthrough */
default:
if (dest_desc->common.type != INTERNAL_TYPE_REFERENCE) {
/* Destination is not an Reference */ /* Destination is not an Reference */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Destination is not a Reference_obj [%p]\n", dest_desc)); "Destination is not a Reference or Constant object [%p]\n", dest_desc));
ACPI_DUMP_STACK_ENTRY (source_desc); ACPI_DUMP_STACK_ENTRY (source_desc);
ACPI_DUMP_STACK_ENTRY (dest_desc); ACPI_DUMP_STACK_ENTRY (dest_desc);
ACPI_DUMP_OPERANDS (&dest_desc, ACPI_IMODE_EXECUTE, "Ex_store", ACPI_DUMP_OPERANDS (&dest_desc, ACPI_IMODE_EXECUTE, "Ex_store",
2, "Target is not a Reference_obj"); 2, "Target is not a Reference or Constant object");
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
} }
...@@ -112,7 +127,6 @@ acpi_ex_store ( ...@@ -112,7 +127,6 @@ acpi_ex_store (
* 2) Store to an indexed area of a Buffer or Package * 2) Store to an indexed area of a Buffer or Package
* 3) Store to a Method Local or Arg * 3) Store to a Method Local or Arg
* 4) Store to the debug object * 4) Store to the debug object
* 5) Store to a constant -- a noop
*/ */
switch (ref_desc->reference.opcode) { switch (ref_desc->reference.opcode) {
case AML_NAME_OP: case AML_NAME_OP:
...@@ -151,9 +165,9 @@ acpi_ex_store ( ...@@ -151,9 +165,9 @@ acpi_ex_store (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "**** Write to Debug Object: ****:\n\n")); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "**** Write to Debug Object: ****:\n\n"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %s: ", ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %s: ",
acpi_ut_get_type_name (source_desc->common.type))); acpi_ut_get_object_type_name (source_desc)));
switch (source_desc->common.type) { switch (ACPI_GET_OBJECT_TYPE (source_desc)) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%8.8X%8.8X\n", ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%8.8X%8.8X\n",
...@@ -185,7 +199,7 @@ acpi_ex_store ( ...@@ -185,7 +199,7 @@ acpi_ex_store (
default: default:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Type %s %p\n", ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Type %s %p\n",
acpi_ut_get_type_name (source_desc->common.type), source_desc)); acpi_ut_get_object_type_name (source_desc), source_desc));
break; break;
} }
...@@ -193,28 +207,15 @@ acpi_ex_store ( ...@@ -193,28 +207,15 @@ acpi_ex_store (
break; break;
case AML_ZERO_OP:
case AML_ONE_OP:
case AML_ONES_OP:
case AML_REVISION_OP:
/*
* Storing to a constant is a no-op according to the ACPI
* Specification. (Delete the reference descriptor, however.)
*/
break;
default: default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference subtype %02x\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference opcode %X\n",
ref_desc->reference.opcode)); ref_desc->reference.opcode));
ACPI_DUMP_ENTRY (ref_desc, ACPI_LV_ERROR); ACPI_DUMP_ENTRY (ref_desc, ACPI_LV_ERROR);
status = AE_AML_INTERNAL; status = AE_AML_INTERNAL;
break; break;
}
} /* switch (Ref_desc->Reference.Opcode) */
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -303,7 +304,7 @@ acpi_ex_store_object_to_index ( ...@@ -303,7 +304,7 @@ acpi_ex_store_object_to_index (
* Make sure the target is a Buffer * Make sure the target is a Buffer
*/ */
obj_desc = index_desc->reference.object; obj_desc = index_desc->reference.object;
if (obj_desc->common.type != ACPI_TYPE_BUFFER) { if (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_BUFFER) {
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
} }
...@@ -311,7 +312,7 @@ acpi_ex_store_object_to_index ( ...@@ -311,7 +312,7 @@ acpi_ex_store_object_to_index (
* The assignment of the individual elements will be slightly * The assignment of the individual elements will be slightly
* different for each source type. * different for each source type.
*/ */
switch (source_desc->common.type) { switch (ACPI_GET_OBJECT_TYPE (source_desc)) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
/* Use the least-significant byte of the integer */ /* Use the least-significant byte of the integer */
...@@ -335,7 +336,7 @@ acpi_ex_store_object_to_index ( ...@@ -335,7 +336,7 @@ acpi_ex_store_object_to_index (
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Source must be Integer/Buffer/String type, not %s\n", "Source must be Integer/Buffer/String type, not %s\n",
acpi_ut_get_type_name (source_desc->common.type))); acpi_ut_get_object_type_name (source_desc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
} }
...@@ -403,7 +404,7 @@ acpi_ex_store_object_to_node ( ...@@ -403,7 +404,7 @@ acpi_ex_store_object_to_node (
target_desc = acpi_ns_get_attached_object (node); target_desc = acpi_ns_get_attached_object (node);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p(%s) into node %p(%s)\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p(%s) into node %p(%s)\n",
source_desc, acpi_ut_get_type_name (source_desc->common.type), source_desc, acpi_ut_get_object_type_name (source_desc),
node, acpi_ut_get_type_name (target_type))); node, acpi_ut_get_type_name (target_type)));
/* /*
...@@ -456,8 +457,8 @@ acpi_ex_store_object_to_node ( ...@@ -456,8 +457,8 @@ acpi_ex_store_object_to_node (
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",
acpi_ut_get_type_name (source_desc->common.type), acpi_ut_get_object_type_name (source_desc),
acpi_ut_get_type_name (new_desc->common.type))); acpi_ut_get_object_type_name (new_desc)));
} }
break; break;
...@@ -466,11 +467,11 @@ acpi_ex_store_object_to_node ( ...@@ -466,11 +467,11 @@ acpi_ex_store_object_to_node (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Storing %s (%p) directly into node (%p), no implicit conversion\n", "Storing %s (%p) directly into node (%p), no implicit conversion\n",
acpi_ut_get_type_name (source_desc->common.type), source_desc, node)); acpi_ut_get_object_type_name (source_desc), source_desc, node));
/* No conversions for all other types. Just attach the source object */ /* No conversions for all other types. Just attach the source object */
status = acpi_ns_attach_object (node, source_desc, source_desc->common.type); status = acpi_ns_attach_object (node, source_desc, ACPI_GET_OBJECT_TYPE (source_desc));
break; break;
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Module Name: exstoren - AML Interpreter object store support, * Module Name: exstoren - AML Interpreter object store support,
* Store to Node (namespace object) * Store to Node (namespace object)
* $Revision: 48 $ * $Revision: 50 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -84,7 +84,7 @@ acpi_ex_resolve_object ( ...@@ -84,7 +84,7 @@ acpi_ex_resolve_object (
* are all essentially the same. This case handles the * are all essentially the same. This case handles the
* "interchangeable" types Integer, String, and Buffer. * "interchangeable" types Integer, String, and Buffer.
*/ */
if (source_desc->common.type == INTERNAL_TYPE_REFERENCE) { if (ACPI_GET_OBJECT_TYPE (source_desc) == INTERNAL_TYPE_REFERENCE) {
/* Resolve a reference object first */ /* Resolve a reference object first */
status = acpi_ex_resolve_to_value (source_desc_ptr, walk_state); status = acpi_ex_resolve_to_value (source_desc_ptr, walk_state);
...@@ -96,15 +96,15 @@ acpi_ex_resolve_object ( ...@@ -96,15 +96,15 @@ acpi_ex_resolve_object (
/* /*
* Must have a Integer, Buffer, or String * Must have a Integer, Buffer, or String
*/ */
if ((source_desc->common.type != ACPI_TYPE_INTEGER) && if ((ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER) &&
(source_desc->common.type != ACPI_TYPE_BUFFER) && (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) &&
(source_desc->common.type != ACPI_TYPE_STRING)) { (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING)) {
/* /*
* Conversion successful but still not a valid type * Conversion successful but still not a valid type
*/ */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Cannot assign type %s to %s (must be type Int/Str/Buf)\n", "Cannot assign type %s to %s (must be type Int/Str/Buf)\n",
acpi_ut_get_type_name (source_desc->common.type), acpi_ut_get_object_type_name (source_desc),
acpi_ut_get_type_name (target_type))); acpi_ut_get_type_name (target_type)));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
} }
...@@ -195,7 +195,7 @@ acpi_ex_store_object_to_object ( ...@@ -195,7 +195,7 @@ acpi_ex_store_object_to_object (
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
if (source_desc->common.type != dest_desc->common.type) { if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_GET_OBJECT_TYPE (dest_desc)) {
/* /*
* The source type does not match the type of the destination. * The source type does not match the type of the destination.
* Perform the "implicit conversion" of the source to the current type * Perform the "implicit conversion" of the source to the current type
...@@ -205,7 +205,7 @@ acpi_ex_store_object_to_object ( ...@@ -205,7 +205,7 @@ acpi_ex_store_object_to_object (
* Otherwise, Actual_src_desc is a temporary object to hold the * Otherwise, Actual_src_desc is a temporary object to hold the
* converted object. * converted object.
*/ */
status = acpi_ex_convert_to_target_type (dest_desc->common.type, source_desc, status = acpi_ex_convert_to_target_type (ACPI_GET_OBJECT_TYPE (dest_desc), source_desc,
&actual_src_desc, walk_state); &actual_src_desc, walk_state);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
...@@ -216,14 +216,14 @@ acpi_ex_store_object_to_object ( ...@@ -216,14 +216,14 @@ acpi_ex_store_object_to_object (
* We now have two objects of identical types, and we can perform a * We now have two objects of identical types, and we can perform a
* copy of the *value* of the source object. * copy of the *value* of the source object.
*/ */
switch (dest_desc->common.type) { switch (ACPI_GET_OBJECT_TYPE (dest_desc)) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
dest_desc->integer.value = actual_src_desc->integer.value; dest_desc->integer.value = actual_src_desc->integer.value;
/* Truncate value if we are executing from a 32-bit ACPI table */ /* Truncate value if we are executing from a 32-bit ACPI table */
acpi_ex_truncate_for32bit_table (dest_desc, walk_state); acpi_ex_truncate_for32bit_table (dest_desc);
break; break;
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
...@@ -246,7 +246,7 @@ acpi_ex_store_object_to_object ( ...@@ -246,7 +246,7 @@ acpi_ex_store_object_to_object (
* All other types come here. * All other types come here.
*/ */
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Store into type %s not implemented\n", ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Store into type %s not implemented\n",
acpi_ut_get_type_name (dest_desc->common.type))); acpi_ut_get_object_type_name (dest_desc)));
status = AE_NOT_IMPLEMENTED; status = AE_NOT_IMPLEMENTED;
break; break;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: exutils - interpreter/scanner utilities * Module Name: exutils - interpreter/scanner utilities
* $Revision: 98 $ * $Revision: 100 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -148,8 +148,6 @@ acpi_ex_validate_object_type ( ...@@ -148,8 +148,6 @@ acpi_ex_validate_object_type (
* FUNCTION: Acpi_ex_truncate_for32bit_table * FUNCTION: Acpi_ex_truncate_for32bit_table
* *
* PARAMETERS: Obj_desc - Object to be truncated * PARAMETERS: Obj_desc - Object to be truncated
* Walk_state - Current walk state
* (A method must be executing)
* *
* RETURN: none * RETURN: none
* *
...@@ -160,8 +158,7 @@ acpi_ex_validate_object_type ( ...@@ -160,8 +158,7 @@ acpi_ex_validate_object_type (
void void
acpi_ex_truncate_for32bit_table ( acpi_ex_truncate_for32bit_table (
acpi_operand_object *obj_desc, acpi_operand_object *obj_desc)
acpi_walk_state *walk_state)
{ {
ACPI_FUNCTION_ENTRY (); ACPI_FUNCTION_ENTRY ();
...@@ -172,8 +169,7 @@ acpi_ex_truncate_for32bit_table ( ...@@ -172,8 +169,7 @@ acpi_ex_truncate_for32bit_table (
* a control method * a control method
*/ */
if ((!obj_desc) || if ((!obj_desc) ||
(obj_desc->common.type != ACPI_TYPE_INTEGER) || (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_INTEGER)) {
(!walk_state->method_node)) {
return; return;
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Module Name: hwregs - Read/write access functions for the various ACPI * Module Name: hwregs - Read/write access functions for the various ACPI
* control and status registers. * control and status registers.
* $Revision: 130 $ * $Revision: 133 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -137,7 +137,7 @@ acpi_get_sleep_type_data ( ...@@ -137,7 +137,7 @@ acpi_get_sleep_type_data (
} }
/* /*
* Acpi_evaluate the namespace object containing the values for this state * Evaluate the namespace object containing the values for this state
*/ */
status = acpi_ns_evaluate_by_name ((NATIVE_CHAR *) acpi_gbl_db_sleep_states[sleep_state], status = acpi_ns_evaluate_by_name ((NATIVE_CHAR *) acpi_gbl_db_sleep_states[sleep_state],
NULL, &obj_desc); NULL, &obj_desc);
...@@ -145,33 +145,34 @@ acpi_get_sleep_type_data ( ...@@ -145,33 +145,34 @@ acpi_get_sleep_type_data (
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
/* Must have a return object */
if (!obj_desc) { if (!obj_desc) {
ACPI_REPORT_ERROR (("Missing Sleep State object\n")); ACPI_REPORT_ERROR (("Missing Sleep State object\n"));
return_ACPI_STATUS (AE_NOT_EXIST); status = AE_NOT_EXIST;
} }
/* /* It must be of type Package */
* We got something, now ensure it is correct. The object must
* be a package and must have at least 2 numeric values as the
* two elements
*/
/* Even though Acpi_evaluate_object resolves package references, else if (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_PACKAGE) {
* Ns_evaluate doesn't. So, we do it here. ACPI_REPORT_ERROR (("Sleep State object not a Package\n"));
*/ status = AE_AML_OPERAND_TYPE;
status = acpi_ut_resolve_package_references(obj_desc); }
if (obj_desc->package.count < 2) { /* The package must have at least two elements */
/* Must have at least two elements */
else if (obj_desc->package.count < 2) {
ACPI_REPORT_ERROR (("Sleep State package does not have at least two elements\n")); ACPI_REPORT_ERROR (("Sleep State package does not have at least two elements\n"));
status = AE_AML_NO_OPERAND; status = AE_AML_NO_OPERAND;
} }
else if (((obj_desc->package.elements[0])->common.type != ACPI_TYPE_INTEGER) ||
((obj_desc->package.elements[1])->common.type != ACPI_TYPE_INTEGER)) {
/* Must have two */
ACPI_REPORT_ERROR (("Sleep State package elements are not both of type Number\n")); /* The first two elements must both be of type Integer */
else if ((ACPI_GET_OBJECT_TYPE (obj_desc->package.elements[0]) != ACPI_TYPE_INTEGER) ||
(ACPI_GET_OBJECT_TYPE (obj_desc->package.elements[1]) != ACPI_TYPE_INTEGER)) {
ACPI_REPORT_ERROR (("Sleep State package elements are not both Integers (%s, %s)\n",
acpi_ut_get_object_type_name (obj_desc->package.elements[0]),
acpi_ut_get_object_type_name (obj_desc->package.elements[1])));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
} }
else { else {
...@@ -183,8 +184,8 @@ acpi_get_sleep_type_data ( ...@@ -183,8 +184,8 @@ acpi_get_sleep_type_data (
} }
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad Sleep object %p type %X\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad Sleep object %p type %s\n",
obj_desc, obj_desc->common.type)); obj_desc, acpi_ut_get_object_type_name (obj_desc)));
} }
acpi_ut_remove_reference (obj_desc); acpi_ut_remove_reference (obj_desc);
...@@ -196,7 +197,7 @@ acpi_get_sleep_type_data ( ...@@ -196,7 +197,7 @@ acpi_get_sleep_type_data (
* *
* FUNCTION: Acpi_hw_get_register_bit_mask * FUNCTION: Acpi_hw_get_register_bit_mask
* *
* PARAMETERS: Register_id - index of ACPI Register to access * PARAMETERS: Register_id - Index of ACPI Register to access
* *
* RETURN: The bit mask to be used when accessing the register * RETURN: The bit mask to be used when accessing the register
* *
...@@ -224,7 +225,7 @@ acpi_hw_get_bit_register_info ( ...@@ -224,7 +225,7 @@ acpi_hw_get_bit_register_info (
* *
* FUNCTION: Acpi_get_register * FUNCTION: Acpi_get_register
* *
* PARAMETERS: Register_id - index of ACPI Register to access * PARAMETERS: Register_id - Index of ACPI Register to access
* Use_lock - Lock the hardware * Use_lock - Lock the hardware
* *
* RETURN: Value is read from specified Register. Value returned is * RETURN: Value is read from specified Register. Value returned is
......
/****************************************************************************** /******************************************************************************
* *
* Name: acconfig.h - Global configuration constants * Name: acconfig.h - Global configuration constants
* $Revision: 102 $ * $Revision: 104 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
/* Version string */ /* Version string */
#define ACPI_CA_VERSION 0x20020517 #define ACPI_CA_VERSION 0x20020611
/* Version of ACPI supported */ /* Version of ACPI supported */
...@@ -92,23 +92,6 @@ ...@@ -92,23 +92,6 @@
* *
*****************************************************************************/ *****************************************************************************/
/*
* Debugger threading model
* Use single threaded if the entire subsystem is contained in an application
* Use multiple threaded when the subsystem is running in the kernel.
*
* By default the model is single threaded if ACPI_APPLICATION is set,
* multi-threaded if ACPI_APPLICATION is not set.
*/
#define DEBUGGER_SINGLE_THREADED 0
#define DEBUGGER_MULTI_THREADED 1
#ifdef ACPI_APPLICATION
#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
#else
#define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED
#endif
/* /*
* Should the subystem abort the loading of an ACPI table if the * Should the subystem abort the loading of an ACPI table if the
......
/****************************************************************************** /******************************************************************************
* *
* Name: acinterp.h - Interpreter subcomponent prototypes and defines * Name: acinterp.h - Interpreter subcomponent prototypes and defines
* $Revision: 137 $ * $Revision: 138 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -603,8 +603,7 @@ acpi_ex_exit_interpreter ( ...@@ -603,8 +603,7 @@ acpi_ex_exit_interpreter (
void void
acpi_ex_truncate_for32bit_table ( acpi_ex_truncate_for32bit_table (
acpi_operand_object *obj_desc, acpi_operand_object *obj_desc);
acpi_walk_state *walk_state);
u8 u8
acpi_ex_validate_object_type ( acpi_ex_validate_object_type (
......
/****************************************************************************** /******************************************************************************
* *
* Name: acmacros.h - C macros for the entire subsystem. * Name: acmacros.h - C macros for the entire subsystem.
* $Revision: 123 $ * $Revision: 124 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -262,7 +262,7 @@ ...@@ -262,7 +262,7 @@
/* Macro to test the object type */ /* Macro to test the object type */
#define ACPI_GET_OBJECT_TYPE(d) (((acpi_operand_object *)(void *)d)->common.type) #define ACPI_GET_OBJECT_TYPE(d) (((acpi_operand_object *)(void *)(d))->common.type)
/* Macro to check the table flags for SINGLE or MULTIPLE tables are allowed */ /* Macro to check the table flags for SINGLE or MULTIPLE tables are allowed */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/****************************************************************************** /******************************************************************************
* *
* Name: acobject.h - Definition of acpi_operand_object (Internal object only) * Name: acobject.h - Definition of acpi_operand_object (Internal object only)
* $Revision: 111 $ * $Revision: 112 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
/* Values for flag byte above */ /* Values for flag byte above */
#define AOPOBJ_RESERVED 0x01 #define AOPOBJ_AML_CONSTANT 0x01
#define AOPOBJ_STATIC_POINTER 0x02 #define AOPOBJ_STATIC_POINTER 0x02
#define AOPOBJ_DATA_VALID 0x04 #define AOPOBJ_DATA_VALID 0x04
#define AOPOBJ_OBJECT_INITIALIZED 0x08 #define AOPOBJ_OBJECT_INITIALIZED 0x08
......
/****************************************************************************** /******************************************************************************
* *
* Name: acoutput.h -- debug output * Name: acoutput.h -- debug output
* $Revision: 86 $ * $Revision: 87 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -105,6 +105,16 @@ ...@@ -105,6 +105,16 @@
#define ACPI_LV_INTERRUPTS 0x08000000 #define ACPI_LV_INTERRUPTS 0x08000000
#define ACPI_LV_VERBOSITY3 0x0F000000 | ACPI_LV_VERBOSITY2 #define ACPI_LV_VERBOSITY3 0x0F000000 | ACPI_LV_VERBOSITY2
/* Exceptionally verbose output -- also used in the global "Debug_level" */
#define ACPI_LV_AML_DISASSEMBLE 0x10000000
#define ACPI_LV_VERBOSE_INFO 0x20000000
#define ACPI_LV_FULL_TABLES 0x40000000
#define ACPI_LV_EVENTS 0x80000000
#define ACPI_LV_VERBOSE 0xF0000000
/* /*
* Debug level macros that are used in the DEBUG_PRINT macros * Debug level macros that are used in the DEBUG_PRINT macros
*/ */
...@@ -145,17 +155,7 @@ ...@@ -145,17 +155,7 @@
#define ACPI_DB_MUTEX ACPI_DEBUG_LEVEL (ACPI_LV_MUTEX) #define ACPI_DB_MUTEX ACPI_DEBUG_LEVEL (ACPI_LV_MUTEX)
#define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) #define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT)
#define ACPI_DB_ALL ACPI_DEBUG_LEVEL (0x0FFFFF80) #define ACPI_DB_ALL ACPI_DEBUG_LEVEL (ACPI_LV_ALL)
/* Exceptionally verbose output -- also used in the global "Debug_level" */
#define ACPI_DB_AML_DISASSEMBLE 0x10000000
#define ACPI_DB_VERBOSE_INFO 0x20000000
#define ACPI_DB_FULL_TABLES 0x40000000
#define ACPI_DB_EVENTS 0x80000000
#define ACPI_DB_VERBOSE 0xF0000000
/* Defaults for Debug_level, debug and normal */ /* Defaults for Debug_level, debug and normal */
......
...@@ -195,6 +195,14 @@ acpi_evaluate_object ( ...@@ -195,6 +195,14 @@ acpi_evaluate_object (
acpi_object_list *parameter_objects, acpi_object_list *parameter_objects,
acpi_buffer *return_object_buffer); acpi_buffer *return_object_buffer);
acpi_status
acpi_evaluate_object_typed (
acpi_handle object,
acpi_string pathname,
acpi_object_list *external_params,
acpi_buffer *return_buffer,
acpi_object_type return_type);
acpi_status acpi_status
acpi_get_object_info ( acpi_get_object_info (
acpi_handle device, acpi_handle device,
......
/****************************************************************************** /******************************************************************************
* *
* Name: acutils.h -- prototypes for the common (subsystem-wide) procedures * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
* $Revision: 137 $ * $Revision: 139 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -104,6 +104,10 @@ NATIVE_CHAR * ...@@ -104,6 +104,10 @@ NATIVE_CHAR *
acpi_ut_get_type_name ( acpi_ut_get_type_name (
acpi_object_type type); acpi_object_type type);
NATIVE_CHAR *
acpi_ut_get_object_type_name (
acpi_operand_object *obj_desc);
#endif #endif
...@@ -663,17 +667,6 @@ NATIVE_CHAR * ...@@ -663,17 +667,6 @@ NATIVE_CHAR *
acpi_ut_strupr ( acpi_ut_strupr (
NATIVE_CHAR *src_string); NATIVE_CHAR *src_string);
acpi_status
acpi_ut_resolve_package_references (
acpi_operand_object *obj_desc);
acpi_status
acpi_ut_resolve_reference (
u8 object_type,
acpi_operand_object *source_object,
acpi_generic_state *state,
void *context);
u8 * u8 *
acpi_ut_get_resource_end_tag ( acpi_ut_get_resource_end_tag (
acpi_operand_object *obj_desc); acpi_operand_object *obj_desc);
......
/****************************************************************************** /******************************************************************************
* *
* Name: acenv.h - Generation environment specific items * Name: acenv.h - Generation environment specific items
* $Revision: 94 $ * $Revision: 95 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -55,17 +55,6 @@ ...@@ -55,17 +55,6 @@
#define ACPI_USE_SYSTEM_CLIBRARY #define ACPI_USE_SYSTEM_CLIBRARY
#endif #endif
/*
* Memory allocation tracking. Used only if
* 1) This is the debug version
* 2) This is NOT a 16-bit version of the code (not enough real-mode memory)
*/
#ifdef ACPI_DEBUG
#if ACPI_MACHINE_WIDTH != 16
#define ACPI_DBG_TRACK_ALLOCATIONS
#endif
#endif
/* /*
* Environment configuration. The purpose of this file is to interface to the * Environment configuration. The purpose of this file is to interface to the
* local generation environment. * local generation environment.
...@@ -151,8 +140,39 @@ ...@@ -151,8 +140,39 @@
#endif #endif
/*
* Memory allocation tracking. Used only if
* 1) This is the debug version
* 2) This is NOT a 16-bit version of the code (not enough real-mode memory)
*/
#ifdef ACPI_DEBUG
#if ACPI_MACHINE_WIDTH != 16
#define ACPI_DBG_TRACK_ALLOCATIONS
#endif
#endif
/*! [End] no source code translation !*/ /*! [End] no source code translation !*/
/*
* Debugger threading model
* Use single threaded if the entire subsystem is contained in an application
* Use multiple threaded when the subsystem is running in the kernel.
*
* By default the model is single threaded if ACPI_APPLICATION is set,
* multi-threaded if ACPI_APPLICATION is not set.
*/
#define DEBUGGER_SINGLE_THREADED 0
#define DEBUGGER_MULTI_THREADED 1
#ifdef ACPI_APPLICATION
#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
#else
#define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED
#endif
/****************************************************************************** /******************************************************************************
* *
* C library configuration * C library configuration
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: nsaccess - Top-level functions for accessing ACPI namespace * Module Name: nsaccess - Top-level functions for accessing ACPI namespace
* $Revision: 155 $ * $Revision: 156 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -179,7 +179,7 @@ acpi_ns_root_initialize (void) ...@@ -179,7 +179,7 @@ acpi_ns_root_initialize (void)
/* Store pointer to value descriptor in the Node */ /* Store pointer to value descriptor in the Node */
status = acpi_ns_attach_object (new_node, obj_desc, obj_desc->common.type); status = acpi_ns_attach_object (new_node, obj_desc, ACPI_GET_OBJECT_TYPE (obj_desc));
/* Remove local reference to the object */ /* Remove local reference to the object */
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: nsdump - table dumping routines for debug * Module Name: nsdump - table dumping routines for debug
* $Revision: 135 $ * $Revision: 136 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -500,7 +500,7 @@ acpi_ns_dump_one_object ( ...@@ -500,7 +500,7 @@ acpi_ns_dump_one_object (
case ACPI_DESC_TYPE_OPERAND: case ACPI_DESC_TYPE_OPERAND:
obj_type = obj_desc->common.type; obj_type = ACPI_GET_OBJECT_TYPE (obj_desc);
if (obj_type > INTERNAL_TYPE_MAX) { if (obj_type > INTERNAL_TYPE_MAX) {
acpi_os_printf ("(Ptr to ACPI Object type %X [UNKNOWN])\n", obj_type); acpi_os_printf ("(Ptr to ACPI Object type %X [UNKNOWN])\n", obj_type);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* *
* Module Name: nseval - Object evaluation interfaces -- includes control * Module Name: nseval - Object evaluation interfaces -- includes control
* method lookup and execution. * method lookup and execution.
* $Revision: 114 $ * $Revision: 116 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -40,12 +40,12 @@ ...@@ -40,12 +40,12 @@
* FUNCTION: Acpi_ns_evaluate_relative * FUNCTION: Acpi_ns_evaluate_relative
* *
* PARAMETERS: Handle - The relative containing object * PARAMETERS: Handle - The relative containing object
* *Pathname - Name of method to execute, If NULL, the * Pathname - Name of method to execute, If NULL, the
* handle is the object to execute * handle is the object to execute
* **Params - List of parameters to pass to the method, * Params - List of parameters to pass to the method,
* terminated by NULL. Params itself may be * terminated by NULL. Params itself may be
* NULL if no parameters are being passed. * NULL if no parameters are being passed.
* *Return_object - Where to put method's return value (if * Return_object - Where to put method's return value (if
* any). If NULL, no value is returned. * any). If NULL, no value is returned.
* *
* RETURN: Status * RETURN: Status
...@@ -141,9 +141,9 @@ acpi_ns_evaluate_relative ( ...@@ -141,9 +141,9 @@ acpi_ns_evaluate_relative (
* FUNCTION: Acpi_ns_evaluate_by_name * FUNCTION: Acpi_ns_evaluate_by_name
* *
* PARAMETERS: Pathname - Fully qualified pathname to the object * PARAMETERS: Pathname - Fully qualified pathname to the object
* *Return_object - Where to put method's return value (if * Return_object - Where to put method's return value (if
* any). If NULL, no value is returned. * any). If NULL, no value is returned.
* **Params - List of parameters to pass to the method, * Params - List of parameters to pass to the method,
* terminated by NULL. Params itself may be * terminated by NULL. Params itself may be
* NULL if no parameters are being passed. * NULL if no parameters are being passed.
* *
...@@ -226,10 +226,10 @@ acpi_ns_evaluate_by_name ( ...@@ -226,10 +226,10 @@ acpi_ns_evaluate_by_name (
* FUNCTION: Acpi_ns_evaluate_by_handle * FUNCTION: Acpi_ns_evaluate_by_handle
* *
* PARAMETERS: Handle - Method Node to execute * PARAMETERS: Handle - Method Node to execute
* **Params - List of parameters to pass to the method, * Params - List of parameters to pass to the method,
* terminated by NULL. Params itself may be * terminated by NULL. Params itself may be
* NULL if no parameters are being passed. * NULL if no parameters are being passed.
* *Return_object - Where to put method's return value (if * Return_object - Where to put method's return value (if
* any). If NULL, no value is returned. * any). If NULL, no value is returned.
* *
* RETURN: Status * RETURN: Status
...@@ -285,7 +285,6 @@ acpi_ns_evaluate_by_handle ( ...@@ -285,7 +285,6 @@ acpi_ns_evaluate_by_handle (
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
} }
/* /*
* Two major cases here: * Two major cases here:
* 1) The object is an actual control method -- execute it. * 1) The object is an actual control method -- execute it.
...@@ -302,7 +301,6 @@ acpi_ns_evaluate_by_handle ( ...@@ -302,7 +301,6 @@ acpi_ns_evaluate_by_handle (
status = acpi_ns_execute_control_method (node, params, status = acpi_ns_execute_control_method (node, params,
&local_return_object); &local_return_object);
} }
else { else {
/* /*
* Case 2) Object is NOT a method, just return its * Case 2) Object is NOT a method, just return its
...@@ -311,7 +309,6 @@ acpi_ns_evaluate_by_handle ( ...@@ -311,7 +309,6 @@ acpi_ns_evaluate_by_handle (
status = acpi_ns_get_object_value (node, &local_return_object); status = acpi_ns_get_object_value (node, &local_return_object);
} }
/* /*
* Check if there is a return value on the stack that must * Check if there is a return value on the stack that must
* be dealt with * be dealt with
...@@ -348,11 +345,11 @@ acpi_ns_evaluate_by_handle ( ...@@ -348,11 +345,11 @@ acpi_ns_evaluate_by_handle (
* *
* FUNCTION: Acpi_ns_execute_control_method * FUNCTION: Acpi_ns_execute_control_method
* *
* PARAMETERS: Method_node - The object/method * PARAMETERS: Method_node - The method to execute
* **Params - List of parameters to pass to the method, * Params - List of parameters to pass to the method,
* terminated by NULL. Params itself may be * terminated by NULL. Params itself may be
* NULL if no parameters are being passed. * NULL if no parameters are being passed.
* **Return_obj_desc - List of result objects to be returned * Return_obj_desc - List of result objects to be returned
* from the method. * from the method.
* *
* RETURN: Status * RETURN: Status
...@@ -425,6 +422,7 @@ acpi_ns_execute_control_method ( ...@@ -425,6 +422,7 @@ acpi_ns_execute_control_method (
* FUNCTION: Acpi_ns_get_object_value * FUNCTION: Acpi_ns_get_object_value
* *
* PARAMETERS: Node - The object * PARAMETERS: Node - The object
* Return_obj_desc - Where the objects value is returned
* *
* RETURN: Status * RETURN: Status
* *
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* *
* Module Name: nsobject - Utilities for objects attached to namespace * Module Name: nsobject - Utilities for objects attached to namespace
* table entries * table entries
* $Revision: 82 $ * $Revision: 83 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -199,8 +199,9 @@ acpi_ns_detach_object ( ...@@ -199,8 +199,9 @@ acpi_ns_detach_object (
obj_desc = node->object; obj_desc = node->object;
if (!obj_desc || if (!obj_desc ||
(obj_desc->common.type == INTERNAL_TYPE_DATA)) { (ACPI_GET_OBJECT_TYPE (obj_desc) == INTERNAL_TYPE_DATA)) {
return_VOID; return_VOID;
} }
...@@ -210,7 +211,7 @@ acpi_ns_detach_object ( ...@@ -210,7 +211,7 @@ acpi_ns_detach_object (
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) { if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) {
node->object = obj_desc->common.next_object; node->object = obj_desc->common.next_object;
if (node->object && if (node->object &&
(node->object->common.type != INTERNAL_TYPE_DATA)) { (ACPI_GET_OBJECT_TYPE (node->object) != INTERNAL_TYPE_DATA)) {
node->object = node->object->common.next_object; node->object = node->object->common.next_object;
} }
} }
...@@ -255,7 +256,7 @@ acpi_ns_get_attached_object ( ...@@ -255,7 +256,7 @@ acpi_ns_get_attached_object (
if (!node->object || if (!node->object ||
((ACPI_GET_DESCRIPTOR_TYPE (node->object) != ACPI_DESC_TYPE_OPERAND) && ((ACPI_GET_DESCRIPTOR_TYPE (node->object) != ACPI_DESC_TYPE_OPERAND) &&
(ACPI_GET_DESCRIPTOR_TYPE (node->object) != ACPI_DESC_TYPE_NAMED)) || (ACPI_GET_DESCRIPTOR_TYPE (node->object) != ACPI_DESC_TYPE_NAMED)) ||
(node->object->common.type == INTERNAL_TYPE_DATA)) { (ACPI_GET_OBJECT_TYPE (node->object) == INTERNAL_TYPE_DATA)) {
return_PTR (NULL); return_PTR (NULL);
} }
...@@ -282,9 +283,9 @@ acpi_ns_get_secondary_object ( ...@@ -282,9 +283,9 @@ acpi_ns_get_secondary_object (
if ((!obj_desc) || if ((!obj_desc) ||
(obj_desc->common.type == INTERNAL_TYPE_DATA) || (ACPI_GET_OBJECT_TYPE (obj_desc) == INTERNAL_TYPE_DATA) ||
(!obj_desc->common.next_object) || (!obj_desc->common.next_object) ||
(obj_desc->common.next_object->common.type == INTERNAL_TYPE_DATA)) { (ACPI_GET_OBJECT_TYPE (obj_desc->common.next_object) == INTERNAL_TYPE_DATA)) {
return_PTR (NULL); return_PTR (NULL);
} }
...@@ -319,7 +320,7 @@ acpi_ns_attach_data ( ...@@ -319,7 +320,7 @@ acpi_ns_attach_data (
prev_obj_desc = NULL; prev_obj_desc = NULL;
obj_desc = node->object; obj_desc = node->object;
while (obj_desc) { while (obj_desc) {
if ((obj_desc->common.type == INTERNAL_TYPE_DATA) && if ((ACPI_GET_OBJECT_TYPE (obj_desc) == INTERNAL_TYPE_DATA) &&
(obj_desc->data.handler == handler)) { (obj_desc->data.handler == handler)) {
return (AE_ALREADY_EXISTS); return (AE_ALREADY_EXISTS);
} }
...@@ -377,7 +378,7 @@ acpi_ns_detach_data ( ...@@ -377,7 +378,7 @@ acpi_ns_detach_data (
prev_obj_desc = NULL; prev_obj_desc = NULL;
obj_desc = node->object; obj_desc = node->object;
while (obj_desc) { while (obj_desc) {
if ((obj_desc->common.type == INTERNAL_TYPE_DATA) && if ((ACPI_GET_OBJECT_TYPE (obj_desc) == INTERNAL_TYPE_DATA) &&
(obj_desc->data.handler == handler)) { (obj_desc->data.handler == handler)) {
if (prev_obj_desc) { if (prev_obj_desc) {
prev_obj_desc->common.next_object = obj_desc->common.next_object; prev_obj_desc->common.next_object = obj_desc->common.next_object;
...@@ -421,7 +422,7 @@ acpi_ns_get_attached_data ( ...@@ -421,7 +422,7 @@ acpi_ns_get_attached_data (
obj_desc = node->object; obj_desc = node->object;
while (obj_desc) { while (obj_desc) {
if ((obj_desc->common.type == INTERNAL_TYPE_DATA) && if ((ACPI_GET_OBJECT_TYPE (obj_desc) == INTERNAL_TYPE_DATA) &&
(obj_desc->data.handler == handler)) { (obj_desc->data.handler == handler)) {
*data = obj_desc->data.pointer; *data = obj_desc->data.pointer;
return (AE_OK); return (AE_OK);
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: nssearch - Namespace search * Module Name: nssearch - Namespace search
* $Revision: 85 $ * $Revision: 86 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -204,7 +204,8 @@ acpi_ns_search_parent_tree ( ...@@ -204,7 +204,8 @@ acpi_ns_search_parent_tree (
} }
if (acpi_ns_local (type)) { if (acpi_ns_local (type)) {
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] type [%s] must be local to this scope (no parent search)\n", ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"[%4.4s] type [%s] must be local to this scope (no parent search)\n",
(char *) &target_name, acpi_ut_get_type_name (type))); (char *) &target_name, acpi_ut_get_type_name (type)));
} }
......
...@@ -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: 109 $ * $Revision: 110 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -227,7 +227,7 @@ acpi_ns_build_internal_name ( ...@@ -227,7 +227,7 @@ acpi_ns_build_internal_name (
NATIVE_CHAR *internal_name = info->internal_name; NATIVE_CHAR *internal_name = info->internal_name;
NATIVE_CHAR *external_name = info->next_external_char; NATIVE_CHAR *external_name = info->next_external_char;
NATIVE_CHAR *result = NULL; NATIVE_CHAR *result = NULL;
NATIVE_UINT_MIN32 i; NATIVE_UINT i;
ACPI_FUNCTION_TRACE ("Ns_build_internal_name"); ACPI_FUNCTION_TRACE ("Ns_build_internal_name");
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: psopcode - Parser/Interpreter opcode information table * Module Name: psopcode - Parser/Interpreter opcode information table
* $Revision: 69 $ * $Revision: 70 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -453,8 +453,8 @@ const acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = ...@@ -453,8 +453,8 @@ const acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] =
/*! [Begin] no source code translation */ /*! [Begin] no source code translation */
/* Index Name Parser Args Interpreter Args ObjectType Class Type Flags */ /* Index Name Parser Args Interpreter Args ObjectType Class Type Flags */
/* 00 */ ACPI_OP ("Zero", ARGP_ZERO_OP, ARGI_ZERO_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), /* 00 */ ACPI_OP ("Zero", ARGP_ZERO_OP, ARGI_ZERO_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
/* 01 */ ACPI_OP ("One", ARGP_ONE_OP, ARGI_ONE_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), /* 01 */ ACPI_OP ("One", ARGP_ONE_OP, ARGI_ONE_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
/* 02 */ ACPI_OP ("Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP, INTERNAL_TYPE_ALIAS, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), /* 02 */ ACPI_OP ("Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP, INTERNAL_TYPE_ALIAS, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 03 */ ACPI_OP ("Name", ARGP_NAME_OP, ARGI_NAME_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), /* 03 */ ACPI_OP ("Name", ARGP_NAME_OP, ARGI_NAME_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 04 */ ACPI_OP ("ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT), /* 04 */ ACPI_OP ("ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
...@@ -522,7 +522,7 @@ const acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = ...@@ -522,7 +522,7 @@ const acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] =
/* 42 */ ACPI_OP ("Return", ARGP_RETURN_OP, ARGI_RETURN_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), /* 42 */ ACPI_OP ("Return", ARGP_RETURN_OP, ARGI_RETURN_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
/* 43 */ ACPI_OP ("Break", ARGP_BREAK_OP, ARGI_BREAK_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), /* 43 */ ACPI_OP ("Break", ARGP_BREAK_OP, ARGI_BREAK_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
/* 44 */ ACPI_OP ("BreakPoint", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), /* 44 */ ACPI_OP ("BreakPoint", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
/* 45 */ ACPI_OP ("Ones", ARGP_ONES_OP, ARGI_ONES_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), /* 45 */ ACPI_OP ("Ones", ARGP_ONES_OP, ARGI_ONES_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
/* Prefixed opcodes (Two-byte opcodes with a prefix op) */ /* Prefixed opcodes (Two-byte opcodes with a prefix op) */
...@@ -541,7 +541,7 @@ const acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = ...@@ -541,7 +541,7 @@ const acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] =
/* 52 */ ACPI_OP ("FromBCD", ARGP_FROM_BCD_OP, ARGI_FROM_BCD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), /* 52 */ ACPI_OP ("FromBCD", ARGP_FROM_BCD_OP, ARGI_FROM_BCD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
/* 53 */ ACPI_OP ("ToBCD", ARGP_TO_BCD_OP, ARGI_TO_BCD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), /* 53 */ ACPI_OP ("ToBCD", ARGP_TO_BCD_OP, ARGI_TO_BCD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
/* 54 */ ACPI_OP ("Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), /* 54 */ ACPI_OP ("Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
/* 55 */ ACPI_OP ("Revision", ARGP_REVISION_OP, ARGI_REVISION_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0), /* 55 */ ACPI_OP ("Revision", ARGP_REVISION_OP, ARGI_REVISION_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
/* 56 */ ACPI_OP ("Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0), /* 56 */ ACPI_OP ("Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
/* 57 */ ACPI_OP ("Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_0T_0R, AML_FLAGS_EXEC_3A_0T_0R), /* 57 */ ACPI_OP ("Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_0T_0R, AML_FLAGS_EXEC_3A_0T_0R),
/* 58 */ ACPI_OP ("OperationRegion", ARGP_REGION_OP, ARGI_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER), /* 58 */ ACPI_OP ("OperationRegion", ARGP_REGION_OP, ARGI_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER),
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: rscalc - Calculate stream and list lengths * Module Name: rscalc - Calculate stream and list lengths
* $Revision: 42 $ * $Revision: 43 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -770,8 +770,8 @@ acpi_rs_get_pci_routing_table_length ( ...@@ -770,8 +770,8 @@ acpi_rs_get_pci_routing_table_length (
name_found = FALSE; name_found = FALSE;
for (table_index = 0; table_index < 4 && !name_found; table_index++) { for (table_index = 0; table_index < 4 && !name_found; table_index++) {
if ((ACPI_TYPE_STRING == (*sub_object_list)->common.type) || if ((ACPI_TYPE_STRING == ACPI_GET_OBJECT_TYPE (*sub_object_list)) ||
((INTERNAL_TYPE_REFERENCE == (*sub_object_list)->common.type) && ((INTERNAL_TYPE_REFERENCE == ACPI_GET_OBJECT_TYPE (*sub_object_list)) &&
((*sub_object_list)->reference.opcode == AML_INT_NAMEPATH_OP))) { ((*sub_object_list)->reference.opcode == AML_INT_NAMEPATH_OP))) {
name_found = TRUE; name_found = TRUE;
} }
...@@ -789,7 +789,7 @@ acpi_rs_get_pci_routing_table_length ( ...@@ -789,7 +789,7 @@ acpi_rs_get_pci_routing_table_length (
* Was a String type found? * Was a String type found?
*/ */
if (name_found) { if (name_found) {
if (ACPI_TYPE_STRING == (*sub_object_list)->common.type) { if (ACPI_GET_OBJECT_TYPE (*sub_object_list) == ACPI_TYPE_STRING) {
/* /*
* The length String.Length field includes the * The length String.Length field includes the
* terminating NULL * terminating NULL
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: rscreate - Create resource lists/tables * Module Name: rscreate - Create resource lists/tables
* $Revision: 56 $ * $Revision: 57 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -212,12 +212,12 @@ acpi_rs_create_pci_routing_table ( ...@@ -212,12 +212,12 @@ acpi_rs_create_pci_routing_table (
/* /*
* 1) First subobject: Dereference the Address * 1) First subobject: Dereference the Address
*/ */
if (ACPI_TYPE_INTEGER == (*sub_object_list)->common.type) { if (ACPI_GET_OBJECT_TYPE (*sub_object_list) == ACPI_TYPE_INTEGER) {
user_prt->address = (*sub_object_list)->integer.value; user_prt->address = (*sub_object_list)->integer.value;
} }
else { else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n",
acpi_ut_get_type_name ((*sub_object_list)->common.type))); acpi_ut_get_object_type_name (*sub_object_list)));
return_ACPI_STATUS (AE_BAD_DATA); return_ACPI_STATUS (AE_BAD_DATA);
} }
...@@ -226,12 +226,12 @@ acpi_rs_create_pci_routing_table ( ...@@ -226,12 +226,12 @@ acpi_rs_create_pci_routing_table (
*/ */
sub_object_list++; sub_object_list++;
if (ACPI_TYPE_INTEGER == (*sub_object_list)->common.type) { if (ACPI_GET_OBJECT_TYPE (*sub_object_list) == ACPI_TYPE_INTEGER) {
user_prt->pin = (u32) (*sub_object_list)->integer.value; user_prt->pin = (u32) (*sub_object_list)->integer.value;
} }
else { else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n",
acpi_ut_get_type_name ((*sub_object_list)->common.type))); acpi_ut_get_object_type_name (*sub_object_list)));
return_ACPI_STATUS (AE_BAD_DATA); return_ACPI_STATUS (AE_BAD_DATA);
} }
...@@ -240,7 +240,7 @@ acpi_rs_create_pci_routing_table ( ...@@ -240,7 +240,7 @@ acpi_rs_create_pci_routing_table (
*/ */
sub_object_list++; sub_object_list++;
switch ((*sub_object_list)->common.type) { switch (ACPI_GET_OBJECT_TYPE (*sub_object_list)) {
case INTERNAL_TYPE_REFERENCE: case INTERNAL_TYPE_REFERENCE:
if ((*sub_object_list)->reference.opcode != AML_INT_NAMEPATH_OP) { if ((*sub_object_list)->reference.opcode != AML_INT_NAMEPATH_OP) {
...@@ -288,7 +288,7 @@ acpi_rs_create_pci_routing_table ( ...@@ -288,7 +288,7 @@ acpi_rs_create_pci_routing_table (
default: default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n",
acpi_ut_get_type_name ((*sub_object_list)->common.type))); acpi_ut_get_object_type_name (*sub_object_list)));
return_ACPI_STATUS (AE_BAD_DATA); return_ACPI_STATUS (AE_BAD_DATA);
} }
...@@ -301,12 +301,12 @@ acpi_rs_create_pci_routing_table ( ...@@ -301,12 +301,12 @@ acpi_rs_create_pci_routing_table (
*/ */
sub_object_list++; sub_object_list++;
if (ACPI_TYPE_INTEGER == (*sub_object_list)->common.type) { if (ACPI_GET_OBJECT_TYPE (*sub_object_list) == ACPI_TYPE_INTEGER) {
user_prt->source_index = (u32) (*sub_object_list)->integer.value; user_prt->source_index = (u32) (*sub_object_list)->integer.value;
} }
else { else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n",
acpi_ut_get_type_name ((*sub_object_list)->common.type))); acpi_ut_get_object_type_name (*sub_object_list)));
return_ACPI_STATUS (AE_BAD_DATA); return_ACPI_STATUS (AE_BAD_DATA);
} }
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: rsutils - Utilities for the resource manager * Module Name: rsutils - Utilities for the resource manager
* $Revision: 30 $ * $Revision: 33 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -56,7 +56,7 @@ acpi_rs_get_prt_method_data ( ...@@ -56,7 +56,7 @@ acpi_rs_get_prt_method_data (
acpi_handle handle, acpi_handle handle,
acpi_buffer *ret_buffer) acpi_buffer *ret_buffer)
{ {
acpi_operand_object *ret_obj; acpi_operand_object *obj_desc;
acpi_status status; acpi_status status;
...@@ -68,12 +68,12 @@ acpi_rs_get_prt_method_data ( ...@@ -68,12 +68,12 @@ acpi_rs_get_prt_method_data (
/* /*
* Execute the method, no parameters * Execute the method, no parameters
*/ */
status = acpi_ns_evaluate_relative (handle, "_PRT", NULL, &ret_obj); status = acpi_ns_evaluate_relative (handle, "_PRT", NULL, &obj_desc);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
if (!ret_obj) { if (!obj_desc) {
/* Return object is required */ /* Return object is required */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _PRT\n")); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _PRT\n"));
...@@ -81,13 +81,13 @@ acpi_rs_get_prt_method_data ( ...@@ -81,13 +81,13 @@ acpi_rs_get_prt_method_data (
} }
/* /*
* The return object will be a package, so check the parameters. If the * The return object must be a package, so check the parameters. If the
* return object is not a package, then the underlying AML code is corrupt * return object is not a package, then the underlying AML code is corrupt
* or improperly written. * or improperly written.
*/ */
if (ACPI_TYPE_PACKAGE != ret_obj->common.type) { if (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_PACKAGE) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_PRT did not return a Package, returned %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_PRT did not return a Package, returned %s\n",
acpi_ut_get_type_name (ret_obj->common.type))); acpi_ut_get_object_type_name (obj_desc)));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
goto cleanup; goto cleanup;
} }
...@@ -96,13 +96,13 @@ acpi_rs_get_prt_method_data ( ...@@ -96,13 +96,13 @@ acpi_rs_get_prt_method_data (
* Create a resource linked list from the byte stream buffer that comes * Create a resource linked list from the byte stream buffer that comes
* back from the _CRS method execution. * back from the _CRS method execution.
*/ */
status = acpi_rs_create_pci_routing_table (ret_obj, ret_buffer); status = acpi_rs_create_pci_routing_table (obj_desc, ret_buffer);
/* On exit, we must delete the object returned by Evaluate_object */ /* On exit, we must delete the object returned by Evaluate_object */
cleanup: cleanup:
acpi_ut_remove_reference (ret_obj); acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -130,7 +130,7 @@ acpi_rs_get_crs_method_data ( ...@@ -130,7 +130,7 @@ acpi_rs_get_crs_method_data (
acpi_handle handle, acpi_handle handle,
acpi_buffer *ret_buffer) acpi_buffer *ret_buffer)
{ {
acpi_operand_object *ret_obj; acpi_operand_object *obj_desc;
acpi_status status; acpi_status status;
...@@ -142,12 +142,12 @@ acpi_rs_get_crs_method_data ( ...@@ -142,12 +142,12 @@ acpi_rs_get_crs_method_data (
/* /*
* Execute the method, no parameters * Execute the method, no parameters
*/ */
status = acpi_ns_evaluate_relative (handle, "_CRS", NULL, &ret_obj); status = acpi_ns_evaluate_relative (handle, "_CRS", NULL, &obj_desc);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
if (!ret_obj) { if (!obj_desc) {
/* Return object is required */ /* Return object is required */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _CRS\n")); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _CRS\n"));
...@@ -160,9 +160,9 @@ acpi_rs_get_crs_method_data ( ...@@ -160,9 +160,9 @@ acpi_rs_get_crs_method_data (
* then the underlying AML code is corrupt or improperly * then the underlying AML code is corrupt or improperly
* written. * written.
*/ */
if (ACPI_TYPE_BUFFER != ret_obj->common.type) { if (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_BUFFER) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_CRS did not return a Buffer, returned %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_CRS did not return a Buffer, returned %s\n",
acpi_ut_get_type_name (ret_obj->common.type))); acpi_ut_get_object_type_name (obj_desc)));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
goto cleanup; goto cleanup;
} }
...@@ -172,13 +172,13 @@ acpi_rs_get_crs_method_data ( ...@@ -172,13 +172,13 @@ acpi_rs_get_crs_method_data (
* byte stream buffer that comes back from the _CRS method * byte stream buffer that comes back from the _CRS method
* execution. * execution.
*/ */
status = acpi_rs_create_resource_list (ret_obj, ret_buffer); status = acpi_rs_create_resource_list (obj_desc, ret_buffer);
/* On exit, we must delete the object returned by evaluate_object */ /* On exit, we must delete the object returned by evaluate_object */
cleanup: cleanup:
acpi_ut_remove_reference (ret_obj); acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -206,7 +206,7 @@ acpi_rs_get_prs_method_data ( ...@@ -206,7 +206,7 @@ acpi_rs_get_prs_method_data (
acpi_handle handle, acpi_handle handle,
acpi_buffer *ret_buffer) acpi_buffer *ret_buffer)
{ {
acpi_operand_object *ret_obj; acpi_operand_object *obj_desc;
acpi_status status; acpi_status status;
...@@ -218,12 +218,12 @@ acpi_rs_get_prs_method_data ( ...@@ -218,12 +218,12 @@ acpi_rs_get_prs_method_data (
/* /*
* Execute the method, no parameters * Execute the method, no parameters
*/ */
status = acpi_ns_evaluate_relative (handle, "_PRS", NULL, &ret_obj); status = acpi_ns_evaluate_relative (handle, "_PRS", NULL, &obj_desc);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
if (!ret_obj) { if (!obj_desc) {
/* Return object is required */ /* Return object is required */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _PRS\n")); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _PRS\n"));
...@@ -236,9 +236,9 @@ acpi_rs_get_prs_method_data ( ...@@ -236,9 +236,9 @@ acpi_rs_get_prs_method_data (
* then the underlying AML code is corrupt or improperly * then the underlying AML code is corrupt or improperly
* written.. * written..
*/ */
if (ACPI_TYPE_BUFFER != ret_obj->common.type) { if (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_BUFFER) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_PRS did not return a Buffer, returned %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_PRS did not return a Buffer, returned %s\n",
acpi_ut_get_type_name (ret_obj->common.type))); acpi_ut_get_object_type_name (obj_desc)));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
goto cleanup; goto cleanup;
} }
...@@ -248,13 +248,13 @@ acpi_rs_get_prs_method_data ( ...@@ -248,13 +248,13 @@ acpi_rs_get_prs_method_data (
* byte stream buffer that comes back from the _CRS method * byte stream buffer that comes back from the _CRS method
* execution. * execution.
*/ */
status = acpi_rs_create_resource_list (ret_obj, ret_buffer); status = acpi_rs_create_resource_list (obj_desc, ret_buffer);
/* On exit, we must delete the object returned by evaluate_object */ /* On exit, we must delete the object returned by evaluate_object */
cleanup: cleanup:
acpi_ut_remove_reference (ret_obj); acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -319,6 +319,7 @@ acpi_rs_set_srs_method_data ( ...@@ -319,6 +319,7 @@ acpi_rs_set_srs_method_data (
*/ */
params[0]->buffer.length = (u32) buffer.length; params[0]->buffer.length = (u32) buffer.length;
params[0]->buffer.pointer = buffer.pointer; params[0]->buffer.pointer = buffer.pointer;
params[0]->common.flags = AOPOBJ_DATA_VALID;
params[1] = NULL; params[1] = NULL;
/* /*
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: tbutils - Table manipulation utilities * Module Name: tbutils - Table manipulation utilities
* $Revision: 53 $ * $Revision: 54 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -91,7 +91,7 @@ acpi_tb_handle_to_object ( ...@@ -91,7 +91,7 @@ acpi_tb_handle_to_object (
* name * name
* 3) Table must be readable for length specified in the header * 3) Table must be readable for length specified in the header
* 4) Table checksum must be valid (with the exception of the FACS * 4) Table checksum must be valid (with the exception of the FACS
* which has no checksum for some odd reason) * which has no checksum because it contains variable fields)
* *
******************************************************************************/ ******************************************************************************/
...@@ -187,21 +187,26 @@ acpi_tb_map_acpi_table ( ...@@ -187,21 +187,26 @@ acpi_tb_map_acpi_table (
table_size = (ACPI_SIZE) table->length; table_size = (ACPI_SIZE) table->length;
#if 0
/* We don't want to validate the header here. */
/* /*
* Validate the header and delete the mapping. * Validate the header and delete the mapping.
* We will create a mapping for the full table below. * We will create a mapping for the full table below.
*/ */
status = acpi_tb_validate_table_header (table); status = acpi_tb_validate_table_header (table);
#endif
/* Always unmap the memory for the header */ /* Always unmap the memory for the header */
acpi_os_unmap_memory (table, sizeof (acpi_table_header)); acpi_os_unmap_memory (table, sizeof (acpi_table_header));
#if 0
/* Exit if header invalid */ /* Exit if header invalid */
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return (status); return (status);
} }
#endif
} }
/* Map the physical memory for the correct length */ /* Map the physical memory for the correct length */
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: utcopy - Internal to external object translation utilities * Module Name: utcopy - Internal to external object translation utilities
* $Revision: 98 $ * $Revision: 101 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -57,7 +57,6 @@ acpi_ut_copy_isimple_to_esimple ( ...@@ -57,7 +57,6 @@ acpi_ut_copy_isimple_to_esimple (
u8 *data_space, u8 *data_space,
ACPI_SIZE *buffer_space_used) ACPI_SIZE *buffer_space_used)
{ {
acpi_buffer buffer;
acpi_status status = AE_OK; acpi_status status = AE_OK;
...@@ -68,7 +67,7 @@ acpi_ut_copy_isimple_to_esimple ( ...@@ -68,7 +67,7 @@ acpi_ut_copy_isimple_to_esimple (
/* /*
* Check for NULL object case (could be an uninitialized * Check for NULL object case (could be an uninitialized
* package element * package element)
*/ */
if (!internal_object) { if (!internal_object) {
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
...@@ -82,11 +81,11 @@ acpi_ut_copy_isimple_to_esimple ( ...@@ -82,11 +81,11 @@ acpi_ut_copy_isimple_to_esimple (
* In general, the external object will be the same type as * In general, the external object will be the same type as
* the internal object * the internal object
*/ */
external_object->type = internal_object->common.type; external_object->type = ACPI_GET_OBJECT_TYPE (internal_object);
/* However, only a limited number of external types are supported */ /* However, only a limited number of external types are supported */
switch (internal_object->common.type) { switch (ACPI_GET_OBJECT_TYPE (internal_object)) {
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
external_object->string.pointer = (NATIVE_CHAR *) data_space; external_object->string.pointer = (NATIVE_CHAR *) data_space;
...@@ -121,45 +120,9 @@ acpi_ut_copy_isimple_to_esimple ( ...@@ -121,45 +120,9 @@ acpi_ut_copy_isimple_to_esimple (
* This is an object reference. Attempt to dereference it. * This is an object reference. Attempt to dereference it.
*/ */
switch (internal_object->reference.opcode) { switch (internal_object->reference.opcode) {
case AML_ZERO_OP:
external_object->type = ACPI_TYPE_INTEGER;
external_object->integer.value = 0;
break;
case AML_ONE_OP:
external_object->type = ACPI_TYPE_INTEGER;
external_object->integer.value = 1;
break;
case AML_ONES_OP:
external_object->type = ACPI_TYPE_INTEGER;
external_object->integer.value = ACPI_INTEGER_MAX;
break;
case AML_REVISION_OP:
external_object->type = ACPI_TYPE_INTEGER;
external_object->integer.value = ACPI_CA_SUPPORT_LEVEL;
break;
case AML_INT_NAMEPATH_OP: case AML_INT_NAMEPATH_OP:
/*
* This is a named reference, get the string. We already know that
* we have room for it, use max length
*/
external_object->type = ACPI_TYPE_STRING;
external_object->string.pointer = (NATIVE_CHAR *) data_space;
buffer.length = MAX_STRING_LENGTH;
buffer.pointer = data_space;
status = acpi_ns_handle_to_pathname ((acpi_handle) internal_object->reference.node, /* For namepath, return the object handle ("reference") */
&buffer);
/* Converted (external) string length is returned from above */
external_object->string.length = (u32) buffer.length;
*buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD (buffer.length);
break;
default: default:
/* /*
...@@ -328,7 +291,7 @@ acpi_ut_copy_ipackage_to_epackage ( ...@@ -328,7 +291,7 @@ acpi_ut_copy_ipackage_to_epackage (
info.num_packages = 1; info.num_packages = 1;
info.free_space = buffer + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (acpi_object)); info.free_space = buffer + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (acpi_object));
external_object->type = internal_object->common.type; external_object->type = ACPI_GET_OBJECT_TYPE (internal_object);
external_object->package.count = internal_object->package.count; external_object->package.count = internal_object->package.count;
external_object->package.elements = ACPI_CAST_PTR (acpi_object, info.free_space); external_object->package.elements = ACPI_CAST_PTR (acpi_object, info.free_space);
...@@ -372,7 +335,7 @@ acpi_ut_copy_iobject_to_eobject ( ...@@ -372,7 +335,7 @@ acpi_ut_copy_iobject_to_eobject (
ACPI_FUNCTION_TRACE ("Ut_copy_iobject_to_eobject"); ACPI_FUNCTION_TRACE ("Ut_copy_iobject_to_eobject");
if (internal_object->common.type == ACPI_TYPE_PACKAGE) { if (ACPI_GET_OBJECT_TYPE (internal_object) == ACPI_TYPE_PACKAGE) {
/* /*
* Package object: Copy all subobjects (including * Package object: Copy all subobjects (including
* nested packages) * nested packages)
...@@ -550,7 +513,7 @@ acpi_ut_copy_epackage_to_ipackage ( ...@@ -550,7 +513,7 @@ acpi_ut_copy_epackage_to_ipackage (
free_space = buffer + sizeof(acpi_object); free_space = buffer + sizeof(acpi_object);
external_object->type = internal_object->common.type; external_object->type = ACPI_GET_OBJECT_TYPE (internal_object);
external_object->package.count = internal_object->package.count; external_object->package.count = internal_object->package.count;
external_object->package.elements = (acpi_object *)free_space; external_object->package.elements = (acpi_object *)free_space;
...@@ -653,7 +616,7 @@ acpi_ut_copy_simple_object ( ...@@ -653,7 +616,7 @@ acpi_ut_copy_simple_object (
/* Handle the objects with extra data */ /* Handle the objects with extra data */
switch (dest_desc->common.type) { switch (ACPI_GET_OBJECT_TYPE (dest_desc)) {
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
dest_desc->buffer.node = NULL; dest_desc->buffer.node = NULL;
...@@ -729,7 +692,7 @@ acpi_ut_copy_ielement_to_ielement ( ...@@ -729,7 +692,7 @@ acpi_ut_copy_ielement_to_ielement (
/* /*
* This is a simple object, just copy it * This is a simple object, just copy it
*/ */
target_object = acpi_ut_create_internal_object (source_object->common.type); target_object = acpi_ut_create_internal_object (ACPI_GET_OBJECT_TYPE (source_object));
if (!target_object) { if (!target_object) {
return (AE_NO_MEMORY); return (AE_NO_MEMORY);
} }
...@@ -803,15 +766,15 @@ acpi_ut_copy_ipackage_to_ipackage ( ...@@ -803,15 +766,15 @@ acpi_ut_copy_ipackage_to_ipackage (
ACPI_FUNCTION_TRACE ("Ut_copy_ipackage_to_ipackage"); ACPI_FUNCTION_TRACE ("Ut_copy_ipackage_to_ipackage");
dest_obj->common.type = source_obj->common.type; dest_obj->common.type = ACPI_GET_OBJECT_TYPE (source_obj);
dest_obj->common.flags = source_obj->common.flags; dest_obj->common.flags = source_obj->common.flags;
dest_obj->package.count = source_obj->package.count; dest_obj->package.count = source_obj->package.count;
/* /*
* Create the object array and walk the source package tree * Create the object array and walk the source package tree
*/ */
dest_obj->package.elements = ACPI_MEM_CALLOCATE (((ACPI_SIZE) source_obj->package.count + 1) * dest_obj->package.elements = ACPI_MEM_CALLOCATE (
((ACPI_SIZE) source_obj->package.count + 1) *
sizeof (void *)); sizeof (void *));
if (!dest_obj->package.elements) { if (!dest_obj->package.elements) {
ACPI_REPORT_ERROR ( ACPI_REPORT_ERROR (
...@@ -863,14 +826,14 @@ acpi_ut_copy_iobject_to_iobject ( ...@@ -863,14 +826,14 @@ acpi_ut_copy_iobject_to_iobject (
/* Create the top level object */ /* Create the top level object */
*dest_desc = acpi_ut_create_internal_object (source_desc->common.type); *dest_desc = acpi_ut_create_internal_object (ACPI_GET_OBJECT_TYPE (source_desc));
if (!*dest_desc) { if (!*dest_desc) {
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
} }
/* Copy the object and possible subobjects */ /* Copy the object and possible subobjects */
if (source_desc->common.type == ACPI_TYPE_PACKAGE) { if (ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_PACKAGE) {
status = acpi_ut_copy_ipackage_to_ipackage (source_desc, *dest_desc, status = acpi_ut_copy_ipackage_to_ipackage (source_desc, *dest_desc,
walk_state); walk_state);
} }
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: utdelete - object deletion and reference count utilities * Module Name: utdelete - object deletion and reference count utilities
* $Revision: 90 $ * $Revision: 91 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -65,7 +65,7 @@ acpi_ut_delete_internal_obj ( ...@@ -65,7 +65,7 @@ acpi_ut_delete_internal_obj (
* Must delete or free any pointers within the object that are not * Must delete or free any pointers within the object that are not
* actual ACPI objects (for example, a raw buffer pointer). * actual ACPI objects (for example, a raw buffer pointer).
*/ */
switch (object->common.type) { switch (ACPI_GET_OBJECT_TYPE (object)) {
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "**** String %p, ptr %p\n", ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "**** String %p, ptr %p\n",
...@@ -190,7 +190,7 @@ acpi_ut_delete_internal_obj ( ...@@ -190,7 +190,7 @@ acpi_ut_delete_internal_obj (
/* Now the object can be safely deleted */ /* Now the object can be safely deleted */
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Deleting Object %p [%s]\n", ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Deleting Object %p [%s]\n",
object, acpi_ut_get_type_name (object->common.type))); object, acpi_ut_get_object_type_name (object)));
acpi_ut_delete_object_desc (object); acpi_ut_delete_object_desc (object);
return_VOID; return_VOID;
...@@ -295,7 +295,7 @@ acpi_ut_update_ref_count ( ...@@ -295,7 +295,7 @@ acpi_ut_update_ref_count (
object, new_count)); object, new_count));
} }
if (object->common.type == ACPI_TYPE_METHOD) { if (ACPI_GET_OBJECT_TYPE (object) == ACPI_TYPE_METHOD) {
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Method Obj %p Refs=%X, [Decremented]\n", ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Method Obj %p Refs=%X, [Decremented]\n",
object, new_count)); object, new_count));
} }
...@@ -403,7 +403,7 @@ acpi_ut_update_object_reference ( ...@@ -403,7 +403,7 @@ acpi_ut_update_object_reference (
* All sub-objects must have their reference count incremented also. * All sub-objects must have their reference count incremented also.
* Different object types have different subobjects. * Different object types have different subobjects.
*/ */
switch (object->common.type) { switch (ACPI_GET_OBJECT_TYPE (object)) {
case ACPI_TYPE_DEVICE: case ACPI_TYPE_DEVICE:
status = acpi_ut_create_update_state_and_push (object->device.addr_handler, status = acpi_ut_create_update_state_and_push (object->device.addr_handler,
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: uteval - Object evaluation * Module Name: uteval - Object evaluation
* $Revision: 39 $ * $Revision: 40 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -91,11 +91,11 @@ acpi_ut_evaluate_numeric_object ( ...@@ -91,11 +91,11 @@ acpi_ut_evaluate_numeric_object (
/* Is the return object of the correct type? */ /* Is the return object of the correct type? */
if (obj_desc->common.type != ACPI_TYPE_INTEGER) { if (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_INTEGER) {
status = AE_TYPE; status = AE_TYPE;
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Type returned from %s was not a number: %X \n", "Type returned from %s was not an Integer: %X \n",
object_name, obj_desc->common.type)); object_name, ACPI_GET_OBJECT_TYPE (obj_desc)));
} }
else { else {
/* /*
...@@ -169,15 +169,16 @@ acpi_ut_execute_HID ( ...@@ -169,15 +169,16 @@ acpi_ut_execute_HID (
* A _HID can return either a Number (32 bit compressed EISA ID) or * A _HID can return either a Number (32 bit compressed EISA ID) or
* a string * a string
*/ */
if ((obj_desc->common.type != ACPI_TYPE_INTEGER) && if ((ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_INTEGER) &&
(obj_desc->common.type != ACPI_TYPE_STRING)) { (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_STRING)) {
status = AE_TYPE; status = AE_TYPE;
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Type returned from _HID not a number or string: %s(%X) \n", "Type returned from _HID not a number or string: %s(%X) \n",
acpi_ut_get_type_name (obj_desc->common.type), obj_desc->common.type)); acpi_ut_get_object_type_name (obj_desc),
ACPI_GET_OBJECT_TYPE (obj_desc)));
} }
else { else {
if (obj_desc->common.type == 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, hid->buffer); acpi_ex_eisa_id_to_string ((u32) obj_desc->integer.value, hid->buffer);
...@@ -253,7 +254,7 @@ acpi_ut_execute_CID ( ...@@ -253,7 +254,7 @@ acpi_ut_execute_CID (
* IDs. Each compatible ID can be a Number (32 bit compressed EISA ID) or * IDs. Each compatible ID can be a Number (32 bit compressed EISA ID) or
* string (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss"). * string (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss").
*/ */
switch (obj_desc->common.type) { switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
/* Convert the Numeric CID to string */ /* Convert the Numeric CID to string */
...@@ -278,7 +279,8 @@ acpi_ut_execute_CID ( ...@@ -278,7 +279,8 @@ acpi_ut_execute_CID (
status = AE_TYPE; status = AE_TYPE;
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Type returned from _CID not a number, string, or package: %s(%X) \n", "Type returned from _CID not a number, string, or package: %s(%X) \n",
acpi_ut_get_type_name (obj_desc->common.type), obj_desc->common.type)); acpi_ut_get_object_type_name (obj_desc),
ACPI_GET_OBJECT_TYPE (obj_desc)));
break; break;
} }
...@@ -347,15 +349,15 @@ acpi_ut_execute_UID ( ...@@ -347,15 +349,15 @@ acpi_ut_execute_UID (
* A _UID can return either a Number (32 bit compressed EISA ID) or * A _UID can return either a Number (32 bit compressed EISA ID) or
* a string * a string
*/ */
if ((obj_desc->common.type != ACPI_TYPE_INTEGER) && if ((ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_INTEGER) &&
(obj_desc->common.type != ACPI_TYPE_STRING)) { (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_STRING)) {
status = AE_TYPE; status = AE_TYPE;
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Type returned from _UID was not a number or string: %X \n", "Type returned from _UID was not a number or string: %X \n",
obj_desc->common.type)); ACPI_GET_OBJECT_TYPE (obj_desc)));
} }
else { else {
if (obj_desc->common.type == 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, uid->buffer); acpi_ex_unsigned_integer_to_string (obj_desc->integer.value, uid->buffer);
...@@ -433,11 +435,11 @@ acpi_ut_execute_STA ( ...@@ -433,11 +435,11 @@ acpi_ut_execute_STA (
/* Is the return object of the correct type? */ /* Is the return object of the correct type? */
if (obj_desc->common.type != ACPI_TYPE_INTEGER) { if (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_INTEGER) {
status = AE_TYPE; status = AE_TYPE;
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Type returned from _STA was not a number: %X \n", "Type returned from _STA was not a number: %X \n",
obj_desc->common.type)); ACPI_GET_OBJECT_TYPE (obj_desc)));
} }
else { else {
/* Extract the status flags */ /* Extract the status flags */
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: utglobal - Global variables for the ACPI subsystem * Module Name: utglobal - Global variables for the ACPI subsystem
* $Revision: 161 $ * $Revision: 162 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -541,6 +541,20 @@ acpi_ut_get_type_name ( ...@@ -541,6 +541,20 @@ acpi_ut_get_type_name (
} }
NATIVE_CHAR *
acpi_ut_get_object_type_name (
acpi_operand_object *obj_desc)
{
if (!obj_desc)
{
return ("[NULL Object Descriptor]");
}
return (acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (obj_desc)));
}
/* Various strings for future use */ /* Various strings for future use */
#if 0 #if 0
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: utmisc - common utility procedures * Module Name: utmisc - common utility procedures
* $Revision: 75 $ * $Revision: 78 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "acpi.h" #include "acpi.h"
#include "acnamesp.h" #include "acnamesp.h"
#include "amlcode.h" #include "amlcode.h"
#include "acinterp.h"
#define _COMPONENT ACPI_UTILITIES #define _COMPONENT ACPI_UTILITIES
...@@ -1098,119 +1099,6 @@ acpi_ut_delete_generic_state_cache ( ...@@ -1098,119 +1099,6 @@ acpi_ut_delete_generic_state_cache (
} }
/*******************************************************************************
*
* FUNCTION: Acpi_ut_resolve_reference
*
* PARAMETERS: ACPI_PKG_CALLBACK
*
* RETURN: Status - the status of the call
*
* DESCRIPTION: Resolve a reference object to an actual value
*
******************************************************************************/
acpi_status
acpi_ut_resolve_reference (
u8 object_type,
acpi_operand_object *source_object,
acpi_generic_state *state,
void *context)
{
acpi_pkg_info *info = (acpi_pkg_info *) context;
switch (object_type) {
case ACPI_COPY_TYPE_SIMPLE:
/*
* Simple object - check for a reference
*/
if (source_object->common.type == INTERNAL_TYPE_REFERENCE) {
switch (source_object->reference.opcode) {
case AML_ZERO_OP:
source_object->common.type = ACPI_TYPE_INTEGER;
source_object->integer.value = 0;
break;
case AML_ONE_OP:
source_object->common.type = ACPI_TYPE_INTEGER;
source_object->integer.value = 1;
break;
case AML_ONES_OP:
source_object->common.type = ACPI_TYPE_INTEGER;
source_object->integer.value = ACPI_INTEGER_MAX;
break;
default:
/* Other types not supported */
return (AE_SUPPORT);
}
}
break;
case ACPI_COPY_TYPE_PACKAGE:
/* Package object - nothing much to do here, let the walk handle it */
info->num_packages++;
state->pkg.this_target_obj = NULL;
break;
default:
return (AE_BAD_PARAMETER);
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: Acpi_ut_resolve_package_references
*
* PARAMETERS: Obj_desc - The Package object on which to resolve refs
*
* RETURN: Status
*
* DESCRIPTION: Walk through a package and turn internal references into values
*
******************************************************************************/
acpi_status
acpi_ut_resolve_package_references (
acpi_operand_object *obj_desc)
{
acpi_pkg_info info;
acpi_status status;
ACPI_FUNCTION_TRACE ("Ut_resolve_package_references");
if (obj_desc->common.type != ACPI_TYPE_PACKAGE) {
/* The object must be a package */
ACPI_REPORT_ERROR (("Expecting a Package object\n"));
return_ACPI_STATUS (AE_TYPE);
}
info.length = 0;
info.object_space = 0;
info.num_packages = 1;
status = acpi_ut_walk_package_tree (obj_desc, NULL,
acpi_ut_resolve_reference, &info);
return_ACPI_STATUS (status);
}
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: Acpi_ut_walk_package_tree * FUNCTION: Acpi_ut_walk_package_tree
...@@ -1260,7 +1148,7 @@ acpi_ut_walk_package_tree ( ...@@ -1260,7 +1148,7 @@ acpi_ut_walk_package_tree (
*/ */
if ((!this_source_obj) || if ((!this_source_obj) ||
(ACPI_GET_DESCRIPTOR_TYPE (this_source_obj) != ACPI_DESC_TYPE_OPERAND) || (ACPI_GET_DESCRIPTOR_TYPE (this_source_obj) != ACPI_DESC_TYPE_OPERAND) ||
(this_source_obj->common.type != ACPI_TYPE_PACKAGE)) { (ACPI_GET_OBJECT_TYPE (this_source_obj) != ACPI_TYPE_PACKAGE)) {
status = walk_callback (ACPI_COPY_TYPE_SIMPLE, this_source_obj, status = walk_callback (ACPI_COPY_TYPE_SIMPLE, this_source_obj,
state, context); state, context);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: utobject - ACPI object create/delete/size/cache routines * Module Name: utobject - ACPI object create/delete/size/cache routines
* $Revision: 73 $ * $Revision: 76 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -37,10 +37,9 @@ ...@@ -37,10 +37,9 @@
* *
* FUNCTION: Acpi_ut_create_internal_object_dbg * FUNCTION: Acpi_ut_create_internal_object_dbg
* *
* PARAMETERS: Address - Address of the memory to deallocate * PARAMETERS: Module_name - Source file name of caller
* Component - Component type of caller * Line_number - Line number of caller
* Module - Source file name of caller * Component_id - Component type of caller
* Line - Line number of caller
* Type - ACPI Type of the new object * Type - ACPI Type of the new object
* *
* RETURN: Object - The new object. Null on failure * RETURN: Object - The new object. Null on failure
...@@ -119,7 +118,7 @@ acpi_ut_create_internal_object_dbg ( ...@@ -119,7 +118,7 @@ acpi_ut_create_internal_object_dbg (
* *
* FUNCTION: Acpi_ut_valid_internal_object * FUNCTION: Acpi_ut_valid_internal_object
* *
* PARAMETERS: Operand - Object to be validated * PARAMETERS: Object - Object to be validated
* *
* RETURN: Validate a pointer to be an acpi_operand_object * RETURN: Validate a pointer to be an acpi_operand_object
* *
...@@ -180,7 +179,6 @@ acpi_ut_valid_internal_object ( ...@@ -180,7 +179,6 @@ acpi_ut_valid_internal_object (
* PARAMETERS: Module_name - Caller's module name (for error output) * PARAMETERS: Module_name - Caller's module name (for error output)
* Line_number - Caller's line number (for error output) * Line_number - Caller's line number (for error output)
* Component_id - Caller's component ID (for error output) * Component_id - Caller's component ID (for error output)
* Message - Error message to use on failure
* *
* RETURN: Pointer to newly allocated object descriptor. Null on error * RETURN: Pointer to newly allocated object descriptor. Null on error
* *
...@@ -209,7 +207,6 @@ acpi_ut_allocate_object_desc_dbg ( ...@@ -209,7 +207,6 @@ acpi_ut_allocate_object_desc_dbg (
return_PTR (NULL); return_PTR (NULL);
} }
/* Mark the descriptor type */ /* Mark the descriptor type */
ACPI_SET_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_OPERAND); ACPI_SET_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_OPERAND);
...@@ -225,7 +222,7 @@ acpi_ut_allocate_object_desc_dbg ( ...@@ -225,7 +222,7 @@ acpi_ut_allocate_object_desc_dbg (
* *
* FUNCTION: Acpi_ut_delete_object_desc * FUNCTION: Acpi_ut_delete_object_desc
* *
* PARAMETERS: Object - Acpi internal object to be deleted * PARAMETERS: Object - An Acpi internal object to be deleted
* *
* RETURN: None. * RETURN: None.
* *
...@@ -260,7 +257,7 @@ acpi_ut_delete_object_desc ( ...@@ -260,7 +257,7 @@ acpi_ut_delete_object_desc (
* *
* PARAMETERS: None * PARAMETERS: None
* *
* RETURN: Status * RETURN: None
* *
* DESCRIPTION: Purge the global state object cache. Used during subsystem * DESCRIPTION: Purge the global state object cache. Used during subsystem
* termination. * termination.
...@@ -284,12 +281,12 @@ acpi_ut_delete_object_cache ( ...@@ -284,12 +281,12 @@ acpi_ut_delete_object_cache (
* FUNCTION: Acpi_ut_get_simple_object_size * FUNCTION: Acpi_ut_get_simple_object_size
* *
* PARAMETERS: *Internal_object - Pointer to the object we are examining * PARAMETERS: *Internal_object - Pointer to the object we are examining
* *Ret_length - Where the length is returned * *Obj_length - Where the length is returned
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: This function is called to determine the space required to * DESCRIPTION: This function is called to determine the space required to
* contain a simple object for return to an API user. * contain a simple object for return to an external user.
* *
* The length includes the object structure plus any additional * The length includes the object structure plus any additional
* needed space. * needed space.
...@@ -315,7 +312,6 @@ acpi_ut_get_simple_object_size ( ...@@ -315,7 +312,6 @@ acpi_ut_get_simple_object_size (
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
/* Start with the length of the Acpi object */ /* Start with the length of the Acpi object */
length = sizeof (acpi_object); length = sizeof (acpi_object);
...@@ -327,16 +323,13 @@ acpi_ut_get_simple_object_size ( ...@@ -327,16 +323,13 @@ acpi_ut_get_simple_object_size (
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
/* /*
* The final length depends on the object type * The final length depends on the object type
* Strings and Buffers are packed right up against the parent object and * Strings and Buffers are packed right up against the parent object and
* must be accessed bytewise or there may be alignment problems on * must be accessed bytewise or there may be alignment problems on
* certain processors * certain processors
*/ */
switch (ACPI_GET_OBJECT_TYPE (internal_object)) {
switch (internal_object->common.type) {
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
length += (ACPI_SIZE) internal_object->string.length + 1; length += (ACPI_SIZE) internal_object->string.length + 1;
...@@ -362,15 +355,6 @@ acpi_ut_get_simple_object_size ( ...@@ -362,15 +355,6 @@ acpi_ut_get_simple_object_size (
case INTERNAL_TYPE_REFERENCE: case INTERNAL_TYPE_REFERENCE:
switch (internal_object->reference.opcode) { switch (internal_object->reference.opcode) {
case AML_ZERO_OP:
case AML_ONE_OP:
case AML_ONES_OP:
case AML_REVISION_OP:
/* These Constant opcodes will be resolved to Integers */
break;
case AML_INT_NAMEPATH_OP: case AML_INT_NAMEPATH_OP:
/* /*
...@@ -384,7 +368,7 @@ acpi_ut_get_simple_object_size ( ...@@ -384,7 +368,7 @@ acpi_ut_get_simple_object_size (
/* /*
* No other reference opcodes are supported. * No other reference opcodes are supported.
* Notably, Locals and Args are not supported, by this may be * Notably, Locals and Args are not supported, but this may be
* required eventually. * required eventually.
*/ */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
...@@ -399,12 +383,11 @@ acpi_ut_get_simple_object_size ( ...@@ -399,12 +383,11 @@ acpi_ut_get_simple_object_size (
default: default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported type=%X in object %p\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported type=%X in object %p\n",
internal_object->common.type, internal_object)); ACPI_GET_OBJECT_TYPE (internal_object), internal_object));
status = AE_TYPE; status = AE_TYPE;
break; break;
} }
/* /*
* Account for the space required by the object rounded up to the next * Account for the space required by the object rounded up to the next
* multiple of the machine word size. This keeps each object aligned * multiple of the machine word size. This keeps each object aligned
...@@ -422,7 +405,7 @@ acpi_ut_get_simple_object_size ( ...@@ -422,7 +405,7 @@ acpi_ut_get_simple_object_size (
* *
* PARAMETERS: ACPI_PKG_CALLBACK * PARAMETERS: ACPI_PKG_CALLBACK
* *
* RETURN: Status - the status of the call * RETURN: Status
* *
* DESCRIPTION: Get the length of one package element. * DESCRIPTION: Get the length of one package element.
* *
...@@ -481,12 +464,12 @@ acpi_ut_get_element_length ( ...@@ -481,12 +464,12 @@ acpi_ut_get_element_length (
* FUNCTION: Acpi_ut_get_package_object_size * FUNCTION: Acpi_ut_get_package_object_size
* *
* PARAMETERS: *Internal_object - Pointer to the object we are examining * PARAMETERS: *Internal_object - Pointer to the object we are examining
* *Ret_length - Where the length is returned * *Obj_length - Where the length is returned
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: This function is called to determine the space required to * DESCRIPTION: This function is called to determine the space required to
* contain a package object for return to an API user. * contain a package object for return to an external user.
* *
* This is moderately complex since a package contains other * This is moderately complex since a package contains other
* objects including packages. * objects including packages.
...@@ -535,7 +518,7 @@ acpi_ut_get_package_object_size ( ...@@ -535,7 +518,7 @@ acpi_ut_get_package_object_size (
* FUNCTION: Acpi_ut_get_object_size * FUNCTION: Acpi_ut_get_object_size
* *
* PARAMETERS: *Internal_object - Pointer to the object we are examining * PARAMETERS: *Internal_object - Pointer to the object we are examining
* *Ret_length - Where the length will be returned * *Obj_length - Where the length will be returned
* *
* RETURN: Status * RETURN: Status
* *
...@@ -556,7 +539,7 @@ acpi_ut_get_object_size( ...@@ -556,7 +539,7 @@ acpi_ut_get_object_size(
if ((ACPI_GET_DESCRIPTOR_TYPE (internal_object) == ACPI_DESC_TYPE_OPERAND) && if ((ACPI_GET_DESCRIPTOR_TYPE (internal_object) == ACPI_DESC_TYPE_OPERAND) &&
(internal_object->common.type == ACPI_TYPE_PACKAGE)) { (ACPI_GET_OBJECT_TYPE (internal_object) == ACPI_TYPE_PACKAGE)) {
status = acpi_ut_get_package_object_size (internal_object, obj_length); status = acpi_ut_get_package_object_size (internal_object, obj_length);
} }
else { else {
......
/* /*
* acpi_utils.c - ACPI Utility Functions ($Revision: 5 $) * acpi_utils.c - ACPI Utility Functions ($Revision: 7 $)
* *
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
...@@ -425,24 +425,16 @@ acpi_evaluate_reference ( ...@@ -425,24 +425,16 @@ acpi_evaluate_reference (
element = &(package->package.elements[i]); element = &(package->package.elements[i]);
if (!element || (element->type != ACPI_TYPE_STRING)) { if (!element || (element->type != ACPI_TYPE_ANY)) {
status = AE_BAD_DATA; status = AE_BAD_DATA;
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid element in package (not a device reference)\n")); ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid element in package (not a device reference)\n"));
acpi_util_eval_error(handle, pathname, status); acpi_util_eval_error(handle, pathname, status);
break; break;
} }
/* Convert reference (e.g. "\_PR_.CPU_") to acpi_handle. */ /* Get the acpi_handle. */
status = acpi_get_handle(handle, element->string.pointer,
&(list->handles[i]));
if (ACPI_FAILURE(status)) {
status = AE_BAD_DATA;
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Unable to resolve device reference [%s]\n", element->string.pointer));
acpi_util_eval_error(handle, pathname, status);
break;
}
list->handles[i] = element->reference.handle;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resolved reference [%s]->[%p]\n", element->string.pointer, list->handles[i])); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resolved reference [%s]->[%p]\n", element->string.pointer, list->handles[i]));
} }
......
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