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
* $Revision: 83 $
* $Revision: 84 $
*
******************************************************************************/
......@@ -663,7 +663,7 @@ acpi_db_walk_for_specific_objects (
/* Display short information about the object */
if (obj_desc) {
switch (obj_desc->common.type) {
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_METHOD:
acpi_os_printf (" #Args %d Concurrency %X", obj_desc->method.param_count, obj_desc->method.concurrency);
break;
......@@ -729,7 +729,8 @@ acpi_db_display_objects (
}
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);
......
/*******************************************************************************
*
* Module Name: dbdisply - debug display commands
* $Revision: 73 $
* $Revision: 75 $
*
******************************************************************************/
......@@ -300,9 +300,9 @@ acpi_db_decode_internal_object (
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:
acpi_os_printf (" %8.8X%8.8X", ACPI_HIDWORD (obj_desc->integer.value),
......@@ -396,7 +396,7 @@ acpi_db_display_internal_object (
case ACPI_DESC_TYPE_OPERAND:
type = obj_desc->common.type;
type = ACPI_GET_OBJECT_TYPE (obj_desc);
if (type > INTERNAL_TYPE_MAX) {
acpi_os_printf (" Type %hX [Invalid Type]", type);
return;
......@@ -404,25 +404,9 @@ acpi_db_display_internal_object (
/* Decode the ACPI object type */
switch (obj_desc->common.type) {
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case INTERNAL_TYPE_REFERENCE:
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:
acpi_os_printf ("[Local%d] ", obj_desc->reference.offset);
if (walk_state) {
......@@ -451,6 +435,8 @@ acpi_db_display_internal_object (
break;
default:
acpi_os_printf ("Unknown Reference opcode %X\n",
obj_desc->reference.opcode);
break;
}
......
/*******************************************************************************
*
* Module Name: dbstats - Generation and display of ACPI table statistics
* $Revision: 59 $
* $Revision: 60 $
*
******************************************************************************/
......@@ -87,18 +87,18 @@ acpi_db_enumerate_object (
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++;
}
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 */
switch (obj_desc->common.type)
switch (ACPI_GET_OBJECT_TYPE (obj_desc))
{
case ACPI_TYPE_PACKAGE:
for (i = 0; i < obj_desc->package.count; i++)
......
/*******************************************************************************
*
* Module Name: dsmthdat - control method arguments and local variables
* $Revision: 61 $
* $Revision: 62 $
*
******************************************************************************/
......@@ -354,7 +354,7 @@ acpi_ds_method_data_get_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 (
* (perform the indirect store)
*/
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);
}
......
/******************************************************************************
*
* Module Name: dsobject - Dispatcher object management routines
* $Revision: 99 $
* $Revision: 103 $
*
*****************************************************************************/
......@@ -29,6 +29,7 @@
#include "amlcode.h"
#include "acdispat.h"
#include "acnamesp.h"
#include "acinterp.h"
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsobject")
......@@ -241,9 +242,10 @@ acpi_ds_init_object_from_op (
{
const acpi_opcode_info *op_info;
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;
......@@ -251,12 +253,12 @@ acpi_ds_init_object_from_op (
if (op_info->class == AML_CLASS_UNKNOWN) {
/* Unknown opcode */
return (AE_TYPE);
return_ACPI_STATUS (AE_TYPE);
}
/* Perform per-object initialization */
switch (obj_desc->common.type) {
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_BUFFER:
/*
......@@ -281,7 +283,62 @@ acpi_ds_init_object_from_op (
case ACPI_TYPE_INTEGER:
obj_desc->integer.value = op->common.value.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;
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n", op_info->type));
status = AE_AML_OPERAND_TYPE;
break;
}
break;
......@@ -323,7 +380,7 @@ acpi_ds_init_object_from_op (
break;
default: /* Constants, Literals, etc.. */
default: /* Other literals, etc.. */
if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
/* Node was saved in Op */
......@@ -340,12 +397,13 @@ acpi_ds_init_object_from_op (
default:
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;
}
return (AE_OK);
return_ACPI_STATUS (status);
}
......@@ -380,7 +438,7 @@ acpi_ds_build_internal_object (
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.
* Otherwise, go ahead and look it up now
*/
......@@ -435,7 +493,9 @@ acpi_ds_build_internal_object (
*
* 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
*
* RETURN: Status
......@@ -541,7 +601,9 @@ acpi_ds_build_internal_buffer_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
*
* RETURN: Status
......@@ -658,12 +720,13 @@ acpi_ds_build_internal_package_obj (
*
* FUNCTION: Acpi_ds_create_node
*
* PARAMETERS: Op - Parser object to be translated
* Obj_desc_ptr - Where the ACPI internal object is returned
* PARAMETERS: Walk_state - Current walk state
* Node - NS Node to be initialized
* Op - Parser object to be translated
*
* RETURN: Status
*
* DESCRIPTION:
* DESCRIPTION: Create the object to be associated with a namespace node
*
****************************************************************************/
......@@ -704,7 +767,7 @@ acpi_ds_create_node (
/* 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 */
......
......@@ -2,7 +2,7 @@
*
* Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes
* $Revision: 79 $
* $Revision: 80 $
*
*****************************************************************************/
......@@ -396,10 +396,10 @@ acpi_ds_init_buffer_field (
/* 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,
"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;
goto cleanup;
......@@ -1021,7 +1021,7 @@ acpi_ds_exec_end_control_op (
* 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) &&
((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)) {
status = acpi_ex_resolve_to_value (&walk_state->results->results.obj_desc [0], walk_state);
if (ACPI_FAILURE (status)) {
......
/*******************************************************************************
*
* Module Name: dsutils - Dispatcher utilities
* $Revision: 92 $
* $Revision: 93 $
*
******************************************************************************/
......@@ -380,8 +380,8 @@ acpi_ds_create_operand (
/*
* If the name is null, this means that this is an
* optional result parameter that was not specified
* in the original ASL. Create an Reference for a
* placeholder
* in the original ASL. Create a Zero Constant for a
* placeholder. (Store to a constant is a Noop.)
*/
opcode = AML_ZERO_OP; /* Has no arguments! */
......
......@@ -2,7 +2,7 @@
*
* Module Name: dswexec - Dispatcher method execution callbacks;
* dispatch to interpreter.
* $Revision: 92 $
* $Revision: 94 $
*
*****************************************************************************/
......@@ -113,10 +113,10 @@ acpi_ds_get_predicate_value (
* Result of predicate evaluation currently must
* 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,
"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;
goto cleanup;
......@@ -124,7 +124,7 @@ acpi_ds_get_predicate_value (
/* 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
......@@ -605,7 +605,7 @@ acpi_ds_exec_end_op (
* ACPI 2.0 support for 64-bit integers: Truncate numeric
* 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
......
/******************************************************************************
*
* Module Name: dswstate - Dispatcher parse tree walk management routines
* $Revision: 64 $
* $Revision: 65 $
*
*****************************************************************************/
......@@ -84,7 +84,7 @@ acpi_ds_result_insert (
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));
return (AE_OK);
......@@ -148,7 +148,7 @@ acpi_ds_result_remove (
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, walk_state, state->results.num_results));
return (AE_OK);
......@@ -204,7 +204,7 @@ acpi_ds_result_pop (
state->results.obj_desc [index -1] = NULL;
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));
return (AE_OK);
......@@ -274,7 +274,7 @@ acpi_ds_result_pop_from_bottom (
}
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));
......@@ -329,7 +329,7 @@ acpi_ds_result_push (
state->results.num_results++;
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));
return (AE_OK);
......@@ -487,7 +487,7 @@ acpi_ds_obj_stack_push (
walk_state->num_operands++;
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));
return (AE_OK);
......@@ -547,7 +547,7 @@ acpi_ds_obj_stack_pop_object (
walk_state->operands [walk_state->num_operands] = NULL;
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));
return (AE_OK);
......
/******************************************************************************
*
* Module Name: evregion - ACPI Address_space (Op_region) handler dispatch
* $Revision: 133 $
* $Revision: 134 $
*
*****************************************************************************/
......@@ -624,7 +624,7 @@ acpi_ev_addr_handler_helper (
/*
* 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
*/
......
This diff is collapsed.
/******************************************************************************
*
* Module Name: evxface - External interfaces for ACPI events
* $Revision: 128 $
* $Revision: 129 $
*
*****************************************************************************/
......@@ -79,7 +79,6 @@ acpi_install_fixed_event_handler (
goto cleanup;
}
/* Install the handler before enabling the event */
acpi_gbl_fixed_event_handlers[event].handler = handler;
......
/******************************************************************************
*
* Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
* $Revision: 65 $
* $Revision: 66 $
*
*****************************************************************************/
......@@ -274,7 +274,7 @@ acpi_ex_load_op (
case ACPI_TYPE_REGION:
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 */
......@@ -319,7 +319,7 @@ acpi_ex_load_op (
case INTERNAL_TYPE_INDEX_FIELD:
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.
......@@ -415,8 +415,7 @@ acpi_ex_unload_table (
*/
if ((!ddb_handle) ||
(ACPI_GET_DESCRIPTOR_TYPE (ddb_handle) != ACPI_DESC_TYPE_OPERAND) ||
(((acpi_operand_object *)ddb_handle)->common.type !=
INTERNAL_TYPE_REFERENCE)) {
(ACPI_GET_OBJECT_TYPE (ddb_handle) != INTERNAL_TYPE_REFERENCE)) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
......
/******************************************************************************
*
* Module Name: exconvrt - Object conversion routines
* $Revision: 35 $
* $Revision: 37 $
*
*****************************************************************************/
......@@ -64,7 +64,7 @@ acpi_ex_convert_to_integer (
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:
*result_desc = obj_desc;
return_ACPI_STATUS (AE_OK);
......@@ -103,7 +103,7 @@ acpi_ex_convert_to_integer (
/*
* String conversion is different than Buffer conversion
*/
switch (obj_desc->common.type) {
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_STRING:
/*
......@@ -190,11 +190,11 @@ acpi_ex_convert_to_buffer (
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:
/*
* Create a new Buffer
* Create a new Buffer object
*/
ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
if (!ret_desc) {
......@@ -203,7 +203,6 @@ acpi_ex_convert_to_buffer (
/* 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);
if (!new_buf) {
ACPI_REPORT_ERROR
......@@ -217,7 +216,12 @@ acpi_ex_convert_to_buffer (
for (i = 0; i < acpi_gbl_integer_byte_width; i++) {
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.length = acpi_gbl_integer_byte_width;
/* Return the new buffer descriptor */
......@@ -373,7 +377,7 @@ acpi_ex_convert_to_string (
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:
string_length = acpi_gbl_integer_byte_width * 2;
......@@ -565,10 +569,10 @@ acpi_ex_convert_to_target_type (
default:
/* 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,
"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)));
status = AE_TYPE;
}
......
/******************************************************************************
*
* Module Name: excreate - Named object creation
* $Revision: 91 $
* $Revision: 92 $
*
*****************************************************************************/
......@@ -40,8 +40,7 @@
*
* FUNCTION: Acpi_ex_create_alias
*
* PARAMETERS: Walk_state - Current state, contains List of
* operands for the opcode
* PARAMETERS: Walk_state - Current state, contains operands
*
* RETURN: Status
*
......@@ -392,9 +391,7 @@ acpi_ex_create_table_region (
*
* FUNCTION: Acpi_ex_create_processor
*
* PARAMETERS: Op - Op containing the Processor definition and
* args
* Processor_node - Parent Node for the processor object
* PARAMETERS: Walk_state - Current state
*
* RETURN: Status
*
......@@ -447,9 +444,7 @@ acpi_ex_create_processor (
*
* FUNCTION: Acpi_ex_create_power_resource
*
* PARAMETERS: Op - Op containing the Power_resource definition
* and args
* Power_node - Parent Node for the power object
* PARAMETERS: Walk_state - Current state
*
* RETURN: Status
*
......@@ -502,8 +497,7 @@ acpi_ex_create_power_resource (
*
* PARAMETERS: Aml_start - First byte of the method's AML
* Aml_length - AML byte count for this method
* Method_flags - AML method flag byte
* Method - Method Node
* Walk_state - Current state
*
* RETURN: Status
*
......
/******************************************************************************
*
* Module Name: exdump - Interpreter debug output routines
* $Revision: 153 $
* $Revision: 155 $
*
*****************************************************************************/
......@@ -96,34 +96,10 @@ acpi_ex_dump_operand (
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:
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:
acpi_os_printf ("Reference: Debug\n");
......@@ -150,7 +126,7 @@ acpi_ex_dump_operand (
acpi_os_printf ("Reference: Arg%d",
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 */
acpi_os_printf (" value is [%8.8X%8.8x]",
......@@ -167,7 +143,7 @@ acpi_ex_dump_operand (
acpi_os_printf ("Reference: Local%d",
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 */
......@@ -189,7 +165,7 @@ acpi_ex_dump_operand (
/* unknown opcode */
acpi_os_printf ("Unknown opcode=%X\n",
acpi_os_printf ("Unknown Reference opcode=%X\n",
obj_desc->reference.opcode);
break;
......@@ -340,8 +316,7 @@ acpi_ex_dump_operand (
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL* \n"));
}
else if (ACPI_TYPE_BUFFER !=
obj_desc->buffer_field.buffer_obj->common.type)
else if (ACPI_GET_OBJECT_TYPE (obj_desc->buffer_field.buffer_obj) != ACPI_TYPE_BUFFER)
{
acpi_os_printf ("*not a Buffer* \n");
}
......@@ -399,9 +374,9 @@ acpi_ex_dump_operand (
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;
}
......@@ -603,13 +578,13 @@ acpi_ex_dump_object_descriptor (
/* 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 ("Flags", obj_desc->common.flags);
/* Object-specific Fields */
switch (obj_desc->common.type)
switch (ACPI_GET_OBJECT_TYPE (obj_desc))
{
case ACPI_TYPE_INTEGER:
......@@ -649,7 +624,7 @@ acpi_ex_dump_object_descriptor (
acpi_os_printf ("[%.3d] %p", i, 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");
}
......@@ -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_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:
acpi_ex_out_pointer ("Buffer_obj", obj_desc->buffer_field.buffer_obj);
......@@ -813,15 +788,10 @@ acpi_ex_dump_object_descriptor (
case INTERNAL_TYPE_DEF_ANY:
case INTERNAL_TYPE_EXTRA:
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:
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;
}
......
/******************************************************************************
*
* Module Name: exfield - ACPI AML (p-code) execution - field manipulation
* $Revision: 110 $
* $Revision: 112 $
*
*****************************************************************************/
......@@ -70,7 +70,7 @@ acpi_ex_read_data_from_field (
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,
* evaluate them now and save the results.
......@@ -110,6 +110,8 @@ acpi_ex_read_data_from_field (
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Complete the buffer object initialization */
buffer_desc->common.flags = AOPOBJ_DATA_VALID;
buffer_desc->buffer.length = length;
buffer = buffer_desc->buffer.pointer;
......@@ -129,7 +131,7 @@ acpi_ex_read_data_from_field (
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"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,
"Field_write: Bit_len=%X Bit_off=%X Byte_off=%X\n",
obj_desc->common_field.bit_length,
......@@ -193,7 +195,7 @@ acpi_ex_write_data_to_field (
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,
* evaluate them now and save the results.
......@@ -209,7 +211,7 @@ acpi_ex_write_data_to_field (
/*
* 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:
buffer = &source_desc->integer.value;
length = sizeof (source_desc->integer.value);
......@@ -258,7 +260,7 @@ acpi_ex_write_data_to_field (
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"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,
"Field_read: Bit_len=%X Bit_off=%X Byte_off=%X\n",
obj_desc->common_field.bit_length,
......
/******************************************************************************
*
* Module Name: exfldio - Aml Field I/O
* $Revision: 86 $
* $Revision: 87 $
*
*****************************************************************************/
......@@ -64,9 +64,11 @@ acpi_ex_setup_region (
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",
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);
}
......@@ -298,7 +300,7 @@ acpi_ex_field_datum_io (
* 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
*/
switch (obj_desc->common.type) {
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_BUFFER_FIELD:
/*
* If the Buffer_field arguments have not been previously evaluated,
......@@ -416,7 +418,7 @@ acpi_ex_field_datum_io (
default:
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;
break;
}
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
* $Revision: 104 $
* $Revision: 106 $
*
*****************************************************************************/
......@@ -64,7 +64,7 @@ acpi_ex_get_object_reference (
switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
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;
status = AE_TYPE;
goto cleanup;
......@@ -184,9 +184,9 @@ acpi_ex_concat_template (
ACPI_MEMCPY (new_buf, obj_desc1->buffer.pointer, length1);
ACPI_MEMCPY (new_buf + length1, obj_desc2->buffer.pointer, length2);
/*
* Point the return object to the new buffer
*/
/* Complete the buffer object initialization */
return_desc->common.flags = AOPOBJ_DATA_VALID;
return_desc->buffer.pointer = (u8 *) new_buf;
return_desc->buffer.length = (u32) (length1 + length2);
......@@ -243,21 +243,22 @@ acpi_ex_do_concatenate (
/*
* There are three cases to handle:
* 1) Two Integers concatenated to produce a buffer
* 2) Two Strings concatenated to produce a string
* 3) Two Buffers concatenated to produce a buffer
*
* 1) Two Integers concatenated to produce a new 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:
/* Result of two integers is a buffer */
/* Result of two Integers is a Buffer */
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
if (!return_desc) {
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;
new_buf = ACPI_MEM_CALLOCATE (return_desc->buffer.length);
......@@ -268,8 +269,6 @@ acpi_ex_do_concatenate (
goto cleanup;
}
return_desc->buffer.pointer = (u8 *) new_buf;
/* Convert the first integer */
this_integer = obj_desc1->integer.value;
......@@ -286,11 +285,17 @@ acpi_ex_do_concatenate (
this_integer >>= 8;
}
/* Complete the buffer object initialization */
return_desc->common.flags = AOPOBJ_DATA_VALID;
return_desc->buffer.pointer = (u8 *) new_buf;
break;
case ACPI_TYPE_STRING:
/* Result of two Strings is a String */
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_STRING);
if (!return_desc) {
return (AE_NO_MEMORY);
......@@ -307,11 +312,13 @@ acpi_ex_do_concatenate (
goto cleanup;
}
/* Concatenate the strings */
ACPI_STRCPY (new_buf, obj_desc1->string.pointer);
ACPI_STRCPY (new_buf + obj_desc1->string.length,
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.length = obj_desc1->string.length +
......@@ -321,7 +328,7 @@ acpi_ex_do_concatenate (
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);
if (!return_desc) {
......@@ -337,22 +344,26 @@ acpi_ex_do_concatenate (
goto cleanup;
}
/* Concatenate the buffers */
ACPI_MEMCPY (new_buf, obj_desc1->buffer.pointer,
obj_desc1->buffer.length);
ACPI_MEMCPY (new_buf + obj_desc1->buffer.length, obj_desc2->buffer.pointer,
obj_desc2->buffer.length);
/*
* Point the return object to the new buffer
*/
/* Complete the buffer object initialization */
return_desc->common.flags = AOPOBJ_DATA_VALID;
return_desc->buffer.pointer = (u8 *) new_buf;
return_desc->buffer.length = obj_desc1->buffer.length +
obj_desc2->buffer.length;
obj_desc2->buffer.length;
break;
default:
/* Invalid object type, should not happen here */
status = AE_AML_INTERNAL;
return_desc = NULL;
}
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg1 - AML execution - opcodes with 1 argument
* $Revision: 137 $
* $Revision: 139 $
*
*****************************************************************************/
......@@ -560,23 +560,12 @@ acpi_ex_opcode_1A_0T_1R (
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
* been converted to a direct name pointer in Resolve_operands
*/
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:
/* The Debug Object is of type "Debug_object" */
......@@ -596,7 +585,7 @@ acpi_ex_opcode_1A_0T_1R (
* of the individual package element that is referenced by
* the index.
*/
type = (*(operand[0]->reference.where))->common.type;
type = ACPI_GET_OBJECT_TYPE (*(operand[0]->reference.where));
}
break;
......@@ -611,7 +600,7 @@ acpi_ex_opcode_1A_0T_1R (
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));
status = AE_AML_INTERNAL;
goto cleanup;
......@@ -668,7 +657,7 @@ acpi_ex_opcode_1A_0T_1R (
* point (even if the original operand was an object reference, it
* will be resolved and typechecked during operand resolution.)
*/
switch (temp_desc->common.type) {
switch (ACPI_GET_OBJECT_TYPE (temp_desc)) {
case ACPI_TYPE_BUFFER:
value = temp_desc->buffer.length;
break;
......@@ -683,7 +672,7 @@ acpi_ex_opcode_1A_0T_1R (
default:
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;
goto cleanup;
}
......
/******************************************************************************
*
* Module Name: exoparg2 - AML execution - opcodes with 2 arguments
* $Revision: 106 $
* $Revision: 108 $
*
*****************************************************************************/
......@@ -297,7 +297,7 @@ acpi_ex_opcode_2A_1T_1R (
* guaranteed to be either Integer/String/Buffer by the operand
* resolution mechanism above.
*/
switch (operand[0]->common.type) {
switch (ACPI_GET_OBJECT_TYPE (operand[0])) {
case ACPI_TYPE_INTEGER:
status = acpi_ex_convert_to_integer (operand[1], &operand[1], walk_state);
break;
......@@ -355,7 +355,7 @@ acpi_ex_opcode_2A_1T_1R (
/*
* 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 */
if (index >= operand[0]->package.count) {
......@@ -364,10 +364,10 @@ acpi_ex_opcode_2A_1T_1R (
goto cleanup;
}
if ((operand[2]->common.type == INTERNAL_TYPE_REFERENCE) &&
(operand[2]->reference.opcode == AML_ZERO_OP)) {
if ((ACPI_GET_OBJECT_TYPE (operand[2]) == ACPI_TYPE_INTEGER) &&
(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
* return a reference to the package element
*/
......@@ -381,7 +381,7 @@ acpi_ex_opcode_2A_1T_1R (
*/
temp_desc = operand[0]->package.elements [index];
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;
status = acpi_ex_store (return_desc, operand[2], walk_state);
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg3 - AML execution - opcodes with 3 arguments
* $Revision: 13 $
* $Revision: 14 $
*
*****************************************************************************/
......@@ -159,7 +159,7 @@ acpi_ex_opcode_3A_1T_1R (
* Create the return object. The Source operand is guaranteed to be
* 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) {
status = AE_NO_MEMORY;
goto cleanup;
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg6 - AML execution - opcodes with 6 arguments
* $Revision: 10 $
* $Revision: 11 $
*
*****************************************************************************/
......@@ -212,7 +212,7 @@ acpi_ex_opcode_6A_0T_1R (
* Treat any NULL or non-numeric elements as non-matching.
*/
if (!this_element ||
this_element->common.type != ACPI_TYPE_INTEGER) {
ACPI_GET_OBJECT_TYPE (this_element) != ACPI_TYPE_INTEGER) {
continue;
}
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exprep - ACPI AML (p-code) execution - field prep utilities
* $Revision: 117 $
* $Revision: 118 $
*
*****************************************************************************/
......@@ -140,7 +140,7 @@ acpi_ex_decode_field_access (
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
* Byte_alignment is always 1 byte -- regardless of any Byte_alignment
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresnte - AML Interpreter object resolution
* $Revision: 53 $
* $Revision: 56 $
*
*****************************************************************************/
......@@ -73,7 +73,6 @@ acpi_ex_resolve_node_to_value (
acpi_operand_object *obj_desc = NULL;
acpi_namespace_node *node;
acpi_object_type entry_type;
acpi_integer temp_val;
ACPI_FUNCTION_TRACE ("Ex_resolve_node_to_value");
......@@ -113,9 +112,9 @@ acpi_ex_resolve_node_to_value (
switch (entry_type) {
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_ut_get_type_name (source_desc->common.type)));
acpi_ut_get_object_type_name (source_desc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
......@@ -131,9 +130,9 @@ acpi_ex_resolve_node_to_value (
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_ut_get_type_name (source_desc->common.type)));
acpi_ut_get_object_type_name (source_desc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
......@@ -149,9 +148,9 @@ acpi_ex_resolve_node_to_value (
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_ut_get_type_name (source_desc->common.type)));
acpi_ut_get_object_type_name (source_desc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
......@@ -164,9 +163,9 @@ acpi_ex_resolve_node_to_value (
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_ut_get_type_name (source_desc->common.type)));
acpi_ut_get_object_type_name (source_desc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
......@@ -216,61 +215,14 @@ acpi_ex_resolve_node_to_value (
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:
switch (source_desc->reference.opcode) {
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;
/* No named references are allowed here */
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported reference opcode %X\n",
source_desc->reference.opcode));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported reference opcode %X\n",
source_desc->reference.opcode));
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
}
/* 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;
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
/* Default case is for unknown types */
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresolv - AML Interpreter object resolution
* $Revision: 111 $
* $Revision: 114 $
*
*****************************************************************************/
......@@ -130,7 +130,7 @@ acpi_ex_resolve_object_to_value (
/* This is an acpi_operand_object */
switch (stack_desc->common.type) {
switch (ACPI_GET_OBJECT_TYPE (stack_desc)) {
case INTERNAL_TYPE_REFERENCE:
opcode = stack_desc->reference.opcode;
......@@ -178,56 +178,6 @@ acpi_ex_resolve_object_to_value (
stack_desc->reference.offset, obj_desc));
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:
......@@ -239,6 +189,7 @@ acpi_ex_resolve_object_to_value (
case ACPI_TYPE_PACKAGE:
obj_desc = *stack_desc->reference.where;
if (obj_desc) {
/*
......@@ -262,7 +213,9 @@ acpi_ex_resolve_object_to_value (
}
break;
default:
/* Invalid reference object */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
......@@ -282,14 +235,12 @@ acpi_ex_resolve_object_to_value (
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));
status = AE_AML_INTERNAL;
break;
} /* switch (Opcode) */
break; /* case INTERNAL_TYPE_REFERENCE */
}
break;
case ACPI_TYPE_BUFFER:
......@@ -313,7 +264,7 @@ acpi_ex_resolve_object_to_value (
case INTERNAL_TYPE_INDEX_FIELD:
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);
*stack_ptr = (void *) obj_desc;
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresop - AML Interpreter operand/object resolution
* $Revision: 50 $
* $Revision: 53 $
*
*****************************************************************************/
......@@ -65,6 +65,18 @@ acpi_ex_check_object_type (
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) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Needed [%s], found [%s] %p\n",
......@@ -85,18 +97,17 @@ acpi_ex_check_object_type (
* PARAMETERS: Opcode - Opcode being interpreted
* Stack_ptr - Pointer to the operand stack to be
* resolved
* Walk_state - Current stateu
* Walk_state - Current state
*
* RETURN: Status
*
* DESCRIPTION: Convert multiple input operands to the types required by the
* target operator.
*
* Each nibble (actually 5 bits) in Arg_types represents one required
* operand and indicates the required Type:
*
* The corresponding operand will be converted to the required type if
* possible, otherwise we abort with an exception.
* Each 5-bit group in Arg_types represents one required
* operand and indicates the required Type. The corresponding operand
* will be converted to the required type if possible, otherwise we
* abort with an exception.
*
******************************************************************************/
......@@ -169,7 +180,7 @@ acpi_ex_resolve_operands (
/* ACPI internal object */
object_type = obj_desc->common.type;
object_type = ACPI_GET_OBJECT_TYPE (obj_desc);
/* Check for bad acpi_object_type */
......@@ -190,15 +201,11 @@ acpi_ex_resolve_operands (
}
switch (obj_desc->reference.opcode) {
case AML_ZERO_OP:
case AML_ONE_OP:
case AML_ONES_OP:
case AML_DEBUG_OP:
case AML_NAME_OP:
case AML_INDEX_OP:
case AML_ARG_OP:
case AML_LOCAL_OP:
case AML_REVISION_OP:
ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Reference Opcode: %s\n", op_info->name)));
......@@ -206,7 +213,7 @@ acpi_ex_resolve_operands (
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Reference Opcode: Unknown [%02x]\n",
"Unknown Reference Opcode %X\n",
obj_desc->reference.opcode));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
......@@ -293,7 +300,7 @@ acpi_ex_resolve_operands (
* -- All others must be resolved below.
*/
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)) {
goto next_operand;
}
......@@ -378,7 +385,7 @@ acpi_ex_resolve_operands (
if (status == AE_TYPE) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"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);
}
......@@ -399,7 +406,7 @@ acpi_ex_resolve_operands (
if (status == AE_TYPE) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"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);
}
......@@ -420,7 +427,7 @@ acpi_ex_resolve_operands (
if (status == AE_TYPE) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"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);
}
......@@ -434,7 +441,7 @@ acpi_ex_resolve_operands (
/* 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_STRING:
case ACPI_TYPE_BUFFER:
......@@ -445,7 +452,7 @@ acpi_ex_resolve_operands (
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"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);
}
......@@ -460,7 +467,7 @@ acpi_ex_resolve_operands (
* The only reference allowed here is a direct reference to
* 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) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Needed [Node Reference], found [%p]\n",
......@@ -492,7 +499,7 @@ acpi_ex_resolve_operands (
/* Need a buffer, string, package */
switch ((*stack_ptr)->common.type) {
switch (ACPI_GET_OBJECT_TYPE (*stack_ptr)) {
case ACPI_TYPE_PACKAGE:
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
......@@ -503,7 +510,7 @@ acpi_ex_resolve_operands (
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"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);
}
......@@ -514,7 +521,7 @@ acpi_ex_resolve_operands (
/* 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_STRING:
case ACPI_TYPE_BUFFER:
......@@ -525,7 +532,7 @@ acpi_ex_resolve_operands (
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"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);
}
......@@ -548,7 +555,7 @@ acpi_ex_resolve_operands (
* required object type (Simple cases only).
*/
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)) {
return_ACPI_STATUS (status);
}
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exstore - AML Interpreter object store support
* $Revision: 164 $
* $Revision: 167 $
*
*****************************************************************************/
......@@ -89,18 +89,33 @@ acpi_ex_store (
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 */
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 (dest_desc);
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);
}
......@@ -112,7 +127,6 @@ acpi_ex_store (
* 2) Store to an indexed area of a Buffer or Package
* 3) Store to a Method Local or Arg
* 4) Store to the debug object
* 5) Store to a constant -- a noop
*/
switch (ref_desc->reference.opcode) {
case AML_NAME_OP:
......@@ -151,9 +165,9 @@ acpi_ex_store (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "**** Write to Debug Object: ****:\n\n"));
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:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%8.8X%8.8X\n",
......@@ -185,7 +199,7 @@ acpi_ex_store (
default:
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;
}
......@@ -193,28 +207,15 @@ acpi_ex_store (
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:
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));
ACPI_DUMP_ENTRY (ref_desc, ACPI_LV_ERROR);
status = AE_AML_INTERNAL;
break;
} /* switch (Ref_desc->Reference.Opcode) */
}
return_ACPI_STATUS (status);
}
......@@ -303,7 +304,7 @@ acpi_ex_store_object_to_index (
* Make sure the target is a Buffer
*/
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);
}
......@@ -311,7 +312,7 @@ acpi_ex_store_object_to_index (
* The assignment of the individual elements will be slightly
* different for each source type.
*/
switch (source_desc->common.type) {
switch (ACPI_GET_OBJECT_TYPE (source_desc)) {
case ACPI_TYPE_INTEGER:
/* Use the least-significant byte of the integer */
......@@ -335,7 +336,7 @@ acpi_ex_store_object_to_index (
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"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);
}
......@@ -403,7 +404,7 @@ acpi_ex_store_object_to_node (
target_desc = acpi_ns_get_attached_object (node);
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)));
/*
......@@ -456,8 +457,8 @@ acpi_ex_store_object_to_node (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Store %s into %s via Convert/Attach\n",
acpi_ut_get_type_name (source_desc->common.type),
acpi_ut_get_type_name (new_desc->common.type)));
acpi_ut_get_object_type_name (source_desc),
acpi_ut_get_object_type_name (new_desc)));
}
break;
......@@ -466,11 +467,11 @@ acpi_ex_store_object_to_node (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"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 */
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;
}
......
......@@ -3,7 +3,7 @@
*
* Module Name: exstoren - AML Interpreter object store support,
* Store to Node (namespace object)
* $Revision: 48 $
* $Revision: 50 $
*
*****************************************************************************/
......@@ -84,7 +84,7 @@ acpi_ex_resolve_object (
* are all essentially the same. This case handles the
* "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 */
status = acpi_ex_resolve_to_value (source_desc_ptr, walk_state);
......@@ -96,15 +96,15 @@ acpi_ex_resolve_object (
/*
* Must have a Integer, Buffer, or String
*/
if ((source_desc->common.type != ACPI_TYPE_INTEGER) &&
(source_desc->common.type != ACPI_TYPE_BUFFER) &&
(source_desc->common.type != ACPI_TYPE_STRING)) {
if ((ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER) &&
(ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) &&
(ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING)) {
/*
* Conversion successful but still not a valid type
*/
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"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)));
status = AE_AML_OPERAND_TYPE;
}
......@@ -195,7 +195,7 @@ acpi_ex_store_object_to_object (
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.
* Perform the "implicit conversion" of the source to the current type
......@@ -205,7 +205,7 @@ acpi_ex_store_object_to_object (
* Otherwise, Actual_src_desc is a temporary object to hold the
* 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);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
......@@ -216,14 +216,14 @@ acpi_ex_store_object_to_object (
* We now have two objects of identical types, and we can perform a
* copy of the *value* of the source object.
*/
switch (dest_desc->common.type) {
switch (ACPI_GET_OBJECT_TYPE (dest_desc)) {
case ACPI_TYPE_INTEGER:
dest_desc->integer.value = actual_src_desc->integer.value;
/* 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;
case ACPI_TYPE_STRING:
......@@ -246,7 +246,7 @@ acpi_ex_store_object_to_object (
* All other types come here.
*/
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;
break;
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exutils - interpreter/scanner utilities
* $Revision: 98 $
* $Revision: 100 $
*
*****************************************************************************/
......@@ -148,8 +148,6 @@ acpi_ex_validate_object_type (
* FUNCTION: Acpi_ex_truncate_for32bit_table
*
* PARAMETERS: Obj_desc - Object to be truncated
* Walk_state - Current walk state
* (A method must be executing)
*
* RETURN: none
*
......@@ -160,8 +158,7 @@ acpi_ex_validate_object_type (
void
acpi_ex_truncate_for32bit_table (
acpi_operand_object *obj_desc,
acpi_walk_state *walk_state)
acpi_operand_object *obj_desc)
{
ACPI_FUNCTION_ENTRY ();
......@@ -172,8 +169,7 @@ acpi_ex_truncate_for32bit_table (
* a control method
*/
if ((!obj_desc) ||
(obj_desc->common.type != ACPI_TYPE_INTEGER) ||
(!walk_state->method_node)) {
(ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_INTEGER)) {
return;
}
......
......@@ -3,7 +3,7 @@
*
* Module Name: hwregs - Read/write access functions for the various ACPI
* control and status registers.
* $Revision: 130 $
* $Revision: 133 $
*
******************************************************************************/
......@@ -129,7 +129,7 @@ acpi_get_sleep_type_data (
/*
* Validate parameters
* Validate parameters
*/
if ((sleep_state > ACPI_S_STATES_MAX) ||
!sleep_type_a || !sleep_type_b) {
......@@ -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],
NULL, &obj_desc);
......@@ -145,46 +145,47 @@ acpi_get_sleep_type_data (
return_ACPI_STATUS (status);
}
/* Must have a return object */
if (!obj_desc) {
ACPI_REPORT_ERROR (("Missing Sleep State object\n"));
return_ACPI_STATUS (AE_NOT_EXIST);
status = AE_NOT_EXIST;
}
/*
* 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
*/
/* It must be of type Package */
/* Even though Acpi_evaluate_object resolves package references,
* Ns_evaluate doesn't. So, we do it here.
*/
status = acpi_ut_resolve_package_references(obj_desc);
else if (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_PACKAGE) {
ACPI_REPORT_ERROR (("Sleep State object not a Package\n"));
status = AE_AML_OPERAND_TYPE;
}
if (obj_desc->package.count < 2) {
/* Must have at least two elements */
/* The package 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"));
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;
}
else {
/*
* Valid _Sx_ package size, type, and value
* Valid _Sx_ package size, type, and value
*/
*sleep_type_a = (u8) (obj_desc->package.elements[0])->integer.value;
*sleep_type_b = (u8) (obj_desc->package.elements[1])->integer.value;
}
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad Sleep object %p type %X\n",
obj_desc, obj_desc->common.type));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad Sleep object %p type %s\n",
obj_desc, acpi_ut_get_object_type_name (obj_desc)));
}
acpi_ut_remove_reference (obj_desc);
......@@ -196,7 +197,7 @@ acpi_get_sleep_type_data (
*
* 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
*
......@@ -224,8 +225,8 @@ acpi_hw_get_bit_register_info (
*
* FUNCTION: Acpi_get_register
*
* PARAMETERS: Register_id - index of ACPI Register to access
* Use_lock - Lock the hardware
* PARAMETERS: Register_id - Index of ACPI Register to access
* Use_lock - Lock the hardware
*
* RETURN: Value is read from specified Register. Value returned is
* normalized to bit0 (is shifted all the way right)
......
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
* $Revision: 102 $
* $Revision: 104 $
*
*****************************************************************************/
......@@ -54,36 +54,36 @@
/* Version string */
#define ACPI_CA_VERSION 0x20020517
#define ACPI_CA_VERSION 0x20020611
/* Version of ACPI supported */
#define ACPI_CA_SUPPORT_LEVEL 2
#define ACPI_CA_SUPPORT_LEVEL 2
/* Maximum objects in the various object caches */
#define MAX_STATE_CACHE_DEPTH 64 /* State objects for stacks */
#define MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */
#define MAX_EXTPARSE_CACHE_DEPTH 64 /* Parse tree objects */
#define MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */
#define MAX_WALK_CACHE_DEPTH 4 /* Objects for parse tree walks */
#define MAX_STATE_CACHE_DEPTH 64 /* State objects for stacks */
#define MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */
#define MAX_EXTPARSE_CACHE_DEPTH 64 /* Parse tree objects */
#define MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */
#define MAX_WALK_CACHE_DEPTH 4 /* Objects for parse tree walks */
/* String size constants */
#define MAX_STRING_LENGTH 512
#define PATHNAME_MAX 256 /* A full namespace pathname */
#define MAX_STRING_LENGTH 512
#define PATHNAME_MAX 256 /* A full namespace pathname */
/* Maximum count for a semaphore object */
#define MAX_SEMAPHORE_COUNT 256
#define MAX_SEMAPHORE_COUNT 256
/* Max reference count (for debug only) */
#define MAX_REFERENCE_COUNT 0x400
#define MAX_REFERENCE_COUNT 0x400
/* Size of cached memory mapping for system memory operation region */
#define SYSMEM_REGION_WINDOW_SIZE 4096
#define SYSMEM_REGION_WINDOW_SIZE 4096
/******************************************************************************
......@@ -92,29 +92,12 @@
*
*****************************************************************************/
/*
* 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
* table checksum is incorrect?
*/
#define ACPI_CHECKSUM_ABORT FALSE
#define ACPI_CHECKSUM_ABORT FALSE
/******************************************************************************
......@@ -125,54 +108,54 @@
/* Number of distinct GPE register blocks */
#define ACPI_MAX_GPE_BLOCKS 2
#define ACPI_MAX_GPE_BLOCKS 2
/*
* Method info (in WALK_STATE), containing local variables and argumetns
*/
#define MTH_NUM_LOCALS 8
#define MTH_MAX_LOCAL 7
#define MTH_NUM_LOCALS 8
#define MTH_MAX_LOCAL 7
#define MTH_NUM_ARGS 7
#define MTH_MAX_ARG 6
#define MTH_NUM_ARGS 7
#define MTH_MAX_ARG 6
/* Maximum length of resulting string when converting from a buffer */
#define ACPI_MAX_STRING_CONVERSION 200
#define ACPI_MAX_STRING_CONVERSION 200
/*
* Operand Stack (in WALK_STATE), Must be large enough to contain MTH_MAX_ARG
*/
#define OBJ_NUM_OPERANDS 8
#define OBJ_MAX_OPERAND 7
#define OBJ_NUM_OPERANDS 8
#define OBJ_MAX_OPERAND 7
/* Names within the namespace are 4 bytes long */
#define ACPI_NAME_SIZE 4
#define PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */
#define PATH_SEPARATOR '.'
#define ACPI_NAME_SIZE 4
#define PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */
#define PATH_SEPARATOR '.'
/* Constants used in searching for the RSDP in low memory */
#define LO_RSDP_WINDOW_BASE 0 /* Physical Address */
#define HI_RSDP_WINDOW_BASE 0xE0000 /* Physical Address */
#define LO_RSDP_WINDOW_SIZE 0x400
#define HI_RSDP_WINDOW_SIZE 0x20000
#define RSDP_SCAN_STEP 16
#define LO_RSDP_WINDOW_BASE 0 /* Physical Address */
#define HI_RSDP_WINDOW_BASE 0xE0000 /* Physical Address */
#define LO_RSDP_WINDOW_SIZE 0x400
#define HI_RSDP_WINDOW_SIZE 0x20000
#define RSDP_SCAN_STEP 16
/* Operation regions */
#define ACPI_NUM_PREDEFINED_REGIONS 8
#define ACPI_USER_REGION_BEGIN 0x80
#define ACPI_NUM_PREDEFINED_REGIONS 8
#define ACPI_USER_REGION_BEGIN 0x80
/* Maximum Space_ids for Operation Regions */
#define ACPI_MAX_ADDRESS_SPACE 255
#define ACPI_MAX_ADDRESS_SPACE 255
/* RSDP checksums */
#define ACPI_RSDP_CHECKSUM_LENGTH 20
#define ACPI_RSDP_XCHECKSUM_LENGTH 36
#define ACPI_RSDP_CHECKSUM_LENGTH 20
#define ACPI_RSDP_XCHECKSUM_LENGTH 36
/******************************************************************************
......@@ -182,10 +165,10 @@
*****************************************************************************/
#define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */
#define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */
#define ACPI_DEBUGGER_COMMAND_PROMPT '-'
#define ACPI_DEBUGGER_EXECUTE_PROMPT '%'
#define ACPI_DEBUGGER_COMMAND_PROMPT '-'
#define ACPI_DEBUGGER_EXECUTE_PROMPT '%'
#endif /* _ACCONFIG_H */
......
/******************************************************************************
*
* Name: acinterp.h - Interpreter subcomponent prototypes and defines
* $Revision: 137 $
* $Revision: 138 $
*
*****************************************************************************/
......@@ -603,8 +603,7 @@ acpi_ex_exit_interpreter (
void
acpi_ex_truncate_for32bit_table (
acpi_operand_object *obj_desc,
acpi_walk_state *walk_state);
acpi_operand_object *obj_desc);
u8
acpi_ex_validate_object_type (
......
/******************************************************************************
*
* Name: acmacros.h - C macros for the entire subsystem.
* $Revision: 123 $
* $Revision: 124 $
*
*****************************************************************************/
......@@ -262,7 +262,7 @@
/* 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 */
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: acobject.h - Definition of acpi_operand_object (Internal object only)
* $Revision: 111 $
* $Revision: 112 $
*
*****************************************************************************/
......@@ -56,7 +56,7 @@
/* Values for flag byte above */
#define AOPOBJ_RESERVED 0x01
#define AOPOBJ_AML_CONSTANT 0x01
#define AOPOBJ_STATIC_POINTER 0x02
#define AOPOBJ_DATA_VALID 0x04
#define AOPOBJ_OBJECT_INITIALIZED 0x08
......
/******************************************************************************
*
* Name: acoutput.h -- debug output
* $Revision: 86 $
* $Revision: 87 $
*
*****************************************************************************/
......@@ -105,6 +105,16 @@
#define ACPI_LV_INTERRUPTS 0x08000000
#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
*/
......@@ -145,17 +155,7 @@
#define ACPI_DB_MUTEX ACPI_DEBUG_LEVEL (ACPI_LV_MUTEX)
#define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT)
#define ACPI_DB_ALL ACPI_DEBUG_LEVEL (0x0FFFFF80)
/* 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
#define ACPI_DB_ALL ACPI_DEBUG_LEVEL (ACPI_LV_ALL)
/* Defaults for Debug_level, debug and normal */
......
......@@ -195,6 +195,14 @@ acpi_evaluate_object (
acpi_object_list *parameter_objects,
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_get_object_info (
acpi_handle device,
......
/******************************************************************************
*
* Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
* $Revision: 137 $
* $Revision: 139 $
*
*****************************************************************************/
......@@ -104,6 +104,10 @@ NATIVE_CHAR *
acpi_ut_get_type_name (
acpi_object_type type);
NATIVE_CHAR *
acpi_ut_get_object_type_name (
acpi_operand_object *obj_desc);
#endif
......@@ -663,17 +667,6 @@ NATIVE_CHAR *
acpi_ut_strupr (
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 *
acpi_ut_get_resource_end_tag (
acpi_operand_object *obj_desc);
......
/******************************************************************************
*
* Name: acenv.h - Generation environment specific items
* $Revision: 94 $
* $Revision: 95 $
*
*****************************************************************************/
......@@ -55,17 +55,6 @@
#define ACPI_USE_SYSTEM_CLIBRARY
#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
* local generation environment.
......@@ -151,8 +140,39 @@
#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 !*/
/*
* 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
......
/*******************************************************************************
*
* Module Name: nsaccess - Top-level functions for accessing ACPI namespace
* $Revision: 155 $
* $Revision: 156 $
*
******************************************************************************/
......@@ -179,7 +179,7 @@ acpi_ns_root_initialize (void)
/* 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 */
......
/******************************************************************************
*
* Module Name: nsdump - table dumping routines for debug
* $Revision: 135 $
* $Revision: 136 $
*
*****************************************************************************/
......@@ -500,7 +500,7 @@ acpi_ns_dump_one_object (
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) {
acpi_os_printf ("(Ptr to ACPI Object type %X [UNKNOWN])\n", obj_type);
......
......@@ -2,7 +2,7 @@
*
* Module Name: nseval - Object evaluation interfaces -- includes control
* method lookup and execution.
* $Revision: 114 $
* $Revision: 116 $
*
******************************************************************************/
......@@ -40,12 +40,12 @@
* FUNCTION: Acpi_ns_evaluate_relative
*
* 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
* **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
* 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.
*
* RETURN: Status
......@@ -141,9 +141,9 @@ acpi_ns_evaluate_relative (
* FUNCTION: Acpi_ns_evaluate_by_name
*
* 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.
* **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
* NULL if no parameters are being passed.
*
......@@ -226,10 +226,10 @@ acpi_ns_evaluate_by_name (
* FUNCTION: Acpi_ns_evaluate_by_handle
*
* 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
* 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.
*
* RETURN: Status
......@@ -285,7 +285,6 @@ acpi_ns_evaluate_by_handle (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/*
* Two major cases here:
* 1) The object is an actual control method -- execute it.
......@@ -302,7 +301,6 @@ acpi_ns_evaluate_by_handle (
status = acpi_ns_execute_control_method (node, params,
&local_return_object);
}
else {
/*
* Case 2) Object is NOT a method, just return its
......@@ -311,7 +309,6 @@ acpi_ns_evaluate_by_handle (
status = acpi_ns_get_object_value (node, &local_return_object);
}
/*
* Check if there is a return value on the stack that must
* be dealt with
......@@ -348,11 +345,11 @@ acpi_ns_evaluate_by_handle (
*
* FUNCTION: Acpi_ns_execute_control_method
*
* PARAMETERS: Method_node - The object/method
* **Params - List of parameters to pass to the method,
* PARAMETERS: Method_node - The method to execute
* Params - List of parameters to pass to the method,
* terminated by NULL. Params itself may be
* 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.
*
* RETURN: Status
......@@ -424,7 +421,8 @@ acpi_ns_execute_control_method (
*
* 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
*
......
......@@ -2,7 +2,7 @@
*
* Module Name: nsobject - Utilities for objects attached to namespace
* table entries
* $Revision: 82 $
* $Revision: 83 $
*
******************************************************************************/
......@@ -199,8 +199,9 @@ acpi_ns_detach_object (
obj_desc = node->object;
if (!obj_desc ||
(obj_desc->common.type == INTERNAL_TYPE_DATA)) {
if (!obj_desc ||
(ACPI_GET_OBJECT_TYPE (obj_desc) == INTERNAL_TYPE_DATA)) {
return_VOID;
}
......@@ -210,7 +211,7 @@ acpi_ns_detach_object (
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) {
node->object = obj_desc->common.next_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;
}
}
......@@ -255,7 +256,7 @@ acpi_ns_get_attached_object (
if (!node->object ||
((ACPI_GET_DESCRIPTOR_TYPE (node->object) != ACPI_DESC_TYPE_OPERAND) &&
(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);
}
......@@ -281,10 +282,10 @@ acpi_ns_get_secondary_object (
ACPI_FUNCTION_TRACE_PTR ("Ns_get_secondary_object", obj_desc);
if ((!obj_desc) ||
(obj_desc->common.type == INTERNAL_TYPE_DATA) ||
(!obj_desc->common.next_object) ||
(obj_desc->common.next_object->common.type == INTERNAL_TYPE_DATA)) {
if ((!obj_desc) ||
(ACPI_GET_OBJECT_TYPE (obj_desc) == INTERNAL_TYPE_DATA) ||
(!obj_desc->common.next_object) ||
(ACPI_GET_OBJECT_TYPE (obj_desc->common.next_object) == INTERNAL_TYPE_DATA)) {
return_PTR (NULL);
}
......@@ -319,7 +320,7 @@ acpi_ns_attach_data (
prev_obj_desc = NULL;
obj_desc = node->object;
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)) {
return (AE_ALREADY_EXISTS);
}
......@@ -377,7 +378,7 @@ acpi_ns_detach_data (
prev_obj_desc = NULL;
obj_desc = node->object;
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)) {
if (prev_obj_desc) {
prev_obj_desc->common.next_object = obj_desc->common.next_object;
......@@ -421,7 +422,7 @@ acpi_ns_get_attached_data (
obj_desc = node->object;
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)) {
*data = obj_desc->data.pointer;
return (AE_OK);
......
/*******************************************************************************
*
* Module Name: nssearch - Namespace search
* $Revision: 85 $
* $Revision: 86 $
*
******************************************************************************/
......@@ -204,7 +204,8 @@ acpi_ns_search_parent_tree (
}
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)));
}
......
......@@ -2,7 +2,7 @@
*
* Module Name: nsutils - Utilities for accessing ACPI namespace, accessing
* parents and siblings and Scope manipulation
* $Revision: 109 $
* $Revision: 110 $
*
*****************************************************************************/
......@@ -227,7 +227,7 @@ acpi_ns_build_internal_name (
NATIVE_CHAR *internal_name = info->internal_name;
NATIVE_CHAR *external_name = info->next_external_char;
NATIVE_CHAR *result = NULL;
NATIVE_UINT_MIN32 i;
NATIVE_UINT i;
ACPI_FUNCTION_TRACE ("Ns_build_internal_name");
......
/******************************************************************************
*
* 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] =
/*! [Begin] no source code translation */
/* 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),
/* 01 */ ACPI_OP ("One", ARGP_ONE_OP, ARGI_ONE_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, 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),
/* 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),
......@@ -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),
/* 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),
/* 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) */
......@@ -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),
/* 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),
/* 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),
/* 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),
......
/*******************************************************************************
*
* Module Name: rscalc - Calculate stream and list lengths
* $Revision: 42 $
* $Revision: 43 $
*
******************************************************************************/
......@@ -770,8 +770,8 @@ acpi_rs_get_pci_routing_table_length (
name_found = FALSE;
for (table_index = 0; table_index < 4 && !name_found; table_index++) {
if ((ACPI_TYPE_STRING == (*sub_object_list)->common.type) ||
((INTERNAL_TYPE_REFERENCE == (*sub_object_list)->common.type) &&
if ((ACPI_TYPE_STRING == ACPI_GET_OBJECT_TYPE (*sub_object_list)) ||
((INTERNAL_TYPE_REFERENCE == ACPI_GET_OBJECT_TYPE (*sub_object_list)) &&
((*sub_object_list)->reference.opcode == AML_INT_NAMEPATH_OP))) {
name_found = TRUE;
}
......@@ -789,7 +789,7 @@ acpi_rs_get_pci_routing_table_length (
* Was a String type 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
* terminating NULL
......
/*******************************************************************************
*
* Module Name: rscreate - Create resource lists/tables
* $Revision: 56 $
* $Revision: 57 $
*
******************************************************************************/
......@@ -212,12 +212,12 @@ acpi_rs_create_pci_routing_table (
/*
* 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;
}
else {
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);
}
......@@ -226,12 +226,12 @@ acpi_rs_create_pci_routing_table (
*/
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;
}
else {
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);
}
......@@ -240,7 +240,7 @@ acpi_rs_create_pci_routing_table (
*/
sub_object_list++;
switch ((*sub_object_list)->common.type) {
switch (ACPI_GET_OBJECT_TYPE (*sub_object_list)) {
case INTERNAL_TYPE_REFERENCE:
if ((*sub_object_list)->reference.opcode != AML_INT_NAMEPATH_OP) {
......@@ -288,7 +288,7 @@ acpi_rs_create_pci_routing_table (
default:
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);
}
......@@ -301,12 +301,12 @@ acpi_rs_create_pci_routing_table (
*/
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;
}
else {
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);
}
......
/*******************************************************************************
*
* Module Name: rsutils - Utilities for the resource manager
* $Revision: 30 $
* $Revision: 33 $
*
******************************************************************************/
......@@ -56,7 +56,7 @@ acpi_rs_get_prt_method_data (
acpi_handle handle,
acpi_buffer *ret_buffer)
{
acpi_operand_object *ret_obj;
acpi_operand_object *obj_desc;
acpi_status status;
......@@ -68,12 +68,12 @@ acpi_rs_get_prt_method_data (
/*
* 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)) {
return_ACPI_STATUS (status);
}
if (!ret_obj) {
if (!obj_desc) {
/* Return object is required */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _PRT\n"));
......@@ -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
* 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_ut_get_type_name (ret_obj->common.type)));
acpi_ut_get_object_type_name (obj_desc)));
status = AE_AML_OPERAND_TYPE;
goto cleanup;
}
......@@ -96,13 +96,13 @@ acpi_rs_get_prt_method_data (
* Create a resource linked list from the byte stream buffer that comes
* 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 */
cleanup:
acpi_ut_remove_reference (ret_obj);
acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status);
}
......@@ -130,7 +130,7 @@ acpi_rs_get_crs_method_data (
acpi_handle handle,
acpi_buffer *ret_buffer)
{
acpi_operand_object *ret_obj;
acpi_operand_object *obj_desc;
acpi_status status;
......@@ -142,12 +142,12 @@ acpi_rs_get_crs_method_data (
/*
* 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)) {
return_ACPI_STATUS (status);
}
if (!ret_obj) {
if (!obj_desc) {
/* Return object is required */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _CRS\n"));
......@@ -160,9 +160,9 @@ acpi_rs_get_crs_method_data (
* then the underlying AML code is corrupt or improperly
* 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_ut_get_type_name (ret_obj->common.type)));
acpi_ut_get_object_type_name (obj_desc)));
status = AE_AML_OPERAND_TYPE;
goto cleanup;
}
......@@ -172,13 +172,13 @@ acpi_rs_get_crs_method_data (
* byte stream buffer that comes back from the _CRS method
* 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 */
cleanup:
acpi_ut_remove_reference (ret_obj);
acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status);
}
......@@ -206,7 +206,7 @@ acpi_rs_get_prs_method_data (
acpi_handle handle,
acpi_buffer *ret_buffer)
{
acpi_operand_object *ret_obj;
acpi_operand_object *obj_desc;
acpi_status status;
......@@ -218,12 +218,12 @@ acpi_rs_get_prs_method_data (
/*
* 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)) {
return_ACPI_STATUS (status);
}
if (!ret_obj) {
if (!obj_desc) {
/* Return object is required */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _PRS\n"));
......@@ -236,9 +236,9 @@ acpi_rs_get_prs_method_data (
* then the underlying AML code is corrupt or improperly
* 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_ut_get_type_name (ret_obj->common.type)));
acpi_ut_get_object_type_name (obj_desc)));
status = AE_AML_OPERAND_TYPE;
goto cleanup;
}
......@@ -248,13 +248,13 @@ acpi_rs_get_prs_method_data (
* byte stream buffer that comes back from the _CRS method
* 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 */
cleanup:
acpi_ut_remove_reference (ret_obj);
acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status);
}
......@@ -319,6 +319,7 @@ acpi_rs_set_srs_method_data (
*/
params[0]->buffer.length = (u32) buffer.length;
params[0]->buffer.pointer = buffer.pointer;
params[0]->common.flags = AOPOBJ_DATA_VALID;
params[1] = NULL;
/*
......
/******************************************************************************
*
* Module Name: tbutils - Table manipulation utilities
* $Revision: 53 $
* $Revision: 54 $
*
*****************************************************************************/
......@@ -91,7 +91,7 @@ acpi_tb_handle_to_object (
* name
* 3) Table must be readable for length specified in the header
* 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 (
table_size = (ACPI_SIZE) table->length;
#if 0
/* We don't want to validate the header here. */
/*
* Validate the header and delete the mapping.
* We will create a mapping for the full table below.
*/
status = acpi_tb_validate_table_header (table);
#endif
/* Always unmap the memory for the header */
acpi_os_unmap_memory (table, sizeof (acpi_table_header));
#if 0
/* Exit if header invalid */
if (ACPI_FAILURE (status)) {
return (status);
}
#endif
}
/* Map the physical memory for the correct length */
......
/******************************************************************************
*
* Module Name: utcopy - Internal to external object translation utilities
* $Revision: 98 $
* $Revision: 101 $
*
*****************************************************************************/
......@@ -57,7 +57,6 @@ acpi_ut_copy_isimple_to_esimple (
u8 *data_space,
ACPI_SIZE *buffer_space_used)
{
acpi_buffer buffer;
acpi_status status = AE_OK;
......@@ -68,7 +67,7 @@ acpi_ut_copy_isimple_to_esimple (
/*
* Check for NULL object case (could be an uninitialized
* package element
* package element)
*/
if (!internal_object) {
return_ACPI_STATUS (AE_OK);
......@@ -82,11 +81,11 @@ acpi_ut_copy_isimple_to_esimple (
* In general, the external object will be the same type as
* 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 */
switch (internal_object->common.type) {
switch (ACPI_GET_OBJECT_TYPE (internal_object)) {
case ACPI_TYPE_STRING:
external_object->string.pointer = (NATIVE_CHAR *) data_space;
......@@ -121,45 +120,9 @@ acpi_ut_copy_isimple_to_esimple (
* This is an object reference. Attempt to dereference it.
*/
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:
/*
* 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,
&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;
/* For namepath, return the object handle ("reference") */
default:
/*
......@@ -175,7 +138,7 @@ acpi_ut_copy_isimple_to_esimple (
case ACPI_TYPE_PROCESSOR:
external_object->processor.proc_id = internal_object->processor.proc_id;
external_object->processor.proc_id = internal_object->processor.proc_id;
external_object->processor.pblk_address = internal_object->processor.address;
external_object->processor.pblk_length = internal_object->processor.length;
break;
......@@ -328,7 +291,7 @@ acpi_ut_copy_ipackage_to_epackage (
info.num_packages = 1;
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.elements = ACPI_CAST_PTR (acpi_object, info.free_space);
......@@ -372,7 +335,7 @@ acpi_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
* nested packages)
......@@ -550,7 +513,7 @@ acpi_ut_copy_epackage_to_ipackage (
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.elements = (acpi_object *)free_space;
......@@ -653,7 +616,7 @@ acpi_ut_copy_simple_object (
/* Handle the objects with extra data */
switch (dest_desc->common.type) {
switch (ACPI_GET_OBJECT_TYPE (dest_desc)) {
case ACPI_TYPE_BUFFER:
dest_desc->buffer.node = NULL;
......@@ -729,7 +692,7 @@ acpi_ut_copy_ielement_to_ielement (
/*
* 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) {
return (AE_NO_MEMORY);
}
......@@ -803,16 +766,16 @@ acpi_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->package.count = source_obj->package.count;
/*
* Create the object array and walk the source package tree
*/
dest_obj->package.elements = ACPI_MEM_CALLOCATE (((ACPI_SIZE) source_obj->package.count + 1) *
sizeof (void *));
dest_obj->package.elements = ACPI_MEM_CALLOCATE (
((ACPI_SIZE) source_obj->package.count + 1) *
sizeof (void *));
if (!dest_obj->package.elements) {
ACPI_REPORT_ERROR (
("Aml_build_copy_internal_package_object: Package allocation failure\n"));
......@@ -863,14 +826,14 @@ acpi_ut_copy_iobject_to_iobject (
/* 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) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* 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,
walk_state);
}
......
/*******************************************************************************
*
* Module Name: utdelete - object deletion and reference count utilities
* $Revision: 90 $
* $Revision: 91 $
*
******************************************************************************/
......@@ -65,7 +65,7 @@ acpi_ut_delete_internal_obj (
* Must delete or free any pointers within the object that are not
* actual ACPI objects (for example, a raw buffer pointer).
*/
switch (object->common.type) {
switch (ACPI_GET_OBJECT_TYPE (object)) {
case ACPI_TYPE_STRING:
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "**** String %p, ptr %p\n",
......@@ -190,7 +190,7 @@ acpi_ut_delete_internal_obj (
/* Now the object can be safely deleted */
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);
return_VOID;
......@@ -295,7 +295,7 @@ acpi_ut_update_ref_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",
object, new_count));
}
......@@ -403,7 +403,7 @@ acpi_ut_update_object_reference (
* All sub-objects must have their reference count incremented also.
* Different object types have different subobjects.
*/
switch (object->common.type) {
switch (ACPI_GET_OBJECT_TYPE (object)) {
case ACPI_TYPE_DEVICE:
status = acpi_ut_create_update_state_and_push (object->device.addr_handler,
......
/******************************************************************************
*
* Module Name: uteval - Object evaluation
* $Revision: 39 $
* $Revision: 40 $
*
*****************************************************************************/
......@@ -91,11 +91,11 @@ acpi_ut_evaluate_numeric_object (
/* 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;
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Type returned from %s was not a number: %X \n",
object_name, obj_desc->common.type));
"Type returned from %s was not an Integer: %X \n",
object_name, ACPI_GET_OBJECT_TYPE (obj_desc)));
}
else {
/*
......@@ -169,15 +169,16 @@ acpi_ut_execute_HID (
* A _HID can return either a Number (32 bit compressed EISA ID) or
* a string
*/
if ((obj_desc->common.type != ACPI_TYPE_INTEGER) &&
(obj_desc->common.type != ACPI_TYPE_STRING)) {
if ((ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_INTEGER) &&
(ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_STRING)) {
status = AE_TYPE;
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"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 {
if (obj_desc->common.type == ACPI_TYPE_INTEGER) {
if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) {
/* Convert the Numeric HID to string */
acpi_ex_eisa_id_to_string ((u32) obj_desc->integer.value, hid->buffer);
......@@ -253,7 +254,7 @@ acpi_ut_execute_CID (
* 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").
*/
switch (obj_desc->common.type) {
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_INTEGER:
/* Convert the Numeric CID to string */
......@@ -278,7 +279,8 @@ acpi_ut_execute_CID (
status = AE_TYPE;
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"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;
}
......@@ -347,15 +349,15 @@ acpi_ut_execute_UID (
* A _UID can return either a Number (32 bit compressed EISA ID) or
* a string
*/
if ((obj_desc->common.type != ACPI_TYPE_INTEGER) &&
(obj_desc->common.type != ACPI_TYPE_STRING)) {
if ((ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_INTEGER) &&
(ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_STRING)) {
status = AE_TYPE;
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Type returned from _UID was not a number or string: %X \n",
obj_desc->common.type));
ACPI_GET_OBJECT_TYPE (obj_desc)));
}
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 */
acpi_ex_unsigned_integer_to_string (obj_desc->integer.value, uid->buffer);
......@@ -433,11 +435,11 @@ acpi_ut_execute_STA (
/* 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;
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Type returned from _STA was not a number: %X \n",
obj_desc->common.type));
ACPI_GET_OBJECT_TYPE (obj_desc)));
}
else {
/* Extract the status flags */
......
/******************************************************************************
*
* Module Name: utglobal - Global variables for the ACPI subsystem
* $Revision: 161 $
* $Revision: 162 $
*
*****************************************************************************/
......@@ -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 */
#if 0
......
/*******************************************************************************
*
* Module Name: utmisc - common utility procedures
* $Revision: 75 $
* $Revision: 78 $
*
******************************************************************************/
......@@ -27,6 +27,7 @@
#include "acpi.h"
#include "acnamesp.h"
#include "amlcode.h"
#include "acinterp.h"
#define _COMPONENT ACPI_UTILITIES
......@@ -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
......@@ -1260,7 +1148,7 @@ acpi_ut_walk_package_tree (
*/
if ((!this_source_obj) ||
(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,
state, context);
if (ACPI_FAILURE (status)) {
......
/******************************************************************************
*
* Module Name: utobject - ACPI object create/delete/size/cache routines
* $Revision: 73 $
* $Revision: 76 $
*
*****************************************************************************/
......@@ -37,10 +37,9 @@
*
* FUNCTION: Acpi_ut_create_internal_object_dbg
*
* PARAMETERS: Address - Address of the memory to deallocate
* Component - Component type of caller
* Module - Source file name of caller
* Line - Line number of caller
* PARAMETERS: Module_name - Source file name of caller
* Line_number - Line number of caller
* Component_id - Component type of caller
* Type - ACPI Type of the new object
*
* RETURN: Object - The new object. Null on failure
......@@ -119,7 +118,7 @@ acpi_ut_create_internal_object_dbg (
*
* 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
*
......@@ -180,7 +179,6 @@ acpi_ut_valid_internal_object (
* PARAMETERS: Module_name - Caller's module name (for error output)
* Line_number - Caller's line number (for error output)
* Component_id - Caller's component ID (for error output)
* Message - Error message to use on failure
*
* RETURN: Pointer to newly allocated object descriptor. Null on error
*
......@@ -209,7 +207,6 @@ acpi_ut_allocate_object_desc_dbg (
return_PTR (NULL);
}
/* Mark the descriptor type */
ACPI_SET_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_OPERAND);
......@@ -225,7 +222,7 @@ acpi_ut_allocate_object_desc_dbg (
*
* 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.
*
......@@ -260,7 +257,7 @@ acpi_ut_delete_object_desc (
*
* PARAMETERS: None
*
* RETURN: Status
* RETURN: None
*
* DESCRIPTION: Purge the global state object cache. Used during subsystem
* termination.
......@@ -284,12 +281,12 @@ acpi_ut_delete_object_cache (
* FUNCTION: Acpi_ut_get_simple_object_size
*
* 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
*
* 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
* needed space.
......@@ -315,7 +312,6 @@ acpi_ut_get_simple_object_size (
return_ACPI_STATUS (AE_OK);
}
/* Start with the length of the Acpi object */
length = sizeof (acpi_object);
......@@ -327,16 +323,13 @@ acpi_ut_get_simple_object_size (
return_ACPI_STATUS (status);
}
/*
* The final length depends on the object type
* Strings and Buffers are packed right up against the parent object and
* must be accessed bytewise or there may be alignment problems on
* certain processors
*/
switch (internal_object->common.type) {
switch (ACPI_GET_OBJECT_TYPE (internal_object)) {
case ACPI_TYPE_STRING:
length += (ACPI_SIZE) internal_object->string.length + 1;
......@@ -362,15 +355,6 @@ acpi_ut_get_simple_object_size (
case INTERNAL_TYPE_REFERENCE:
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:
/*
......@@ -384,7 +368,7 @@ acpi_ut_get_simple_object_size (
/*
* 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.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
......@@ -399,12 +383,11 @@ acpi_ut_get_simple_object_size (
default:
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;
break;
}
/*
* Account for the space required by the object rounded up to the next
* multiple of the machine word size. This keeps each object aligned
......@@ -422,7 +405,7 @@ acpi_ut_get_simple_object_size (
*
* PARAMETERS: ACPI_PKG_CALLBACK
*
* RETURN: Status - the status of the call
* RETURN: Status
*
* DESCRIPTION: Get the length of one package element.
*
......@@ -481,12 +464,12 @@ acpi_ut_get_element_length (
* FUNCTION: Acpi_ut_get_package_object_size
*
* 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
*
* 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
* objects including packages.
......@@ -535,7 +518,7 @@ acpi_ut_get_package_object_size (
* FUNCTION: Acpi_ut_get_object_size
*
* 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
*
......@@ -556,7 +539,7 @@ acpi_ut_get_object_size(
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);
}
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 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -425,24 +425,16 @@ acpi_evaluate_reference (
element = &(package->package.elements[i]);
if (!element || (element->type != ACPI_TYPE_STRING)) {
if (!element || (element->type != ACPI_TYPE_ANY)) {
status = AE_BAD_DATA;
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid element in package (not a device reference)\n"));
acpi_util_eval_error(handle, pathname, status);
break;
}
/* Convert reference (e.g. "\_PR_.CPU_") to 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;
}
/* Get the acpi_handle. */
list->handles[i] = element->reference.handle;
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