Commit 7a47fa52 authored by Andy Grover's avatar Andy Grover Committed by Andy Grover

ACPI interpreter update.

add support for GPE fields to be in any address space, not just IO.
comment and debug print cleanups
parent cbba4f5e
/*******************************************************************************
*
* Module Name: dbdisply - debug display commands
* $Revision: 66 $
* $Revision: 67 $
*
******************************************************************************/
......@@ -298,6 +298,7 @@ acpi_db_decode_internal_object (
if (!obj_desc) {
acpi_os_printf (" Uninitialized\n");
return;
}
......@@ -420,10 +421,10 @@ acpi_db_display_internal_object (
break;
case AML_LOCAL_OP:
acpi_os_printf ("[Local%d]", obj_desc->reference.offset);
acpi_os_printf ("[Local%d] ", obj_desc->reference.offset);
if (walk_state) {
obj_desc = walk_state->local_variables[obj_desc->reference.offset].object;
acpi_os_printf (" %p", obj_desc);
acpi_os_printf ("%p", obj_desc);
acpi_db_decode_internal_object (obj_desc);
}
break;
......@@ -432,7 +433,7 @@ acpi_db_display_internal_object (
acpi_os_printf ("[Arg%d] ", obj_desc->reference.offset);
if (walk_state) {
obj_desc = walk_state->arguments[obj_desc->reference.offset].object;
acpi_os_printf (" %p", obj_desc);
acpi_os_printf ("%p", obj_desc);
acpi_db_decode_internal_object (obj_desc);
}
break;
......@@ -467,7 +468,6 @@ acpi_db_display_internal_object (
break;
}
acpi_os_printf ("\n");
}
......
......@@ -2,7 +2,7 @@
*
* Module Name: dbfileio - Debugger file I/O commands. These can't usually
* be used when running the debugger in Ring 0 (Kernel mode)
* $Revision: 59 $
* $Revision: 60 $
*
******************************************************************************/
......@@ -308,27 +308,14 @@ ae_local_load_table (
}
/*******************************************************************************
*
* FUNCTION: Acpi_db_load_acpi_table
*
* PARAMETERS: Filname - File where table is located
*
* RETURN: Status
*
* DESCRIPTION: Load an ACPI table from a file
*
******************************************************************************/
#ifdef ACPI_APPLICATION
acpi_status
acpi_db_load_acpi_table (
acpi_db_get_acpi_table (
NATIVE_CHAR *filename)
{
#ifdef ACPI_APPLICATION
FILE *fp;
acpi_status status;
u32 table_length;
acpi_status status;
/* Open the file */
......@@ -350,7 +337,35 @@ acpi_db_load_acpi_table (
return (status);
}
/* Attempt to recognize and install the table */
return (AE_OK);
}
#endif
/*******************************************************************************
*
* FUNCTION: Acpi_db_load_acpi_table
*
* PARAMETERS: Filname - File where table is located
*
* RETURN: Status
*
* DESCRIPTION: Load an ACPI table from a file
*
******************************************************************************/
acpi_status
acpi_db_load_acpi_table (
NATIVE_CHAR *filename) {
#ifdef ACPI_APPLICATION
acpi_status status;
status = acpi_db_get_acpi_table (filename);
if (ACPI_FAILURE (status)) {
return (status);
}
/* Attempt to recognize and install the table */
status = ae_local_load_table (acpi_gbl_db_table_ptr);
if (ACPI_FAILURE (status)) {
......
/*******************************************************************************
*
* Module Name: dbutils - AML debugger utilities
* $Revision: 51 $
* $Revision: 52 $
*
******************************************************************************/
......@@ -151,7 +151,7 @@ acpi_db_dump_object (
case ACPI_TYPE_BUFFER:
acpi_os_printf ("[Buffer] = ");
acpi_os_printf ("[Buffer] Length %.2X = ", obj_desc->buffer.length);
acpi_ut_dump_buffer ((u8 *) obj_desc->buffer.pointer, obj_desc->buffer.length, DB_DWORD_DISPLAY, _COMPONENT);
break;
......
/******************************************************************************
*
* Module Name: dsmethod - Parser/Interpreter interface - control method parsing
* $Revision: 79 $
* $Revision: 81 $
*
*****************************************************************************/
......@@ -77,7 +77,7 @@ acpi_ds_parse_method (
return_ACPI_STATUS (AE_NULL_ENTRY);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Parsing [%4.4s] **** Named_obj=%p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** Named_obj=%p\n",
(char *) &((acpi_namespace_node *) obj_handle)->name, obj_handle));
/* Extract the method object from the method Node */
......@@ -111,7 +111,7 @@ acpi_ds_parse_method (
/* Init new op with the method name and pointer back to the Node */
acpi_ps_set_name (op, node->name);
acpi_ps_set_name (op, node->name.integer);
op->node = node;
/*
......@@ -152,7 +152,7 @@ acpi_ds_parse_method (
return_ACPI_STATUS (status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** [%4.4s] Parsed **** Named_obj=%p Op=%p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** [%4.4s] Parsed **** Named_obj=%p Op=%p\n",
(char *) &((acpi_namespace_node *) obj_handle)->name, obj_handle, op));
acpi_ps_delete_parse_tree (op);
......@@ -414,7 +414,6 @@ acpi_ds_restart_control_method (
walk_state->method_call_op, return_desc, walk_state->return_used,
walk_state->results, walk_state));
return_ACPI_STATUS (AE_OK);
}
......
/*******************************************************************************
*
* Module Name: dsmthdat - control method arguments and local variables
* $Revision: 58 $
* $Revision: 59 $
*
******************************************************************************/
......@@ -72,10 +72,10 @@ acpi_ds_method_data_init (
for (i = 0; i < MTH_NUM_ARGS; i++) {
ACPI_MOVE_UNALIGNED32_TO_32 (&walk_state->arguments[i].name,
NAMEOF_ARG_NTE);
walk_state->arguments[i].name |= (i << 24);
walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED;
walk_state->arguments[i].type = ACPI_TYPE_ANY;
walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG;
walk_state->arguments[i].name.integer |= (i << 24);
walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED;
walk_state->arguments[i].type = ACPI_TYPE_ANY;
walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG;
}
/* Init the method locals */
......@@ -84,10 +84,10 @@ acpi_ds_method_data_init (
ACPI_MOVE_UNALIGNED32_TO_32 (&walk_state->local_variables[i].name,
NAMEOF_LOCAL_NTE);
walk_state->local_variables[i].name |= (i << 24);
walk_state->local_variables[i].descriptor = ACPI_DESC_TYPE_NAMED;
walk_state->local_variables[i].type = ACPI_TYPE_ANY;
walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
walk_state->local_variables[i].name.integer |= (i << 24);
walk_state->local_variables[i].descriptor = ACPI_DESC_TYPE_NAMED;
walk_state->local_variables[i].type = ACPI_TYPE_ANY;
walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
}
return_ACPI_STATUS (AE_OK);
......
/******************************************************************************
*
* Module Name: dsobject - Dispatcher object management routines
* $Revision: 90 $
* $Revision: 91 $
*
*****************************************************************************/
......@@ -47,11 +47,11 @@
* RETURN: Status
*
* DESCRIPTION: Callback from Acpi_walk_namespace. Invoked for every object
* within the namespace.
* within the namespace.
*
* Currently, the only objects that require initialization are:
* 1) Methods
* 2) Op Regions
* 2) Operation Regions
*
******************************************************************************/
......@@ -83,7 +83,6 @@ acpi_ds_init_one_object (
return (AE_OK);
}
/* And even then, we are only interested in a few object types */
type = acpi_ns_get_type (obj_handle);
......@@ -152,12 +151,13 @@ acpi_ds_init_one_object (
*
* FUNCTION: Acpi_ds_initialize_objects
*
* PARAMETERS: None
* PARAMETERS: Table_desc - Descriptor for parent ACPI table
* Start_node - Root of subtree to be initialized.
*
* RETURN: Status
*
* DESCRIPTION: Walk the entire namespace and perform any necessary
* initialization on the objects found therein
* DESCRIPTION: Walk the namespace starting at "Start_node" and perform any
* necessary initialization on the objects found therein
*
******************************************************************************/
......@@ -183,7 +183,6 @@ acpi_ds_initialize_objects (
info.object_count = 0;
info.table_desc = table_desc;
/* Walk entire namespace from the supplied root */
status = acpi_walk_namespace (ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX,
......@@ -208,9 +207,10 @@ acpi_ds_initialize_objects (
*
* FUNCTION: Acpi_ds_init_object_from_op
*
* PARAMETERS: Op - Parser op used to init the internal object
* PARAMETERS: Walk_state - Current walk state
* Op - Parser op used to init the internal object
* Opcode - AML opcode associated with the object
* Obj_desc - Namespace object to be initialized
* Ret_obj_desc - Namespace object to be initialized
*
* RETURN: Status
*
......@@ -227,10 +227,6 @@ acpi_ds_init_object_from_op (
u16 opcode,
acpi_operand_object **ret_obj_desc)
{
acpi_status status;
acpi_parse_object *arg;
acpi_parse2_object *byte_list;
acpi_operand_object *arg_desc;
const acpi_opcode_info *op_info;
acpi_operand_object *obj_desc;
......@@ -246,100 +242,39 @@ acpi_ds_init_object_from_op (
return (AE_TYPE);
}
/* Get and prepare the first argument */
/* Perform per-object initialization */
switch (obj_desc->common.type) {
case ACPI_TYPE_BUFFER:
obj_desc->buffer.node = (acpi_namespace_node *) walk_state->operands[0];
/* First arg is a number */
acpi_ds_create_operand (walk_state, op->value.arg, 0);
arg_desc = walk_state->operands [walk_state->num_operands - 1];
acpi_ds_obj_stack_pop (1, walk_state);
/* Resolve the object (could be an arg or local) */
status = acpi_ex_resolve_to_value (&arg_desc, walk_state);
if (ACPI_FAILURE (status)) {
acpi_ut_remove_reference (arg_desc);
return (status);
}
/* We are expecting a number */
if (arg_desc->common.type != ACPI_TYPE_INTEGER) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Expecting number, got obj: %p type %X\n",
arg_desc, arg_desc->common.type));
acpi_ut_remove_reference (arg_desc);
return (AE_TYPE);
}
/* Get the value, delete the internal object */
obj_desc->buffer.length = (u32) arg_desc->integer.value;
acpi_ut_remove_reference (arg_desc);
/* Allocate the buffer */
if (obj_desc->buffer.length == 0) {
obj_desc->buffer.pointer = NULL;
ACPI_REPORT_WARNING (("Buffer created with zero length in AML\n"));
break;
}
else {
obj_desc->buffer.pointer = ACPI_MEM_CALLOCATE (
obj_desc->buffer.length);
if (!obj_desc->buffer.pointer) {
return (AE_NO_MEMORY);
}
}
/*
* Second arg is the buffer data (optional) Byte_list can be either
* individual bytes or a string initializer.
* Defer evaluation of Buffer Term_arg operand
*/
arg = op->value.arg; /* skip first arg */
byte_list = (acpi_parse2_object *) arg->next;
if (byte_list) {
if (byte_list->opcode != AML_INT_BYTELIST_OP) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Expecting bytelist, got: %p\n",
byte_list));
return (AE_TYPE);
}
ACPI_MEMCPY (obj_desc->buffer.pointer, byte_list->data,
obj_desc->buffer.length);
}
obj_desc->buffer.node = (acpi_namespace_node *) walk_state->operands[0];
obj_desc->buffer.aml_start = ((acpi_parse2_object *) op)->data;
obj_desc->buffer.aml_length = ((acpi_parse2_object *) op)->length;
break;
case ACPI_TYPE_PACKAGE:
/*
* When called, an internal package object has already been built and
* is pointed to by Obj_desc. Acpi_ds_build_internal_object builds another
* internal package object, so remove reference to the original so
* that it is deleted. Error checking is done within the remove
* reference function.
* Defer evaluation of Package Term_arg operand
*/
acpi_ut_remove_reference (obj_desc);
status = acpi_ds_build_internal_object (walk_state, op, ret_obj_desc);
obj_desc->package.node = (acpi_namespace_node *) walk_state->operands[0];
obj_desc->package.aml_start = ((acpi_parse2_object *) op)->data;
obj_desc->package.aml_length = ((acpi_parse2_object *) op)->length;
break;
case ACPI_TYPE_INTEGER:
obj_desc->integer.value = op->value.integer;
break;
case ACPI_TYPE_STRING:
obj_desc->string.pointer = op->value.string;
obj_desc->string.length = ACPI_STRLEN (op->value.string);
......@@ -387,7 +322,6 @@ acpi_ds_init_object_from_op (
obj_desc->reference.opcode = opcode;
break;
}
break;
......@@ -405,9 +339,10 @@ acpi_ds_init_object_from_op (
/*****************************************************************************
*
* FUNCTION: Acpi_ds_build_internal_simple_obj
* FUNCTION: Acpi_ds_build_internal_object
*
* PARAMETERS: Op - Parser object to be translated
* PARAMETERS: Walk_state - Current walk state
* Op - Parser object to be translated
* Obj_desc_ptr - Where the ACPI internal object is returned
*
* RETURN: Status
......@@ -417,8 +352,8 @@ acpi_ds_init_object_from_op (
*
****************************************************************************/
static acpi_status
acpi_ds_build_internal_simple_obj (
acpi_status
acpi_ds_build_internal_object (
acpi_walk_state *walk_state,
acpi_parse_object *op,
acpi_operand_object **obj_desc_ptr)
......@@ -428,7 +363,7 @@ acpi_ds_build_internal_simple_obj (
char *name;
ACPI_FUNCTION_TRACE ("Ds_build_internal_simple_obj");
ACPI_FUNCTION_TRACE ("Ds_build_internal_object");
if (op->opcode == AML_INT_NAMEPATH_OP) {
......@@ -453,7 +388,6 @@ acpi_ds_build_internal_simple_obj (
name, op->aml_offset));
ACPI_MEM_FREE (name);
}
else {
ACPI_REPORT_WARNING (("Reference %s at AML %X not found\n",
op->value.string, op->aml_offset));
......@@ -461,7 +395,6 @@ acpi_ds_build_internal_simple_obj (
*obj_desc_ptr = NULL;
}
else {
return_ACPI_STATUS (status);
}
......@@ -483,14 +416,13 @@ acpi_ds_build_internal_simple_obj (
}
*obj_desc_ptr = obj_desc;
return_ACPI_STATUS (AE_OK);
}
/*****************************************************************************
*
* FUNCTION: Acpi_ds_build_internal_package_obj
* FUNCTION: Acpi_ds_build_internal_buffer_obj
*
* PARAMETERS: Op - Parser object to be translated
* Obj_desc_ptr - Where the ACPI internal object is returned
......@@ -503,114 +435,212 @@ acpi_ds_build_internal_simple_obj (
****************************************************************************/
acpi_status
acpi_ds_build_internal_package_obj (
acpi_ds_build_internal_buffer_obj (
acpi_walk_state *walk_state,
acpi_parse_object *op,
u32 buffer_length,
acpi_operand_object **obj_desc_ptr)
{
acpi_parse_object *arg;
acpi_operand_object *obj_desc;
acpi_status status = AE_OK;
acpi_parse2_object *byte_list;
u32 byte_list_length = 0;
ACPI_FUNCTION_TRACE ("Ds_build_internal_package_obj");
ACPI_FUNCTION_TRACE ("Ds_build_internal_buffer_obj");
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_PACKAGE);
*obj_desc_ptr = obj_desc;
if (!obj_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
if (op->opcode == AML_VAR_PACKAGE_OP) {
obj_desc = *obj_desc_ptr;
if (obj_desc) {
/*
* Variable length package parameters are evaluated JIT
* We are evaluating a Named buffer object "Name (xxxx, Buffer)".
* The buffer object already exists (from the NS node)
*/
return_ACPI_STATUS (AE_OK);
}
else {
/* Create a new buffer object */
/* The first argument must be the package length */
arg = op->value.arg;
obj_desc->package.count = arg->value.integer32;
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
*obj_desc_ptr = obj_desc;
if (!obj_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
}
/*
* Allocate the array of pointers (ptrs to the
* individual objects) Add an extra pointer slot so
* that the list is always null terminated.
* Second arg is the buffer data (optional) Byte_list can be either
* individual bytes or a string initializer. In either case, a
* Byte_list appears in the AML.
*/
obj_desc->package.elements = ACPI_MEM_CALLOCATE (
(obj_desc->package.count + 1) * sizeof (void *));
arg = op->value.arg; /* skip first arg */
if (!obj_desc->package.elements) {
acpi_ut_delete_object_desc (obj_desc);
return_ACPI_STATUS (AE_NO_MEMORY);
}
byte_list = (acpi_parse2_object *) arg->next;
if (byte_list) {
if (byte_list->opcode != AML_INT_BYTELIST_OP) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Expecting bytelist, got AML opcode %X in op %p\n",
byte_list->opcode, byte_list));
obj_desc->package.next_element = obj_desc->package.elements;
acpi_ut_remove_reference (obj_desc);
return (AE_TYPE);
}
byte_list_length = byte_list->value.integer32;
}
/*
* Now init the elements of the package
* The buffer length (number of bytes) will be the larger of:
* 1) The specified buffer length and
* 2) The length of the initializer byte list
*/
arg = arg->next;
while (arg) {
if (arg->opcode == AML_PACKAGE_OP) {
status = acpi_ds_build_internal_package_obj (walk_state, arg,
obj_desc->package.next_element);
}
obj_desc->buffer.length = buffer_length;
if (byte_list_length > buffer_length) {
obj_desc->buffer.length = byte_list_length;
}
else {
status = acpi_ds_build_internal_simple_obj (walk_state, arg,
obj_desc->package.next_element);
}
/* Allocate the buffer */
obj_desc->package.next_element++;
arg = arg->next;
if (obj_desc->buffer.length == 0) {
obj_desc->buffer.pointer = NULL;
ACPI_REPORT_WARNING (("Buffer created with zero length in AML\n"));
return_ACPI_STATUS (AE_OK);
}
obj_desc->package.flags |= AOPOBJ_DATA_VALID;
return_ACPI_STATUS (status);
obj_desc->buffer.pointer = ACPI_MEM_CALLOCATE (
obj_desc->buffer.length);
if (!obj_desc->buffer.pointer) {
acpi_ut_delete_object_desc (obj_desc);
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Initialize buffer from the Byte_list (if present) */
if (byte_list) {
ACPI_MEMCPY (obj_desc->buffer.pointer, byte_list->data,
byte_list_length);
}
obj_desc->buffer.flags |= AOPOBJ_DATA_VALID;
op->node = (acpi_namespace_node *) obj_desc;
return_ACPI_STATUS (AE_OK);
}
/*****************************************************************************
*
* FUNCTION: Acpi_ds_build_internal_object
* FUNCTION: Acpi_ds_build_internal_package_obj
*
* PARAMETERS: Op - Parser object to be translated
* Obj_desc_ptr - Where the ACPI internal object is returned
*
* RETURN: Status
*
* DESCRIPTION: Translate a parser Op object to the equivalent namespace
* object
* DESCRIPTION: Translate a parser Op package object to the equivalent
* namespace object
*
****************************************************************************/
acpi_status
acpi_ds_build_internal_object (
acpi_ds_build_internal_package_obj (
acpi_walk_state *walk_state,
acpi_parse_object *op,
u32 package_length,
acpi_operand_object **obj_desc_ptr)
{
acpi_status status;
acpi_parse_object *arg;
acpi_parse_object *parent;
acpi_operand_object *obj_desc = NULL;
u32 package_list_length;
acpi_status status = AE_OK;
u32 i;
switch (op->opcode) {
case AML_PACKAGE_OP:
case AML_VAR_PACKAGE_OP:
ACPI_FUNCTION_TRACE ("Ds_build_internal_package_obj");
status = acpi_ds_build_internal_package_obj (walk_state, op, obj_desc_ptr);
break;
/* Find the parent of a possibly nested package */
default:
status = acpi_ds_build_internal_simple_obj (walk_state, op, obj_desc_ptr);
break;
parent = op->parent;
while ((parent->opcode == AML_PACKAGE_OP) ||
(parent->opcode == AML_VAR_PACKAGE_OP)) {
parent = parent->parent;
}
return (status);
obj_desc = *obj_desc_ptr;
if (obj_desc) {
/*
* We are evaluating a Named package object "Name (xxxx, Package)".
* Get the existing package object from the NS node
*/
}
else {
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_PACKAGE);
*obj_desc_ptr = obj_desc;
if (!obj_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
obj_desc->package.node = parent->node;
}
obj_desc->package.count = package_length;
/* Count the number of items in the package list */
package_list_length = 0;
arg = op->value.arg;
arg = arg->next;
while (arg) {
package_list_length++;
arg = arg->next;
}
/*
* The package length (number of elements) will be the greater
* of the specified length and the length of the initializer list
*/
if (package_list_length > package_length) {
obj_desc->package.count = package_list_length;
}
/*
* Allocate the pointer array (array of pointers to the
* individual objects). Add an extra pointer slot so
* that the list is always null terminated.
*/
obj_desc->package.elements = ACPI_MEM_CALLOCATE (
(obj_desc->package.count + 1) * sizeof (void *));
if (!obj_desc->package.elements) {
acpi_ut_delete_object_desc (obj_desc);
return_ACPI_STATUS (AE_NO_MEMORY);
}
/*
* Now init the elements of the package
*/
i = 0;
arg = op->value.arg;
arg = arg->next;
while (arg) {
if (arg->opcode == AML_INT_RETURN_VALUE_OP) {
/* Object (package or buffer) is already built */
obj_desc->package.elements[i] = (acpi_operand_object *) arg->node;
}
else {
status = acpi_ds_build_internal_object (walk_state, arg,
&obj_desc->package.elements[i]);
}
i++;
arg = arg->next;
}
obj_desc->package.flags |= AOPOBJ_DATA_VALID;
op->node = (acpi_namespace_node *) obj_desc;
return_ACPI_STATUS (status);
}
......@@ -666,7 +696,7 @@ acpi_ds_create_node (
node->type = obj_desc->common.type;
/* Init obj */
/* Attach obj to node */
status = acpi_ns_attach_object (node, obj_desc, node->type);
......
......@@ -2,7 +2,7 @@
*
* Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes
* $Revision: 73 $
* $Revision: 74 $
*
*****************************************************************************/
......@@ -54,7 +54,9 @@
acpi_status
acpi_ds_execute_arguments (
acpi_namespace_node *node,
acpi_operand_object *extra_desc)
acpi_namespace_node *scope_node,
u32 aml_length,
u8 *aml_start)
{
acpi_status status;
acpi_parse_object *op;
......@@ -66,17 +68,16 @@ acpi_ds_execute_arguments (
/*
* Allocate a new parser op to be the root of the parsed
* Buffer_field tree
* Allocate a new parser op to be the root of the parsed tree
*/
op = acpi_ps_alloc_op (AML_SCOPE_OP);
op = acpi_ps_alloc_op (AML_INT_EVAL_SUBTREE_OP);
if (!op) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Save the Node for use in Acpi_ps_parse_aml */
op->node = acpi_ns_get_parent_node (node);
op->node = scope_node;
/* Create and initialize a new parser state */
......@@ -85,8 +86,8 @@ acpi_ds_execute_arguments (
return_ACPI_STATUS (AE_NO_MEMORY);
}
status = acpi_ds_init_aml_walk (walk_state, op, NULL, extra_desc->extra.aml_start,
extra_desc->extra.aml_length, NULL, NULL, 1);
status = acpi_ds_init_aml_walk (walk_state, op, NULL, aml_start,
aml_length, NULL, NULL, 1);
if (ACPI_FAILURE (status)) {
acpi_ds_delete_walk_state (walk_state);
return_ACPI_STATUS (status);
......@@ -94,7 +95,7 @@ acpi_ds_execute_arguments (
walk_state->parse_flags = 0;
/* Pass1: Parse the entire Buffer_field declaration */
/* Pass1: Parse the entire declaration */
status = acpi_ps_parse_aml (walk_state);
if (ACPI_FAILURE (status)) {
......@@ -102,7 +103,7 @@ acpi_ds_execute_arguments (
return_ACPI_STATUS (status);
}
/* Get and init the actual Field_unit Op created above */
/* Get and init the Op created above */
arg = op->value.arg;
op->node = node;
......@@ -111,12 +112,12 @@ acpi_ds_execute_arguments (
/* Evaluate the address and length arguments for the Buffer Field */
op = acpi_ps_alloc_op (AML_SCOPE_OP);
op = acpi_ps_alloc_op (AML_INT_EVAL_SUBTREE_OP);
if (!op) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
op->node = acpi_ns_get_parent_node (node);
op->node = scope_node;
/* Create and initialize a new parser state */
......@@ -125,8 +126,8 @@ acpi_ds_execute_arguments (
return_ACPI_STATUS (AE_NO_MEMORY);
}
status = acpi_ds_init_aml_walk (walk_state, op, NULL, extra_desc->extra.aml_start,
extra_desc->extra.aml_length, NULL, NULL, 3);
status = acpi_ds_init_aml_walk (walk_state, op, NULL, aml_start,
aml_length, NULL, NULL, 3);
if (ACPI_FAILURE (status)) {
acpi_ds_delete_walk_state (walk_state);
return_ACPI_STATUS (status);
......@@ -178,7 +179,102 @@ acpi_ds_get_buffer_field_arguments (
/* Execute the AML code for the Term_arg arguments */
status = acpi_ds_execute_arguments (node, extra_desc);
status = acpi_ds_execute_arguments (node, acpi_ns_get_parent_node (node),
extra_desc->extra.aml_length, extra_desc->extra.aml_start);
return_ACPI_STATUS (status);
}
/*****************************************************************************
*
* FUNCTION: Acpi_ds_get_buffer_arguments
*
* PARAMETERS: Obj_desc - A valid Bufferobject
*
* RETURN: Status.
*
* DESCRIPTION: Get Buffer length and initializer byte list. This implements
* the late evaluation of these attributes.
*
****************************************************************************/
acpi_status
acpi_ds_get_buffer_arguments (
acpi_operand_object *obj_desc)
{
acpi_namespace_node *node;
acpi_status status;
ACPI_FUNCTION_TRACE_PTR ("Ds_get_buffer_arguments", obj_desc);
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
return_ACPI_STATUS (AE_OK);
}
/* Get the Buffer node */
node = obj_desc->buffer.node;
if (!node) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"No pointer back to NS node in buffer %p\n", obj_desc));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Buffer JIT Init\n"));
/* Execute the AML code for the Term_arg arguments */
status = acpi_ds_execute_arguments (node, node,
obj_desc->buffer.aml_length, obj_desc->buffer.aml_start);
return_ACPI_STATUS (status);
}
/*****************************************************************************
*
* FUNCTION: Acpi_ds_get_package_arguments
*
* PARAMETERS: Obj_desc - A valid Packageobject
*
* RETURN: Status.
*
* DESCRIPTION: Get Package length and initializer byte list. This implements
* the late evaluation of these attributes.
*
****************************************************************************/
acpi_status
acpi_ds_get_package_arguments (
acpi_operand_object *obj_desc)
{
acpi_namespace_node *node;
acpi_status status;
ACPI_FUNCTION_TRACE_PTR ("Ds_get_package_arguments", obj_desc);
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
return_ACPI_STATUS (AE_OK);
}
/* Get the Package node */
node = obj_desc->package.node;
if (!node) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"No pointer back to NS node in package %p\n", obj_desc));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package JIT Init\n"));
/* Execute the AML code for the Term_arg arguments */
status = acpi_ds_execute_arguments (node, node,
obj_desc->package.aml_length, obj_desc->package.aml_start);
return_ACPI_STATUS (status);
}
......@@ -202,7 +298,7 @@ acpi_ds_get_region_arguments (
{
acpi_namespace_node *node;
acpi_status status;
acpi_operand_object *region_obj2;
acpi_operand_object *extra_desc;
ACPI_FUNCTION_TRACE_PTR ("Ds_get_region_arguments", obj_desc);
......@@ -212,22 +308,23 @@ acpi_ds_get_region_arguments (
return_ACPI_STATUS (AE_OK);
}
region_obj2 = acpi_ns_get_secondary_object (obj_desc);
if (!region_obj2) {
extra_desc = acpi_ns_get_secondary_object (obj_desc);
if (!extra_desc) {
return_ACPI_STATUS (AE_NOT_EXIST);
}
/* Get the AML pointer (method object) and region node */
/* Get the Region node */
node = obj_desc->region.node;
ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname (node, " [Operation Region]"));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] Op_region Init at AML %p\n",
(char *) &node->name, region_obj2->extra.aml_start));
(char *) &node->name, extra_desc->extra.aml_start));
status = acpi_ds_execute_arguments (node, region_obj2);
status = acpi_ds_execute_arguments (node, acpi_ns_get_parent_node (node),
extra_desc->extra.aml_length, extra_desc->extra.aml_start);
return_ACPI_STATUS (status);
}
......@@ -306,7 +403,7 @@ acpi_ds_eval_buffer_field_operands (
next_op = op->value.arg;
/* Acpi_evaluate/create the address and length operands */
/* Evaluate/create the address and length operands */
status = acpi_ds_create_operands (walk_state, next_op);
if (ACPI_FAILURE (status)) {
......@@ -556,7 +653,7 @@ acpi_ds_eval_region_operands (
next_op = next_op->next;
/* Acpi_evaluate/create the address and length operands */
/* Evaluate/create the address and length operands */
status = acpi_ds_create_operands (walk_state, next_op);
if (ACPI_FAILURE (status)) {
......@@ -610,6 +707,95 @@ acpi_ds_eval_region_operands (
}
/*****************************************************************************
*
* FUNCTION: Acpi_ds_eval_data_object_operands
*
* PARAMETERS: Op - A valid Data_object Op object
*
* RETURN: Status
*
* DESCRIPTION: Get the operands and complete the following data objec types:
* Buffer
* Package
*
****************************************************************************/
acpi_status
acpi_ds_eval_data_object_operands (
acpi_walk_state *walk_state,
acpi_parse_object *op,
acpi_operand_object *obj_desc)
{
acpi_status status;
acpi_operand_object *arg_desc;
u32 length;
ACPI_FUNCTION_TRACE ("Ds_eval_data_object_operands");
/* The first operand (for all of these data objects) is the length */
status = acpi_ds_create_operand (walk_state, op->value.arg, 1);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
status = acpi_ex_resolve_operands (walk_state->opcode,
&(walk_state->operands [walk_state->num_operands -1]),
walk_state);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* Extract length operand */
arg_desc = walk_state->operands [walk_state->num_operands - 1];
length = (u32) arg_desc->integer.value;
/* Cleanup for length operand */
acpi_ds_obj_stack_pop (1, walk_state);
acpi_ut_remove_reference (arg_desc);
/*
* Create the actual data object
*/
switch (op->opcode) {
case AML_BUFFER_OP:
status = acpi_ds_build_internal_buffer_obj (walk_state, op, length, &obj_desc);
break;
case AML_PACKAGE_OP:
case AML_VAR_PACKAGE_OP:
status = acpi_ds_build_internal_package_obj (walk_state, op, length, &obj_desc);
break;
default:
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
}
if (ACPI_SUCCESS (status)) {
/*
* Return the object in the Walk_state, unless the parent is a package --
* in this case, the return object will be stored in the parse tree
* for the package.
*/
if ((!op->parent) ||
((op->parent->opcode != AML_PACKAGE_OP) &&
(op->parent->opcode != AML_VAR_PACKAGE_OP) &&
(op->parent->opcode != AML_NAME_OP))) {
walk_state->result_obj = obj_desc;
}
}
return_ACPI_STATUS (status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_ds_exec_begin_control_op
......
/*******************************************************************************
*
* Module Name: dsutils - Dispatcher utilities
* $Revision: 88 $
* $Revision: 89 $
*
******************************************************************************/
......@@ -133,7 +133,11 @@ acpi_ds_is_result_used (
case AML_CLASS_NAMED_OBJECT:
if ((op->parent->opcode == AML_REGION_OP) ||
(op->parent->opcode == AML_DATA_REGION_OP)) {
(op->parent->opcode == AML_DATA_REGION_OP) ||
(op->parent->opcode == AML_PACKAGE_OP) ||
(op->parent->opcode == AML_VAR_PACKAGE_OP) ||
(op->parent->opcode == AML_BUFFER_OP) ||
(op->parent->opcode == AML_INT_EVAL_SUBTREE_OP)) {
/*
* These opcodes allow Term_arg(s) as operands and therefore
* the operands can be method calls. The result is used.
......@@ -144,11 +148,12 @@ acpi_ds_is_result_used (
goto result_not_used;
/*
* In all other cases. the parent will actually use the return
* object, so keep it.
*/
default:
/*
* In all other cases. the parent will actually use the return
* object, so keep it.
*/
goto result_used;
}
......
......@@ -2,7 +2,7 @@
*
* Module Name: dswexec - Dispatcher method execution callbacks;
* dispatch to interpreter.
* $Revision: 89 $
* $Revision: 90 $
*
*****************************************************************************/
......@@ -498,6 +498,50 @@ acpi_ds_exec_end_op (
break;
case AML_TYPE_CREATE_OBJECT:
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Executing Create_object (Buffer/Package) Op=%p\n", op));
switch (op->parent->opcode) {
case AML_NAME_OP:
/*
* Put the Node on the object stack (Contains the ACPI Name of
* this object)
*/
walk_state->operands[0] = (void *) op->parent->node;
walk_state->num_operands = 1;
status = acpi_ds_create_node (walk_state, op->parent->node, op->parent);
if (ACPI_FAILURE (status)) {
break;
}
/* Fall through */
case AML_INT_EVAL_SUBTREE_OP:
status = acpi_ds_eval_data_object_operands (walk_state, op, acpi_ns_get_attached_object (op->parent->node));
break;
default:
status = acpi_ds_eval_data_object_operands (walk_state, op, NULL);
break;
}
/*
* If a result object was returned from above, push it on the
* current result stack
*/
if (ACPI_SUCCESS (status) &&
walk_state->result_obj) {
status = acpi_ds_result_push (walk_state->result_obj, walk_state);
}
break;
case AML_TYPE_NAMED_FIELD:
case AML_TYPE_NAMED_COMPLEX:
case AML_TYPE_NAMED_SIMPLE:
......
/******************************************************************************
*
* Module Name: dswload - Dispatcher namespace load callbacks
* $Revision: 61 $
* $Revision: 62 $
*
*****************************************************************************/
......@@ -167,7 +167,7 @@ acpi_ds_load1_begin_op (
/* Initialize */
((acpi_parse2_object *)op)->name = node->name;
((acpi_parse2_object *)op)->name = node->name.integer;
/*
* Put the Node in the "op" object that the parser uses, so we
......@@ -381,7 +381,7 @@ acpi_ds_load2_begin_op (
/* Initialize the new op */
((acpi_parse2_object *)op)->name = node->name;
((acpi_parse2_object *)op)->name = node->name.integer;
*out_op = op;
}
......
/******************************************************************************
*
* Module Name: evevent - Fixed and General Purpose Even handling and dispatch
* $Revision: 71 $
* $Revision: 78 $
*
*****************************************************************************/
......@@ -326,11 +326,14 @@ acpi_ev_gpe_initialize (void)
* FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need
* to be the same size."
*/
acpi_gbl_gpe_block_info[0].register_count = (u16) ACPI_DIV_2 (acpi_gbl_FADT->gpe0_blk_len);
acpi_gbl_gpe_block_info[1].register_count = (u16) ACPI_DIV_2 (acpi_gbl_FADT->gpe1_blk_len);
acpi_gbl_gpe_block_info[0].address_space_id = acpi_gbl_FADT->Xgpe0_blk.address_space_id;
acpi_gbl_gpe_block_info[1].address_space_id = acpi_gbl_FADT->Xgpe1_blk.address_space_id;
acpi_gbl_gpe_block_info[0].block_address = (u16) ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe0_blk.address);
acpi_gbl_gpe_block_info[1].block_address = (u16) ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe1_blk.address);
acpi_gbl_gpe_block_info[0].register_count = (u16) ACPI_DIV_16 (acpi_gbl_FADT->Xgpe0_blk.register_bit_width);
acpi_gbl_gpe_block_info[1].register_count = (u16) ACPI_DIV_16 (acpi_gbl_FADT->Xgpe1_blk.register_bit_width);
acpi_gbl_gpe_block_info[0].block_address = &acpi_gbl_FADT->Xgpe0_blk;
acpi_gbl_gpe_block_info[1].block_address = &acpi_gbl_FADT->Xgpe1_blk;
acpi_gbl_gpe_block_info[0].block_base_number = 0;
acpi_gbl_gpe_block_info[1].block_base_number = acpi_gbl_FADT->gpe1_base;
......@@ -421,9 +424,20 @@ acpi_ev_gpe_initialize (void)
/* Init the Register info for this entire GPE register (8 GPEs) */
gpe_register_info->base_gpe_number = (u8) (acpi_gbl_gpe_block_info[gpe_block].block_base_number + (ACPI_MUL_8 (i)));
gpe_register_info->status_addr = (u16) (acpi_gbl_gpe_block_info[gpe_block].block_address + i);
gpe_register_info->enable_addr = (u16) (acpi_gbl_gpe_block_info[gpe_block].block_address + i +
acpi_gbl_gpe_block_info[gpe_block].register_count);
ACPI_STORE_ADDRESS (gpe_register_info->status_address.address,
(ACPI_GET_ADDRESS (acpi_gbl_gpe_block_info[gpe_block].block_address->address) + i));
ACPI_STORE_ADDRESS (gpe_register_info->enable_address.address,
(ACPI_GET_ADDRESS (acpi_gbl_gpe_block_info[gpe_block].block_address->address) + i +
acpi_gbl_gpe_block_info[gpe_block].register_count));
gpe_register_info->status_address.address_space_id = acpi_gbl_gpe_block_info[gpe_block].address_space_id;
gpe_register_info->enable_address.address_space_id = acpi_gbl_gpe_block_info[gpe_block].address_space_id;
gpe_register_info->status_address.register_bit_width = 8;
gpe_register_info->enable_address.register_bit_width = 8;
gpe_register_info->status_address.register_bit_offset = 8;
gpe_register_info->enable_address.register_bit_offset = 8;
/* Init the Index mapping info for each GPE number within this register */
......@@ -440,18 +454,24 @@ acpi_ev_gpe_initialize (void)
* are cleared by writing a '1', while enable registers are cleared
* by writing a '0'.
*/
acpi_os_write_port (gpe_register_info->enable_addr, 0x00, 8);
acpi_os_write_port (gpe_register_info->status_addr, 0xFF, 8);
acpi_hw_low_level_write (8, 0x00, &gpe_register_info->enable_address, 0);
acpi_hw_low_level_write (8, 0xFF, &gpe_register_info->status_address, 0);
gpe_register++;
}
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "GPE registers: %X@%8.8X%8.8X (Blk0) %X@%8.8X%8.8X (Blk1)\n",
acpi_gbl_gpe_block_info[0].register_count,
ACPI_HIDWORD (acpi_gbl_FADT->Xgpe0_blk.address), ACPI_LODWORD (acpi_gbl_FADT->Xgpe0_blk.address),
acpi_gbl_gpe_block_info[1].register_count,
ACPI_HIDWORD (acpi_gbl_FADT->Xgpe1_blk.address), ACPI_LODWORD (acpi_gbl_FADT->Xgpe1_blk.address)));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "GPE Block%d: %X registers at %8.8X%8.8X\n",
gpe_block, acpi_gbl_gpe_block_info[0].register_count,
ACPI_HIDWORD (acpi_gbl_gpe_block_info[gpe_block].block_address->address),
ACPI_LODWORD (acpi_gbl_gpe_block_info[gpe_block].block_address->address)));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "GPE Block%d Range GPE #%2.2X to GPE #%2.2X\n",
gpe_block,
acpi_gbl_gpe_block_info[gpe_block].block_base_number,
acpi_gbl_gpe_block_info[gpe_block].block_base_number +
((acpi_gbl_gpe_block_info[gpe_block].register_count * 8) -1)));
}
return_ACPI_STATUS (AE_OK);
......@@ -645,17 +665,18 @@ acpi_ev_gpe_detect (void)
for (i = 0; i < acpi_gbl_gpe_register_count; i++) {
gpe_register_info = &acpi_gbl_gpe_register_info[i];
acpi_os_read_port (gpe_register_info->status_addr,
&gpe_register_info->status, 8);
gpe_register_info->status = (u8) acpi_hw_low_level_read (8,
&gpe_register_info->status_address, 0);
acpi_os_read_port (gpe_register_info->enable_addr,
&gpe_register_info->enable, 8);
gpe_register_info->enable = (u8) acpi_hw_low_level_read (8,
&gpe_register_info->enable_address, 0);
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
"GPE block at %X - Enable %08X Status %08X\n",
gpe_register_info->enable_addr,
gpe_register_info->status,
gpe_register_info->enable));
"GPE block at %8.8X%8.8X - Enable %08X Status %08X\n",
ACPI_HIDWORD (gpe_register_info->enable_address.address),
ACPI_LODWORD (gpe_register_info->enable_address.address),
gpe_register_info->enable,
gpe_register_info->status));
/* First check if there is anything active at all in this register */
......@@ -815,19 +836,19 @@ acpi_ev_gpe_dispatch (
gpe_info->handler (gpe_info->context);
}
else if (gpe_info->method_handle) {
/*
* Disable GPE, so it doesn't keep firing before the method has a
* chance to run.
*/
acpi_hw_disable_gpe (gpe_number);
/*
* Execute the method associated with the GPE.
*/
if (ACPI_FAILURE (acpi_os_queue_for_execution (OSD_PRIORITY_GPE,
acpi_ev_asynch_execute_gpe_method,
ACPI_TO_POINTER (gpe_number)))) {
ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to queue handler for GPE[%X], disabling event\n", gpe_number));
/*
* Disable the GPE on error. The GPE will remain disabled until the ACPI
* Core Subsystem is restarted, or the handler is reinstalled.
*/
acpi_hw_disable_gpe (gpe_number);
ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to queue handler for GPE[%X], event is disabled\n", gpe_number));
}
}
else {
......
/******************************************************************************
*
* Module Name: evmisc - ACPI device notification handler dispatch
* and ACPI Global Lock support
* $Revision: 47 $
* Module Name: evmisc - Miscellaneous event manager support functions
* $Revision: 48 $
*
*****************************************************************************/
......@@ -34,6 +33,40 @@
ACPI_MODULE_NAME ("evmisc")
/*******************************************************************************
*
* FUNCTION: Acpi_ev_is_notify_object
*
* PARAMETERS: Node - Node to check
*
* RETURN: TRUE if notifies allowed on this object
*
* DESCRIPTION: Check type of node for a object that supports notifies.
*
* TBD: This could be replaced by a flag bit in the node.
*
******************************************************************************/
u8
acpi_ev_is_notify_object (
acpi_namespace_node *node)
{
switch (node->type) {
case ACPI_TYPE_DEVICE:
case ACPI_TYPE_PROCESSOR:
case ACPI_TYPE_POWER:
case ACPI_TYPE_THERMAL:
/*
* These are the ONLY objects that can receive ACPI notifications
*/
return (TRUE);
default:
return (FALSE);
}
}
/*******************************************************************************
*
* FUNCTION: Acpi_ev_get_gpe_register_index
......
/******************************************************************************
*
* Module Name: evxface - External interfaces for ACPI events
* $Revision: 125 $
* $Revision: 126 $
*
*****************************************************************************/
......@@ -191,7 +191,7 @@ acpi_install_notify_handler (
{
acpi_operand_object *obj_desc;
acpi_operand_object *notify_obj;
acpi_namespace_node *device_node;
acpi_namespace_node *node;
acpi_status status;
......@@ -200,7 +200,8 @@ acpi_install_notify_handler (
/* Parameter validation */
if ((!handler) ||
if ((!device) ||
(!handler) ||
(handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
......@@ -212,8 +213,8 @@ acpi_install_notify_handler (
/* Convert and validate the device handle */
device_node = acpi_ns_map_handle_to_node (device);
if (!device_node) {
node = acpi_ns_map_handle_to_node (device);
if (!node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
}
......@@ -236,12 +237,12 @@ acpi_install_notify_handler (
}
if (handler_type == ACPI_SYSTEM_NOTIFY) {
acpi_gbl_sys_notify.node = device_node;
acpi_gbl_sys_notify.node = node;
acpi_gbl_sys_notify.handler = handler;
acpi_gbl_sys_notify.context = context;
}
else /* ACPI_DEVICE_NOTIFY */ {
acpi_gbl_drv_notify.node = device_node;
acpi_gbl_drv_notify.node = node;
acpi_gbl_drv_notify.handler = handler;
acpi_gbl_drv_notify.context = context;
}
......@@ -255,28 +256,24 @@ acpi_install_notify_handler (
* Note that only certain object types can receive notifications.
*/
else {
/*
* These are the ONLY objects that can receive ACPI notifications
*/
if ((device_node->type != ACPI_TYPE_DEVICE) &&
(device_node->type != ACPI_TYPE_PROCESSOR) &&
(device_node->type != ACPI_TYPE_POWER) &&
(device_node->type != ACPI_TYPE_THERMAL)) {
status = AE_BAD_PARAMETER;
/* Notifies allowed on this object? */
if (!acpi_ev_is_notify_object (node)) {
status = AE_TYPE;
goto unlock_and_exit;
}
/* Check for an existing internal object */
obj_desc = acpi_ns_get_attached_object (device_node);
obj_desc = acpi_ns_get_attached_object (node);
if (obj_desc) {
/* Object exists - make sure there's no handler */
if (((handler_type == ACPI_SYSTEM_NOTIFY) &&
obj_desc->device.sys_handler) ||
obj_desc->common_notify.sys_handler) ||
((handler_type == ACPI_DEVICE_NOTIFY) &&
obj_desc->device.drv_handler)) {
obj_desc->common_notify.drv_handler)) {
status = AE_ALREADY_EXISTS;
goto unlock_and_exit;
}
......@@ -284,7 +281,7 @@ acpi_install_notify_handler (
else {
/* Create a new object */
obj_desc = acpi_ut_create_internal_object (device_node->type);
obj_desc = acpi_ut_create_internal_object (node->type);
if (!obj_desc) {
status = AE_NO_MEMORY;
goto unlock_and_exit;
......@@ -292,7 +289,7 @@ acpi_install_notify_handler (
/* Attach new object to the Node */
status = acpi_ns_attach_object (device, obj_desc, device_node->type);
status = acpi_ns_attach_object (device, obj_desc, node->type);
if (ACPI_FAILURE (status)) {
goto unlock_and_exit;
}
......@@ -306,16 +303,15 @@ acpi_install_notify_handler (
goto unlock_and_exit;
}
notify_obj->notify_handler.node = device_node;
notify_obj->notify_handler.node = node;
notify_obj->notify_handler.handler = handler;
notify_obj->notify_handler.context = context;
if (handler_type == ACPI_SYSTEM_NOTIFY) {
obj_desc->device.sys_handler = notify_obj;
obj_desc->common_notify.sys_handler = notify_obj;
}
else /* ACPI_DEVICE_NOTIFY */ {
obj_desc->device.drv_handler = notify_obj;
obj_desc->common_notify.drv_handler = notify_obj;
}
}
......@@ -349,7 +345,7 @@ acpi_remove_notify_handler (
{
acpi_operand_object *notify_obj;
acpi_operand_object *obj_desc;
acpi_namespace_node *device_node;
acpi_namespace_node *node;
acpi_status status;
......@@ -358,7 +354,8 @@ acpi_remove_notify_handler (
/* Parameter validation */
if ((!handler) ||
if ((!device) ||
(!handler) ||
(handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
......@@ -370,8 +367,8 @@ acpi_remove_notify_handler (
/* Convert and validate the device handle */
device_node = acpi_ns_map_handle_to_node (device);
if (!device_node) {
node = acpi_ns_map_handle_to_node (device);
if (!node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
}
......@@ -406,20 +403,16 @@ acpi_remove_notify_handler (
* All Other Objects
*/
else {
/*
* These are the ONLY objects that can receive ACPI notifications
*/
if ((device_node->type != ACPI_TYPE_DEVICE) &&
(device_node->type != ACPI_TYPE_PROCESSOR) &&
(device_node->type != ACPI_TYPE_POWER) &&
(device_node->type != ACPI_TYPE_THERMAL)) {
status = AE_BAD_PARAMETER;
/* Notifies allowed on this object? */
if (!acpi_ev_is_notify_object (node)) {
status = AE_TYPE;
goto unlock_and_exit;
}
/* Check for an existing internal object */
obj_desc = acpi_ns_get_attached_object (device_node);
obj_desc = acpi_ns_get_attached_object (node);
if (!obj_desc) {
status = AE_NOT_EXIST;
goto unlock_and_exit;
......@@ -428,10 +421,10 @@ acpi_remove_notify_handler (
/* Object exists - make sure there's an existing handler */
if (handler_type == ACPI_SYSTEM_NOTIFY) {
notify_obj = obj_desc->device.sys_handler;
notify_obj = obj_desc->common_notify.sys_handler;
}
else {
notify_obj = obj_desc->device.drv_handler;
notify_obj = obj_desc->common_notify.drv_handler;
}
if ((!notify_obj) ||
......@@ -443,10 +436,10 @@ acpi_remove_notify_handler (
/* Remove the handler */
if (handler_type == ACPI_SYSTEM_NOTIFY) {
obj_desc->device.sys_handler = NULL;
obj_desc->common_notify.sys_handler = NULL;
}
else {
obj_desc->device.drv_handler = NULL;
obj_desc->common_notify.drv_handler = NULL;
}
acpi_ut_remove_reference (notify_obj);
......
/******************************************************************************
*
* Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
* $Revision: 59 $
* $Revision: 60 $
*
*****************************************************************************/
......@@ -329,7 +329,7 @@ acpi_ex_load_op (
* Read the entire field and thus the entire table. Buffer is
* allocated during the read.
*/
status = acpi_ex_read_data_from_field (obj_desc, &buffer_desc);
status = acpi_ex_read_data_from_field (walk_state, obj_desc, &buffer_desc);
if (ACPI_FAILURE (status)) {
goto cleanup;
}
......
/******************************************************************************
*
* Module Name: exconvrt - Object conversion routines
* $Revision: 30 $
* $Revision: 32 $
*
*****************************************************************************/
......@@ -215,8 +215,7 @@ acpi_ex_convert_to_buffer (
if (walk_state->method_node->flags & ANOBJ_DATA_WIDTH_32) {
/*
* We are running a method that exists in a 32-bit ACPI table.
* Truncate the value to 32 bits by zeroing out the upper
* 32-bit field
* Use only 32 bits of the Integer for conversion.
*/
integer_size = sizeof (u32);
}
......@@ -259,6 +258,9 @@ acpi_ex_convert_to_buffer (
return_ACPI_STATUS (AE_TYPE);
}
/* Mark buffer initialized */
(*result_desc)->common.flags |= AOPOBJ_DATA_VALID;
return_ACPI_STATUS (AE_OK);
}
......@@ -399,8 +401,7 @@ acpi_ex_convert_to_string (
if (walk_state->method_node->flags & ANOBJ_DATA_WIDTH_32) {
/*
* We are running a method that exists in a 32-bit ACPI table.
* Truncate the value to 32 bits by zeroing out the upper
* 32-bit field
* Use only 32 bits of the Integer
*/
integer_size = sizeof (u32);
}
......
/******************************************************************************
*
* Module Name: exdump - Interpreter debug output routines
* $Revision: 145 $
* $Revision: 147 $
*
*****************************************************************************/
......@@ -149,7 +149,7 @@ acpi_ex_dump_operand (
ACPI_FUNCTION_NAME ("Ex_dump_operand")
if (!((ACPI_LV_INFO & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) {
if (!((ACPI_LV_EXEC & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) {
return (AE_OK);
}
......@@ -159,25 +159,25 @@ acpi_ex_dump_operand (
* since most (if not all)
* code that dumps the stack expects something to be there!
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null stack entry ptr\n"));
acpi_os_printf ("Null stack entry ptr\n");
return (AE_OK);
}
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p NS Node: ", obj_desc));
ACPI_DUMP_ENTRY (obj_desc, ACPI_LV_INFO);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p NS Node: ", obj_desc));
ACPI_DUMP_ENTRY (obj_desc, ACPI_LV_EXEC);
return (AE_OK);
}
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_INTERNAL) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p is not a local object\n", obj_desc));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p is not a local object\n", obj_desc));
ACPI_DUMP_BUFFER (obj_desc, sizeof (acpi_operand_object));
return (AE_OK);
}
/* Obj_desc is a valid object */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p ", obj_desc));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", obj_desc));
switch (obj_desc->common.type) {
case INTERNAL_TYPE_REFERENCE:
......@@ -427,7 +427,7 @@ acpi_ex_dump_operand (
if (!obj_desc->buffer_field.buffer_obj)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "*NULL* \n"));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL* \n"));
}
else if (ACPI_TYPE_BUFFER !=
......@@ -541,7 +541,7 @@ acpi_ex_dump_operands (
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"************* Operand Stack Contents (Opcode [%s], %d Operands)\n",
ident, num_levels));
......@@ -562,7 +562,7 @@ acpi_ex_dump_operands (
}
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"************* Stack dump from %s(%d), %s\n",
module_name, line_number, note));
return;
......@@ -734,7 +734,6 @@ acpi_ex_dump_object_descriptor (
acpi_ex_out_integer ("Flags", obj_desc->package.flags);
acpi_ex_out_integer ("Count", obj_desc->package.count);
acpi_ex_out_pointer ("Elements", obj_desc->package.elements);
acpi_ex_out_pointer ("Next_element", obj_desc->package.next_element);
/* Dump the package contents */
......
/******************************************************************************
*
* Module Name: exfield - ACPI AML (p-code) execution - field manipulation
* $Revision: 105 $
* $Revision: 108 $
*
*****************************************************************************/
......@@ -41,7 +41,8 @@
*
* FUNCTION: Acpi_ex_read_data_from_field
*
* PARAMETERS: Obj_desc - The named field
* PARAMETERS: Walk_state - Current execution state
* Obj_desc - The named field
* Ret_buffer_desc - Where the return data object is stored
*
* RETURN: Status
......@@ -53,12 +54,14 @@
acpi_status
acpi_ex_read_data_from_field (
acpi_walk_state *walk_state,
acpi_operand_object *obj_desc,
acpi_operand_object **ret_buffer_desc)
{
acpi_status status;
acpi_operand_object *buffer_desc;
u32 length;
u32 integer_size;
void *buffer;
u8 locked;
......@@ -97,7 +100,18 @@ acpi_ex_read_data_from_field (
*/
length = ACPI_ROUND_BITS_UP_TO_BYTES (obj_desc->field.bit_length);
if (length > sizeof (acpi_integer)) {
/* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
integer_size = sizeof (acpi_integer);
if (walk_state->method_node->flags & ANOBJ_DATA_WIDTH_32) {
/*
* We are running a method that exists in a 32-bit ACPI table.
* Integer size is 4.
*/
integer_size = sizeof (u32);
}
if (length > integer_size) {
/* Field is too large for an Integer, create a Buffer instead */
buffer_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
......@@ -113,6 +127,7 @@ acpi_ex_read_data_from_field (
return_ACPI_STATUS (AE_NO_MEMORY);
}
buffer_desc->common.flags = AOPOBJ_DATA_VALID;
buffer_desc->buffer.length = length;
buffer = buffer_desc->buffer.pointer;
}
......@@ -124,14 +139,15 @@ acpi_ex_read_data_from_field (
return_ACPI_STATUS (AE_NO_MEMORY);
}
length = sizeof (buffer_desc->integer.value);
length = integer_size;
buffer_desc->integer.value = 0;
buffer = &buffer_desc->integer.value;
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Obj=%p Type=%X Buf=%p Len=%X\n",
obj_desc, obj_desc->common.type, buffer, length));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Field_write: Bit_len=%X Bit_off=%X Byte_off=%X\n",
obj_desc->common_field.bit_length,
obj_desc->common_field.start_field_bit_offset,
......@@ -257,10 +273,10 @@ acpi_ex_write_data_to_field (
length = required_length;
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Obj=%p Type=%X Buf=%p Len=%X\n",
obj_desc, obj_desc->common.type, buffer, length));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Field_read: Bit_len=%X Bit_off=%X Byte_off=%X\n",
obj_desc->common_field.bit_length,
obj_desc->common_field.start_field_bit_offset,
......
/******************************************************************************
*
* Module Name: exfldio - Aml Field I/O
* $Revision: 82 $
* $Revision: 84 $
*
*****************************************************************************/
......@@ -148,7 +148,7 @@ acpi_ex_access_region (
ACPI_PHYSICAL_ADDRESS address;
ACPI_FUNCTION_TRACE ("Acpi_ex_access_region");
ACPI_FUNCTION_TRACE ("Ex_access_region");
/*
......@@ -672,7 +672,7 @@ acpi_ex_extract_from_field (
*/
byte_field_length = ACPI_ROUND_BITS_UP_TO_BYTES (obj_desc->common_field.bit_length);
if (byte_field_length > buffer_length) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Field size %X (bytes) too large for buffer (%X)\n",
byte_field_length, buffer_length));
......@@ -684,7 +684,7 @@ acpi_ex_extract_from_field (
datum_count = ACPI_ROUND_UP_TO (byte_field_length,
obj_desc->common_field.access_byte_width);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Byte_len=%x, Datum_len=%x, Byte_gran=%x\n",
byte_field_length, datum_count,obj_desc->common_field.access_byte_width));
......@@ -852,7 +852,7 @@ acpi_ex_insert_into_field (
*/
byte_field_length = ACPI_ROUND_BITS_UP_TO_BYTES (obj_desc->common_field.bit_length);
if (buffer_length < byte_field_length) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Buffer length %X too small for field %X\n",
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Buffer length %X too small for field %X\n",
buffer_length, byte_field_length));
return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
......@@ -862,7 +862,7 @@ acpi_ex_insert_into_field (
datum_count = ACPI_ROUND_UP_TO (byte_field_length, obj_desc->common_field.access_byte_width);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Byte_len=%x, Datum_len=%x, Byte_gran=%x\n",
byte_field_length, datum_count, obj_desc->common_field.access_byte_width));
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg1 - AML execution - opcodes with 1 argument
* $Revision: 134 $
* $Revision: 135 $
*
*****************************************************************************/
......@@ -791,10 +791,21 @@ acpi_ex_opcode_1A_0T_1R (
*/
switch (operand[0]->reference.target_type) {
case ACPI_TYPE_BUFFER_FIELD:
/* Ensure that the Buffer arguments are evaluated */
temp_desc = operand[0]->reference.object;
#if 0
status = acpi_ds_get_buffer_arguments (temp_desc);
if (ACPI_FAILURE (status)) {
goto cleanup;
}
#endif
/*
* The target is a buffer, we must create a new object that
* contains one element of the buffer, the element pointed
* to by the index.
* Create a new object that contains one element of the
* buffer -- the element pointed to by the index.
*
* NOTE: index into a buffer is NOT a pointer to a
* sub-buffer of the main buffer, it is only a pointer to a
......@@ -811,7 +822,6 @@ acpi_ex_opcode_1A_0T_1R (
* indexed location, we don't need to add an additional
* reference to the buffer itself.
*/
temp_desc = operand[0]->reference.object;
return_desc->integer.value =
temp_desc->buffer.pointer[operand[0]->reference.offset];
break;
......@@ -819,10 +829,17 @@ acpi_ex_opcode_1A_0T_1R (
case ACPI_TYPE_PACKAGE:
#if 0
/* Ensure that the Package arguments are evaluated */
status = acpi_ds_get_package_arguments (operand[0]->reference.object);
if (ACPI_FAILURE (status)) {
goto cleanup;
}
#endif
/*
* The target is a package, we want to return the referenced
* element of the package. We must add another reference to
* this object, however.
* Return the referenced element of the package. We must add
* another reference to the referenced object, however.
*/
return_desc = *(operand[0]->reference.where);
if (!return_desc) {
......
/******************************************************************************
*
* Module Name: exoparg2 - AML execution - opcodes with 2 arguments
* $Revision: 104 $
* $Revision: 105 $
*
*****************************************************************************/
......@@ -84,49 +84,45 @@ acpi_ex_opcode_2A_0T_0R (
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE_STR ("Ex_opcode_2A_0T_0R", acpi_ps_get_opcode_name (walk_state->opcode));
ACPI_FUNCTION_TRACE_STR ("Ex_opcode_2A_0T_0R",
acpi_ps_get_opcode_name (walk_state->opcode));
/* Examine the opcode */
switch (walk_state->opcode) {
case AML_NOTIFY_OP: /* Notify (Notify_object, Notify_value) */
/* The first operand is a namespace node */
node = (acpi_namespace_node *) operand[0];
/* The node must refer to a device or thermal zone or processor */
switch (node->type) {
case ACPI_TYPE_DEVICE:
case ACPI_TYPE_THERMAL:
case ACPI_TYPE_PROCESSOR:
/*
* Dispatch the notify to the appropriate handler
* NOTE: the request is queued for execution after this method
* completes. The notify handlers are NOT invoked synchronously
* from this thread -- because handlers may in turn run other
* control methods.
*/
status = acpi_ev_queue_notify_request (node,
(u32) operand[1]->integer.value);
break;
/* Notifies allowed on this object? */
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unexpected notify object type %X\n",
node->type));
if (!acpi_ev_is_notify_object (node)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unexpected notify object type [%s]\n",
acpi_ut_get_type_name (node->type)));
status = AE_AML_OPERAND_TYPE;
break;
}
/*
* Dispatch the notify to the appropriate handler
* NOTE: the request is queued for execution after this method
* completes. The notify handlers are NOT invoked synchronously
* from this thread -- because handlers may in turn run other
* control methods.
*/
status = acpi_ev_queue_notify_request (node,
(u32) operand[1]->integer.value);
break;
default:
ACPI_REPORT_ERROR (("Acpi_ex_opcode_2A_0T_0R: Unknown opcode %X\n", walk_state->opcode));
ACPI_REPORT_ERROR (("Acpi_ex_opcode_2A_0T_0R: Unknown opcode %X\n",
walk_state->opcode));
status = AE_AML_BAD_OPCODE;
}
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exprep - ACPI AML (p-code) execution - field prep utilities
* $Revision: 114 $
* $Revision: 115 $
*
*****************************************************************************/
......@@ -204,61 +204,77 @@ acpi_ex_prep_common_field_object (
* two pieces of information - the width of each field access and the
* necessary Byte_alignment (address granularity) of the access.
*
* For Any_acc, the Access_bit_width is the largest width that is both necessary
* and possible in an attempt to access the whole field in one
* I/O operation. However, for Any_acc, the Byte_alignment is always one byte.
* For Any_acc, the Access_bit_width is the largest width that is both
* necessary and possible in an attempt to access the whole field in one
* I/O operation. However, for Any_acc, the Byte_alignment is always one
* byte.
*
* For all Buffer Fields, the Byte_alignment is always one byte.
*
* For all other access types (Byte, Word, Dword, Qword), the Bitwidth is the
* same (equivalent) as the Byte_alignment.
* For all other access types (Byte, Word, Dword, Qword), the Bitwidth is
* the same (equivalent) as the Byte_alignment.
*/
access_bit_width = acpi_ex_decode_field_access (obj_desc, field_flags, &byte_alignment);
access_bit_width = acpi_ex_decode_field_access (obj_desc, field_flags,
&byte_alignment);
if (!access_bit_width) {
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
}
/* Setup width (access granularity) fields */
obj_desc->common_field.access_byte_width = (u8) ACPI_DIV_8 (access_bit_width); /* 1, 2, 4, 8 */
obj_desc->common_field.access_byte_width = (u8)
ACPI_DIV_8 (access_bit_width); /* 1, 2, 4, 8 */
/*
* Base_byte_offset is the address of the start of the field within the region. It is
* the byte address of the first *datum* (field-width data unit) of the field.
* (i.e., the first datum that contains at least the first *bit* of the field.)
* Note: Byte_alignment is always either equal to the Access_bit_width or 8 (Byte access),
* and it defines the addressing granularity of the parent region or buffer.
* Base_byte_offset is the address of the start of the field within the
* region. It is the byte address of the first *datum* (field-width data
* unit) of the field. (i.e., the first datum that contains at least the
* first *bit* of the field.)
*
* Note: Byte_alignment is always either equal to the Access_bit_width or 8
* (Byte access), and it defines the addressing granularity of the parent
* region or buffer.
*/
nearest_byte_address = ACPI_ROUND_BITS_DOWN_TO_BYTES (field_bit_position);
obj_desc->common_field.base_byte_offset = ACPI_ROUND_DOWN (nearest_byte_address, byte_alignment);
nearest_byte_address =
ACPI_ROUND_BITS_DOWN_TO_BYTES (field_bit_position);
obj_desc->common_field.base_byte_offset =
ACPI_ROUND_DOWN (nearest_byte_address, byte_alignment);
/*
* Start_field_bit_offset is the offset of the first bit of the field within a field datum.
* Start_field_bit_offset is the offset of the first bit of the field within
* a field datum.
*/
obj_desc->common_field.start_field_bit_offset = (u8) (field_bit_position -
ACPI_MUL_8 (obj_desc->common_field.base_byte_offset));
obj_desc->common_field.start_field_bit_offset = (u8)
(field_bit_position - ACPI_MUL_8 (obj_desc->common_field.base_byte_offset));
/*
* Valid bits -- the number of bits that compose a partial datum,
* 1) At the end of the field within the region (arbitrary starting bit offset)
* 2) At the end of a buffer used to contain the field (starting offset always zero)
* 1) At the end of the field within the region (arbitrary starting bit
* offset)
* 2) At the end of a buffer used to contain the field (starting offset
* always zero)
*/
obj_desc->common_field.end_field_valid_bits = (u8) ((obj_desc->common_field.start_field_bit_offset + field_bit_length) %
access_bit_width);
obj_desc->common_field.end_buffer_valid_bits = (u8) (field_bit_length % access_bit_width); /* Start_buffer_bit_offset always = 0 */
obj_desc->common_field.end_field_valid_bits = (u8)
((obj_desc->common_field.start_field_bit_offset + field_bit_length) %
access_bit_width);
/* Start_buffer_bit_offset always = 0 */
obj_desc->common_field.end_buffer_valid_bits = (u8)
(field_bit_length % access_bit_width);
/*
* Datum_valid_bits is the number of valid field bits in the first field datum.
* Datum_valid_bits is the number of valid field bits in the first
* field datum.
*/
obj_desc->common_field.datum_valid_bits = (u8) (access_bit_width -
obj_desc->common_field.start_field_bit_offset);
obj_desc->common_field.datum_valid_bits = (u8)
(access_bit_width - obj_desc->common_field.start_field_bit_offset);
/*
* Does the entire field fit within a single field access element? (datum)
* (i.e., without crossing a datum boundary)
*/
if ((obj_desc->common_field.start_field_bit_offset + field_bit_length) <=
(u16) access_bit_width) {
(u16) access_bit_width) {
obj_desc->common.flags |= AOPOBJ_SINGLE_DATUM;
}
......@@ -341,7 +357,7 @@ acpi_ex_prep_field_value (
acpi_ut_add_reference (obj_desc->field.region_obj);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Region_field: Bitoff=%X Off=%X Gran=%X Region %p\n",
obj_desc->field.start_field_bit_offset, obj_desc->field.base_byte_offset,
obj_desc->field.access_byte_width, obj_desc->field.region_obj));
......@@ -359,9 +375,12 @@ acpi_ex_prep_field_value (
acpi_ut_add_reference (obj_desc->bank_field.region_obj);
acpi_ut_add_reference (obj_desc->bank_field.bank_obj);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Bank Field: Bit_off=%X Off=%X Gran=%X Region %p Bank_reg %p\n",
obj_desc->bank_field.start_field_bit_offset, obj_desc->bank_field.base_byte_offset,
obj_desc->field.access_byte_width, obj_desc->bank_field.region_obj,
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Bank Field: Bit_off=%X Off=%X Gran=%X Region %p Bank_reg %p\n",
obj_desc->bank_field.start_field_bit_offset,
obj_desc->bank_field.base_byte_offset,
obj_desc->field.access_byte_width,
obj_desc->bank_field.region_obj,
obj_desc->bank_field.bank_obj));
break;
......@@ -370,8 +389,8 @@ acpi_ex_prep_field_value (
obj_desc->index_field.index_obj = acpi_ns_get_attached_object (info->register_node);
obj_desc->index_field.data_obj = acpi_ns_get_attached_object (info->data_register_node);
obj_desc->index_field.value = (u32) (info->field_bit_position /
ACPI_MUL_8 (obj_desc->field.access_byte_width));
obj_desc->index_field.value = (u32)
(info->field_bit_position / ACPI_MUL_8 (obj_desc->field.access_byte_width));
if (!obj_desc->index_field.data_obj || !obj_desc->index_field.index_obj) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Index Object\n"));
......@@ -383,9 +402,12 @@ acpi_ex_prep_field_value (
acpi_ut_add_reference (obj_desc->index_field.data_obj);
acpi_ut_add_reference (obj_desc->index_field.index_obj);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Index_field: bitoff=%X off=%X gran=%X Index %p Data %p\n",
obj_desc->index_field.start_field_bit_offset, obj_desc->index_field.base_byte_offset,
obj_desc->field.access_byte_width, obj_desc->index_field.index_obj,
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Index_field: bitoff=%X off=%X gran=%X Index %p Data %p\n",
obj_desc->index_field.start_field_bit_offset,
obj_desc->index_field.base_byte_offset,
obj_desc->field.access_byte_width,
obj_desc->index_field.index_obj,
obj_desc->index_field.data_obj));
break;
}
......@@ -397,7 +419,7 @@ acpi_ex_prep_field_value (
status = acpi_ns_attach_object (info->field_node, obj_desc,
acpi_ns_get_type (info->field_node));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "set Named_obj %p (%4.4s) val = %p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "set Named_obj %p (%4.4s) val = %p\n",
info->field_node, (char *) &(info->field_node->name), obj_desc));
/* Remove local reference to the object */
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exregion - ACPI default Op_region (address space) handlers
* $Revision: 72 $
* $Revision: 74 $
*
*****************************************************************************/
......@@ -69,7 +69,6 @@ acpi_ex_system_memory_space_handler (
acpi_mem_space_context *mem_info = region_context;
u32 length;
u32 window_size;
u32 remaining;
ACPI_FUNCTION_TRACE ("Ex_system_memory_space_handler");
......@@ -123,13 +122,10 @@ acpi_ex_system_memory_space_handler (
* Don't attempt to map memory beyond the end of the region, and
* constrain the maximum mapping size to something reasonable.
*/
remaining = (u32) ((mem_info->address + (ACPI_PHYSICAL_ADDRESS) mem_info->length) - address);
if (remaining > SYSMEM_REGION_WINDOW_SIZE) {
window_size = (u32) ((mem_info->address + mem_info->length) - address);
if (window_size > SYSMEM_REGION_WINDOW_SIZE) {
window_size = SYSMEM_REGION_WINDOW_SIZE;
}
else {
window_size = remaining;
}
/* Create a new mapping starting at the address given */
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresnte - AML Interpreter object resolution
* $Revision: 50 $
* $Revision: 52 $
*
*****************************************************************************/
......@@ -122,10 +122,13 @@ acpi_ex_resolve_node_to_value (
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/* Return an additional reference to the object */
status = acpi_ds_get_package_arguments (source_desc);
if (ACPI_SUCCESS (status)) {
/* Return an additional reference to the object */
obj_desc = source_desc;
acpi_ut_add_reference (obj_desc);
obj_desc = source_desc;
acpi_ut_add_reference (obj_desc);
}
break;
......@@ -137,10 +140,13 @@ acpi_ex_resolve_node_to_value (
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/* Return an additional reference to the object */
status = acpi_ds_get_buffer_arguments (source_desc);
if (ACPI_SUCCESS (status)) {
/* Return an additional reference to the object */
obj_desc = source_desc;
acpi_ut_add_reference (obj_desc);
obj_desc = source_desc;
acpi_ut_add_reference (obj_desc);
}
break;
......@@ -182,7 +188,7 @@ acpi_ex_resolve_node_to_value (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Field_read Node=%p Source_desc=%p Type=%X\n",
node, source_desc, entry_type));
status = acpi_ex_read_data_from_field (source_desc, &obj_desc);
status = acpi_ex_read_data_from_field (walk_state, source_desc, &obj_desc);
break;
/*
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresolv - AML Interpreter object resolution
* $Revision: 106 $
* $Revision: 109 $
*
*****************************************************************************/
......@@ -94,7 +94,7 @@ acpi_ex_resolve_to_value (
}
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Resolved object %p\n", *stack_ptr));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Resolved object %p\n", *stack_ptr));
return_ACPI_STATUS (AE_OK);
}
......@@ -177,7 +177,7 @@ acpi_ex_resolve_object_to_value (
acpi_ut_remove_reference (stack_desc);
*stack_ptr = obj_desc;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "[Arg/Local %d] Value_obj is %p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Arg/Local %d] Value_obj is %p\n",
stack_desc->reference.offset, obj_desc));
break;
......@@ -290,6 +290,19 @@ acpi_ex_resolve_object_to_value (
break; /* case INTERNAL_TYPE_REFERENCE */
case ACPI_TYPE_BUFFER:
status = acpi_ds_get_buffer_arguments (stack_desc);
break;
case ACPI_TYPE_PACKAGE:
status = acpi_ds_get_package_arguments (stack_desc);
break;
/*
* These cases may never happen here, but just in case..
*/
......@@ -301,7 +314,7 @@ acpi_ex_resolve_object_to_value (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Field_read Source_desc=%p Type=%X\n",
stack_desc, stack_desc->common.type));
status = acpi_ex_read_data_from_field (stack_desc, &obj_desc);
status = acpi_ex_read_data_from_field (walk_state, stack_desc, &obj_desc);
*stack_ptr = (void *) obj_desc;
break;
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresop - AML Interpreter operand/object resolution
* $Revision: 47 $
* $Revision: 48 $
*
*****************************************************************************/
......@@ -69,7 +69,7 @@ acpi_ex_check_object_type (
}
if (type_needed != this_type) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Needed [%s], found [%s] %p\n",
acpi_ut_get_type_name (type_needed),
acpi_ut_get_type_name (this_type), object));
......@@ -135,8 +135,8 @@ acpi_ex_resolve_operands (
return_ACPI_STATUS (AE_AML_INTERNAL);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode %X Operand_types=%X \n",
opcode, arg_types));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode %X [%s] Operand_types=%X \n",
opcode, op_info->name, arg_types));
/*
* Normal exit is with (Arg_types == 0) at end of argument list.
......@@ -203,7 +203,7 @@ acpi_ex_resolve_operands (
case AML_LOCAL_OP:
case AML_REVISION_OP:
ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Reference Opcode: %s\n", op_info->name)));
break;
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exstore - AML Interpreter object store support
* $Revision: 162 $
* $Revision: 163 $
*
*****************************************************************************/
......@@ -150,7 +150,7 @@ acpi_ex_store (
* Storing to the Debug object causes the value stored to be
* displayed and otherwise has no effect -- see ACPI Specification
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Write to Debug Object: ****:\n\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "**** Write to Debug Object: ****:\n\n"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %s: ",
acpi_ut_get_type_name (source_desc->common.type)));
......@@ -191,7 +191,7 @@ acpi_ex_store (
break;
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n"));
break;
......@@ -404,7 +404,7 @@ acpi_ex_store_object_to_node (
target_type = acpi_ns_get_type (node);
target_desc = acpi_ns_get_attached_object (node);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Storing %p(%s) into node %p(%s)\n",
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p(%s) into node %p(%s)\n",
source_desc, acpi_ut_get_type_name (source_desc->common.type),
node, acpi_ut_get_type_name (target_type)));
......@@ -456,7 +456,7 @@ acpi_ex_store_object_to_node (
*/
status = acpi_ns_attach_object (node, new_desc, target_type);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
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)));
......@@ -466,7 +466,7 @@ acpi_ex_store_object_to_node (
default:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
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));
......
......@@ -3,7 +3,7 @@
*
* Module Name: exstoren - AML Interpreter object store support,
* Store to Node (namespace object)
* $Revision: 46 $
* $Revision: 47 $
*
*****************************************************************************/
......@@ -145,7 +145,7 @@ acpi_ex_resolve_object (
* FUNCTION: Acpi_ex_store_object_to_object
*
* PARAMETERS: Source_desc - Object to store
* Dest_desc - Object to recieve a copy of the source
* Dest_desc - Object to receive a copy of the source
* New_desc - New object if Dest_desc is obsoleted
* Walk_state - Current walk state
*
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exstorob - AML Interpreter object store support, store to object
* $Revision: 41 $
* $Revision: 42 $
*
*****************************************************************************/
......@@ -104,6 +104,10 @@ acpi_ex_store_buffer_to_buffer (
length, target_desc->buffer.length));
}
/* Copy flags */
target_desc->buffer.flags = source_desc->buffer.flags;
return (AE_OK);
}
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: hwgpe - Low level GPE enable/disable/clear functions
* $Revision: 39 $
* $Revision: 40 $
*
*****************************************************************************/
......@@ -89,10 +89,10 @@ acpi_hw_enable_gpe (
* Read the current value of the register, set the appropriate bit
* to enable the GPE, and write out the new register.
*/
in_byte = 0;
acpi_os_read_port (acpi_gbl_gpe_register_info[register_index].enable_addr, &in_byte, 8);
acpi_os_write_port (acpi_gbl_gpe_register_info[register_index].enable_addr,
(in_byte | bit_mask), 8);
in_byte = acpi_hw_low_level_read (8,
&acpi_gbl_gpe_register_info[register_index].enable_address, 0);
acpi_hw_low_level_write (8, (in_byte | bit_mask),
&acpi_gbl_gpe_register_info[register_index].enable_address, 0);
}
......@@ -171,10 +171,10 @@ acpi_hw_disable_gpe (
* Read the current value of the register, clear the appropriate bit,
* and write out the new register value to disable the GPE.
*/
in_byte = 0;
acpi_os_read_port (acpi_gbl_gpe_register_info[register_index].enable_addr, &in_byte, 8);
acpi_os_write_port (acpi_gbl_gpe_register_info[register_index].enable_addr,
(in_byte & ~bit_mask), 8);
in_byte = acpi_hw_low_level_read (8,
&acpi_gbl_gpe_register_info[register_index].enable_address, 0);
acpi_hw_low_level_write (8, (in_byte & ~bit_mask),
&acpi_gbl_gpe_register_info[register_index].enable_address, 0);
acpi_hw_disable_gpe_for_wakeup(gpe_number);
}
......@@ -254,7 +254,8 @@ acpi_hw_clear_gpe (
* Write a one to the appropriate bit in the status register to
* clear this GPE.
*/
acpi_os_write_port (acpi_gbl_gpe_register_info[register_index].status_addr, bit_mask, 8);
acpi_hw_low_level_write (8, bit_mask,
&acpi_gbl_gpe_register_info[register_index].status_address, 0);
}
......@@ -301,8 +302,7 @@ acpi_hw_get_gpe_status (
/* GPE Enabled? */
in_byte = 0;
acpi_os_read_port (gpe_register_info->enable_addr, &in_byte, 8);
in_byte = acpi_hw_low_level_read (8, &gpe_register_info->enable_address, 0);
if (bit_mask & in_byte) {
(*event_status) |= ACPI_EVENT_FLAG_ENABLED;
}
......@@ -315,8 +315,7 @@ acpi_hw_get_gpe_status (
/* GPE active (set)? */
in_byte = 0;
acpi_os_read_port (gpe_register_info->status_addr, &in_byte, 8);
in_byte = acpi_hw_low_level_read (8, &gpe_register_info->status_address, 0);
if (bit_mask & in_byte) {
(*event_status) |= ACPI_EVENT_FLAG_SET;
}
......@@ -357,14 +356,14 @@ acpi_hw_disable_non_wakeup_gpes (
* Read the enabled status of all GPEs. We
* will be using it to restore all the GPEs later.
*/
acpi_os_read_port (gpe_register_info->enable_addr,
&gpe_register_info->enable, 8);
gpe_register_info->enable = (u8) acpi_hw_low_level_read (8,
&gpe_register_info->enable_address, 0);
/*
* Disable all GPEs except wakeup GPEs.
*/
acpi_os_write_port(gpe_register_info->enable_addr,
gpe_register_info->wake_enable, 8);
acpi_hw_low_level_write (8, gpe_register_info->wake_enable,
&gpe_register_info->enable_address, 0);
}
}
......@@ -399,7 +398,7 @@ acpi_hw_enable_non_wakeup_gpes (
* We previously stored the enabled status of all GPEs.
* Blast them back in.
*/
acpi_os_write_port(gpe_register_info->enable_addr,
gpe_register_info->enable, 8);
acpi_hw_low_level_write (8, gpe_register_info->enable, &
gpe_register_info->enable_address, 0);
}
}
......@@ -3,7 +3,7 @@
*
* Module Name: hwregs - Read/write access functions for the various ACPI
* control and status registers.
* $Revision: 120 $
* $Revision: 121 $
*
******************************************************************************/
......@@ -73,18 +73,16 @@ acpi_hw_clear_acpi_status (void)
/* Clear the fixed events */
if (ACPI_VALID_ADDRESS (acpi_gbl_FADT->Xpm1b_evt_blk.address)) {
acpi_os_write_port ((ACPI_IO_ADDRESS)
ACPI_GET_ADDRESS (acpi_gbl_FADT->Xpm1b_evt_blk.address),
ACPI_BITMASK_ALL_FIXED_STATUS, 16);
acpi_hw_low_level_write (16, ACPI_BITMASK_ALL_FIXED_STATUS,
&acpi_gbl_FADT->Xpm1b_evt_blk, 0);
}
/* Clear the GPE Bits */
for (gpe_block = 0; gpe_block < ACPI_MAX_GPE_BLOCKS; gpe_block++) {
for (i = 0; i < acpi_gbl_gpe_block_info[gpe_block].register_count; i++) {
acpi_os_write_port ((ACPI_IO_ADDRESS)
(acpi_gbl_gpe_block_info[gpe_block].block_address + i),
0xFF, 8);
acpi_hw_low_level_write (8, 0xFF,
acpi_gbl_gpe_block_info[gpe_block].block_address, i);
}
}
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface
* $Revision: 35 $
* $Revision: 37 $
*
*****************************************************************************/
......@@ -237,6 +237,7 @@ acpi_enter_sleep_state (
PM1Bcontrol |= sleep_enable_reg_info->access_bit_mask;
/* Write #2: SLP_TYP + SLP_EN */
ACPI_FLUSH_CPU_CACHE();
acpi_hw_register_write (ACPI_MTX_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol);
acpi_hw_register_write (ACPI_MTX_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol);
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: hwtimer.c - ACPI Power Management Timer Interface
* $Revision: 19 $
* $Revision: 20 $
*
*****************************************************************************/
......@@ -88,8 +88,7 @@ acpi_get_timer (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
acpi_os_read_port ((ACPI_IO_ADDRESS)
ACPI_GET_ADDRESS (acpi_gbl_FADT->Xpm_tmr_blk.address), ticks, 32);
*ticks = acpi_hw_low_level_read (32, &acpi_gbl_FADT->Xpm_tmr_blk, 0);
return_ACPI_STATUS (AE_OK);
}
......
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
* $Revision: 94 $
* $Revision: 96 $
*
*****************************************************************************/
......@@ -54,7 +54,7 @@
/* Version string */
#define ACPI_CA_VERSION 0x20020308
#define ACPI_CA_VERSION 0x20020403
/* Version of ACPI supported */
......
/******************************************************************************
*
* Name: acdebug.h - ACPI/AML debugger
* $Revision: 57 $
* $Revision: 58 $
*
*****************************************************************************/
......@@ -271,6 +271,9 @@ acpi_status
acpi_db_load_acpi_table (
NATIVE_CHAR *filename);
acpi_status
acpi_db_get_acpi_table (
NATIVE_CHAR *filename);
/*
* dbhistry - debugger HISTORY command
......
/******************************************************************************
*
* Name: acdispat.h - dispatcher (parser to interpreter interface)
* $Revision: 51 $
* $Revision: 52 $
*
*****************************************************************************/
......@@ -65,6 +65,14 @@ acpi_status
acpi_ds_get_region_arguments (
acpi_operand_object *rgn_desc);
acpi_status
acpi_ds_get_buffer_arguments (
acpi_operand_object *obj_desc);
acpi_status
acpi_ds_get_package_arguments (
acpi_operand_object *obj_desc);
/* dsctrl - Parser/Interpreter interface, control stack routines */
......@@ -266,10 +274,18 @@ acpi_ds_initialize_objects (
acpi_table_desc *table_desc,
acpi_namespace_node *start_node);
acpi_status
acpi_ds_build_internal_buffer_obj (
acpi_walk_state *walk_state,
acpi_parse_object *op,
u32 buffer_length,
acpi_operand_object **obj_desc_ptr);
acpi_status
acpi_ds_build_internal_package_obj (
acpi_walk_state *walk_state,
acpi_parse_object *op,
u32 package_length,
acpi_operand_object **obj_desc);
acpi_status
......@@ -304,6 +320,12 @@ acpi_ds_eval_region_operands (
acpi_walk_state *walk_state,
acpi_parse_object *op);
acpi_status
acpi_ds_eval_data_object_operands (
acpi_walk_state *walk_state,
acpi_parse_object *op,
acpi_operand_object *obj_desc);
acpi_status
acpi_ds_initialize_region (
acpi_handle obj_handle);
......
/******************************************************************************
*
* Name: acevents.h - Event subcomponent prototypes and defines
* $Revision: 75 $
* $Revision: 76 $
*
*****************************************************************************/
......@@ -57,6 +57,10 @@ acpi_ev_fixed_event_dispatch (
* Evmisc
*/
u8
acpi_ev_is_notify_object (
acpi_namespace_node *node);
acpi_status
acpi_ev_acquire_global_lock(
u32 timeout);
......
/******************************************************************************
*
* Name: acexcep.h - Exception codes returned by the ACPI subsystem
* $Revision: 57 $
* $Revision: 59 $
*
*****************************************************************************/
......@@ -74,8 +74,9 @@
#define AE_ALREADY_ACQUIRED (acpi_status) (0x0018 | AE_CODE_ENVIRONMENTAL)
#define AE_NO_HARDWARE_RESPONSE (acpi_status) (0x0019 | AE_CODE_ENVIRONMENTAL)
#define AE_NO_GLOBAL_LOCK (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL)
#define AE_LOGICAL_ADDRESS (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL)
#define AE_CODE_ENV_MAX 0x001A
#define AE_CODE_ENV_MAX 0x001B
/*
* Programmer exceptions
......@@ -86,8 +87,11 @@
#define AE_BAD_DATA (acpi_status) (0x0004 | AE_CODE_PROGRAMMER)
#define AE_BAD_ADDRESS (acpi_status) (0x0005 | AE_CODE_PROGRAMMER)
#define AE_ALIGNMENT (acpi_status) (0x0006 | AE_CODE_PROGRAMMER)
#define AE_BAD_HEX_CONSTANT (acpi_status) (0x0007 | AE_CODE_PROGRAMMER)
#define AE_BAD_OCTAL_CONSTANT (acpi_status) (0x0008 | AE_CODE_PROGRAMMER)
#define AE_BAD_DECIMAL_CONSTANT (acpi_status) (0x0009 | AE_CODE_PROGRAMMER)
#define AE_CODE_PGM_MAX 0x0006
#define AE_CODE_PGM_MAX 0x0009
/*
......@@ -188,7 +192,8 @@ NATIVE_CHAR const *acpi_gbl_exception_names_env[] =
"AE_NOT_ACQUIRED",
"AE_ALREADY_ACQUIRED",
"AE_NO_HARDWARE_RESPONSE",
"AE_NO_GLOBAL_LOCK"
"AE_NO_GLOBAL_LOCK",
"AE_LOGICAL_ADDRESS"
};
NATIVE_CHAR const *acpi_gbl_exception_names_pgm[] =
......@@ -198,7 +203,10 @@ NATIVE_CHAR const *acpi_gbl_exception_names_pgm[] =
"AE_BAD_PATHNAME",
"AE_BAD_DATA",
"AE_BAD_ADDRESS",
"AE_ALIGNMENT"
"AE_ALIGNMENT",
"AE_BAD_HEX_CONSTANT",
"AE_BAD_OCTAL_CONSTANT",
"AE_BAD_DECIMAL_CONSTANT"
};
NATIVE_CHAR const *acpi_gbl_exception_names_tbl[] =
......
/******************************************************************************
*
* Name: acglobal.h - Declarations for global variables
* $Revision: 120 $
* $Revision: 121 $
*
*****************************************************************************/
......@@ -71,6 +71,7 @@ extern u32 acpi_gbl_nesting_level;
* of each in the system. Each global points to the actual table.
*
*/
ACPI_EXTERN u32 acpi_gbl_table_flags;
ACPI_EXTERN RSDP_DESCRIPTOR *acpi_gbl_RSDP;
ACPI_EXTERN xsdt_descriptor *acpi_gbl_XSDT;
ACPI_EXTERN FADT_DESCRIPTOR *acpi_gbl_FADT;
......
/******************************************************************************
*
* Name: acinterp.h - Interpreter subcomponent prototypes and defines
* $Revision: 132 $
* $Revision: 133 $
*
*****************************************************************************/
......@@ -147,6 +147,7 @@ acpi_ex_set_buffer_datum (
acpi_status
acpi_ex_read_data_from_field (
acpi_walk_state *walk_state,
acpi_operand_object *obj_desc,
acpi_operand_object **ret_buffer_desc);
......
/******************************************************************************
*
* Name: aclocal.h - Internal data types used across the ACPI subsystem
* $Revision: 159 $
* $Revision: 162 $
*
*****************************************************************************/
......@@ -182,12 +182,18 @@ typedef enum
* be the first byte in this structure.
*/
typedef union acpi_name_union
{
u32 integer;
char ascii[4];
} ACPI_NAME_UNION;
typedef struct acpi_node
{
u8 descriptor; /* Used to differentiate object descriptor types */
u8 type; /* Type associated with this name */
u16 owner_id;
u32 name; /* ACPI Name, always 4 chars per ACPI spec */
ACPI_NAME_UNION name; /* ACPI Name, always 4 chars per ACPI spec */
union acpi_operand_obj *object; /* Pointer to attached ACPI object (optional) */
......@@ -314,8 +320,9 @@ typedef struct
typedef struct
{
u8 address_space_id;
acpi_generic_address *block_address;
u16 register_count;
u16 block_address;
u8 block_base_number;
} ACPI_GPE_BLOCK_INFO;
......@@ -324,8 +331,8 @@ typedef struct
typedef struct
{
u16 status_addr; /* Address of status reg */
u16 enable_addr; /* Address of enable reg */
acpi_generic_address status_address; /* Address of status reg */
acpi_generic_address enable_address; /* Address of enable reg */
u8 status; /* Current value of status reg */
u8 enable; /* Current value of enable reg */
u8 wake_enable; /* Mask of bits to keep enabled when sleeping */
......@@ -410,11 +417,11 @@ struct acpi_obj_mutex;
#define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\
u8 data_type; /* To differentiate various internal objs */\
u8 flags; \
u16 value; \
u16 state; \
u16 acpi_eval; \
void *next; \
u8 flags; \
u16 value; \
u16 state; \
u16 reserved; \
void *next; \
typedef struct acpi_common_state
{
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: acobject.h - Definition of acpi_operand_object (Internal object only)
* $Revision: 106 $
* $Revision: 110 $
*
*****************************************************************************/
......@@ -32,23 +32,14 @@
* The acpi_operand_object is used to pass AML operands from the dispatcher
* to the interpreter, and to keep track of the various handlers such as
* address space handlers and notify handlers. The object is a constant
* size in order to allow them to be cached and reused.
*
* All variants of the acpi_operand_object are defined with the same
* sequence of field types, with fields that are not used in a particular
* variant being named "Reserved". This is not strictly necessary, but
* may in some circumstances simplify understanding if these structures
* need to be displayed in a debugger having limited (or no) support for
* union types. It also simplifies some debug code in Dump_table() which
* dumps multi-level values: fetching Buffer.Pointer suffices to pick up
* the value or next level for any of several types.
* size in order to allow it to be cached and reused.
*/
/******************************************************************************
/*******************************************************************************
*
* Common Descriptors
*
*****************************************************************************/
******************************************************************************/
/*
* Common area for all objects.
......@@ -56,8 +47,6 @@
* Data_type is used to differentiate between internal descriptors, and MUST
* be the first byte in this structure.
*/
#define ACPI_OBJECT_COMMON_HEADER /* SIZE/ALIGNMENT: 32 bits, one ptr plus trailing 8-bit flag */\
u8 descriptor; /* To differentiate various internal objs */\
u8 type; /* acpi_object_type */\
......@@ -65,7 +54,7 @@
union acpi_operand_obj *next_object; /* Objects linked to parent NS node */\
u8 flags; \
/* Defines for flag byte above */
/* Values for flag byte above */
#define AOPOBJ_RESERVED 0x01
#define AOPOBJ_STATIC_POINTER 0x02
......@@ -101,29 +90,29 @@
u32 length;
/*
* Common fields for objects that support ASL notifications
*/
#define ACPI_COMMON_NOTIFY_INFO \
union acpi_operand_obj *sys_handler; /* Handler for system notifies */\
union acpi_operand_obj *drv_handler; /* Handler for driver notifies */\
union acpi_operand_obj *addr_handler; /* Handler for Address space */
/******************************************************************************
*
* Individual Object Descriptors
* Basic data types
*
*****************************************************************************/
typedef struct /* COMMON */
typedef struct acpi_object_common
{
ACPI_OBJECT_COMMON_HEADER
} ACPI_OBJECT_COMMON;
typedef struct /* CACHE_LIST */
{
ACPI_OBJECT_COMMON_HEADER
union acpi_operand_obj *next; /* Link for object cache and internal lists*/
} ACPI_OBJECT_CACHE_LIST;
typedef struct /* NUMBER - has value */
typedef struct acpi_object_integer
{
ACPI_OBJECT_COMMON_HEADER
......@@ -132,48 +121,47 @@ typedef struct /* NUMBER - has value */
} ACPI_OBJECT_INTEGER;
typedef struct /* STRING - has length and pointer - Null terminated, ASCII characters only */
typedef struct acpi_object_string /* Null terminated, ASCII characters only */
{
ACPI_OBJECT_COMMON_HEADER
ACPI_COMMON_BUFFER_INFO
NATIVE_CHAR *pointer; /* String value in AML stream or in allocated space */
NATIVE_CHAR *pointer; /* String in AML stream or allocated string */
} ACPI_OBJECT_STRING;
typedef struct /* BUFFER - has length and pointer - not null terminated */
typedef struct acpi_object_buffer
{
ACPI_OBJECT_COMMON_HEADER
ACPI_COMMON_BUFFER_INFO
u8 *pointer; /* Buffer value in AML stream or in allocated space */
u8 *pointer; /* Buffer in AML stream or allocated buffer */
acpi_namespace_node *node; /* Link back to parent node */
u8 *aml_start;
u32 aml_length;
} ACPI_OBJECT_BUFFER;
typedef struct /* PACKAGE - has count, elements, next element */
typedef struct acpi_object_package
{
ACPI_OBJECT_COMMON_HEADER
u32 count; /* # of elements in package */
u32 aml_length;
u8 *aml_start;
acpi_namespace_node *node; /* Link back to parent node */
union acpi_operand_obj **elements; /* Array of pointers to Acpi_objects */
union acpi_operand_obj **next_element; /* used only while initializing */
} ACPI_OBJECT_PACKAGE;
typedef struct /* DEVICE - has handle and notification handler/context */
{
ACPI_OBJECT_COMMON_HEADER
union acpi_operand_obj *sys_handler; /* Handler for system notifies */
union acpi_operand_obj *drv_handler; /* Handler for driver notifies */
union acpi_operand_obj *addr_handler; /* Handler for Address space */
} ACPI_OBJECT_DEVICE;
/******************************************************************************
*
* Complex data types
*
*****************************************************************************/
typedef struct /* EVENT */
typedef struct acpi_object_event
{
ACPI_OBJECT_COMMON_HEADER
void *semaphore;
......@@ -183,7 +171,7 @@ typedef struct /* EVENT */
#define INFINITE_CONCURRENCY 0xFF
typedef struct /* METHOD */
typedef struct acpi_object_method
{
ACPI_OBJECT_COMMON_HEADER
u8 method_flags;
......@@ -201,7 +189,7 @@ typedef struct /* METHOD */
} ACPI_OBJECT_METHOD;
typedef struct acpi_obj_mutex /* MUTEX */
typedef struct acpi_object_mutex
{
ACPI_OBJECT_COMMON_HEADER
u16 sync_level;
......@@ -215,65 +203,82 @@ typedef struct acpi_obj_mutex /* MUTEX */
} ACPI_OBJECT_MUTEX;
typedef struct /* REGION */
typedef struct acpi_object_region
{
ACPI_OBJECT_COMMON_HEADER
u8 space_id;
u32 length;
ACPI_PHYSICAL_ADDRESS address;
union acpi_operand_obj *addr_handler; /* Handler for system notifies */
acpi_namespace_node *node; /* containing object */
union acpi_operand_obj *next;
u32 length;
ACPI_PHYSICAL_ADDRESS address;
} ACPI_OBJECT_REGION;
typedef struct /* POWER RESOURCE - has Handle and notification handler/context*/
/******************************************************************************
*
* Objects that can be notified. All share a common Notify_info area.
*
*****************************************************************************/
typedef struct acpi_object_notify_common /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */
{
ACPI_OBJECT_COMMON_HEADER
ACPI_COMMON_NOTIFY_INFO
} ACPI_OBJECT_NOTIFY_COMMON;
typedef struct acpi_object_device
{
ACPI_OBJECT_COMMON_HEADER
ACPI_COMMON_NOTIFY_INFO
} ACPI_OBJECT_DEVICE;
typedef struct acpi_object_power_resource
{
ACPI_OBJECT_COMMON_HEADER
ACPI_COMMON_NOTIFY_INFO
u32 system_level;
u32 resource_order;
union acpi_operand_obj *sys_handler; /* Handler for system notifies */
union acpi_operand_obj *drv_handler; /* Handler for driver notifies */
} ACPI_OBJECT_POWER_RESOURCE;
typedef struct /* PROCESSOR - has Handle and notification handler/context*/
typedef struct acpi_object_processor
{
ACPI_OBJECT_COMMON_HEADER
ACPI_COMMON_NOTIFY_INFO
u32 proc_id;
u32 length;
ACPI_IO_ADDRESS address;
union acpi_operand_obj *sys_handler; /* Handler for system notifies */
union acpi_operand_obj *drv_handler; /* Handler for driver notifies */
union acpi_operand_obj *addr_handler; /* Handler for Address space */
} ACPI_OBJECT_PROCESSOR;
typedef struct /* THERMAL ZONE - has Handle and Handler/Context */
typedef struct acpi_object_thermal_zone
{
ACPI_OBJECT_COMMON_HEADER
ACPI_COMMON_NOTIFY_INFO
union acpi_operand_obj *sys_handler; /* Handler for system notifies */
union acpi_operand_obj *drv_handler; /* Handler for driver notifies */
union acpi_operand_obj *addr_handler; /* Handler for Address space */
} ACPI_OBJECT_THERMAL_ZONE;
/*
/******************************************************************************
*
* Fields. All share a common header/info field.
*/
*
*****************************************************************************/
typedef struct /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
typedef struct acpi_object_field_common /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
{
ACPI_OBJECT_COMMON_HEADER
ACPI_COMMON_FIELD_INFO
......@@ -282,7 +287,7 @@ typedef struct /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
} ACPI_OBJECT_FIELD_COMMON;
typedef struct /* REGION FIELD */
typedef struct acpi_object_region_field
{
ACPI_OBJECT_COMMON_HEADER
ACPI_COMMON_FIELD_INFO
......@@ -291,7 +296,7 @@ typedef struct /* REGION FIELD */
} ACPI_OBJECT_REGION_FIELD;
typedef struct /* BANK FIELD */
typedef struct acpi_object_bank_field
{
ACPI_OBJECT_COMMON_HEADER
ACPI_COMMON_FIELD_INFO
......@@ -302,7 +307,7 @@ typedef struct /* BANK FIELD */
} ACPI_OBJECT_BANK_FIELD;
typedef struct /* INDEX FIELD */
typedef struct acpi_object_index_field
{
ACPI_OBJECT_COMMON_HEADER
ACPI_COMMON_FIELD_INFO
......@@ -320,7 +325,7 @@ typedef struct /* INDEX FIELD */
/* The Buffer_field is different in that it is part of a Buffer, not an Op_region */
typedef struct /* BUFFER FIELD */
typedef struct acpi_object_buffer_field
{
ACPI_OBJECT_COMMON_HEADER
ACPI_COMMON_FIELD_INFO
......@@ -330,11 +335,13 @@ typedef struct /* BUFFER FIELD */
} ACPI_OBJECT_BUFFER_FIELD;
/*
* Handlers
*/
/******************************************************************************
*
* Objects for handlers
*
*****************************************************************************/
typedef struct /* NOTIFY HANDLER */
typedef struct acpi_object_notify_handler
{
ACPI_OBJECT_COMMON_HEADER
......@@ -350,7 +357,7 @@ typedef struct /* NOTIFY HANDLER */
#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x1
typedef struct /* ADDRESS HANDLER */
typedef struct acpi_object_addr_handler
{
ACPI_OBJECT_COMMON_HEADER
......@@ -367,12 +374,17 @@ typedef struct /* ADDRESS HANDLER */
} ACPI_OBJECT_ADDR_HANDLER;
/******************************************************************************
*
* Special internal objects
*
*****************************************************************************/
/*
* The Reference object type is used for these opcodes:
* Arg[0-6], Local[0-7], Index_op, Name_op, Zero_op, One_op, Ones_op, Debug_op
*/
typedef struct /* Reference - Local object type */
typedef struct acpi_object_reference
{
ACPI_OBJECT_COMMON_HEADER
......@@ -394,8 +406,7 @@ typedef struct /* Reference - Local object type */
*
* Currently: Region and Field_unit types
*/
typedef struct /* EXTRA */
typedef struct acpi_object_extra
{
ACPI_OBJECT_COMMON_HEADER
u8 byte_fill1;
......@@ -408,7 +419,9 @@ typedef struct /* EXTRA */
} ACPI_OBJECT_EXTRA;
typedef struct /* DATA */
/* Additional data that can be attached to namespace nodes */
typedef struct acpi_object_data
{
ACPI_OBJECT_COMMON_HEADER
ACPI_OBJECT_HANDLER handler;
......@@ -417,38 +430,55 @@ typedef struct /* DATA */
} ACPI_OBJECT_DATA;
/* Structure used when objects are cached for reuse */
typedef struct acpi_object_cache_list
{
ACPI_OBJECT_COMMON_HEADER
union acpi_operand_obj *next; /* Link for object cache and internal lists*/
} ACPI_OBJECT_CACHE_LIST;
/******************************************************************************
*
* acpi_operand_object Descriptor - a giant union of all of the above
* acpi_operand_object Descriptor - a giant union of all of the above
*
*****************************************************************************/
typedef union acpi_operand_obj
{
ACPI_OBJECT_COMMON common;
ACPI_OBJECT_CACHE_LIST cache;
ACPI_OBJECT_INTEGER integer;
ACPI_OBJECT_STRING string;
ACPI_OBJECT_BUFFER buffer;
ACPI_OBJECT_PACKAGE package;
ACPI_OBJECT_BUFFER_FIELD buffer_field;
ACPI_OBJECT_DEVICE device;
ACPI_OBJECT_EVENT event;
ACPI_OBJECT_METHOD method;
ACPI_OBJECT_MUTEX mutex;
ACPI_OBJECT_REGION region;
ACPI_OBJECT_NOTIFY_COMMON common_notify;
ACPI_OBJECT_DEVICE device;
ACPI_OBJECT_POWER_RESOURCE power_resource;
ACPI_OBJECT_PROCESSOR processor;
ACPI_OBJECT_THERMAL_ZONE thermal_zone;
ACPI_OBJECT_FIELD_COMMON common_field;
ACPI_OBJECT_REGION_FIELD field;
ACPI_OBJECT_BUFFER_FIELD buffer_field;
ACPI_OBJECT_BANK_FIELD bank_field;
ACPI_OBJECT_INDEX_FIELD index_field;
ACPI_OBJECT_REFERENCE reference;
ACPI_OBJECT_NOTIFY_HANDLER notify_handler;
ACPI_OBJECT_ADDR_HANDLER addr_handler;
ACPI_OBJECT_REFERENCE reference;
ACPI_OBJECT_EXTRA extra;
ACPI_OBJECT_DATA data;
ACPI_OBJECT_CACHE_LIST cache;
} acpi_operand_object;
......
......@@ -83,10 +83,20 @@ acpi_status
acpi_os_terminate (
void);
/*
* ACPI Table interfaces
*/
acpi_status
acpi_os_get_root_pointer (
u32 flags,
ACPI_PHYSICAL_ADDRESS *rsdp_physical_address);
ACPI_POINTER *address);
acpi_status
acpi_os_table_override (
acpi_table_header *existing_table,
acpi_table_header **new_table);
/*
......
......@@ -96,7 +96,7 @@ acpi_free (
acpi_status
acpi_find_root_pointer (
u32 flags,
ACPI_PHYSICAL_ADDRESS *rsdp_physical_address);
ACPI_POINTER *rsdp_address);
acpi_status
acpi_load_tables (
......
/******************************************************************************
*
* Name: acstruct.h - Internal structs
* $Revision: 16 $
* $Revision: 17 $
*
*****************************************************************************/
......@@ -104,8 +104,12 @@ typedef struct acpi_init_walk_info
u16 method_count;
u16 op_region_count;
u16 field_count;
u16 buffer_count;
u16 package_count;
u16 op_region_init;
u16 field_init;
u16 buffer_init;
u16 package_init;
u16 object_count;
acpi_table_desc *table_desc;
......
/******************************************************************************
*
* Name: actables.h - ACPI table management
* $Revision: 35 $
* $Revision: 36 $
*
*****************************************************************************/
......@@ -71,22 +71,16 @@ acpi_tb_get_table_ptr (
acpi_status
acpi_tb_get_table (
ACPI_PHYSICAL_ADDRESS physical_address,
acpi_table_header *buffer_ptr,
ACPI_POINTER *address,
acpi_table_desc *table_info);
acpi_status
acpi_tb_verify_rsdp (
ACPI_PHYSICAL_ADDRESS RSDP_physical_address);
acpi_status
acpi_tb_get_table_facs (
acpi_table_header *buffer_ptr,
acpi_table_desc *table_info);
ACPI_POINTER *address);
ACPI_PHYSICAL_ADDRESS
void
acpi_tb_get_rsdt_address (
void);
ACPI_POINTER *out_address);
acpi_status
acpi_tb_validate_rsdt (
......@@ -94,7 +88,7 @@ acpi_tb_validate_rsdt (
acpi_status
acpi_tb_get_table_pointer (
ACPI_PHYSICAL_ADDRESS physical_address,
ACPI_POINTER *address,
u32 flags,
u32 *size,
acpi_table_header **table_ptr);
......
/******************************************************************************
*
* Name: actypes.h - Common data types for the entire ACPI subsystem
* $Revision: 224 $
* $Revision: 227 $
*
*****************************************************************************/
......@@ -57,12 +57,13 @@ typedef unsigned char BOOLEAN;
typedef unsigned short UINT16;
typedef int INT32;
typedef unsigned int UINT32;
typedef COMPILER_DEPENDENT_INT64 INT64;
typedef COMPILER_DEPENDENT_UINT64 UINT64;
typedef UINT64 NATIVE_UINT;
typedef UINT64 NATIVE_INT;
typedef NATIVE_UINT ACPI_TBLPTR;
typedef UINT64 ACPI_TBLPTR;
typedef UINT64 ACPI_IO_ADDRESS;
typedef UINT64 ACPI_PHYSICAL_ADDRESS;
typedef UINT64 ACPI_SIZE;
......@@ -119,12 +120,13 @@ typedef unsigned char BOOLEAN;
typedef unsigned short UINT16;
typedef int INT32;
typedef unsigned int UINT32;
typedef COMPILER_DEPENDENT_INT64 INT64;
typedef COMPILER_DEPENDENT_UINT64 UINT64;
typedef UINT32 NATIVE_UINT;
typedef INT32 NATIVE_INT;
typedef NATIVE_UINT ACPI_TBLPTR;
typedef UINT64 ACPI_TBLPTR;
typedef UINT32 ACPI_IO_ADDRESS;
typedef UINT64 ACPI_PHYSICAL_ADDRESS;
typedef UINT32 ACPI_SIZE;
......@@ -148,7 +150,6 @@ typedef char NATIVE_CHAR;
/*
* Data type ranges
*/
#define ACPI_UINT8_MAX (UINT8) 0xFF
#define ACPI_UINT16_MAX (UINT16) 0xFFFF
#define ACPI_UINT32_MAX (UINT32) 0xFFFFFFFF
......@@ -170,6 +171,31 @@ typedef UINT64 u64;
/*! [End] no source code translation !*/
/*
* Pointer overlays to avoid lots of typecasting for
* code that accepts both physical and logical pointers.
*/
typedef union acpi_pointers
{
ACPI_PHYSICAL_ADDRESS physical;
void *logical;
ACPI_TBLPTR value;
} ACPI_POINTERS;
typedef struct acpi_pointer
{
u32 pointer_type;
ACPI_POINTERS pointer;
} ACPI_POINTER;
/* Pointer_types for above */
#define ACPI_LOGICAL_POINTER 0x01
#define ACPI_PHYSICAL_POINTER 0x02
/*
* Useful defines
*/
......
......@@ -3,7 +3,7 @@
* Name: amlcode.h - Definitions for AML, as included in "definition blocks"
* Declarations and definitions contained herein are derived
* directly from the ACPI specification.
* $Revision: 66 $
* $Revision: 67 $
*
*****************************************************************************/
......@@ -185,6 +185,7 @@
#define AML_INT_STATICSTRING_OP (u16) 0x0034
#define AML_INT_METHODCALL_OP (u16) 0x0035
#define AML_INT_RETURN_VALUE_OP (u16) 0x0036
#define AML_INT_EVAL_SUBTREE_OP (u16) 0x0037
#define ARG_NONE 0x0
......@@ -335,15 +336,16 @@
/* Misc */
#define AML_TYPE_CREATE_FIELD 0x11
#define AML_TYPE_CONTROL 0x12
#define AML_TYPE_NAMED_NO_OBJ 0x13
#define AML_TYPE_NAMED_FIELD 0x14
#define AML_TYPE_NAMED_SIMPLE 0x15
#define AML_TYPE_NAMED_COMPLEX 0x16
#define AML_TYPE_RETURN 0x17
#define AML_TYPE_UNDEFINED 0x18
#define AML_TYPE_BOGUS 0x19
#define AML_TYPE_CREATE_OBJECT 0x12
#define AML_TYPE_CONTROL 0x13
#define AML_TYPE_NAMED_NO_OBJ 0x14
#define AML_TYPE_NAMED_FIELD 0x15
#define AML_TYPE_NAMED_SIMPLE 0x16
#define AML_TYPE_NAMED_COMPLEX 0x17
#define AML_TYPE_RETURN 0x18
#define AML_TYPE_UNDEFINED 0x19
#define AML_TYPE_BOGUS 0x1A
/*
......
/*******************************************************************************
*
* Module Name: nsaccess - Top-level functions for accessing ACPI namespace
* $Revision: 152 $
* $Revision: 153 $
*
******************************************************************************/
......@@ -522,8 +522,9 @@ acpi_ns_lookup (
return_ACPI_STATUS (status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Setting global scope to %p\n", this_node));
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Setting current scope to [%4.4s] (%p)\n",
this_node->name.ascii, this_node));
}
}
......
/*******************************************************************************
*
* Module Name: nsalloc - Namespace allocation and deletion utilities
* $Revision: 70 $
* $Revision: 72 $
*
******************************************************************************/
......@@ -62,7 +62,7 @@ acpi_ns_create_node (
ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_allocated++);
node->name = name;
node->name.integer = name;
node->reference_count = 1;
ACPI_SET_DESCRIPTOR_TYPE (node, ACPI_DESC_TYPE_NAMED);
......@@ -206,7 +206,7 @@ acpi_ns_install_node (
* We will fill in the actual type when the
* real definition is found later.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "[%4.4s] is a forward reference\n",
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] is a forward reference\n",
(char *) &node->name));
}
......@@ -302,7 +302,7 @@ acpi_ns_delete_children (
ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Object %p, Remaining %X\n",
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p, Remaining %X\n",
child_node, acpi_gbl_current_node_count));
/*
......
/******************************************************************************
*
* Module Name: nsdump - table dumping routines for debug
* $Revision: 127 $
* $Revision: 129 $
*
*****************************************************************************/
......@@ -53,7 +53,7 @@ acpi_ns_print_pathname (
u32 num_segments,
char *pathname)
{
ACPI_FUNCTION_NAME ("Acpi_ns_print_pathname");
ACPI_FUNCTION_NAME ("Ns_print_pathname");
if (!(acpi_dbg_level & ACPI_LV_NAMES) || !(acpi_dbg_layer & ACPI_NAMESPACE)) {
......@@ -228,7 +228,7 @@ acpi_ns_dump_one_object (
type = INTERNAL_TYPE_DEF_ANY; /* prints as *ERROR* */
}
if (!acpi_ut_valid_acpi_name (this_node->name)) {
if (!acpi_ut_valid_acpi_name (this_node->name.integer)) {
ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n", this_node->name));
}
......@@ -255,59 +255,87 @@ acpi_ns_dump_one_object (
switch (type) {
case ACPI_TYPE_PROCESSOR:
acpi_os_printf (" ID %d Addr %.4X Len %.4X\n",
obj_desc->processor.proc_id,
obj_desc->processor.address,
obj_desc->processor.length);
break;
case ACPI_TYPE_DEVICE:
acpi_os_printf (" Notification object: %p", obj_desc);
break;
case ACPI_TYPE_METHOD:
acpi_os_printf (" Args %d Len %.4X Aml %p \n",
obj_desc->method.param_count,
obj_desc->method.aml_length,
obj_desc->method.aml_start);
break;
case ACPI_TYPE_INTEGER:
acpi_os_printf (" = %8.8X%8.8X\n",
ACPI_HIDWORD (obj_desc->integer.value),
ACPI_LODWORD (obj_desc->integer.value));
break;
case ACPI_TYPE_PACKAGE:
acpi_os_printf (" Elements %.2X\n",
obj_desc->package.count);
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
acpi_os_printf (" Elements %.2X\n",
obj_desc->package.count);
}
else {
acpi_os_printf (" [Length not yet evaluated]\n");
}
break;
case ACPI_TYPE_BUFFER:
acpi_os_printf (" Len %.2X",
obj_desc->buffer.length);
/* Dump some of the buffer */
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
acpi_os_printf (" Len %.2X",
obj_desc->buffer.length);
if (obj_desc->buffer.length > 0) {
acpi_os_printf (" =");
for (i = 0; (i < obj_desc->buffer.length && i < 12); i++) {
acpi_os_printf (" %.2X", obj_desc->buffer.pointer[i]);
/* Dump some of the buffer */
if (obj_desc->buffer.length > 0) {
acpi_os_printf (" =");
for (i = 0; (i < obj_desc->buffer.length && i < 12); i++) {
acpi_os_printf (" %.2X", obj_desc->buffer.pointer[i]);
}
}
acpi_os_printf ("\n");
}
else {
acpi_os_printf (" [Length not yet evaluated]\n");
}
acpi_os_printf ("\n");
break;
case ACPI_TYPE_STRING:
acpi_os_printf (" Len %.2X", obj_desc->string.length);
if (obj_desc->string.length > 0) {
acpi_os_printf (" = \"%.32s\"...", obj_desc->string.pointer);
acpi_os_printf (" = \"%.32s\"", obj_desc->string.pointer);
if (obj_desc->string.length > 32) {
acpi_os_printf ("...");
}
}
acpi_os_printf ("\n");
break;
case ACPI_TYPE_REGION:
acpi_os_printf (" [%s]", acpi_ut_get_region_name (obj_desc->region.space_id));
if (obj_desc->region.flags & AOPOBJ_DATA_VALID) {
acpi_os_printf (" Addr %8.8X%8.8X Len %.4X\n",
......@@ -316,16 +344,20 @@ acpi_ns_dump_one_object (
obj_desc->region.length);
}
else {
acpi_os_printf (" [Address/Length not evaluated]\n");
acpi_os_printf (" [Address/Length not yet evaluated]\n");
}
break;
case INTERNAL_TYPE_REFERENCE:
acpi_os_printf (" [%s]\n",
acpi_ps_get_opcode_name (obj_desc->reference.opcode));
break;
case ACPI_TYPE_BUFFER_FIELD:
if (obj_desc->buffer_field.buffer_obj &&
obj_desc->buffer_field.buffer_obj->buffer.node) {
acpi_os_printf (" Buf [%4.4s]",
......@@ -333,24 +365,32 @@ acpi_ns_dump_one_object (
}
break;
case INTERNAL_TYPE_REGION_FIELD:
acpi_os_printf (" Rgn [%4.4s]",
(char *) &obj_desc->common_field.region_obj->region.node->name);
break;
case INTERNAL_TYPE_BANK_FIELD:
acpi_os_printf (" Rgn [%4.4s] Bnk [%4.4s]",
(char *) &obj_desc->common_field.region_obj->region.node->name,
(char *) &obj_desc->bank_field.bank_obj->common_field.node->name);
break;
case INTERNAL_TYPE_INDEX_FIELD:
acpi_os_printf (" Idx [%4.4s] Dat [%4.4s]",
(char *) &obj_desc->index_field.index_obj->common_field.node->name,
(char *) &obj_desc->index_field.data_obj->common_field.node->name);
break;
default:
acpi_os_printf (" Object %p\n", obj_desc);
break;
}
......
......@@ -2,7 +2,7 @@
*
* Module Name: nseval - Object evaluation interfaces -- includes control
* method lookup and execution.
* $Revision: 109 $
* $Revision: 112 $
*
******************************************************************************/
......@@ -113,7 +113,7 @@ acpi_ns_evaluate_relative (
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Object [%s] not found [%s]\n",
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Object [%s] not found [%s]\n",
pathname, acpi_format_exception (status)));
goto cleanup;
}
......@@ -122,12 +122,12 @@ acpi_ns_evaluate_relative (
* Now that we have a handle to the object, we can attempt
* to evaluate it.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s [%p] Value %p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n",
pathname, node, acpi_ns_get_attached_object (node)));
status = acpi_ns_evaluate_by_handle (node, params, return_object);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "*** Completed eval of object %s ***\n",
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n",
pathname));
cleanup:
......@@ -192,7 +192,7 @@ acpi_ns_evaluate_by_name (
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Object at [%s] was not found, status=%.4X\n",
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Object at [%s] was not found, status=%.4X\n",
pathname, status));
goto cleanup;
}
......@@ -201,12 +201,12 @@ acpi_ns_evaluate_by_name (
* Now that we have a handle to the object, we can attempt
* to evaluate it.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s [%p] Value %p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n",
pathname, node, acpi_ns_get_attached_object (node)));
status = acpi_ns_evaluate_by_handle (node, params, return_object);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "*** Completed eval of object %s ***\n",
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n",
pathname));
......@@ -390,16 +390,11 @@ acpi_ns_execute_control_method (
return_ACPI_STATUS (AE_NULL_OBJECT);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Control method at Offset %p Length %x]\n",
obj_desc->method.aml_start + 1, obj_desc->method.aml_length - 1));
ACPI_DUMP_PATHNAME (method_node, "Ns_execute_control_method: Executing",
ACPI_LV_NAMES, _COMPONENT);
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "At offset %p\n",
obj_desc->method.aml_start + 1));
ACPI_LV_INFO, _COMPONENT);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Method at AML address %p Length %x\n",
obj_desc->method.aml_start + 1, obj_desc->method.aml_length - 1));
/*
* Unlock the namespace before execution. This allows namespace access
......@@ -497,7 +492,7 @@ acpi_ns_get_object_value (
if (ACPI_SUCCESS (status)) {
status = AE_CTRL_RETURN_VALUE;
*return_obj_desc = obj_desc;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Returning obj %p\n", *return_obj_desc));
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning obj %p\n", *return_obj_desc));
}
}
......
/******************************************************************************
*
* Module Name: nsinit - namespace initialization
* $Revision: 41 $
* $Revision: 43 $
*
*****************************************************************************/
......@@ -59,15 +59,11 @@ acpi_ns_initialize_objects (
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"**** Starting initialization of namespace objects ****\n"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "Completing Region and Field initialization:"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "Completing Region/Field/Buffer/Package initialization:"));
/* Set all init info to zero */
info.field_count = 0;
info.field_init = 0;
info.op_region_count = 0;
info.op_region_init = 0;
info.object_count = 0;
ACPI_MEMSET (&info, 0, sizeof (acpi_init_walk_info));
/* Walk entire namespace from the supplied root */
......@@ -79,9 +75,11 @@ acpi_ns_initialize_objects (
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
"\n%d/%d Regions, %d/%d Fields initialized (%d nodes total)\n",
info.op_region_init, info.op_region_count, info.field_init,
info.field_count, info.object_count));
"\n Initialized %d/%d Regions %d/%d Fields %d/%d Buffers %d/%d Packages (%d nodes)\n",
info.op_region_init, info.op_region_count,
info.field_init, info.field_count,
info.buffer_init, info.buffer_count,
info.package_init, info.package_count, info.object_count));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"%d Control Methods found\n", info.method_count));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
......@@ -118,12 +116,15 @@ acpi_ns_initialize_devices (
ACPI_FUNCTION_TRACE ("Ns_initialize_devices");
/* Init counters */
info.device_count = 0;
info.num_STA = 0;
info.num_INI = 0;
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "Executing all Device _STA and_INI methods:"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "Executing device _INI methods:"));
/* Walk namespace for all objects of type Device */
status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX, FALSE, acpi_ns_init_one_device, &info, NULL);
......@@ -132,9 +133,8 @@ acpi_ns_initialize_devices (
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Walk_namespace failed! %x\n", status));
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
"\n%d Devices found: %d _STA, %d _INI\n",
"\n%d Devices found containing: %d _STA, %d _INI methods\n",
info.device_count, info.num_STA, info.num_INI));
return_ACPI_STATUS (status);
......@@ -180,7 +180,6 @@ acpi_ns_init_one_object (
info->object_count++;
/* And even then, we are only interested in a few object types */
type = acpi_ns_get_type (obj_handle);
......@@ -189,11 +188,37 @@ acpi_ns_init_one_object (
return (AE_OK);
}
if ((type != ACPI_TYPE_REGION) &&
(type != ACPI_TYPE_BUFFER_FIELD)) {
/* Increment counters for object types we are looking for */
switch (type) {
case ACPI_TYPE_REGION:
info->op_region_count++;
break;
case ACPI_TYPE_BUFFER_FIELD:
info->field_count++;
break;
case ACPI_TYPE_BUFFER:
info->buffer_count++;
break;
case ACPI_TYPE_PACKAGE:
info->package_count++;
break;
default:
/* No init required, just exit now */
return (AE_OK);
}
/*
* If the object is already initialized, nothing else to do
*/
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
return (AE_OK);
}
/*
* Must lock the interpreter before executing AML code
......@@ -203,61 +228,53 @@ acpi_ns_init_one_object (
return (status);
}
/*
* Each of these types can contain executable AML code within
* the declaration.
*/
switch (type) {
case ACPI_TYPE_REGION:
info->op_region_count++;
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
break;
}
info->op_region_init++;
status = acpi_ds_get_region_arguments (obj_desc);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"%s while getting region arguments [%4.4s]\n",
acpi_format_exception (status), (char *) &node->name));
}
if (!(acpi_dbg_level & ACPI_LV_INIT)) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "."));
}
break;
case ACPI_TYPE_BUFFER_FIELD:
info->field_count++;
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
break;
}
info->field_init++;
status = acpi_ds_get_buffer_field_arguments (obj_desc);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"%s while getting buffer field arguments [%4.4s]\n",
acpi_format_exception (status), (char *) &node->name));
}
if (!(acpi_dbg_level & ACPI_LV_INIT)) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "."));
}
break;
case ACPI_TYPE_BUFFER:
info->buffer_init++;
status = acpi_ds_get_buffer_arguments (obj_desc);
break;
default:
case ACPI_TYPE_PACKAGE:
info->package_init++;
status = acpi_ds_get_package_arguments (obj_desc);
break;
}
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not execute arguments for [%4.4s] (%s), %s\n",
(char *) &node->name, acpi_ut_get_type_name (type), acpi_format_exception (status)));
}
if (!(acpi_dbg_level & ACPI_LV_INIT)) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "."));
}
/*
* We ignore errors from above, and always return OK, since
* we don't want to abort the walk on a single error.
* we don't want to abort the walk on any single error.
*/
acpi_ex_exit_interpreter ();
return (AE_OK);
......@@ -335,7 +352,6 @@ acpi_ns_init_one_device (
return_ACPI_STATUS(AE_CTRL_DEPTH);
}
/*
* The device is present. Run _INI.
*/
......
......@@ -2,7 +2,7 @@
*
* Module Name: nsobject - Utilities for objects attached to namespace
* table entries
* $Revision: 78 $
* $Revision: 80 $
*
******************************************************************************/
......@@ -221,7 +221,7 @@ acpi_ns_detach_object (
node->type = ACPI_TYPE_ANY;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Node %p [%4.4s] Object %p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Node %p [%4.4s] Object %p\n",
node, (char *) &node->name, obj_desc));
/* Remove one reference on the object (and all subobjects) */
......@@ -280,7 +280,7 @@ acpi_operand_object *
acpi_ns_get_secondary_object (
acpi_operand_object *obj_desc)
{
ACPI_FUNCTION_TRACE_PTR ("Acpi_ns_get_secondary_object", obj_desc);
ACPI_FUNCTION_TRACE_PTR ("Ns_get_secondary_object", obj_desc);
if ((!obj_desc) ||
......
/*******************************************************************************
*
* Module Name: nssearch - Namespace search
* $Revision: 83 $
* $Revision: 84 $
*
******************************************************************************/
......@@ -95,7 +95,7 @@ acpi_ns_search_node (
while (next_node) {
/* Check for match against the name */
if (next_node->name == target_name) {
if (next_node->name.integer == target_name) {
/*
* Found matching entry. Capture the type if appropriate, before
* returning the entry.
......@@ -146,8 +146,8 @@ acpi_ns_search_node (
/* Searched entire table, not found */
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Name %4.4s (type %X) not found at %p\n",
(char *) &target_name, type, next_node));
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Name %4.4s Type [%s] not found at %p\n",
(char *) &target_name, acpi_ut_get_type_name (type), next_node));
return_ACPI_STATUS (AE_NOT_FOUND);
}
......@@ -206,8 +206,8 @@ acpi_ns_search_parent_tree (
}
if (acpi_ns_local (type)) {
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] type %X is local(no search)\n",
(char *) &target_name, type));
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)));
}
return_ACPI_STATUS (AE_NOT_FOUND);
......
......@@ -2,7 +2,7 @@
*
* Module Name: nsutils - Utilities for accessing ACPI namespace, accessing
* parents and siblings and Scope manipulation
* $Revision: 104 $
* $Revision: 105 $
*
*****************************************************************************/
......@@ -254,7 +254,6 @@ acpi_ns_build_internal_name (
result = &internal_name[3];
}
}
else {
/*
* Not fully qualified.
......@@ -281,7 +280,6 @@ acpi_ns_build_internal_name (
}
}
/* Build the name (minus path separators) */
for (; num_segments; num_segments--) {
......@@ -319,11 +317,11 @@ acpi_ns_build_internal_name (
if (info->fully_qualified) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "returning [%p] (abs) \"\\%s\"\n",
internal_name, &internal_name[0]));
internal_name, internal_name));
}
else {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "returning [%p] (rel) \"%s\"\n",
internal_name, &internal_name[2]));
internal_name, internal_name));
}
return_ACPI_STATUS (AE_OK);
......@@ -823,8 +821,8 @@ acpi_ns_find_parent_name (
child_node, (char *) &child_node->name,
parent_node, (char *) &parent_node->name));
if (parent_node->name) {
return_VALUE (parent_node->name);
if (parent_node->name.integer) {
return_VALUE (parent_node->name.integer);
}
}
......@@ -863,7 +861,7 @@ acpi_ns_exist_downstream_sibling (
return (FALSE);
}
if (node->name) {
if (node->name.integer) {
return (TRUE);
}
......
......@@ -2,7 +2,7 @@
*
* Module Name: nsxfname - Public interfaces to the ACPI subsystem
* ACPI Namespace oriented interfaces
* $Revision: 89 $
* $Revision: 90 $
*
*****************************************************************************/
......@@ -243,8 +243,8 @@ acpi_get_object_info (
return (AE_BAD_PARAMETER);
}
info->type = node->type;
info->name = node->name;
info->type = node->type;
info->name = node->name.integer;
status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) {
......
/******************************************************************************
*
* Module Name: psopcode - Parser/Interpreter opcode information table
* $Revision: 64 $
* $Revision: 66 $
*
*****************************************************************************/
......@@ -219,7 +219,7 @@
#define ARGI_BIT_XOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_BREAK_OP ARG_NONE
#define ARGI_BREAK_POINT_OP ARG_NONE
#define ARGI_BUFFER_OP ARGI_INVALID_OPCODE
#define ARGI_BUFFER_OP ARGI_LIST1 (ARGI_INTEGER)
#define ARGI_BYTE_OP ARGI_INVALID_OPCODE
#define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE
#define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF)
......@@ -284,7 +284,7 @@
#define ARGI_NOTIFY_OP ARGI_LIST2 (ARGI_DEVICE_REF, ARGI_INTEGER)
#define ARGI_ONE_OP ARG_NONE
#define ARGI_ONES_OP ARG_NONE
#define ARGI_PACKAGE_OP ARGI_INVALID_OPCODE
#define ARGI_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER)
#define ARGI_POWER_RES_OP ARGI_INVALID_OPCODE
#define ARGI_PROCESSOR_OP ARGI_INVALID_OPCODE
#define ARGI_QWORD_OP ARGI_INVALID_OPCODE
......@@ -315,7 +315,7 @@
#define ARGI_TO_STRING_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_FIXED_TARGET)
#define ARGI_TYPE_OP ARGI_LIST1 (ARGI_ANYTYPE)
#define ARGI_UNLOAD_OP ARGI_LIST1 (ARGI_DDBHANDLE)
#define ARGI_VAR_PACKAGE_OP ARGI_INVALID_OPCODE
#define ARGI_VAR_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER)
#define ARGI_WAIT_OP ARGI_LIST2 (ARGI_EVENT, ARGI_INTEGER)
#define ARGI_WHILE_OP ARGI_INVALID_OPCODE
#define ARGI_WORD_OP ARGI_INVALID_OPCODE
......@@ -422,6 +422,7 @@
AML_CREATE_DWORD_FIELD_OP
AML_CREATE_QWORD_FIELD_OP
AML_REGION_OP
AML_BUFFER_OP
Field opcodes
......@@ -461,8 +462,8 @@ static const acpi_opcode_info acpi_gbl_aml_op_info[] =
/* 06 */ ACPI_OP ("DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
/* 07 */ ACPI_OP ("String", ARGP_STRING_OP, ARGI_STRING_OP, ACPI_TYPE_STRING, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
/* 08 */ ACPI_OP ("Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP, INTERNAL_TYPE_SCOPE, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 09 */ ACPI_OP ("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP, ACPI_TYPE_BUFFER, AML_CLASS_ARGUMENT, AML_TYPE_DATA_TERM, AML_HAS_ARGS),
/* 0A */ ACPI_OP ("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_ARGUMENT, AML_TYPE_DATA_TERM, AML_HAS_ARGS),
/* 09 */ ACPI_OP ("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP, ACPI_TYPE_BUFFER, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER),
/* 0A */ ACPI_OP ("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER),
/* 0B */ ACPI_OP ("Method", ARGP_METHOD_OP, ARGI_METHOD_OP, ACPI_TYPE_METHOD, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER),
/* 0C */ ACPI_OP ("Local0", ARGP_LOCAL0, ARGI_LOCAL0, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
/* 0D */ ACPI_OP ("Local1", ARGP_LOCAL1, ARGI_LOCAL1, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
......@@ -573,7 +574,7 @@ static const acpi_opcode_info acpi_gbl_aml_op_info[] =
/* ACPI 2.0 opcodes */
/* 6E */ ACPI_OP ("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
/* 6F */ ACPI_OP ("Package /*Var*/", ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_ARGUMENT, AML_TYPE_DATA_TERM, AML_HAS_ARGS | AML_DEFER),
/* 6F */ ACPI_OP ("Package /*Var*/", ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER),
/* 70 */ ACPI_OP ("ConcatenateResTemplate", ARGP_CONCAT_RES_OP, ARGI_CONCAT_RES_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R),
/* 71 */ ACPI_OP ("Mod", ARGP_MOD_OP, ARGI_MOD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R),
/* 72 */ ACPI_OP ("CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP,ARGI_CREATE_QWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
......@@ -587,6 +588,7 @@ static const acpi_opcode_info acpi_gbl_aml_op_info[] =
/* 7A */ ACPI_OP ("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
/* 7B */ ACPI_OP ("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R),
/* 7C */ ACPI_OP ("DataTableRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 7D */ ACPI_OP ("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP, INTERNAL_TYPE_SCOPE, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE)
/*! [End] no source code translation !*/
};
......@@ -606,7 +608,7 @@ static const u8 acpi_gbl_short_op_index[256] =
/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0x20 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0x28 */ _UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX,
/* 0x30 */ 0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, _UNK,
/* 0x30 */ 0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, 0x7D,
/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0x40 */ _UNK, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
/* 0x48 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
......
/******************************************************************************
*
* Module Name: psparse - Parser top level AML parse routines
* $Revision: 119 $
* $Revision: 121 $
*
*****************************************************************************/
......@@ -220,7 +220,7 @@ acpi_ps_complete_this_op (
/*
* These opcodes contain Term_arg operands. The current
* op must be replace by a placeholder return op
* op must be replaced by a placeholder return op
*/
replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
if (!replacement_op) {
......@@ -232,15 +232,35 @@ acpi_ps_complete_this_op (
/*
* These opcodes contain Term_arg operands. The current
* op must be replace by a placeholder return op
* op must be replaced by a placeholder return op
*/
if ((op->parent->opcode == AML_REGION_OP) ||
(op->parent->opcode == AML_DATA_REGION_OP)) {
if ((op->parent->opcode == AML_REGION_OP) ||
(op->parent->opcode == AML_DATA_REGION_OP) ||
(op->parent->opcode == AML_BUFFER_OP) ||
(op->parent->opcode == AML_PACKAGE_OP) ||
(op->parent->opcode == AML_VAR_PACKAGE_OP)) {
replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
if (!replacement_op) {
return_VALUE (FALSE);
}
}
if ((op->parent->opcode == AML_NAME_OP) &&
(walk_state->descending_callback != acpi_ds_exec_begin_op)) {
if ((op->opcode == AML_BUFFER_OP) ||
(op->opcode == AML_PACKAGE_OP) ||
(op->opcode == AML_VAR_PACKAGE_OP)) {
replacement_op = acpi_ps_alloc_op (op->opcode);
if (!replacement_op) {
return_VALUE (FALSE);
}
((acpi_parse2_object *) replacement_op)->data =
((acpi_parse2_object *) op)->data;
((acpi_parse2_object *) replacement_op)->length =
((acpi_parse2_object *) op)->length;
}
}
break;
default:
......@@ -259,6 +279,7 @@ acpi_ps_complete_this_op (
if (replacement_op) {
replacement_op->parent = op->parent;
replacement_op->value.arg = NULL;
replacement_op->node = op->node;
op->parent->value.arg = replacement_op;
replacement_op->next = op->next;
}
......@@ -275,10 +296,11 @@ acpi_ps_complete_this_op (
next = prev->next;
if (next == op) {
if (replacement_op) {
replacement_op->parent = op->parent;
replacement_op->parent = op->parent;
replacement_op->value.arg = NULL;
prev->next = replacement_op;
replacement_op->next = op->next;
replacement_op->node = op->node;
prev->next = replacement_op;
replacement_op->next = op->next;
next = NULL;
}
else {
......@@ -312,9 +334,10 @@ acpi_ps_complete_this_op (
*
* PARAMETERS: Parser_state - Current parser state object
*
* RETURN:
* RETURN: Status
*
* DESCRIPTION:
* DESCRIPTION: Update the parser state based upon the return exception from
* the parser callback.
*
******************************************************************************/
......@@ -441,7 +464,7 @@ acpi_ps_parse_loop (
acpi_parse_object *arg = NULL;
acpi_parse_object pre_op;
acpi_parse_state *parser_state;
u8 *aml_op_start;
u8 *aml_op_start = NULL;
ACPI_FUNCTION_TRACE_PTR ("Ps_parse_loop", walk_state);
......@@ -465,7 +488,6 @@ acpi_ps_parse_loop (
(walk_state->control_state) &&
(walk_state->control_state->common.state ==
ACPI_CONTROL_PREDICATE_EXECUTING)) {
/*
* A predicate was just completed, get the value of the
* predicate and branch based on that value
......@@ -491,7 +513,6 @@ acpi_ps_parse_loop (
acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types, &walk_state->arg_count);
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op));
}
else if (walk_state->prev_op) {
/* We were in the middle of an op */
......@@ -535,8 +556,8 @@ acpi_ps_parse_loop (
/* The opcode is unrecognized. Just skip unknown opcodes */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Found unknown opcode %X at AML offset %X, ignoring\n",
walk_state->opcode, walk_state->aml_offset));
"Found unknown opcode %X at AML address %p offset %X, ignoring\n",
walk_state->opcode, parser_state->aml, walk_state->aml_offset));
ACPI_DUMP_BUFFER (parser_state->aml, 128);
......@@ -552,10 +573,8 @@ acpi_ps_parse_loop (
parser_state->aml += acpi_ps_get_opcode_size (walk_state->opcode);
walk_state->arg_types = walk_state->op_info->parse_args;
break;
}
/* Create Op structure and append to parent's argument list */
if (walk_state->op_info->flags & AML_NAMED) {
......@@ -570,7 +589,6 @@ acpi_ps_parse_loop (
INCREMENT_ARG_LIST (walk_state->arg_types);
}
/* We know that this arg is a name, move to next arg */
INCREMENT_ARG_LIST (walk_state->arg_types);
......@@ -624,7 +642,6 @@ acpi_ps_parse_loop (
((acpi_parse2_object * ) op)->length = 0;
}
}
else {
/* Not a named opcode, just allocate Op and append to parent */
......@@ -680,7 +697,7 @@ acpi_ps_parse_loop (
walk_state->arg_count = 0;
if (walk_state->arg_types) /* Are there any arguments that must be processed? */ {
/* get arguments */
/* Get arguments */
switch (op->opcode) {
case AML_BYTE_OP: /* AML_BYTEDATA_ARG */
......@@ -689,7 +706,7 @@ acpi_ps_parse_loop (
case AML_QWORD_OP: /* AML_QWORDATA_ARG */
case AML_STRING_OP: /* AML_ASCIICHARLIST_ARG */
/* fill in constant or string argument directly */
/* Fill in constant or string argument directly */
acpi_ps_get_next_simple_arg (parser_state,
GET_CURRENT_ARG_TYPE (walk_state->arg_types), op);
......@@ -719,9 +736,11 @@ acpi_ps_parse_loop (
INCREMENT_ARG_LIST (walk_state->arg_types);
}
/* For a method, save the length and address of the body */
switch (op->opcode) {
case AML_METHOD_OP:
/* For a method, save the length and address of the body */
if (op->opcode == AML_METHOD_OP) {
/*
* Skip parsing of control method or opregion body,
* because we don't have enough info in the first pass
......@@ -730,7 +749,6 @@ acpi_ps_parse_loop (
((acpi_parse2_object * ) op)->data = parser_state->aml;
((acpi_parse2_object * ) op)->length = (u32) (parser_state->pkg_end -
parser_state->aml);
/*
* Skip body of method. For Op_regions, we must continue
* parsing because the opregion is not a standalone
......@@ -738,17 +756,42 @@ acpi_ps_parse_loop (
*/
parser_state->aml = parser_state->pkg_end;
walk_state->arg_count = 0;
}
else if (op->opcode == AML_WHILE_OP) {
break;
case AML_BUFFER_OP:
case AML_PACKAGE_OP:
case AML_VAR_PACKAGE_OP:
if ((op->parent) &&
(op->parent->opcode == AML_NAME_OP) &&
(walk_state->descending_callback != acpi_ds_exec_begin_op)) {
/*
* Skip parsing of
* because we don't have enough info in the first pass
* to parse them correctly.
*/
((acpi_parse2_object * ) op)->data = aml_op_start;
((acpi_parse2_object * ) op)->length = (u32) (parser_state->pkg_end -
aml_op_start);
/*
* Skip body
*/
parser_state->aml = parser_state->pkg_end;
walk_state->arg_count = 0;
}
break;
case AML_WHILE_OP:
if (walk_state->control_state) {
walk_state->control_state->control.package_end = parser_state->pkg_end;
}
break;
}
break;
}
}
/* Check for arguments that need to be processed */
if (walk_state->arg_count) {
......@@ -759,7 +802,6 @@ acpi_ps_parse_loop (
continue;
}
/* All arguments have been processed -- Op is complete, prepare for next */
walk_state->op_info = acpi_ps_get_opcode_info (op->opcode);
......
/******************************************************************************
*
* Module Name: psutils - Parser miscellaneous utilities (Parser only)
* $Revision: 49 $
* $Revision: 50 $
*
*****************************************************************************/
......@@ -97,30 +97,25 @@ acpi_ps_alloc_op (
size = sizeof (acpi_parse2_object);
flags = ACPI_PARSEOP_DEFERRED;
}
else if (op_info->flags & AML_NAMED) {
size = sizeof (acpi_parse2_object);
flags = ACPI_PARSEOP_NAMED;
}
else if (opcode == AML_INT_BYTELIST_OP) {
size = sizeof (acpi_parse2_object);
flags = ACPI_PARSEOP_BYTELIST;
}
else {
size = sizeof (acpi_parse_object);
flags = ACPI_PARSEOP_GENERIC;
}
if (size == sizeof (acpi_parse_object)) {
/*
* The generic op is by far the most common (16 to 1)
*/
op = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_PSNODE);
}
else {
op = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_PSNODE_EXT);
}
......@@ -157,13 +152,12 @@ acpi_ps_free_op (
if (op->opcode == AML_INT_RETURN_VALUE_OP) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Free retval op: %p\n", op));
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", op));
}
if (op->flags == ACPI_PARSEOP_GENERIC) {
acpi_ut_release_to_cache (ACPI_MEM_LIST_PSNODE, op);
}
else {
acpi_ut_release_to_cache (ACPI_MEM_LIST_PSNODE_EXT, op);
}
......
/******************************************************************************
*
* Module Name: psxface - Parser external interfaces
* $Revision: 59 $
* $Revision: 61 $
*
*****************************************************************************/
......@@ -102,7 +102,7 @@ acpi_psx_execute (
* 1) Perform the first pass parse of the method to enter any
* named objects that it creates into the namespace
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"**** Begin Method Parse **** Entry=%p obj=%p\n",
method_node, obj_desc));
......@@ -144,7 +144,7 @@ acpi_psx_execute (
/*
* 2) Execute the method. Performs second pass parse simultaneously
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"**** Begin Method Execution **** Entry=%p obj=%p\n",
method_node, obj_desc));
......@@ -157,7 +157,7 @@ acpi_psx_execute (
/* Init new op with the method name and pointer back to the NS node */
acpi_ps_set_name (op, method_node->name);
acpi_ps_set_name (op, method_node->name.integer);
op->node = method_node;
/* Create and initialize a new walk state */
......@@ -194,7 +194,7 @@ acpi_psx_execute (
* a control exception code
*/
if (*return_obj_desc) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Method returned Obj_desc=%p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Method returned Obj_desc=%p\n",
*return_obj_desc));
ACPI_DUMP_STACK_ENTRY (*return_obj_desc);
......
/******************************************************************************
*
* Module Name: tbget - ACPI Table get* routines
* $Revision: 63 $
* $Revision: 67 $
*
*****************************************************************************/
......@@ -125,8 +125,7 @@ acpi_tb_get_table_ptr (
acpi_status
acpi_tb_get_table (
ACPI_PHYSICAL_ADDRESS physical_address,
acpi_table_header *buffer_ptr,
ACPI_POINTER *address,
acpi_table_desc *table_info)
{
acpi_table_header *table_header = NULL;
......@@ -139,21 +138,17 @@ acpi_tb_get_table (
ACPI_FUNCTION_TRACE ("Tb_get_table");
if (!table_info) {
if (!table_info || !address) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
if (buffer_ptr) {
switch (address->pointer_type) {
case ACPI_LOGICAL_POINTER:
/*
* Getting data from a buffer, not BIOS tables
*/
table_header = buffer_ptr;
status = acpi_tb_validate_table_header (table_header);
if (ACPI_FAILURE (status)) {
/* Table failed verification, map all errors to BAD_DATA */
return_ACPI_STATUS (AE_BAD_DATA);
}
table_header = address->pointer.logical;
/* Allocate buffer for the entire table */
......@@ -165,21 +160,23 @@ acpi_tb_get_table (
/* Copy the entire table (including header) to the local buffer */
size = table_header->length;
ACPI_MEMCPY (full_table, buffer_ptr, size);
ACPI_MEMCPY (full_table, table_header, size);
/* Save allocation type */
allocation = ACPI_MEM_ALLOCATED;
}
break;
/*
* Not reading from a buffer, just map the table's physical memory
* into our address space.
*/
else {
case ACPI_PHYSICAL_POINTER:
/*
* Not reading from a buffer, just map the table's physical memory
* into our address space.
*/
size = SIZE_IN_HEADER;
status = acpi_tb_map_acpi_table (physical_address, &size, &full_table);
status = acpi_tb_map_acpi_table (address->pointer.physical, &size, &full_table);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
......@@ -187,6 +184,11 @@ acpi_tb_get_table (
/* Save allocation type */
allocation = ACPI_MEM_MAPPED;
break;
default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Return values */
......@@ -196,6 +198,12 @@ acpi_tb_get_table (
table_info->allocation = allocation;
table_info->base_pointer = full_table;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Found table [%4.4s] at %8.8X%8.8X, mapped/copied to %p\n",
full_table->signature,
ACPI_HIDWORD (address->pointer.physical),
ACPI_LODWORD (address->pointer.physical), full_table));
return_ACPI_STATUS (status);
}
......@@ -209,9 +217,15 @@ acpi_tb_get_table (
*
* RETURN: Status
*
* DESCRIPTION: Load and validate all tables other than the RSDT. The RSDT must
* DESCRIPTION: Load and validate tables other than the RSDT. The RSDT must
* already be loaded and validated.
*
* Get the minimum set of ACPI tables, namely:
*
* 1) FADT (via RSDT in loop below)
* 2) FACS (via FADT)
* 3) DSDT (via FADT)
*
******************************************************************************/
acpi_status
......@@ -222,6 +236,7 @@ acpi_tb_get_all_tables (
acpi_status status = AE_OK;
u32 index;
acpi_table_desc table_info;
ACPI_POINTER address;
ACPI_FUNCTION_TRACE ("Tb_get_all_tables");
......@@ -232,7 +247,9 @@ acpi_tb_get_all_tables (
/*
* Loop through all table pointers found in RSDT.
* This will NOT include the FACS and DSDT - we must get
* them after the loop
* them after the loop.
*
* The ONLY table we are interested in getting here is the FADT.
*/
for (index = 0; index < number_of_tables; index++) {
/* Clear the Table_info each time */
......@@ -241,18 +258,10 @@ acpi_tb_get_all_tables (
/* Get the table via the XSDT */
status = acpi_tb_get_table ((ACPI_PHYSICAL_ADDRESS)
ACPI_GET_ADDRESS (acpi_gbl_XSDT->table_offset_entry[index]),
table_ptr, &table_info);
/* Ignore a table that failed verification */
if (status == AE_BAD_DATA) {
continue;
}
/* However, abort on serious errors */
address.pointer_type = acpi_gbl_table_flags;
address.pointer.value = ACPI_GET_ADDRESS (acpi_gbl_XSDT->table_offset_entry[index]);
status = acpi_tb_get_table (&address, &table_info);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
......@@ -267,6 +276,7 @@ acpi_tb_get_all_tables (
* determine if there are enough tables to continue.
*/
acpi_tb_uninstall_table (&table_info);
status = AE_OK;
}
}
......@@ -276,24 +286,20 @@ acpi_tb_get_all_tables (
*/
status = acpi_tb_convert_table_fadt ();
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Could not convert FADT to internal common format\n"));
return_ACPI_STATUS (status);
}
/*
* Get the minimum set of ACPI tables, namely:
*
* 1) FADT (via RSDT in loop above)
* 2) FACS
* 3) DSDT
*
*/
/*
* Get the FACS (must have the FADT first, from loop above)
* Acpi_tb_get_table_facs will fail if FADT pointer is not valid
*/
status = acpi_tb_get_table_facs (table_ptr, &table_info);
address.pointer_type = acpi_gbl_table_flags;
address.pointer.value = ACPI_GET_ADDRESS (acpi_gbl_FADT->Xfirmware_ctrl);
status = acpi_tb_get_table (&address, &table_info);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Could not get the FACS\n"));
return_ACPI_STATUS (status);
}
......@@ -301,6 +307,7 @@ acpi_tb_get_all_tables (
status = acpi_tb_install_table (table_ptr, &table_info);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Could not install the FACS\n"));
return_ACPI_STATUS (status);
}
......@@ -310,15 +317,19 @@ acpi_tb_get_all_tables (
*/
status = acpi_tb_build_common_facs (&table_info);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Could not convert FACS to common internal format\n"));
return_ACPI_STATUS (status);
}
/*
* Get the DSDT (We know that the FADT is valid now)
*/
status = acpi_tb_get_table ((ACPI_PHYSICAL_ADDRESS) ACPI_GET_ADDRESS (acpi_gbl_FADT->Xdsdt),
table_ptr, &table_info);
address.pointer_type = acpi_gbl_table_flags;
address.pointer.value = ACPI_GET_ADDRESS (acpi_gbl_FADT->Xdsdt);
status = acpi_tb_get_table (&address, &table_info);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Could not get the DSDT\n"));
return_ACPI_STATUS (status);
}
......@@ -326,20 +337,16 @@ acpi_tb_get_all_tables (
status = acpi_tb_install_table (table_ptr, &table_info);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Could not install the DSDT\n"));
return_ACPI_STATUS (status);
}
/* Dump the DSDT Header */
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Hex dump of DSDT Header:\n"));
ACPI_DUMP_BUFFER ((u8 *) acpi_gbl_DSDT, sizeof (acpi_table_header));
/* Dump the entire DSDT */
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
"Hex dump of DSDT (After header), size %d (%x)\n",
"Hex dump of entire DSDT, size %d (0x%X)\n",
acpi_gbl_DSDT->length, acpi_gbl_DSDT->length));
ACPI_DUMP_BUFFER ((u8 *) (acpi_gbl_DSDT + 1), acpi_gbl_DSDT->length);
ACPI_DUMP_BUFFER ((u8 *) acpi_gbl_DSDT, acpi_gbl_DSDT->length);
/* Always delete the RSDP mapping, we are done with it */
......@@ -362,7 +369,7 @@ acpi_tb_get_all_tables (
acpi_status
acpi_tb_verify_rsdp (
ACPI_PHYSICAL_ADDRESS rsdp_physical_address)
ACPI_POINTER *address)
{
acpi_table_desc table_info;
acpi_status status;
......@@ -372,13 +379,25 @@ acpi_tb_verify_rsdp (
ACPI_FUNCTION_TRACE ("Tb_verify_rsdp");
/*
* Obtain access to the RSDP structure
*/
status = acpi_os_map_memory (rsdp_physical_address, sizeof (RSDP_DESCRIPTOR),
(void **) &rsdp);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
switch (address->pointer_type) {
case ACPI_LOGICAL_POINTER:
rsdp = address->pointer.logical;
break;
case ACPI_PHYSICAL_POINTER:
/*
* Obtain access to the RSDP structure
*/
status = acpi_os_map_memory (address->pointer.physical, sizeof (RSDP_DESCRIPTOR),
(void **) &rsdp);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
break;
default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/*
......@@ -407,7 +426,6 @@ acpi_tb_verify_rsdp (
}
}
/* The RSDP supplied is OK */
table_info.pointer = (acpi_table_header *) rsdp;
......@@ -431,7 +449,9 @@ acpi_tb_verify_rsdp (
/* Error exit */
cleanup:
acpi_os_unmap_memory (rsdp, sizeof (RSDP_DESCRIPTOR));
if (acpi_gbl_table_flags & ACPI_PHYSICAL_POINTER) {
acpi_os_unmap_memory (rsdp, sizeof (RSDP_DESCRIPTOR));
}
return_ACPI_STATUS (status);
}
......@@ -449,28 +469,26 @@ acpi_tb_verify_rsdp (
*
******************************************************************************/
ACPI_PHYSICAL_ADDRESS
acpi_tb_get_rsdt_address (void)
void
acpi_tb_get_rsdt_address (
ACPI_POINTER *out_address)
{
ACPI_PHYSICAL_ADDRESS physical_address;
ACPI_FUNCTION_ENTRY ();
out_address->pointer_type = acpi_gbl_table_flags;
/*
* For RSDP revision 0 or 1, we use the RSDT.
* For RSDP revision 2 (and above), we use the XSDT
*/
if (acpi_gbl_RSDP->revision < 2) {
physical_address = (ACPI_PHYSICAL_ADDRESS) acpi_gbl_RSDP->rsdt_physical_address;
out_address->pointer.value = acpi_gbl_RSDP->rsdt_physical_address;
}
else {
physical_address = (ACPI_PHYSICAL_ADDRESS)
ACPI_GET_ADDRESS (acpi_gbl_RSDP->xsdt_physical_address);
out_address->pointer.value = ACPI_GET_ADDRESS (acpi_gbl_RSDP->xsdt_physical_address);
}
return (physical_address);
}
......@@ -543,25 +561,51 @@ acpi_tb_validate_rsdt (
acpi_status
acpi_tb_get_table_pointer (
ACPI_PHYSICAL_ADDRESS physical_address,
ACPI_POINTER *address,
u32 flags,
u32 *size,
acpi_table_header **table_ptr)
{
acpi_status status;
acpi_status status = AE_OK;
ACPI_FUNCTION_ENTRY ();
/*
* What mode is the processor in? (Virtual or Physical addressing)
*/
if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) {
*size = SIZE_IN_HEADER;
status = acpi_tb_map_acpi_table (physical_address, size, table_ptr);
/* Incoming pointer can be either logical or physical */
switch (address->pointer_type) {
case ACPI_PHYSICAL_POINTER:
*size = SIZE_IN_HEADER;
status = acpi_tb_map_acpi_table (address->pointer.physical, size, table_ptr);
break;
case ACPI_LOGICAL_POINTER:
*table_ptr = address->pointer.logical;
*size = 0;
break;
}
}
else {
*size = 0;
*table_ptr = ACPI_PHYSADDR_TO_PTR (physical_address);
status = AE_OK;
/* In Physical addressing mode, all pointers must be physical */
switch (address->pointer_type) {
case ACPI_PHYSICAL_POINTER:
*size = 0;
*table_ptr = address->pointer.logical;
break;
case ACPI_LOGICAL_POINTER:
status = AE_BAD_PARAMETER;
break;
}
}
return (status);
......@@ -586,7 +630,7 @@ acpi_tb_get_table_rsdt (
{
acpi_table_desc table_info;
acpi_status status;
ACPI_PHYSICAL_ADDRESS physical_address;
ACPI_POINTER address;
ACPI_FUNCTION_TRACE ("Tb_get_table_rsdt");
......@@ -601,11 +645,11 @@ acpi_tb_get_table_rsdt (
ACPI_HIDWORD (acpi_gbl_RSDP->rsdt_physical_address),
ACPI_LODWORD (acpi_gbl_RSDP->rsdt_physical_address)));
physical_address = acpi_tb_get_rsdt_address ();
/* Get the RSDT/XSDT */
status = acpi_tb_get_table (physical_address, NULL, &table_info);
acpi_tb_get_rsdt_address (&address);
status = acpi_tb_get_table (&address, &table_info);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not get the RSDT, %s\n",
acpi_format_exception (status)));
......@@ -646,81 +690,3 @@ acpi_tb_get_table_rsdt (
}
/******************************************************************************
*
* FUNCTION: Acpi_tb_get_table_facs
*
* PARAMETERS: *Buffer_ptr - If Buffer_ptr is valid, read data from
* buffer rather than searching memory
* *Table_info - Where the table info is returned
*
* RETURN: Status
*
* DESCRIPTION: Returns a pointer to the FACS as defined in FADT. This
* function assumes the global variable FADT has been
* correctly initialized. The value of FADT->Firmware_ctrl
* into a far pointer which is returned.
*
*****************************************************************************/
acpi_status
acpi_tb_get_table_facs (
acpi_table_header *buffer_ptr,
acpi_table_desc *table_info)
{
acpi_table_header *table_ptr = NULL;
u32 size;
u8 allocation;
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE ("Tb_get_table_facs");
/* Must have a valid FADT pointer */
if (!acpi_gbl_FADT) {
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
size = sizeof (FACS_DESCRIPTOR);
if (buffer_ptr) {
/*
* Getting table from a file -- allocate a buffer and
* read the table.
*/
table_ptr = ACPI_MEM_ALLOCATE (size);
if(!table_ptr) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
ACPI_MEMCPY (table_ptr, buffer_ptr, size);
/* Save allocation type */
allocation = ACPI_MEM_ALLOCATED;
}
else {
/* Just map the physical memory to our address space */
status = acpi_tb_map_acpi_table ((ACPI_PHYSICAL_ADDRESS) ACPI_GET_ADDRESS (acpi_gbl_FADT->Xfirmware_ctrl),
&size, &table_ptr);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* Save allocation type */
allocation = ACPI_MEM_MAPPED;
}
/* Return values */
table_info->pointer = table_ptr;
table_info->length = size;
table_info->allocation = allocation;
table_info->base_pointer = table_ptr;
return_ACPI_STATUS (status);
}
/******************************************************************************
*
* Module Name: tbinstal - ACPI table installation and removal
* $Revision: 55 $
* $Revision: 57 $
*
*****************************************************************************/
......@@ -177,28 +177,35 @@ acpi_tb_recognize_table (
* We only "recognize" a limited number of ACPI tables -- namely, the
* ones that are used by the subsystem (DSDT, FADT, etc.)
*
* An AE_NOT_FOUND means that the table was not recognized.
* An AE_TABLE_NOT_SUPPORTED means that the table was not recognized.
* This can be any one of many valid ACPI tables, it just isn't one of
* the tables that is consumed by the core subsystem
*/
status = acpi_tb_match_signature (table_header->signature, table_info);
if (ACPI_SUCCESS (status)) {
/* Return the table type and length via the info struct */
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
table_info->length = table_header->length;
status = acpi_tb_validate_table_header (table_header);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/*
* Validate checksum for _most_ tables,
* even the ones whose signature we don't recognize
*/
if (table_info->type != ACPI_TABLE_FACS) {
status = acpi_tb_verify_table_checksum (table_header);
if (ACPI_FAILURE (status) &&
(!ACPI_CHECKSUM_ABORT)) {
/* Ignore the error if configuration says so */
/* Return the table type and length via the info struct */
status = AE_OK;
}
table_info->length = table_header->length;
/*
* Validate checksum for _most_ tables,
* even the ones whose signature we don't recognize
*/
if (table_info->type != ACPI_TABLE_FACS) {
status = acpi_tb_verify_table_checksum (table_header);
if (ACPI_FAILURE (status) &&
(!ACPI_CHECKSUM_ABORT)) {
/* Ignore the error if configuration says so */
status = AE_OK;
}
}
......@@ -372,10 +379,6 @@ acpi_tb_delete_acpi_table (
return;
}
/* Free the table */
acpi_tb_free_acpi_tables_of_type (&acpi_gbl_acpi_tables[type]);
/* Clear the appropriate "typed" global table pointer */
switch (type) {
......@@ -405,6 +408,10 @@ acpi_tb_delete_acpi_table (
break;
}
/* Free the table */
acpi_tb_free_acpi_tables_of_type (&acpi_gbl_acpi_tables[type]);
(void) acpi_ut_release_mutex (ACPI_MTX_TABLES);
return_VOID;
}
......
/******************************************************************************
*
* Module Name: tbutils - Table manipulation utilities
* $Revision: 49 $
* $Revision: 51 $
*
*****************************************************************************/
......@@ -71,7 +71,6 @@ acpi_tb_handle_to_object (
} while (list_head != &acpi_gbl_acpi_tables[i]);
}
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Table_id=%X does not exist\n", table_id));
return (AE_BAD_PARAMETER);
}
......@@ -115,7 +114,6 @@ acpi_tb_validate_table_header (
return (AE_BAD_ADDRESS);
}
/* Ensure that the signature is 4 ASCII characters */
ACPI_MOVE_UNALIGNED32_TO_32 (&signature, &table_header->signature);
......@@ -124,12 +122,11 @@ acpi_tb_validate_table_header (
"Table signature at %p [%p] has invalid characters\n",
table_header, &signature));
ACPI_REPORT_WARNING (("Invalid table signature %4.4s found\n", (char *) &signature));
ACPI_REPORT_WARNING (("Invalid table signature found: [%4.4s]\n", (char *) &signature));
ACPI_DUMP_BUFFER (table_header, sizeof (acpi_table_header));
return (AE_BAD_SIGNATURE);
}
/* Validate the table length */
if (table_header->length < sizeof (acpi_table_header)) {
......@@ -208,10 +205,10 @@ acpi_tb_map_acpi_table (
}
}
/* Map the physical memory for the correct length */
status = acpi_os_map_memory (physical_address, table_size, (void **) &table);
status = acpi_os_map_memory (physical_address, table_size,
(void **) &table);
if (ACPI_FAILURE (status)) {
return (status);
}
......@@ -222,7 +219,6 @@ acpi_tb_map_acpi_table (
*size = table_size;
*logical_address = table;
return (status);
}
......@@ -263,8 +259,6 @@ acpi_tb_verify_table_checksum (
status = AE_BAD_CHECKSUM;
}
return_ACPI_STATUS (status);
}
......@@ -301,7 +295,6 @@ acpi_tb_checksum (
sum = (u8) (sum + *rover);
}
}
return (sum);
}
......
......@@ -2,7 +2,7 @@
*
* Module Name: tbxface - Public interfaces to the ACPI subsystem
* ACPI table oriented interfaces
* $Revision: 51 $
* $Revision: 52 $
*
*****************************************************************************/
......@@ -51,7 +51,7 @@
acpi_status
acpi_load_tables (void)
{
ACPI_PHYSICAL_ADDRESS rsdp_physical_address;
ACPI_POINTER rsdp_address;
acpi_status status;
u32 number_of_tables = 0;
......@@ -62,7 +62,7 @@ acpi_load_tables (void)
/* Get the RSDP */
status = acpi_os_get_root_pointer (ACPI_LOGICAL_ADDRESSING,
&rsdp_physical_address);
&rsdp_address);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Acpi_load_tables: Could not get RSDP, %s\n",
acpi_format_exception (status)));
......@@ -71,7 +71,9 @@ acpi_load_tables (void)
/* Map and validate the RSDP */
status = acpi_tb_verify_rsdp (rsdp_physical_address);
acpi_gbl_table_flags = rsdp_address.pointer_type;
status = acpi_tb_verify_rsdp (&rsdp_address);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Acpi_load_tables: RSDP Failed validation: %s\n",
acpi_format_exception (status)));
......@@ -141,6 +143,7 @@ acpi_load_table (
{
acpi_status status;
acpi_table_desc table_info;
ACPI_POINTER address;
ACPI_FUNCTION_TRACE ("Acpi_load_table");
......@@ -152,7 +155,10 @@ acpi_load_table (
/* Copy the table to a local buffer */
status = acpi_tb_get_table (0, table_ptr, &table_info);
address.pointer_type = ACPI_LOGICAL_POINTER;
address.pointer.logical = table_ptr;
status = acpi_tb_get_table (&address, &table_info);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
......
/******************************************************************************
*
* Module Name: tbxfroot - Find the root ACPI table (RSDT)
* $Revision: 58 $
* $Revision: 61 $
*
*****************************************************************************/
......@@ -118,7 +118,8 @@ acpi_get_firmware_table (
u32 flags,
acpi_table_header **table_pointer)
{
ACPI_PHYSICAL_ADDRESS physical_address;
ACPI_POINTER rsdp_address;
ACPI_POINTER address;
acpi_table_header *rsdt_ptr = NULL;
acpi_table_header *table_ptr;
acpi_status status;
......@@ -149,7 +150,7 @@ acpi_get_firmware_table (
if (!acpi_gbl_RSDP) {
/* Get the RSDP */
status = acpi_os_get_root_pointer (flags, &physical_address);
status = acpi_os_get_root_pointer (flags, &rsdp_address);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "RSDP not found\n"));
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
......@@ -158,14 +159,14 @@ acpi_get_firmware_table (
/* Map and validate the RSDP */
if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) {
status = acpi_os_map_memory (physical_address, sizeof (RSDP_DESCRIPTOR),
status = acpi_os_map_memory (rsdp_address.pointer.physical, sizeof (RSDP_DESCRIPTOR),
(void **) &acpi_gbl_RSDP);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
}
else {
acpi_gbl_RSDP = ACPI_PHYSADDR_TO_PTR (physical_address);
acpi_gbl_RSDP = rsdp_address.pointer.logical;
}
/*
......@@ -194,8 +195,9 @@ acpi_get_firmware_table (
/* Get the RSDT and validate it */
physical_address = acpi_tb_get_rsdt_address ();
status = acpi_tb_get_table_pointer (physical_address, flags, &rsdt_size, &rsdt_ptr);
acpi_tb_get_rsdt_address (&address);
status = acpi_tb_get_table_pointer (&address, flags, &rsdt_size, &rsdt_ptr);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
......@@ -217,18 +219,18 @@ acpi_get_firmware_table (
for (i = 0, j = 0; i < table_count; i++) {
/* Get the next table pointer */
address.pointer_type = acpi_gbl_table_flags;
if (acpi_gbl_RSDP->revision < 2) {
physical_address = (ACPI_PHYSICAL_ADDRESS)
((RSDT_DESCRIPTOR *) rsdt_ptr)->table_offset_entry[i];
address.pointer.value = ((RSDT_DESCRIPTOR *) rsdt_ptr)->table_offset_entry[i];
}
else {
physical_address = (ACPI_PHYSICAL_ADDRESS)
ACPI_GET_ADDRESS (((xsdt_descriptor *) rsdt_ptr)->table_offset_entry[i]);
address.pointer.value = ACPI_GET_ADDRESS (
((xsdt_descriptor *) rsdt_ptr)->table_offset_entry[i]);
}
/* Get addressibility if necessary */
status = acpi_tb_get_table_pointer (physical_address, flags, &table_size, &table_ptr);
status = acpi_tb_get_table_pointer (&address, flags, &table_size, &table_ptr);
if (ACPI_FAILURE (status)) {
goto cleanup;
}
......@@ -276,8 +278,8 @@ acpi_get_firmware_table (
*
* FUNCTION: Acpi_find_root_pointer
*
* PARAMETERS: **Rsdp_physical_address - Where to place the RSDP address
* Flags - Logical/Physical addressing
* PARAMETERS: **Rsdp_address - Where to place the RSDP address
* Flags - Logical/Physical addressing
*
* RETURN: Status, Physical address of the RSDP
*
......@@ -288,7 +290,7 @@ acpi_get_firmware_table (
acpi_status
acpi_find_root_pointer (
u32 flags,
ACPI_PHYSICAL_ADDRESS *rsdp_physical_address)
ACPI_POINTER *rsdp_address)
{
acpi_table_desc table_info;
acpi_status status;
......@@ -305,7 +307,8 @@ acpi_find_root_pointer (
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
*rsdp_physical_address = table_info.physical_address;
rsdp_address->pointer_type = ACPI_PHYSICAL_POINTER;
rsdp_address->pointer.physical = table_info.physical_address;
return_ACPI_STATUS (AE_OK);
}
......
/******************************************************************************
*
* Module Name: utcopy - Internal to external object translation utilities
* $Revision: 94 $
* $Revision: 95 $
*
*****************************************************************************/
......@@ -654,6 +654,9 @@ acpi_ut_copy_simple_object (
case ACPI_TYPE_BUFFER:
dest_desc->buffer.node = NULL;
dest_desc->common.flags = source_desc->common.flags;
/* Fall through to common string/buffer case */
case ACPI_TYPE_STRING:
......@@ -744,6 +747,7 @@ acpi_ut_copy_ielement_to_ielement (
}
target_object->package.count = source_object->package.count;
target_object->common.flags = source_object->common.flags;
/*
* Pass the new package object back to the package walk routine
......@@ -792,6 +796,7 @@ acpi_ut_copy_ipackage_to_ipackage (
dest_obj->common.type = source_obj->common.type;
dest_obj->common.flags = source_obj->common.flags;
dest_obj->package.count = source_obj->package.count;
......@@ -806,10 +811,6 @@ acpi_ut_copy_ipackage_to_ipackage (
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Init */
dest_obj->package.next_element = dest_obj->package.elements;
/*
* Copy the package element-by-element by walking the package "tree".
* This handles nested packages of arbitrary depth.
......
/******************************************************************************
*
* Module Name: utdebug - Debug print routines
* $Revision: 96 $
* $Revision: 97 $
*
*****************************************************************************/
......@@ -508,6 +508,11 @@ acpi_ut_dump_buffer (
return;
}
if ((count < 4) || (count & 0x01)) {
display = DB_BYTE_DISPLAY;
}
acpi_os_printf ("\n_offset Value\n");
/*
* Nasty little dump buffer routine!
......
/*******************************************************************************
*
* Module Name: utdelete - object deletion and reference count utilities
* $Revision: 87 $
* $Revision: 88 $
*
******************************************************************************/
......@@ -68,10 +68,9 @@ acpi_ut_delete_internal_obj (
* actual ACPI objects (for example, a raw buffer pointer).
*/
switch (object->common.type) {
case ACPI_TYPE_STRING:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** String %p, ptr %p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "**** String %p, ptr %p\n",
object, object->string.pointer));
/* Free the actual string buffer */
......@@ -84,7 +83,7 @@ acpi_ut_delete_internal_obj (
case ACPI_TYPE_BUFFER:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Buffer %p, ptr %p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "**** Buffer %p, ptr %p\n",
object, object->buffer.pointer));
/* Free the actual buffer */
......@@ -95,7 +94,7 @@ acpi_ut_delete_internal_obj (
case ACPI_TYPE_PACKAGE:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, " **** Package of count %X\n",
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, " **** Package of count %X\n",
object->package.count));
/*
......@@ -111,7 +110,7 @@ acpi_ut_delete_internal_obj (
case ACPI_TYPE_MUTEX:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "***** Mutex %p, Semaphore %p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Mutex %p, Semaphore %p\n",
object, object->mutex.semaphore));
acpi_ex_unlink_mutex (object);
......@@ -121,7 +120,7 @@ acpi_ut_delete_internal_obj (
case ACPI_TYPE_EVENT:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "***** Event %p, Semaphore %p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Event %p, Semaphore %p\n",
object, object->event.semaphore));
acpi_os_delete_semaphore (object->event.semaphore);
......@@ -131,7 +130,7 @@ acpi_ut_delete_internal_obj (
case ACPI_TYPE_METHOD:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "***** Method %p\n", object));
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Method %p\n", object));
/* Delete the method semaphore if it exists */
......@@ -144,7 +143,7 @@ acpi_ut_delete_internal_obj (
case ACPI_TYPE_REGION:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "***** Region %p\n", object));
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Region %p\n", object));
second_desc = acpi_ns_get_secondary_object (object);
if (second_desc) {
......@@ -168,7 +167,7 @@ acpi_ut_delete_internal_obj (
case ACPI_TYPE_BUFFER_FIELD:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "***** Buffer Field %p\n", object));
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Buffer Field %p\n", object));
second_desc = acpi_ns_get_secondary_object (object);
if (second_desc) {
......@@ -185,14 +184,14 @@ acpi_ut_delete_internal_obj (
/* Free any allocated memory (pointer within the object) found above */
if (obj_pointer) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting Object Subptr %p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Deleting Object Subptr %p\n",
obj_pointer));
ACPI_MEM_FREE (obj_pointer);
}
/* Now the object can be safely deleted */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting Object %p [%s]\n",
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Deleting Object %p [%s]\n",
object, acpi_ut_get_type_name (object->common.type)));
acpi_ut_delete_object_desc (object);
......@@ -232,7 +231,6 @@ acpi_ut_delete_internal_object_list (
/* Free the combined parameter pointer list and object array */
ACPI_MEM_FREE (obj_list);
return_ACPI_STATUS (AE_OK);
}
......@@ -261,11 +259,11 @@ acpi_ut_update_ref_count (
ACPI_FUNCTION_NAME ("Ut_update_ref_count");
if (!object) {
return;
}
count = object->common.reference_count;
new_count = count;
......@@ -279,7 +277,7 @@ acpi_ut_update_ref_count (
new_count++;
object->common.reference_count = new_count;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Obj %p Refs=%X, [Incremented]\n",
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, [Incremented]\n",
object, new_count));
break;
......@@ -287,21 +285,20 @@ acpi_ut_update_ref_count (
case REF_DECREMENT:
if (count < 1) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Obj %p Refs=%X, can't decrement! (Set to 0)\n",
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, can't decrement! (Set to 0)\n",
object, new_count));
new_count = 0;
}
else {
new_count--;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Obj %p Refs=%X, [Decremented]\n",
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, [Decremented]\n",
object, new_count));
}
if (object->common.type == ACPI_TYPE_METHOD) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Method Obj %p Refs=%X, [Decremented]\n",
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Method Obj %p Refs=%X, [Decremented]\n",
object, new_count));
}
......@@ -315,7 +312,7 @@ acpi_ut_update_ref_count (
case REF_FORCE_DELETE:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Obj %p Refs=%X, Force delete! (Set to 0)\n",
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, Force delete! (Set to 0)\n",
object, count));
new_count = 0;
......@@ -330,7 +327,6 @@ acpi_ut_update_ref_count (
break;
}
/*
* Sanity check the reference count, for debug purposes only.
* (A deleted object will have a huge reference count)
......@@ -394,7 +390,7 @@ acpi_ut_update_object_reference (
* Make sure that this isn't a namespace handle
*/
if (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Object %p is NS handle\n", object));
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p is NS handle\n", object));
return_ACPI_STATUS (AE_OK);
}
......@@ -566,7 +562,6 @@ acpi_ut_add_reference (
* We have a valid ACPI internal object, now increment the reference count
*/
acpi_ut_update_object_reference (object, REF_INCREMENT);
return_VOID;
}
......@@ -607,7 +602,7 @@ acpi_ut_remove_reference (
return_VOID;
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Obj %p Refs=%X\n",
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X\n",
object, object->common.reference_count));
/*
......
/******************************************************************************
*
* Module Name: uteval - Object evaluation
* $Revision: 37 $
* $Revision: 38 $
*
*****************************************************************************/
......@@ -68,7 +68,7 @@ acpi_ut_evaluate_numeric_object (
status = acpi_ns_evaluate_relative (device_node, object_name, NULL, &obj_desc);
if (ACPI_FAILURE (status)) {
if (status == AE_NOT_FOUND) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s on %4.4s was not found\n",
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s on %4.4s was not found\n",
object_name, (char *) &device_node->name));
}
else {
......@@ -147,7 +147,7 @@ acpi_ut_execute_HID (
METHOD_NAME__HID, NULL, &obj_desc);
if (ACPI_FAILURE (status)) {
if (status == AE_NOT_FOUND) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "_HID on %4.4s was not found\n",
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "_HID on %4.4s was not found\n",
(char *) &device_node->name));
}
else {
......@@ -230,7 +230,7 @@ acpi_ut_execute_CID (
METHOD_NAME__CID, NULL, &obj_desc);
if (ACPI_FAILURE (status)) {
if (status == AE_NOT_FOUND) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "_CID on %4.4s was not found\n",
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "_CID on %4.4s was not found\n",
(char *)&device_node->name));
}
else {
......@@ -324,7 +324,7 @@ acpi_ut_execute_UID (
METHOD_NAME__UID, NULL, &obj_desc);
if (ACPI_FAILURE (status)) {
if (status == AE_NOT_FOUND) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "_UID on %4.4s was not found\n",
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "_UID on %4.4s was not found\n",
(char *) &device_node->name));
}
else {
......@@ -409,7 +409,7 @@ acpi_ut_execute_STA (
status = acpi_ns_evaluate_relative (device_node,
METHOD_NAME__STA, NULL, &obj_desc);
if (AE_NOT_FOUND == status) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"_STA on %4.4s was not found, assuming present.\n",
(char *) &device_node->name));
......
/******************************************************************************
*
* Module Name: utglobal - Global variables for the ACPI subsystem
* $Revision: 153 $
* $Revision: 155 $
*
*****************************************************************************/
......@@ -56,50 +56,62 @@ acpi_format_exception (
acpi_status sub_status;
sub_status = (status & ~AE_CODE_MASK);
ACPI_FUNCTION_NAME ("Format_exception");
sub_status = (status & ~AE_CODE_MASK);
switch (status & AE_CODE_MASK) {
case AE_CODE_ENVIRONMENTAL:
if (sub_status <= AE_CODE_ENV_MAX) {
exception = acpi_gbl_exception_names_env [sub_status];
break;
}
break;
goto unknown;
case AE_CODE_PROGRAMMER:
if (sub_status <= AE_CODE_PGM_MAX) {
exception = acpi_gbl_exception_names_pgm [sub_status -1];
break;
}
break;
goto unknown;
case AE_CODE_ACPI_TABLES:
if (sub_status <= AE_CODE_TBL_MAX) {
exception = acpi_gbl_exception_names_tbl [sub_status -1];
break;
}
break;
goto unknown;
case AE_CODE_AML:
if (sub_status <= AE_CODE_AML_MAX) {
exception = acpi_gbl_exception_names_aml [sub_status -1];
break;
}
break;
goto unknown;
case AE_CODE_CONTROL:
if (sub_status <= AE_CODE_CTRL_MAX) {
exception = acpi_gbl_exception_names_ctrl [sub_status -1];
break;
}
break;
goto unknown;
default:
break;
goto unknown;
}
return ((const char *) exception);
unknown:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown exception code: 0x%8.8X\n", status));
return ((const char *) exception);
}
......@@ -173,10 +185,10 @@ const acpi_predefined_names acpi_gbl_pre_defined_names[] =
{"_SB_", ACPI_TYPE_DEVICE},
{"_SI_", INTERNAL_TYPE_DEF_ANY},
{"_TZ_", INTERNAL_TYPE_DEF_ANY},
{"_REV", ACPI_TYPE_INTEGER, "2"},
{"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
{"_GL_", ACPI_TYPE_MUTEX, "0"},
{NULL, ACPI_TYPE_ANY} /* Table terminator */
{"_REV", ACPI_TYPE_INTEGER, "2"},
{"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
{"_GL_", ACPI_TYPE_MUTEX, "0"},
{NULL, ACPI_TYPE_ANY} /* Table terminator */
};
......@@ -193,16 +205,16 @@ const u8 acpi_gbl_ns_properties[] =
ACPI_NS_NORMAL, /* 01 Number */
ACPI_NS_NORMAL, /* 02 String */
ACPI_NS_NORMAL, /* 03 Buffer */
ACPI_NS_LOCAL, /* 04 Package */
ACPI_NS_NORMAL, /* 04 Package */
ACPI_NS_NORMAL, /* 05 Field_unit */
ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 06 Device */
ACPI_NS_LOCAL, /* 07 Acpi_event */
ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 08 Method */
ACPI_NS_LOCAL, /* 09 Mutex */
ACPI_NS_LOCAL, /* 10 Region */
ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 11 Power */
ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 12 Processor */
ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 13 Thermal */
ACPI_NS_NEWSCOPE, /* 06 Device */
ACPI_NS_NORMAL, /* 07 Event */
ACPI_NS_NEWSCOPE, /* 08 Method */
ACPI_NS_NORMAL, /* 09 Mutex */
ACPI_NS_NORMAL, /* 10 Region */
ACPI_NS_NEWSCOPE, /* 11 Power */
ACPI_NS_NEWSCOPE, /* 12 Processor */
ACPI_NS_NEWSCOPE, /* 13 Thermal */
ACPI_NS_NORMAL, /* 14 Buffer_field */
ACPI_NS_NORMAL, /* 15 Ddb_handle */
ACPI_NS_NORMAL, /* 16 Debug Object */
......@@ -758,6 +770,7 @@ acpi_ut_init_globals (
/* Miscellaneous variables */
acpi_gbl_table_flags = ACPI_PHYSICAL_POINTER;
acpi_gbl_rsdp_original_location = 0;
acpi_gbl_cm_single_step = FALSE;
acpi_gbl_db_terminate_threads = FALSE;
......@@ -779,7 +792,7 @@ acpi_ut_init_globals (
acpi_gbl_root_node = NULL;
acpi_gbl_root_node_struct.name = ACPI_ROOT_NAME;
acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME;
acpi_gbl_root_node_struct.descriptor = ACPI_DESC_TYPE_NAMED;
acpi_gbl_root_node_struct.type = ACPI_TYPE_ANY;
acpi_gbl_root_node_struct.child = NULL;
......
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