Commit 5a07b58d authored by Andy Grover's avatar Andy Grover

ACPI: Interpreter update to 20021205

  Prefix more contants with ACPI_
  Fixed a problem causing DSDT image corruption
  Fixed a problem if a method was called in an object declaration
  Fixed a problem in the string copy routine
  Broke out some code into new files
parent af8619ee
...@@ -142,7 +142,7 @@ acpi_set_debug ( ...@@ -142,7 +142,7 @@ acpi_set_debug (
switch (flag) { switch (flag) {
case ACPI_DEBUG_LOW: case ACPI_DEBUG_LOW:
acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS; acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS;
acpi_dbg_level = DEBUG_DEFAULT; acpi_dbg_level = ACPI_DEBUG_DEFAULT;
break; break;
case ACPI_DEBUG_MEDIUM: case ACPI_DEBUG_MEDIUM:
acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS; acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS;
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
# #
obj-y := dsfield.o dsmthdat.o dsopcode.o dswexec.o dswscope.o \ obj-y := dsfield.o dsmthdat.o dsopcode.o dswexec.o dswscope.o \
dsmethod.o dsobject.o dsutils.o dswload.o dswstate.o dsmethod.o dsobject.o dsutils.o dswload.o dswstate.o \
dsinit.o
EXTRA_CFLAGS += $(ACPI_CFLAGS) EXTRA_CFLAGS += $(ACPI_CFLAGS)
......
/******************************************************************************
*
* Module Name: dsinit - Object initialization namespace walk
* $Revision: 2 $
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "acpi.h"
#include "acparser.h"
#include "amlcode.h"
#include "acdispat.h"
#include "acnamesp.h"
#include "acinterp.h"
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsinit")
/*******************************************************************************
*
* FUNCTION: Acpi_ds_init_one_object
*
* PARAMETERS: Obj_handle - Node
* Level - Current nesting level
* Context - Points to a init info struct
* Return_value - Not used
*
* RETURN: Status
*
* DESCRIPTION: Callback from Acpi_walk_namespace. Invoked for every object
* within the namespace.
*
* Currently, the only objects that require initialization are:
* 1) Methods
* 2) Operation Regions
*
******************************************************************************/
acpi_status
acpi_ds_init_one_object (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value)
{
acpi_object_type type;
acpi_status status;
acpi_init_walk_info *info = (acpi_init_walk_info *) context;
ACPI_FUNCTION_NAME ("Ds_init_one_object");
/*
* We are only interested in objects owned by the table that
* was just loaded
*/
if (((acpi_namespace_node *) obj_handle)->owner_id !=
info->table_desc->table_id) {
return (AE_OK);
}
info->object_count++;
/* And even then, we are only interested in a few object types */
type = acpi_ns_get_type (obj_handle);
switch (type) {
case ACPI_TYPE_REGION:
status = acpi_ds_initialize_region (obj_handle);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region %p [%4.4s] - Init failure, %s\n",
obj_handle, ((acpi_namespace_node *) obj_handle)->name.ascii,
acpi_format_exception (status)));
}
info->op_region_count++;
break;
case ACPI_TYPE_METHOD:
info->method_count++;
/* Print a dot for each method unless we are going to print the entire pathname */
if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
acpi_os_printf (".");
}
/*
* Set the execution data width (32 or 64) based upon the
* revision number of the parent ACPI table.
* TBD: This is really for possible future support of integer width
* on a per-table basis. Currently, we just use a global for the width.
*/
if (info->table_desc->pointer->revision == 1) {
((acpi_namespace_node *) obj_handle)->flags |= ANOBJ_DATA_WIDTH_32;
}
/*
* Always parse methods to detect errors, we may delete
* the parse tree below
*/
status = acpi_ds_parse_method (obj_handle);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] - parse failure, %s\n",
obj_handle, ((acpi_namespace_node *) obj_handle)->name.ascii,
acpi_format_exception (status)));
/* This parse failed, but we will continue parsing more methods */
break;
}
/*
* Delete the parse tree. We simple re-parse the method
* for every execution since there isn't much overhead
*/
acpi_ns_delete_namespace_subtree (obj_handle);
acpi_ns_delete_namespace_by_owner (((acpi_namespace_node *) obj_handle)->object->method.owning_id);
break;
case ACPI_TYPE_DEVICE:
info->device_count++;
break;
default:
break;
}
/*
* We ignore errors from above, and always return OK, since
* we don't want to abort the walk on a single error.
*/
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: Acpi_ds_initialize_objects
*
* PARAMETERS: Table_desc - Descriptor for parent ACPI table
* Start_node - Root of subtree to be initialized.
*
* RETURN: Status
*
* DESCRIPTION: Walk the namespace starting at "Start_node" and perform any
* necessary initialization on the objects found therein
*
******************************************************************************/
acpi_status
acpi_ds_initialize_objects (
acpi_table_desc *table_desc,
acpi_namespace_node *start_node)
{
acpi_status status;
acpi_init_walk_info info;
ACPI_FUNCTION_TRACE ("Ds_initialize_objects");
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"**** Starting initialization of namespace objects ****\n"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Parsing all Control Methods:"));
info.method_count = 0;
info.op_region_count = 0;
info.object_count = 0;
info.device_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,
acpi_ds_init_one_object, &info, NULL);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Walk_namespace failed, %s\n",
acpi_format_exception (status)));
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"\nTable [%4.4s] - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
table_desc->pointer->signature, info.object_count,
info.device_count, info.method_count, info.op_region_count));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"%hd Methods, %hd Regions\n", info.method_count, info.op_region_count));
return_ACPI_STATUS (AE_OK);
}
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dsmthdat - control method arguments and local variables * Module Name: dsmthdat - control method arguments and local variables
* $Revision: 66 $ * $Revision: 67 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -68,7 +68,7 @@ acpi_ds_method_data_init ( ...@@ -68,7 +68,7 @@ acpi_ds_method_data_init (
/* Init the method arguments */ /* Init the method arguments */
for (i = 0; i < MTH_NUM_ARGS; i++) { for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) {
ACPI_MOVE_UNALIGNED32_TO_32 (&walk_state->arguments[i].name, ACPI_MOVE_UNALIGNED32_TO_32 (&walk_state->arguments[i].name,
NAMEOF_ARG_NTE); NAMEOF_ARG_NTE);
walk_state->arguments[i].name.integer |= (i << 24); walk_state->arguments[i].name.integer |= (i << 24);
...@@ -79,7 +79,7 @@ acpi_ds_method_data_init ( ...@@ -79,7 +79,7 @@ acpi_ds_method_data_init (
/* Init the method locals */ /* Init the method locals */
for (i = 0; i < MTH_NUM_LOCALS; i++) { for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) {
ACPI_MOVE_UNALIGNED32_TO_32 (&walk_state->local_variables[i].name, ACPI_MOVE_UNALIGNED32_TO_32 (&walk_state->local_variables[i].name,
NAMEOF_LOCAL_NTE); NAMEOF_LOCAL_NTE);
...@@ -118,7 +118,7 @@ acpi_ds_method_data_delete_all ( ...@@ -118,7 +118,7 @@ acpi_ds_method_data_delete_all (
/* Detach the locals */ /* Detach the locals */
for (index = 0; index < MTH_NUM_LOCALS; index++) { for (index = 0; index < ACPI_METHOD_NUM_LOCALS; index++) {
if (walk_state->local_variables[index].object) { if (walk_state->local_variables[index].object) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%d=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%d=%p\n",
index, walk_state->local_variables[index].object)); index, walk_state->local_variables[index].object));
...@@ -131,7 +131,7 @@ acpi_ds_method_data_delete_all ( ...@@ -131,7 +131,7 @@ acpi_ds_method_data_delete_all (
/* Detach the arguments */ /* Detach the arguments */
for (index = 0; index < MTH_NUM_ARGS; index++) { for (index = 0; index < ACPI_METHOD_NUM_ARGS; index++) {
if (walk_state->arguments[index].object) { if (walk_state->arguments[index].object) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%d=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%d=%p\n",
index, walk_state->arguments[index].object)); index, walk_state->arguments[index].object));
...@@ -182,7 +182,7 @@ acpi_ds_method_data_init_args ( ...@@ -182,7 +182,7 @@ acpi_ds_method_data_init_args (
/* Copy passed parameters into the new method stack frame */ /* Copy passed parameters into the new method stack frame */
while ((index < MTH_NUM_ARGS) && (index < max_param_count) && params[index]) { while ((index < ACPI_METHOD_NUM_ARGS) && (index < max_param_count) && params[index]) {
/* /*
* A valid parameter. * A valid parameter.
* Store the argument in the method/walk descriptor * Store the argument in the method/walk descriptor
...@@ -230,9 +230,9 @@ acpi_ds_method_data_get_node ( ...@@ -230,9 +230,9 @@ acpi_ds_method_data_get_node (
switch (opcode) { switch (opcode) {
case AML_LOCAL_OP: case AML_LOCAL_OP:
if (index > MTH_MAX_LOCAL) { if (index > ACPI_METHOD_MAX_LOCAL) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Local index %d is invalid (max %d)\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Local index %d is invalid (max %d)\n",
index, MTH_MAX_LOCAL)); index, ACPI_METHOD_MAX_LOCAL));
return_ACPI_STATUS (AE_AML_INVALID_INDEX); return_ACPI_STATUS (AE_AML_INVALID_INDEX);
} }
...@@ -243,9 +243,9 @@ acpi_ds_method_data_get_node ( ...@@ -243,9 +243,9 @@ acpi_ds_method_data_get_node (
case AML_ARG_OP: case AML_ARG_OP:
if (index > MTH_MAX_ARG) { if (index > ACPI_METHOD_MAX_ARG) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Arg index %d is invalid (max %d)\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Arg index %d is invalid (max %d)\n",
index, MTH_MAX_ARG)); index, ACPI_METHOD_MAX_ARG));
return_ACPI_STATUS (AE_AML_INVALID_INDEX); return_ACPI_STATUS (AE_AML_INVALID_INDEX);
} }
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: dsobject - Dispatcher object management routines * Module Name: dsobject - Dispatcher object management routines
* $Revision: 110 $ * $Revision: 111 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -36,187 +36,6 @@ ...@@ -36,187 +36,6 @@
#ifndef ACPI_NO_METHOD_EXECUTION #ifndef ACPI_NO_METHOD_EXECUTION
/*******************************************************************************
*
* FUNCTION: Acpi_ds_init_one_object
*
* PARAMETERS: Obj_handle - Node
* Level - Current nesting level
* Context - Points to a init info struct
* Return_value - Not used
*
* RETURN: Status
*
* DESCRIPTION: Callback from Acpi_walk_namespace. Invoked for every object
* within the namespace.
*
* Currently, the only objects that require initialization are:
* 1) Methods
* 2) Operation Regions
*
******************************************************************************/
acpi_status
acpi_ds_init_one_object (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value)
{
acpi_object_type type;
acpi_status status;
acpi_init_walk_info *info = (acpi_init_walk_info *) context;
ACPI_FUNCTION_NAME ("Ds_init_one_object");
/*
* We are only interested in objects owned by the table that
* was just loaded
*/
if (((acpi_namespace_node *) obj_handle)->owner_id !=
info->table_desc->table_id) {
return (AE_OK);
}
info->object_count++;
/* And even then, we are only interested in a few object types */
type = acpi_ns_get_type (obj_handle);
switch (type) {
case ACPI_TYPE_REGION:
status = acpi_ds_initialize_region (obj_handle);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region %p [%4.4s] - Init failure, %s\n",
obj_handle, ((acpi_namespace_node *) obj_handle)->name.ascii,
acpi_format_exception (status)));
}
info->op_region_count++;
break;
case ACPI_TYPE_METHOD:
info->method_count++;
if (!(acpi_dbg_level & ACPI_LV_INIT)) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "."));
}
/*
* Set the execution data width (32 or 64) based upon the
* revision number of the parent ACPI table.
* TBD: This is really for possible future support of integer width
* on a per-table basis. Currently, we just use a global for the width.
*/
if (info->table_desc->pointer->revision == 1) {
((acpi_namespace_node *) obj_handle)->flags |= ANOBJ_DATA_WIDTH_32;
}
/*
* Always parse methods to detect errors, we may delete
* the parse tree below
*/
status = acpi_ds_parse_method (obj_handle);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] - parse failure, %s\n",
obj_handle, ((acpi_namespace_node *) obj_handle)->name.ascii,
acpi_format_exception (status)));
/* This parse failed, but we will continue parsing more methods */
break;
}
/*
* Delete the parse tree. We simple re-parse the method
* for every execution since there isn't much overhead
*/
acpi_ns_delete_namespace_subtree (obj_handle);
acpi_ns_delete_namespace_by_owner (((acpi_namespace_node *) obj_handle)->object->method.owning_id);
break;
case ACPI_TYPE_DEVICE:
info->device_count++;
break;
default:
break;
}
/*
* We ignore errors from above, and always return OK, since
* we don't want to abort the walk on a single error.
*/
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: Acpi_ds_initialize_objects
*
* PARAMETERS: Table_desc - Descriptor for parent ACPI table
* Start_node - Root of subtree to be initialized.
*
* RETURN: Status
*
* DESCRIPTION: Walk the namespace starting at "Start_node" and perform any
* necessary initialization on the objects found therein
*
******************************************************************************/
acpi_status
acpi_ds_initialize_objects (
acpi_table_desc *table_desc,
acpi_namespace_node *start_node)
{
acpi_status status;
acpi_init_walk_info info;
ACPI_FUNCTION_TRACE ("Ds_initialize_objects");
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"**** Starting initialization of namespace objects ****\n"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "Parsing Methods:"));
info.method_count = 0;
info.op_region_count = 0;
info.object_count = 0;
info.device_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,
acpi_ds_init_one_object, &info, NULL);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Walk_namespace failed, %s\n",
acpi_format_exception (status)));
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
"\nTable [%4.4s] - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
table_desc->pointer->signature, info.object_count,
info.device_count, info.method_count, info.op_region_count));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"%hd Methods, %hd Regions\n", info.method_count, info.op_region_count));
return_ACPI_STATUS (AE_OK);
}
/***************************************************************************** /*****************************************************************************
* *
* FUNCTION: Acpi_ds_build_internal_object * FUNCTION: Acpi_ds_build_internal_object
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* *
* Module Name: dsopcode - Dispatcher Op Region support and handling of * Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes * "control" opcodes
* $Revision: 83 $ * $Revision: 84 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -173,7 +173,7 @@ acpi_ds_get_buffer_field_arguments ( ...@@ -173,7 +173,7 @@ acpi_ds_get_buffer_field_arguments (
extra_desc = acpi_ns_get_secondary_object (obj_desc); extra_desc = acpi_ns_get_secondary_object (obj_desc);
node = obj_desc->buffer_field.node; node = obj_desc->buffer_field.node;
ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname (node, " [Field]")); ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname (ACPI_TYPE_BUFFER_FIELD, node, NULL));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] Buffer_field JIT Init\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] Buffer_field JIT Init\n",
node->name.ascii)); node->name.ascii));
...@@ -317,7 +317,7 @@ acpi_ds_get_region_arguments ( ...@@ -317,7 +317,7 @@ acpi_ds_get_region_arguments (
node = obj_desc->region.node; node = obj_desc->region.node;
ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname (node, " [Operation Region]")); ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname (ACPI_TYPE_REGION, node, NULL));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] Op_region Init at AML %p\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] Op_region Init at AML %p\n",
node->name.ascii, extra_desc->extra.aml_start)); node->name.ascii, extra_desc->extra.aml_start));
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: dswload - Dispatcher namespace load callbacks * Module Name: dswload - Dispatcher namespace load callbacks
* $Revision: 78 $ * $Revision: 80 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -356,6 +356,37 @@ acpi_ds_load1_end_op ( ...@@ -356,6 +356,37 @@ acpi_ds_load1_end_op (
} }
} }
if (op->common.aml_opcode == AML_METHOD_OP) {
/*
* Method_op Pkg_length Name_string Method_flags Term_list
*
* Note: We must create the method node/object pair as soon as we
* see the method declaration. This allows later pass1 parsing
* of invocations of the method (need to know the number of
* arguments.)
*/
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"LOADING-Method: State=%p Op=%p Named_obj=%p\n",
walk_state, op, op->named.node));
if (!acpi_ns_get_attached_object (op->named.node)) {
walk_state->operands[0] = (void *) op->named.node;
walk_state->num_operands = 1;
status = acpi_ds_create_operands (walk_state, op->common.value.arg);
if (ACPI_SUCCESS (status)) {
status = acpi_ex_create_method (op->named.data,
op->named.length, walk_state);
}
walk_state->operands[0] = NULL;
walk_state->num_operands = 0;
if (ACPI_FAILURE (status)) {
return (status);
}
}
}
/* Pop the scope stack */ /* Pop the scope stack */
if (acpi_ns_opens_scope (object_type)) { if (acpi_ns_opens_scope (object_type)) {
...@@ -651,11 +682,10 @@ acpi_ds_load2_end_op ( ...@@ -651,11 +682,10 @@ acpi_ds_load2_end_op (
status = acpi_ds_scope_stack_pop (walk_state); status = acpi_ds_scope_stack_pop (walk_state);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); goto cleanup;
} }
} }
/* /*
* Named operations are as follows: * Named operations are as follows:
* *
...@@ -789,26 +819,6 @@ acpi_ds_load2_end_op ( ...@@ -789,26 +819,6 @@ acpi_ds_load2_end_op (
case AML_TYPE_NAMED_COMPLEX: case AML_TYPE_NAMED_COMPLEX:
switch (op->common.aml_opcode) { switch (op->common.aml_opcode) {
case AML_METHOD_OP:
/*
* Method_op Pkg_length Name_string Method_flags Term_list
*/
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"LOADING-Method: State=%p Op=%p Named_obj=%p\n",
walk_state, op, node));
if (!acpi_ns_get_attached_object (node)) {
status = acpi_ds_create_operands (walk_state, arg);
if (ACPI_FAILURE (status)) {
goto cleanup;
}
status = acpi_ex_create_method (op->named.data,
op->named.length, walk_state);
}
break;
#ifndef ACPI_NO_METHOD_EXECUTION #ifndef ACPI_NO_METHOD_EXECUTION
case AML_REGION_OP: case AML_REGION_OP:
/* /*
...@@ -842,6 +852,7 @@ acpi_ds_load2_end_op ( ...@@ -842,6 +852,7 @@ acpi_ds_load2_end_op (
default: default:
/* All NAMED_COMPLEX opcodes must be handled above */ /* All NAMED_COMPLEX opcodes must be handled above */
/* Note: Method objects were already created in Pass 1 */
break; break;
} }
break; break;
...@@ -891,7 +902,6 @@ acpi_ds_load2_end_op ( ...@@ -891,7 +902,6 @@ acpi_ds_load2_end_op (
break; break;
} }
cleanup: cleanup:
/* Remove the Node pushed at the very beginning */ /* Remove the Node pushed at the very beginning */
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: dswstate - Dispatcher parse tree walk management routines * Module Name: dswstate - Dispatcher parse tree walk management routines
* $Revision: 70 $ * $Revision: 71 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -65,7 +65,7 @@ acpi_ds_result_insert ( ...@@ -65,7 +65,7 @@ acpi_ds_result_insert (
return (AE_NOT_EXIST); return (AE_NOT_EXIST);
} }
if (index >= OBJ_NUM_OPERANDS) { if (index >= ACPI_OBJ_NUM_OPERANDS) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Index out of range: %X Obj=%p State=%p Num=%X\n", "Index out of range: %X Obj=%p State=%p Num=%X\n",
index, object, walk_state, state->results.num_results)); index, object, walk_state, state->results.num_results));
...@@ -124,7 +124,7 @@ acpi_ds_result_remove ( ...@@ -124,7 +124,7 @@ acpi_ds_result_remove (
return (AE_NOT_EXIST); return (AE_NOT_EXIST);
} }
if (index >= OBJ_MAX_OPERAND) { if (index >= ACPI_OBJ_MAX_OPERAND) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Index out of range: %X State=%p Num=%X\n", "Index out of range: %X State=%p Num=%X\n",
index, walk_state, state->results.num_results)); index, walk_state, state->results.num_results));
...@@ -196,7 +196,7 @@ acpi_ds_result_pop ( ...@@ -196,7 +196,7 @@ acpi_ds_result_pop (
state->results.num_results--; state->results.num_results--;
for (index = OBJ_NUM_OPERANDS; index; index--) { for (index = ACPI_OBJ_NUM_OPERANDS; index; index--) {
/* Check for a valid result object */ /* Check for a valid result object */
if (state->results.obj_desc [index -1]) { if (state->results.obj_desc [index -1]) {
...@@ -312,7 +312,7 @@ acpi_ds_result_push ( ...@@ -312,7 +312,7 @@ acpi_ds_result_push (
return (AE_AML_INTERNAL); return (AE_AML_INTERNAL);
} }
if (state->results.num_results == OBJ_NUM_OPERANDS) { if (state->results.num_results == ACPI_OBJ_NUM_OPERANDS) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Result stack overflow: Obj=%p State=%p Num=%X\n", "Result stack overflow: Obj=%p State=%p Num=%X\n",
object, walk_state, state->results.num_results)); object, walk_state, state->results.num_results));
...@@ -440,7 +440,7 @@ acpi_ds_obj_stack_delete_all ( ...@@ -440,7 +440,7 @@ acpi_ds_obj_stack_delete_all (
/* The stack size is configurable, but fixed */ /* The stack size is configurable, but fixed */
for (i = 0; i < OBJ_NUM_OPERANDS; i++) { for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++) {
if (walk_state->operands[i]) { if (walk_state->operands[i]) {
acpi_ut_remove_reference (walk_state->operands[i]); acpi_ut_remove_reference (walk_state->operands[i]);
walk_state->operands[i] = NULL; walk_state->operands[i] = NULL;
...@@ -474,7 +474,7 @@ acpi_ds_obj_stack_push ( ...@@ -474,7 +474,7 @@ acpi_ds_obj_stack_push (
/* Check for stack overflow */ /* Check for stack overflow */
if (walk_state->num_operands >= OBJ_NUM_OPERANDS) { if (walk_state->num_operands >= ACPI_OBJ_NUM_OPERANDS) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"overflow! Obj=%p State=%p #Ops=%X\n", "overflow! Obj=%p State=%p #Ops=%X\n",
object, walk_state, walk_state->num_operands)); object, walk_state, walk_state->num_operands));
...@@ -922,7 +922,7 @@ acpi_ds_init_aml_walk ( ...@@ -922,7 +922,7 @@ acpi_ds_init_aml_walk (
/* Init the method arguments */ /* Init the method arguments */
status = acpi_ds_method_data_init_args (params, MTH_NUM_ARGS, walk_state); status = acpi_ds_method_data_init_args (params, ACPI_METHOD_NUM_ARGS, walk_state);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
# #
obj-y := evevent.o evregion.o evsci.o evxfevnt.o \ obj-y := evevent.o evregion.o evsci.o evxfevnt.o \
evmisc.o evrgnini.o evxface.o evxfregn.o evmisc.o evrgnini.o evxface.o evxfregn.o \
evgpe.o
EXTRA_CFLAGS += $(ACPI_CFLAGS) EXTRA_CFLAGS += $(ACPI_CFLAGS)
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: evevent - Fixed and General Purpose Even handling and dispatch * Module Name: evevent - Fixed Event handling and dispatch
* $Revision: 99 $ * $Revision: 104 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -67,7 +67,7 @@ acpi_ev_initialize ( ...@@ -67,7 +67,7 @@ acpi_ev_initialize (
*/ */
status = acpi_ev_fixed_event_initialize (); status = acpi_ev_fixed_event_initialize ();
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, ACPI_REPORT_ERROR ((
"Unable to initialize fixed events, %s\n", "Unable to initialize fixed events, %s\n",
acpi_format_exception (status))); acpi_format_exception (status)));
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
...@@ -75,7 +75,7 @@ acpi_ev_initialize ( ...@@ -75,7 +75,7 @@ acpi_ev_initialize (
status = acpi_ev_gpe_initialize (); status = acpi_ev_gpe_initialize ();
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, ACPI_REPORT_ERROR ((
"Unable to initialize general purpose events, %s\n", "Unable to initialize general purpose events, %s\n",
acpi_format_exception (status))); acpi_format_exception (status)));
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
...@@ -111,7 +111,7 @@ acpi_ev_handler_initialize ( ...@@ -111,7 +111,7 @@ acpi_ev_handler_initialize (
status = acpi_ev_install_sci_handler (); status = acpi_ev_install_sci_handler ();
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, ACPI_REPORT_ERROR ((
"Unable to install System Control Interrupt Handler, %s\n", "Unable to install System Control Interrupt Handler, %s\n",
acpi_format_exception (status))); acpi_format_exception (status)));
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
...@@ -121,7 +121,7 @@ acpi_ev_handler_initialize ( ...@@ -121,7 +121,7 @@ acpi_ev_handler_initialize (
status = acpi_ev_init_gpe_control_methods (); status = acpi_ev_init_gpe_control_methods ();
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, ACPI_REPORT_ERROR ((
"Unable to initialize GPE control methods, %s\n", "Unable to initialize GPE control methods, %s\n",
acpi_format_exception (status))); acpi_format_exception (status)));
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
...@@ -131,7 +131,7 @@ acpi_ev_handler_initialize ( ...@@ -131,7 +131,7 @@ acpi_ev_handler_initialize (
status = acpi_ev_init_global_lock_handler (); status = acpi_ev_init_global_lock_handler ();
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, ACPI_REPORT_ERROR ((
"Unable to initialize Global Lock handler, %s\n", "Unable to initialize Global Lock handler, %s\n",
acpi_format_exception (status))); acpi_format_exception (status)));
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
...@@ -288,666 +288,3 @@ acpi_ev_fixed_event_dispatch ( ...@@ -288,666 +288,3 @@ acpi_ev_fixed_event_dispatch (
} }
/*******************************************************************************
*
* FUNCTION: Acpi_ev_gpe_initialize
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Initialize the GPE data structures
*
******************************************************************************/
acpi_status
acpi_ev_gpe_initialize (void)
{
NATIVE_UINT_MAX32 i;
NATIVE_UINT_MAX32 j;
u32 gpe_block;
u32 gpe_register;
u32 gpe_number_index;
u32 gpe_number;
ACPI_GPE_REGISTER_INFO *gpe_register_info;
acpi_status status;
ACPI_FUNCTION_TRACE ("Ev_gpe_initialize");
/*
* Initialize the GPE Block globals
*
* Why the GPE register block lengths divided by 2: From the ACPI Spec,
* section "General-Purpose Event Registers", we have:
*
* "Each register block contains two registers of equal length
* GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the
* GPE0_STS and GPE0_EN registers is equal to half the GPE0_LEN
* The length of the GPE1_STS and GPE1_EN registers is equal to
* half the GPE1_LEN. If a generic register block is not supported
* then its respective block pointer and block length values in the
* 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 = 0;
acpi_gbl_gpe_block_info[1].register_count = 0;
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;
/*
* Determine the maximum GPE number for this machine.
* Note: both GPE0 and GPE1 are optional, and either can exist without
* the other.
* If EITHER the register length OR the block address are zero, then that
* particular block is not supported.
*/
if (acpi_gbl_FADT->Xgpe0_blk.register_bit_width && ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe0_blk.address)) {
/* GPE block 0 exists (has length and address > 0) */
acpi_gbl_gpe_block_info[0].register_count = (u16) ACPI_DIV_16 (acpi_gbl_FADT->Xgpe0_blk.register_bit_width);
acpi_gbl_gpe_number_max = ACPI_MUL_8 (acpi_gbl_gpe_block_info[0].register_count) - 1;
}
if (acpi_gbl_FADT->Xgpe1_blk.register_bit_width && ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe1_blk.address)) {
/* GPE block 1 exists (has length and address > 0) */
acpi_gbl_gpe_block_info[1].register_count = (u16) ACPI_DIV_16 (acpi_gbl_FADT->Xgpe1_blk.register_bit_width);
/* Check for GPE0/GPE1 overlap (if both banks exist) */
if ((acpi_gbl_gpe_block_info[0].register_count) &&
(acpi_gbl_gpe_number_max >= acpi_gbl_FADT->gpe1_base)) {
ACPI_REPORT_ERROR ((
"GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d)\n",
acpi_gbl_gpe_number_max, acpi_gbl_FADT->gpe1_base,
acpi_gbl_FADT->gpe1_base + (ACPI_MUL_8 (acpi_gbl_gpe_block_info[1].register_count) - 1)));
return_ACPI_STATUS (AE_BAD_VALUE);
}
/*
* GPE0 and GPE1 do not have to be contiguous in the GPE number space,
* But, GPE0 always starts at zero.
*/
acpi_gbl_gpe_number_max = acpi_gbl_FADT->gpe1_base +
(ACPI_MUL_8 (acpi_gbl_gpe_block_info[1].register_count) - 1);
}
/* Warn and exit if there are no GPE registers */
acpi_gbl_gpe_register_count = acpi_gbl_gpe_block_info[0].register_count +
acpi_gbl_gpe_block_info[1].register_count;
if (!acpi_gbl_gpe_register_count) {
ACPI_REPORT_WARNING (("There are no GPE blocks defined in the FADT\n"));
return_ACPI_STATUS (AE_OK);
}
/* Check for Max GPE number out-of-range */
if (acpi_gbl_gpe_number_max > ACPI_GPE_MAX) {
ACPI_REPORT_ERROR (("Maximum GPE number from FADT is too large: 0x%X\n",
acpi_gbl_gpe_number_max));
return_ACPI_STATUS (AE_BAD_VALUE);
}
/* Allocate the GPE number-to-index translation table */
acpi_gbl_gpe_number_to_index = ACPI_MEM_CALLOCATE (
sizeof (ACPI_GPE_INDEX_INFO) *
((ACPI_SIZE) acpi_gbl_gpe_number_max + 1));
if (!acpi_gbl_gpe_number_to_index) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not allocate the Gpe_number_to_index table\n"));
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Set the Gpe index table to GPE_INVALID */
ACPI_MEMSET (acpi_gbl_gpe_number_to_index, (int) ACPI_GPE_INVALID,
sizeof (ACPI_GPE_INDEX_INFO) * ((ACPI_SIZE) acpi_gbl_gpe_number_max + 1));
/* Allocate the GPE register information block */
acpi_gbl_gpe_register_info = ACPI_MEM_CALLOCATE (
(ACPI_SIZE) acpi_gbl_gpe_register_count *
sizeof (ACPI_GPE_REGISTER_INFO));
if (!acpi_gbl_gpe_register_info) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not allocate the Gpe_register_info table\n"));
goto error_exit1;
}
/*
* Allocate the GPE dispatch handler block. There are eight distinct GPEs
* per register. Initialization to zeros is sufficient.
*/
acpi_gbl_gpe_number_info = ACPI_MEM_CALLOCATE (
(ACPI_SIZE) ACPI_MUL_8 (acpi_gbl_gpe_register_count) *
sizeof (ACPI_GPE_NUMBER_INFO));
if (!acpi_gbl_gpe_number_info) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not allocate the Gpe_number_info table\n"));
goto error_exit2;
}
/*
* Initialize the GPE information and validation tables. A goal of these
* tables is to hide the fact that there are two separate GPE register sets
* in a given gpe hardware block, the status registers occupy the first half,
* and the enable registers occupy the second half. Another goal is to hide
* the fact that there may be multiple GPE hardware blocks.
*/
gpe_register = 0;
gpe_number_index = 0;
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++) {
gpe_register_info = &acpi_gbl_gpe_register_info[gpe_register];
/* 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)));
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].block_address->address_space_id;
gpe_register_info->enable_address.address_space_id = acpi_gbl_gpe_block_info[gpe_block].block_address->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 */
for (j = 0; j < 8; j++) {
gpe_number = gpe_register_info->base_gpe_number + j;
acpi_gbl_gpe_number_to_index[gpe_number].number_index = (u8) gpe_number_index;
acpi_gbl_gpe_number_info[gpe_number_index].bit_mask = acpi_gbl_decode_to8bit[j];
gpe_number_index++;
}
/*
* Clear the status/enable registers. Note that status registers
* are cleared by writing a '1', while enable registers are cleared
* by writing a '0'.
*/
status = acpi_hw_low_level_write (8, 0x00, &gpe_register_info->enable_address, 0);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
status = acpi_hw_low_level_write (8, 0xFF, &gpe_register_info->status_address, 0);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
gpe_register++;
}
if (i) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "GPE Block%d: %X registers at %8.8X%8.8X\n",
(s32) gpe_block, acpi_gbl_gpe_block_info[0].register_count,
ACPI_HIDWORD (ACPI_GET_ADDRESS (acpi_gbl_gpe_block_info[gpe_block].block_address->address)),
ACPI_LODWORD (ACPI_GET_ADDRESS (acpi_gbl_gpe_block_info[gpe_block].block_address->address))));
ACPI_REPORT_INFO (("GPE Block%d defined as GPE%d to GPE%d\n",
(s32) gpe_block,
(u32) acpi_gbl_gpe_block_info[gpe_block].block_base_number,
(u32) (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);
/* Error cleanup */
error_exit2:
ACPI_MEM_FREE (acpi_gbl_gpe_register_info);
error_exit1:
ACPI_MEM_FREE (acpi_gbl_gpe_number_to_index);
return_ACPI_STATUS (AE_NO_MEMORY);
}
/*******************************************************************************
*
* FUNCTION: Acpi_ev_save_method_info
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Called from Acpi_walk_namespace. Expects each object to be a
* control method under the _GPE portion of the namespace.
* Extract the name and GPE type from the object, saving this
* information for quick lookup during GPE dispatch
*
* The name of each GPE control method is of the form:
* "_Lnn" or "_Enn"
* Where:
* L - means that the GPE is level triggered
* E - means that the GPE is edge triggered
* nn - is the GPE number [in HEX]
*
******************************************************************************/
static acpi_status
acpi_ev_save_method_info (
acpi_handle obj_handle,
u32 level,
void *obj_desc,
void **return_value)
{
u32 gpe_number;
u32 gpe_number_index;
NATIVE_CHAR name[ACPI_NAME_SIZE + 1];
u8 type;
acpi_status status;
ACPI_FUNCTION_NAME ("Ev_save_method_info");
/* Extract the name from the object and convert to a string */
ACPI_MOVE_UNALIGNED32_TO_32 (name,
&((acpi_namespace_node *) obj_handle)->name.integer);
name[ACPI_NAME_SIZE] = 0;
/*
* Edge/Level determination is based on the 2nd character of the method name
*/
switch (name[1]) {
case 'L':
type = ACPI_EVENT_LEVEL_TRIGGERED;
break;
case 'E':
type = ACPI_EVENT_EDGE_TRIGGERED;
break;
default:
/* Unknown method type, just ignore it! */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unknown GPE method type: %s (name not of form _Lnn or _Enn)\n",
name));
return (AE_OK);
}
/* Convert the last two characters of the name to the GPE Number */
gpe_number = ACPI_STRTOUL (&name[2], NULL, 16);
if (gpe_number == ACPI_UINT32_MAX) {
/* Conversion failed; invalid method, just ignore it */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not extract GPE number from name: %s (name not of form _Lnn or _Enn)\n",
name));
return (AE_OK);
}
/* Get GPE index and ensure that we have a valid GPE number */
gpe_number_index = acpi_ev_get_gpe_number_index (gpe_number);
if (gpe_number_index == ACPI_GPE_INVALID) {
/* Not valid, all we can do here is ignore it */
return (AE_OK);
}
/*
* Now we can add this information to the Gpe_info block
* for use during dispatch of this GPE.
*/
acpi_gbl_gpe_number_info [gpe_number_index].type = type;
acpi_gbl_gpe_number_info [gpe_number_index].method_node = (acpi_namespace_node *) obj_handle;
/*
* Enable the GPE (SCIs should be disabled at this point)
*/
status = acpi_hw_enable_gpe (gpe_number);
if (ACPI_FAILURE (status)) {
return (status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Registered GPE method %s as GPE number %2.2X\n",
name, gpe_number));
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: Acpi_ev_init_gpe_control_methods
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Obtain the control methods associated with the GPEs.
* NOTE: Must be called AFTER namespace initialization!
*
******************************************************************************/
acpi_status
acpi_ev_init_gpe_control_methods (void)
{
acpi_status status;
ACPI_FUNCTION_TRACE ("Ev_init_gpe_control_methods");
/* Get a permanent handle to the _GPE object */
status = acpi_get_handle (NULL, "\\_GPE", &acpi_gbl_gpe_obj_handle);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* Traverse the namespace under \_GPE to find all methods there */
status = acpi_walk_namespace (ACPI_TYPE_METHOD, acpi_gbl_gpe_obj_handle,
ACPI_UINT32_MAX, acpi_ev_save_method_info,
NULL, NULL);
return_ACPI_STATUS (status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_ev_gpe_detect
*
* PARAMETERS: None
*
* RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
*
* DESCRIPTION: Detect if any GP events have occurred. This function is
* executed at interrupt level.
*
******************************************************************************/
u32
acpi_ev_gpe_detect (void)
{
u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
u32 i;
u32 j;
u8 enabled_status_byte;
u8 bit_mask;
ACPI_GPE_REGISTER_INFO *gpe_register_info;
u32 in_value;
acpi_status status;
ACPI_FUNCTION_NAME ("Ev_gpe_detect");
/*
* Read all of the 8-bit GPE status and enable registers
* in both of the register blocks, saving all of it.
* Find all currently active GP events.
*/
for (i = 0; i < acpi_gbl_gpe_register_count; i++) {
gpe_register_info = &acpi_gbl_gpe_register_info[i];
status = acpi_hw_low_level_read (8, &in_value, &gpe_register_info->status_address, 0);
gpe_register_info->status = (u8) in_value;
if (ACPI_FAILURE (status)) {
return (ACPI_INTERRUPT_NOT_HANDLED);
}
status = acpi_hw_low_level_read (8, &in_value, &gpe_register_info->enable_address, 0);
gpe_register_info->enable = (u8) in_value;
if (ACPI_FAILURE (status)) {
return (ACPI_INTERRUPT_NOT_HANDLED);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
"GPE block at %8.8X%8.8X - Values: Enable %02X Status %02X\n",
ACPI_HIDWORD (ACPI_GET_ADDRESS (gpe_register_info->enable_address.address)),
ACPI_LODWORD (ACPI_GET_ADDRESS (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 */
enabled_status_byte = (u8) (gpe_register_info->status &
gpe_register_info->enable);
if (!enabled_status_byte) {
/* No active GPEs in this register, move on */
continue;
}
/* Now look at the individual GPEs in this byte register */
for (j = 0, bit_mask = 1; j < 8; j++, bit_mask <<= 1) {
/* Examine one GPE bit */
if (enabled_status_byte & bit_mask) {
/*
* Found an active GPE. Dispatch the event to a handler
* or method.
*/
int_status |= acpi_ev_gpe_dispatch (
gpe_register_info->base_gpe_number + j);
}
}
}
return (int_status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_ev_asynch_execute_gpe_method
*
* PARAMETERS: Gpe_number - The 0-based GPE number
*
* RETURN: None
*
* DESCRIPTION: Perform the actual execution of a GPE control method. This
* function is called from an invocation of Acpi_os_queue_for_execution
* (and therefore does NOT execute at interrupt level) so that
* the control method itself is not executed in the context of
* the SCI interrupt handler.
*
******************************************************************************/
static void ACPI_SYSTEM_XFACE
acpi_ev_asynch_execute_gpe_method (
void *context)
{
u32 gpe_number = (u32) ACPI_TO_INTEGER (context);
u32 gpe_number_index;
ACPI_GPE_NUMBER_INFO gpe_info;
acpi_status status;
ACPI_FUNCTION_TRACE ("Ev_asynch_execute_gpe_method");
gpe_number_index = acpi_ev_get_gpe_number_index (gpe_number);
if (gpe_number_index == ACPI_GPE_INVALID) {
return_VOID;
}
/*
* Take a snapshot of the GPE info for this level - we copy the
* info to prevent a race condition with Remove_handler.
*/
status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (status)) {
return_VOID;
}
gpe_info = acpi_gbl_gpe_number_info [gpe_number_index];
status = acpi_ut_release_mutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (status)) {
return_VOID;
}
if (gpe_info.method_node) {
/*
* Invoke the GPE Method (_Lxx, _Exx):
* (Evaluate the _Lxx/_Exx control method that corresponds to this GPE.)
*/
status = acpi_ns_evaluate_by_handle (gpe_info.method_node, NULL, NULL);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("%s while evaluating method [%4.4s] for GPE[%2.2X]\n",
acpi_format_exception (status),
gpe_info.method_node->name.ascii, gpe_number));
}
}
if (gpe_info.type & ACPI_EVENT_LEVEL_TRIGGERED) {
/*
* GPE is level-triggered, we clear the GPE status bit after handling
* the event.
*/
status = acpi_hw_clear_gpe (gpe_number);
if (ACPI_FAILURE (status)) {
return_VOID;
}
}
/*
* Enable the GPE.
*/
(void) acpi_hw_enable_gpe (gpe_number);
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: Acpi_ev_gpe_dispatch
*
* PARAMETERS: Gpe_number - The 0-based GPE number
*
* RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
*
* DESCRIPTION: Dispatch a General Purpose Event to either a function (e.g. EC)
* or method (e.g. _Lxx/_Exx) handler. This function executes
* at interrupt level.
*
******************************************************************************/
u32
acpi_ev_gpe_dispatch (
u32 gpe_number)
{
u32 gpe_number_index;
ACPI_GPE_NUMBER_INFO *gpe_info;
acpi_status status;
ACPI_FUNCTION_TRACE ("Ev_gpe_dispatch");
gpe_number_index = acpi_ev_get_gpe_number_index (gpe_number);
if (gpe_number_index == ACPI_GPE_INVALID) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "GPE[%X] is not a valid event\n", gpe_number));
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
}
/*
* We don't have to worry about mutex on Gpe_info because we are
* executing at interrupt level.
*/
gpe_info = &acpi_gbl_gpe_number_info [gpe_number_index];
/*
* If edge-triggered, clear the GPE status bit now. Note that
* level-triggered events are cleared after the GPE is serviced.
*/
if (gpe_info->type & ACPI_EVENT_EDGE_TRIGGERED) {
status = acpi_hw_clear_gpe (gpe_number);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to clear GPE[%2.2X]\n", gpe_number));
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
}
}
/*
* Dispatch the GPE to either an installed handler, or the control
* method associated with this GPE (_Lxx or _Exx).
* If a handler exists, we invoke it and do not attempt to run the method.
* If there is neither a handler nor a method, we disable the level to
* prevent further events from coming in here.
*/
if (gpe_info->handler) {
/* Invoke the installed handler (at interrupt level) */
gpe_info->handler (gpe_info->context);
}
else if (gpe_info->method_node) {
/*
* Disable GPE, so it doesn't keep firing before the method has a
* chance to run.
*/
status = acpi_hw_disable_gpe (gpe_number);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to disable GPE[%2.2X]\n", gpe_number));
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
}
/*
* 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[%2.2X], event is disabled\n", gpe_number));
}
}
else {
/* No handler or method to run! */
ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: No handler or method for GPE[%2.2X], disabling event\n", gpe_number));
/*
* Disable the GPE. The GPE will remain disabled until the ACPI
* Core Subsystem is restarted, or the handler is reinstalled.
*/
status = acpi_hw_disable_gpe (gpe_number);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to disable GPE[%2.2X]\n", gpe_number));
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
}
}
/*
* It is now safe to clear level-triggered evnets.
*/
if (gpe_info->type & ACPI_EVENT_LEVEL_TRIGGERED) {
status = acpi_hw_clear_gpe (gpe_number);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to clear GPE[%2.2X]\n", gpe_number));
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
}
}
return_VALUE (ACPI_INTERRUPT_HANDLED);
}
/******************************************************************************
*
* Module Name: evgpe - General Purpose Event handling and dispatch
* $Revision: 1 $
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "acpi.h"
#include "acevents.h"
#include "acnamesp.h"
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evgpe")
/*******************************************************************************
*
* FUNCTION: Acpi_ev_gpe_initialize
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Initialize the GPE data structures
*
******************************************************************************/
acpi_status
acpi_ev_gpe_initialize (void)
{
NATIVE_UINT_MAX32 i;
NATIVE_UINT_MAX32 j;
u32 gpe_block;
u32 gpe_register;
u32 gpe_number_index;
u32 gpe_number;
ACPI_GPE_REGISTER_INFO *gpe_register_info;
acpi_status status;
ACPI_FUNCTION_TRACE ("Ev_gpe_initialize");
/*
* Initialize the GPE Block globals
*
* Why the GPE register block lengths are divided by 2: From the ACPI Spec,
* section "General-Purpose Event Registers", we have:
*
* "Each register block contains two registers of equal length
* GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the
* GPE0_STS and GPE0_EN registers is equal to half the GPE0_LEN
* The length of the GPE1_STS and GPE1_EN registers is equal to
* half the GPE1_LEN. If a generic register block is not supported
* then its respective block pointer and block length values in the
* 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 = 0;
acpi_gbl_gpe_block_info[1].register_count = 0;
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;
/*
* Determine the maximum GPE number for this machine.
*
* Note: both GPE0 and GPE1 are optional, and either can exist without
* the other.
* If EITHER the register length OR the block address are zero, then that
* particular block is not supported.
*/
if (acpi_gbl_FADT->Xgpe0_blk.register_bit_width && ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe0_blk.address)) {
/* GPE block 0 exists (has both length and address > 0) */
acpi_gbl_gpe_block_info[0].register_count = (u16) (acpi_gbl_FADT->Xgpe0_blk.register_bit_width / (ACPI_GPE_REGISTER_WIDTH * 2));
acpi_gbl_gpe_number_max = (acpi_gbl_gpe_block_info[0].register_count * ACPI_GPE_REGISTER_WIDTH) - 1;
}
if (acpi_gbl_FADT->Xgpe1_blk.register_bit_width && ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe1_blk.address)) {
/* GPE block 1 exists (has both length and address > 0) */
acpi_gbl_gpe_block_info[1].register_count = (u16) (acpi_gbl_FADT->Xgpe1_blk.register_bit_width / (ACPI_GPE_REGISTER_WIDTH * 2));
/* Check for GPE0/GPE1 overlap (if both banks exist) */
if ((acpi_gbl_gpe_block_info[0].register_count) &&
(acpi_gbl_gpe_number_max >= acpi_gbl_FADT->gpe1_base)) {
ACPI_REPORT_ERROR ((
"GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1\n",
acpi_gbl_gpe_number_max, acpi_gbl_FADT->gpe1_base,
acpi_gbl_FADT->gpe1_base + ((acpi_gbl_gpe_block_info[1].register_count * ACPI_GPE_REGISTER_WIDTH) - 1)));
/* Ignore GPE1 block by setting the register count to zero */
acpi_gbl_gpe_block_info[1].register_count = 0;
}
else {
/*
* GPE0 and GPE1 do not have to be contiguous in the GPE number space,
* But, GPE0 always starts at zero.
*/
acpi_gbl_gpe_number_max = acpi_gbl_FADT->gpe1_base +
((acpi_gbl_gpe_block_info[1].register_count * ACPI_GPE_REGISTER_WIDTH) - 1);
}
}
/* Exit if there are no GPE registers */
acpi_gbl_gpe_register_count = acpi_gbl_gpe_block_info[0].register_count +
acpi_gbl_gpe_block_info[1].register_count;
if (!acpi_gbl_gpe_register_count) {
/* GPEs are not required by ACPI, this is OK */
ACPI_REPORT_INFO (("There are no GPE blocks defined in the FADT\n"));
return_ACPI_STATUS (AE_OK);
}
/* Check for Max GPE number out-of-range */
if (acpi_gbl_gpe_number_max > ACPI_GPE_MAX) {
ACPI_REPORT_ERROR (("Maximum GPE number from FADT is too large: 0x%X\n",
acpi_gbl_gpe_number_max));
return_ACPI_STATUS (AE_BAD_VALUE);
}
/* Allocate the GPE number-to-index translation table */
acpi_gbl_gpe_number_to_index = ACPI_MEM_CALLOCATE (
sizeof (ACPI_GPE_INDEX_INFO) *
((ACPI_SIZE) acpi_gbl_gpe_number_max + 1));
if (!acpi_gbl_gpe_number_to_index) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not allocate the Gpe_number_to_index table\n"));
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Set the Gpe index table to GPE_INVALID */
ACPI_MEMSET (acpi_gbl_gpe_number_to_index, (int) ACPI_GPE_INVALID,
sizeof (ACPI_GPE_INDEX_INFO) * ((ACPI_SIZE) acpi_gbl_gpe_number_max + 1));
/* Allocate the GPE register information block */
acpi_gbl_gpe_register_info = ACPI_MEM_CALLOCATE (
(ACPI_SIZE) acpi_gbl_gpe_register_count *
sizeof (ACPI_GPE_REGISTER_INFO));
if (!acpi_gbl_gpe_register_info) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not allocate the Gpe_register_info table\n"));
goto error_exit1;
}
/*
* Allocate the GPE dispatch handler block. There are eight distinct GPEs
* per register. Initialization to zeros is sufficient.
*/
acpi_gbl_gpe_number_info = ACPI_MEM_CALLOCATE (
(ACPI_SIZE) (acpi_gbl_gpe_register_count * ACPI_GPE_REGISTER_WIDTH) *
sizeof (ACPI_GPE_NUMBER_INFO));
if (!acpi_gbl_gpe_number_info) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not allocate the Gpe_number_info table\n"));
goto error_exit2;
}
/*
* Initialize the GPE information and validation tables. A goal of these
* tables is to hide the fact that there are two separate GPE register sets
* in a given gpe hardware block, the status registers occupy the first half,
* and the enable registers occupy the second half. Another goal is to hide
* the fact that there may be multiple GPE hardware blocks.
*/
gpe_register = 0;
gpe_number_index = 0;
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++) {
gpe_register_info = &acpi_gbl_gpe_register_info[gpe_register];
/* 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
+ (i * ACPI_GPE_REGISTER_WIDTH));
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].block_address->address_space_id;
gpe_register_info->enable_address.address_space_id = acpi_gbl_gpe_block_info[gpe_block].block_address->address_space_id;
gpe_register_info->status_address.register_bit_width = ACPI_GPE_REGISTER_WIDTH;
gpe_register_info->enable_address.register_bit_width = ACPI_GPE_REGISTER_WIDTH;
gpe_register_info->status_address.register_bit_offset = ACPI_GPE_REGISTER_WIDTH;
gpe_register_info->enable_address.register_bit_offset = ACPI_GPE_REGISTER_WIDTH;
/* Init the Index mapping info for each GPE number within this register */
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
gpe_number = gpe_register_info->base_gpe_number + j;
acpi_gbl_gpe_number_to_index[gpe_number].number_index = (u8) gpe_number_index;
acpi_gbl_gpe_number_info[gpe_number_index].bit_mask = acpi_gbl_decode_to8bit[j];
gpe_number_index++;
}
/*
* Clear the status/enable registers. Note that status registers
* are cleared by writing a '1', while enable registers are cleared
* by writing a '0'.
*/
status = acpi_hw_low_level_write (ACPI_GPE_REGISTER_WIDTH, 0x00, &gpe_register_info->enable_address, 0);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
status = acpi_hw_low_level_write (ACPI_GPE_REGISTER_WIDTH, 0xFF, &gpe_register_info->status_address, 0);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
gpe_register++;
}
if (i) {
/* Dump info about this valid GPE block */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "GPE Block%d: %X registers at %8.8X%8.8X\n",
(s32) gpe_block, acpi_gbl_gpe_block_info[0].register_count,
ACPI_HIDWORD (ACPI_GET_ADDRESS (acpi_gbl_gpe_block_info[gpe_block].block_address->address)),
ACPI_LODWORD (ACPI_GET_ADDRESS (acpi_gbl_gpe_block_info[gpe_block].block_address->address))));
ACPI_REPORT_INFO (("GPE Block%d defined as GPE%d to GPE%d\n",
(s32) gpe_block,
(u32) acpi_gbl_gpe_block_info[gpe_block].block_base_number,
(u32) (acpi_gbl_gpe_block_info[gpe_block].block_base_number +
((acpi_gbl_gpe_block_info[gpe_block].register_count * ACPI_GPE_REGISTER_WIDTH) -1))));
}
}
return_ACPI_STATUS (AE_OK);
/* Error cleanup */
error_exit2:
ACPI_MEM_FREE (acpi_gbl_gpe_register_info);
error_exit1:
ACPI_MEM_FREE (acpi_gbl_gpe_number_to_index);
return_ACPI_STATUS (AE_NO_MEMORY);
}
/*******************************************************************************
*
* FUNCTION: Acpi_ev_save_method_info
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Called from Acpi_walk_namespace. Expects each object to be a
* control method under the _GPE portion of the namespace.
* Extract the name and GPE type from the object, saving this
* information for quick lookup during GPE dispatch
*
* The name of each GPE control method is of the form:
* "_Lnn" or "_Enn"
* Where:
* L - means that the GPE is level triggered
* E - means that the GPE is edge triggered
* nn - is the GPE number [in HEX]
*
******************************************************************************/
static acpi_status
acpi_ev_save_method_info (
acpi_handle obj_handle,
u32 level,
void *obj_desc,
void **return_value)
{
u32 gpe_number;
u32 gpe_number_index;
NATIVE_CHAR name[ACPI_NAME_SIZE + 1];
u8 type;
acpi_status status;
ACPI_FUNCTION_NAME ("Ev_save_method_info");
/* Extract the name from the object and convert to a string */
ACPI_MOVE_UNALIGNED32_TO_32 (name,
&((acpi_namespace_node *) obj_handle)->name.integer);
name[ACPI_NAME_SIZE] = 0;
/*
* Edge/Level determination is based on the 2nd character of the method name
*/
switch (name[1]) {
case 'L':
type = ACPI_EVENT_LEVEL_TRIGGERED;
break;
case 'E':
type = ACPI_EVENT_EDGE_TRIGGERED;
break;
default:
/* Unknown method type, just ignore it! */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unknown GPE method type: %s (name not of form _Lnn or _Enn)\n",
name));
return (AE_OK);
}
/* Convert the last two characters of the name to the GPE Number */
gpe_number = ACPI_STRTOUL (&name[2], NULL, 16);
if (gpe_number == ACPI_UINT32_MAX) {
/* Conversion failed; invalid method, just ignore it */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not extract GPE number from name: %s (name not of form _Lnn or _Enn)\n",
name));
return (AE_OK);
}
/* Get GPE index and ensure that we have a valid GPE number */
gpe_number_index = acpi_ev_get_gpe_number_index (gpe_number);
if (gpe_number_index == ACPI_GPE_INVALID) {
/* Not valid, all we can do here is ignore it */
return (AE_OK);
}
/*
* Now we can add this information to the Gpe_info block
* for use during dispatch of this GPE.
*/
acpi_gbl_gpe_number_info [gpe_number_index].type = type;
acpi_gbl_gpe_number_info [gpe_number_index].method_node = (acpi_namespace_node *) obj_handle;
/*
* Enable the GPE (SCIs should be disabled at this point)
*/
status = acpi_hw_enable_gpe (gpe_number);
if (ACPI_FAILURE (status)) {
return (status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Registered GPE method %s as GPE number %2.2X\n",
name, gpe_number));
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: Acpi_ev_init_gpe_control_methods
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Obtain the control methods associated with the GPEs.
* NOTE: Must be called AFTER namespace initialization!
*
******************************************************************************/
acpi_status
acpi_ev_init_gpe_control_methods (void)
{
acpi_status status;
ACPI_FUNCTION_TRACE ("Ev_init_gpe_control_methods");
/* Get a permanent handle to the _GPE object */
status = acpi_get_handle (NULL, "\\_GPE", &acpi_gbl_gpe_obj_handle);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* Traverse the namespace under \_GPE to find all methods there */
status = acpi_walk_namespace (ACPI_TYPE_METHOD, acpi_gbl_gpe_obj_handle,
ACPI_UINT32_MAX, acpi_ev_save_method_info,
NULL, NULL);
return_ACPI_STATUS (status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_ev_gpe_detect
*
* PARAMETERS: None
*
* RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
*
* DESCRIPTION: Detect if any GP events have occurred. This function is
* executed at interrupt level.
*
******************************************************************************/
u32
acpi_ev_gpe_detect (void)
{
u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
u32 i;
u32 j;
u8 enabled_status_byte;
u8 bit_mask;
ACPI_GPE_REGISTER_INFO *gpe_register_info;
u32 in_value;
acpi_status status;
ACPI_FUNCTION_NAME ("Ev_gpe_detect");
/*
* Read all of the 8-bit GPE status and enable registers
* in both of the register blocks, saving all of it.
* Find all currently active GP events.
*/
for (i = 0; i < acpi_gbl_gpe_register_count; i++) {
gpe_register_info = &acpi_gbl_gpe_register_info[i];
status = acpi_hw_low_level_read (ACPI_GPE_REGISTER_WIDTH, &in_value, &gpe_register_info->status_address, 0);
gpe_register_info->status = (u8) in_value;
if (ACPI_FAILURE (status)) {
return (ACPI_INTERRUPT_NOT_HANDLED);
}
status = acpi_hw_low_level_read (ACPI_GPE_REGISTER_WIDTH, &in_value, &gpe_register_info->enable_address, 0);
gpe_register_info->enable = (u8) in_value;
if (ACPI_FAILURE (status)) {
return (ACPI_INTERRUPT_NOT_HANDLED);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
"GPE block at %8.8X%8.8X - Values: Enable %02X Status %02X\n",
ACPI_HIDWORD (ACPI_GET_ADDRESS (gpe_register_info->enable_address.address)),
ACPI_LODWORD (ACPI_GET_ADDRESS (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 */
enabled_status_byte = (u8) (gpe_register_info->status &
gpe_register_info->enable);
if (!enabled_status_byte) {
/* No active GPEs in this register, move on */
continue;
}
/* Now look at the individual GPEs in this byte register */
for (j = 0, bit_mask = 1; j < ACPI_GPE_REGISTER_WIDTH; j++, bit_mask <<= 1) {
/* Examine one GPE bit */
if (enabled_status_byte & bit_mask) {
/*
* Found an active GPE. Dispatch the event to a handler
* or method.
*/
int_status |= acpi_ev_gpe_dispatch (
gpe_register_info->base_gpe_number + j);
}
}
}
return (int_status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_ev_asynch_execute_gpe_method
*
* PARAMETERS: Gpe_number - The 0-based GPE number
*
* RETURN: None
*
* DESCRIPTION: Perform the actual execution of a GPE control method. This
* function is called from an invocation of Acpi_os_queue_for_execution
* (and therefore does NOT execute at interrupt level) so that
* the control method itself is not executed in the context of
* the SCI interrupt handler.
*
******************************************************************************/
static void ACPI_SYSTEM_XFACE
acpi_ev_asynch_execute_gpe_method (
void *context)
{
u32 gpe_number = (u32) ACPI_TO_INTEGER (context);
u32 gpe_number_index;
ACPI_GPE_NUMBER_INFO gpe_info;
acpi_status status;
ACPI_FUNCTION_TRACE ("Ev_asynch_execute_gpe_method");
gpe_number_index = acpi_ev_get_gpe_number_index (gpe_number);
if (gpe_number_index == ACPI_GPE_INVALID) {
return_VOID;
}
/*
* Take a snapshot of the GPE info for this level - we copy the
* info to prevent a race condition with Remove_handler.
*/
status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (status)) {
return_VOID;
}
gpe_info = acpi_gbl_gpe_number_info [gpe_number_index];
status = acpi_ut_release_mutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (status)) {
return_VOID;
}
if (gpe_info.method_node) {
/*
* Invoke the GPE Method (_Lxx, _Exx):
* (Evaluate the _Lxx/_Exx control method that corresponds to this GPE.)
*/
status = acpi_ns_evaluate_by_handle (gpe_info.method_node, NULL, NULL);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("%s while evaluating method [%4.4s] for GPE[%2.2X]\n",
acpi_format_exception (status),
gpe_info.method_node->name.ascii, gpe_number));
}
}
if (gpe_info.type & ACPI_EVENT_LEVEL_TRIGGERED) {
/*
* GPE is level-triggered, we clear the GPE status bit after handling
* the event.
*/
status = acpi_hw_clear_gpe (gpe_number);
if (ACPI_FAILURE (status)) {
return_VOID;
}
}
/*
* Enable the GPE.
*/
(void) acpi_hw_enable_gpe (gpe_number);
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: Acpi_ev_gpe_dispatch
*
* PARAMETERS: Gpe_number - The 0-based GPE number
*
* RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
*
* DESCRIPTION: Dispatch a General Purpose Event to either a function (e.g. EC)
* or method (e.g. _Lxx/_Exx) handler. This function executes
* at interrupt level.
*
******************************************************************************/
u32
acpi_ev_gpe_dispatch (
u32 gpe_number)
{
u32 gpe_number_index;
ACPI_GPE_NUMBER_INFO *gpe_info;
acpi_status status;
ACPI_FUNCTION_TRACE ("Ev_gpe_dispatch");
gpe_number_index = acpi_ev_get_gpe_number_index (gpe_number);
if (gpe_number_index == ACPI_GPE_INVALID) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "GPE[%X] is not a valid event\n", gpe_number));
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
}
/*
* We don't have to worry about mutex on Gpe_info because we are
* executing at interrupt level.
*/
gpe_info = &acpi_gbl_gpe_number_info [gpe_number_index];
/*
* If edge-triggered, clear the GPE status bit now. Note that
* level-triggered events are cleared after the GPE is serviced.
*/
if (gpe_info->type & ACPI_EVENT_EDGE_TRIGGERED) {
status = acpi_hw_clear_gpe (gpe_number);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to clear GPE[%2.2X]\n", gpe_number));
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
}
}
/*
* Dispatch the GPE to either an installed handler, or the control
* method associated with this GPE (_Lxx or _Exx).
* If a handler exists, we invoke it and do not attempt to run the method.
* If there is neither a handler nor a method, we disable the level to
* prevent further events from coming in here.
*/
if (gpe_info->handler) {
/* Invoke the installed handler (at interrupt level) */
gpe_info->handler (gpe_info->context);
}
else if (gpe_info->method_node) {
/*
* Disable GPE, so it doesn't keep firing before the method has a
* chance to run.
*/
status = acpi_hw_disable_gpe (gpe_number);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to disable GPE[%2.2X]\n", gpe_number));
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
}
/*
* 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[%2.2X], event is disabled\n", gpe_number));
}
}
else {
/* No handler or method to run! */
ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: No handler or method for GPE[%2.2X], disabling event\n", gpe_number));
/*
* Disable the GPE. The GPE will remain disabled until the ACPI
* Core Subsystem is restarted, or the handler is reinstalled.
*/
status = acpi_hw_disable_gpe (gpe_number);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to disable GPE[%2.2X]\n", gpe_number));
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
}
}
/*
* It is now safe to clear level-triggered evnets.
*/
if (gpe_info->type & ACPI_EVENT_LEVEL_TRIGGERED) {
status = acpi_hw_clear_gpe (gpe_number);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to clear GPE[%2.2X]\n", gpe_number));
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
}
}
return_VALUE (ACPI_INTERRUPT_HANDLED);
}
/****************************************************************************** /******************************************************************************
* *
* Module Name: evregion - ACPI Address_space (Op_region) handler dispatch * Module Name: evregion - ACPI Address_space (Op_region) handler dispatch
* $Revision: 135 $ * $Revision: 136 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -172,7 +172,7 @@ acpi_ev_execute_reg_method ( ...@@ -172,7 +172,7 @@ acpi_ev_execute_reg_method (
/* /*
* Execute the method, no return value * Execute the method, no return value
*/ */
ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname (region_obj2->extra.method_REG, " [Method]")); ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname (ACPI_TYPE_METHOD, region_obj2->extra.method_REG, NULL));
status = acpi_ns_evaluate_by_handle (region_obj2->extra.method_REG, params, NULL); status = acpi_ns_evaluate_by_handle (region_obj2->extra.method_REG, params, NULL);
acpi_ut_remove_reference (params[1]); acpi_ut_remove_reference (params[1]);
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: evxfevnt - External Interfaces, ACPI event disable/enable * Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
* $Revision: 57 $ * $Revision: 59 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -60,18 +60,18 @@ acpi_enable (void) ...@@ -60,18 +60,18 @@ acpi_enable (void)
} }
if (acpi_hw_get_mode() == ACPI_SYS_MODE_ACPI) { if (acpi_hw_get_mode() == ACPI_SYS_MODE_ACPI) {
ACPI_DEBUG_PRINT ((ACPI_DB_OK, "Already in ACPI mode.\n")); ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "System is already in ACPI mode\n"));
} }
else { else {
/* Transition to ACPI mode */ /* Transition to ACPI mode */
status = acpi_hw_set_mode (ACPI_SYS_MODE_ACPI); status = acpi_hw_set_mode (ACPI_SYS_MODE_ACPI);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Could not transition to ACPI mode.\n")); ACPI_REPORT_ERROR (("Could not transition to ACPI mode.\n"));
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
ACPI_DEBUG_PRINT ((ACPI_DB_OK, "Transition to ACPI mode successful\n")); ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Transition to ACPI mode successful\n"));
} }
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
...@@ -104,18 +104,19 @@ acpi_disable (void) ...@@ -104,18 +104,19 @@ acpi_disable (void)
} }
if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) { if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) {
ACPI_DEBUG_PRINT ((ACPI_DB_OK, "Already in LEGACY mode.\n")); ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "System is already in legacy (non-ACPI) mode\n"));
} }
else { else {
/* Transition to LEGACY mode */ /* Transition to LEGACY mode */
status = acpi_hw_set_mode (ACPI_SYS_MODE_LEGACY); status = acpi_hw_set_mode (ACPI_SYS_MODE_LEGACY);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not transition to LEGACY mode.")); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not exit ACPI mode to legacy mode"));
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
ACPI_DEBUG_PRINT ((ACPI_DB_OK, "Transition to LEGACY mode successful\n")); ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI mode disabled\n"));
} }
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: exconvrt - Object conversion routines * Module Name: exconvrt - Object conversion routines
* $Revision: 44 $ * $Revision: 45 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -230,7 +230,7 @@ acpi_ex_convert_to_buffer ( ...@@ -230,7 +230,7 @@ acpi_ex_convert_to_buffer (
* Create a new Buffer object * Create a new Buffer object
* Size will be the string length * Size will be the string length
*/ */
ret_desc = acpi_ut_create_buffer_object (obj_desc->string.length); ret_desc = acpi_ut_create_buffer_object ((ACPI_SIZE) obj_desc->string.length);
if (!ret_desc) { if (!ret_desc) {
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
} }
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: exfield - ACPI AML (p-code) execution - field manipulation * Module Name: exfield - ACPI AML (p-code) execution - field manipulation
* $Revision: 115 $ * $Revision: 116 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -56,7 +56,7 @@ acpi_ex_read_data_from_field ( ...@@ -56,7 +56,7 @@ acpi_ex_read_data_from_field (
{ {
acpi_status status; acpi_status status;
acpi_operand_object *buffer_desc; acpi_operand_object *buffer_desc;
u32 length; ACPI_SIZE length;
void *buffer; void *buffer;
u8 locked; u8 locked;
...@@ -118,7 +118,7 @@ acpi_ex_read_data_from_field ( ...@@ -118,7 +118,7 @@ acpi_ex_read_data_from_field (
* *
* Note: Field.length is in bits. * Note: Field.length is in bits.
*/ */
length = ACPI_ROUND_BITS_UP_TO_BYTES (obj_desc->field.bit_length); length = (ACPI_SIZE) ACPI_ROUND_BITS_UP_TO_BYTES (obj_desc->field.bit_length);
if (length > acpi_gbl_integer_byte_width) { if (length > acpi_gbl_integer_byte_width) {
/* Field is too large for an Integer, create a Buffer instead */ /* Field is too large for an Integer, create a Buffer instead */
...@@ -143,7 +143,7 @@ acpi_ex_read_data_from_field ( ...@@ -143,7 +143,7 @@ acpi_ex_read_data_from_field (
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Obj=%p Type=%X Buf=%p Len=%X\n", "Obj=%p Type=%X Buf=%p Len=%X\n",
obj_desc, ACPI_GET_OBJECT_TYPE (obj_desc), buffer, length)); obj_desc, ACPI_GET_OBJECT_TYPE (obj_desc), buffer, (u32) length));
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Field_write: Bit_len=%X Bit_off=%X Byte_off=%X\n", "Field_write: Bit_len=%X Bit_off=%X Byte_off=%X\n",
obj_desc->common_field.bit_length, obj_desc->common_field.bit_length,
...@@ -156,7 +156,7 @@ acpi_ex_read_data_from_field ( ...@@ -156,7 +156,7 @@ acpi_ex_read_data_from_field (
/* Read from the field */ /* Read from the field */
status = acpi_ex_extract_from_field (obj_desc, buffer, length); status = acpi_ex_extract_from_field (obj_desc, buffer, (u32) length);
acpi_ex_release_global_lock (locked); acpi_ex_release_global_lock (locked);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes * Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
* $Revision: 112 $ * $Revision: 113 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -281,7 +281,7 @@ acpi_ex_do_concatenate ( ...@@ -281,7 +281,7 @@ acpi_ex_do_concatenate (
/* Operand0 is string */ /* Operand0 is string */
new_buf = ACPI_MEM_ALLOCATE ((ACPI_SIZE) obj_desc1->string.length + new_buf = ACPI_MEM_CALLOCATE ((ACPI_SIZE) obj_desc1->string.length +
(ACPI_SIZE) obj_desc2->string.length + 1); (ACPI_SIZE) obj_desc2->string.length + 1);
if (!new_buf) { if (!new_buf) {
ACPI_REPORT_ERROR ACPI_REPORT_ERROR
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: exregion - ACPI default Op_region (address space) handlers * Module Name: exregion - ACPI default Op_region (address space) handlers
* $Revision: 80 $ * $Revision: 81 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -133,8 +133,8 @@ acpi_ex_system_memory_space_handler ( ...@@ -133,8 +133,8 @@ acpi_ex_system_memory_space_handler (
* constrain the maximum mapping size to something reasonable. * constrain the maximum mapping size to something reasonable.
*/ */
window_size = (ACPI_SIZE) ((mem_info->address + mem_info->length) - address); window_size = (ACPI_SIZE) ((mem_info->address + mem_info->length) - address);
if (window_size > SYSMEM_REGION_WINDOW_SIZE) { if (window_size > ACPI_SYSMEM_REGION_WINDOW_SIZE) {
window_size = SYSMEM_REGION_WINDOW_SIZE; window_size = ACPI_SYSMEM_REGION_WINDOW_SIZE;
} }
/* Create a new mapping starting at the address given */ /* Create a new mapping starting at the address given */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: exstorob - AML Interpreter object store support, store to object * Module Name: exstorob - AML Interpreter object store support, store to object
* $Revision: 46 $ * $Revision: 47 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -65,15 +65,17 @@ acpi_ex_store_buffer_to_buffer ( ...@@ -65,15 +65,17 @@ acpi_ex_store_buffer_to_buffer (
length = source_desc->buffer.length; length = source_desc->buffer.length;
/* /*
* If target is a buffer of length zero, allocate a new * If target is a buffer of length zero or is a static buffer,
* buffer of the proper length * allocate a new buffer of the proper length
*/ */
if (target_desc->buffer.length == 0) { if ((target_desc->buffer.length == 0) ||
(target_desc->common.flags & AOPOBJ_STATIC_POINTER)) {
target_desc->buffer.pointer = ACPI_MEM_ALLOCATE (length); target_desc->buffer.pointer = ACPI_MEM_ALLOCATE (length);
if (!target_desc->buffer.pointer) { if (!target_desc->buffer.pointer) {
return (AE_NO_MEMORY); return (AE_NO_MEMORY);
} }
target_desc->common.flags &= ~AOPOBJ_STATIC_POINTER;
target_desc->buffer.length = length; target_desc->buffer.length = length;
} }
...@@ -137,11 +139,13 @@ acpi_ex_store_string_to_string ( ...@@ -137,11 +139,13 @@ acpi_ex_store_string_to_string (
length = source_desc->string.length; length = source_desc->string.length;
/* /*
* Setting a string value replaces the old string * Replace existing string value if it will fit and the string
* pointer is not a static pointer (part of an ACPI table)
*/ */
if (length < target_desc->string.length) { if ((length < target_desc->string.length) &&
(!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
/* /*
* String will fit in existing buffer. * String will fit in existing non-static buffer.
* Clear old string and copy in the new one * Clear old string and copy in the new one
*/ */
ACPI_MEMSET (target_desc->string.pointer, 0, (ACPI_SIZE) target_desc->string.length + 1); ACPI_MEMSET (target_desc->string.pointer, 0, (ACPI_SIZE) target_desc->string.length + 1);
...@@ -165,6 +169,7 @@ acpi_ex_store_string_to_string ( ...@@ -165,6 +169,7 @@ acpi_ex_store_string_to_string (
return (AE_NO_MEMORY); return (AE_NO_MEMORY);
} }
target_desc->common.flags &= ~AOPOBJ_STATIC_POINTER;
ACPI_MEMCPY (target_desc->string.pointer, buffer, length); ACPI_MEMCPY (target_desc->string.pointer, buffer, length);
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Module Name: hwregs - Read/write access functions for the various ACPI * Module Name: hwregs - Read/write access functions for the various ACPI
* control and status registers. * control and status registers.
* $Revision: 134 $ * $Revision: 137 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -142,6 +142,9 @@ acpi_get_sleep_type_data ( ...@@ -142,6 +142,9 @@ acpi_get_sleep_type_data (
status = acpi_ns_evaluate_by_name ((NATIVE_CHAR *) acpi_gbl_db_sleep_states[sleep_state], status = acpi_ns_evaluate_by_name ((NATIVE_CHAR *) acpi_gbl_db_sleep_states[sleep_state],
NULL, &obj_desc); NULL, &obj_desc);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s while evaluating Sleep_state [%s]\n",
acpi_format_exception (status), acpi_gbl_db_sleep_states[sleep_state]));
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -184,8 +187,8 @@ acpi_get_sleep_type_data ( ...@@ -184,8 +187,8 @@ acpi_get_sleep_type_data (
} }
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad Sleep object %p type %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "While evaluating Sleep_state [%s], bad Sleep object %p type %s\n",
obj_desc, acpi_ut_get_object_type_name (obj_desc))); acpi_gbl_db_sleep_states[sleep_state], obj_desc, acpi_ut_get_object_type_name (obj_desc)));
} }
acpi_ut_remove_reference (obj_desc); acpi_ut_remove_reference (obj_desc);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/****************************************************************************** /******************************************************************************
* *
* Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface * Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface
* $Revision: 47 $ * $Revision: 48 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -236,7 +236,7 @@ acpi_enter_sleep_state ( ...@@ -236,7 +236,7 @@ acpi_enter_sleep_state (
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
ACPI_DEBUG_PRINT ((ACPI_DB_OK, "Entering S%d\n", sleep_state)); ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Entering sleep state [S%d]\n", sleep_state));
/* Clear SLP_EN and SLP_TYP fields */ /* Clear SLP_EN and SLP_TYP fields */
......
/****************************************************************************** /******************************************************************************
* *
* Name: acconfig.h - Global configuration constants * Name: acconfig.h - Global configuration constants
* $Revision: 119 $ * $Revision: 122 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
/* Version string */ /* Version string */
#define ACPI_CA_VERSION 0x20021122 #define ACPI_CA_VERSION 0x20021205
/* Version of ACPI supported */ /* Version of ACPI supported */
...@@ -62,28 +62,28 @@ ...@@ -62,28 +62,28 @@
/* Maximum objects in the various object caches */ /* Maximum objects in the various object caches */
#define MAX_STATE_CACHE_DEPTH 64 /* State objects for stacks */ #define ACPI_MAX_STATE_CACHE_DEPTH 64 /* State objects for stacks */
#define MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ #define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */
#define MAX_EXTPARSE_CACHE_DEPTH 64 /* Parse tree objects */ #define ACPI_MAX_EXTPARSE_CACHE_DEPTH 64 /* Parse tree objects */
#define MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */ #define ACPI_MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */
#define MAX_WALK_CACHE_DEPTH 4 /* Objects for parse tree walks */ #define ACPI_MAX_WALK_CACHE_DEPTH 4 /* Objects for parse tree walks */
/* String size constants */ /* String size constants */
#define MAX_STRING_LENGTH 512 #define ACPI_MAX_STRING_LENGTH 512
#define PATHNAME_MAX 256 /* A full namespace pathname */ #define ACPI_PATHNAME_MAX 256 /* A full namespace pathname */
/* Maximum count for a semaphore object */ /* Maximum count for a semaphore object */
#define MAX_SEMAPHORE_COUNT 256 #define ACPI_MAX_SEMAPHORE_COUNT 256
/* Max reference count (for debug only) */ /* Max reference count (for debug only) */
#define MAX_REFERENCE_COUNT 0x400 #define ACPI_MAX_REFERENCE_COUNT 0x400
/* Size of cached memory mapping for system memory operation region */ /* Size of cached memory mapping for system memory operation region */
#define SYSMEM_REGION_WINDOW_SIZE 4096 #define ACPI_SYSMEM_REGION_WINDOW_SIZE 4096
/****************************************************************************** /******************************************************************************
...@@ -106,42 +106,43 @@ ...@@ -106,42 +106,43 @@
* *
*****************************************************************************/ *****************************************************************************/
/* Number of distinct GPE register blocks */ /* Number of distinct GPE register blocks and register width */
#define ACPI_MAX_GPE_BLOCKS 2 #define ACPI_MAX_GPE_BLOCKS 2
#define ACPI_GPE_REGISTER_WIDTH 8
/* /*
* Method info (in WALK_STATE), containing local variables and argumetns * Method info (in WALK_STATE), containing local variables and argumetns
*/ */
#define MTH_NUM_LOCALS 8 #define ACPI_METHOD_NUM_LOCALS 8
#define MTH_MAX_LOCAL 7 #define ACPI_METHOD_MAX_LOCAL 7
#define MTH_NUM_ARGS 7 #define ACPI_METHOD_NUM_ARGS 7
#define MTH_MAX_ARG 6 #define ACPI_METHOD_MAX_ARG 6
/* Maximum length of resulting string when converting from a buffer */ /* Maximum length of resulting string when converting from a buffer */
#define ACPI_MAX_STRING_CONVERSION 200 #define ACPI_MAX_STRING_CONVERSION 200
/* /*
* Operand Stack (in WALK_STATE), Must be large enough to contain MTH_MAX_ARG * Operand Stack (in WALK_STATE), Must be large enough to contain METHOD_MAX_ARG
*/ */
#define OBJ_NUM_OPERANDS 8 #define ACPI_OBJ_NUM_OPERANDS 8
#define OBJ_MAX_OPERAND 7 #define ACPI_OBJ_MAX_OPERAND 7
/* Names within the namespace are 4 bytes long */ /* Names within the namespace are 4 bytes long */
#define ACPI_NAME_SIZE 4 #define ACPI_NAME_SIZE 4
#define PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */ #define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */
#define PATH_SEPARATOR '.' #define ACPI_PATH_SEPARATOR '.'
/* Constants used in searching for the RSDP in low memory */ /* Constants used in searching for the RSDP in low memory */
#define LO_RSDP_WINDOW_BASE 0 /* Physical Address */ #define ACPI_LO_RSDP_WINDOW_BASE 0 /* Physical Address */
#define HI_RSDP_WINDOW_BASE 0xE0000 /* Physical Address */ #define ACPI_HI_RSDP_WINDOW_BASE 0xE0000 /* Physical Address */
#define LO_RSDP_WINDOW_SIZE 0x400 #define ACPI_LO_RSDP_WINDOW_SIZE 0x400
#define HI_RSDP_WINDOW_SIZE 0x20000 #define ACPI_HI_RSDP_WINDOW_SIZE 0x20000
#define RSDP_SCAN_STEP 16 #define ACPI_RSDP_SCAN_STEP 16
/* Operation regions */ /* Operation regions */
...@@ -154,12 +155,12 @@ ...@@ -154,12 +155,12 @@
/* Array sizes. Used for range checking also */ /* Array sizes. Used for range checking also */
#define NUM_ACCESS_TYPES 6 #define ACPI_NUM_ACCESS_TYPES 6
#define NUM_UPDATE_RULES 3 #define ACPI_NUM_UPDATE_RULES 3
#define NUM_LOCK_RULES 2 #define ACPI_NUM_LOCK_RULES 2
#define NUM_MATCH_OPS 6 #define ACPI_NUM_MATCH_OPS 6
#define NUM_OPCODES 256 #define ACPI_NUM_OPCODES 256
#define NUM_FIELD_NAMES 2 #define ACPI_NUM_FIELD_NAMES 2
/* RSDP checksums */ /* RSDP checksums */
......
/****************************************************************************** /******************************************************************************
* *
* Name: acdisasm.h - AML disassembler * Name: acdisasm.h - AML disassembler
* $Revision: 5 $ * $Revision: 6 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -50,10 +50,10 @@ extern const char *acpi_gbl_SHRdecode[2]; ...@@ -50,10 +50,10 @@ extern const char *acpi_gbl_SHRdecode[2];
extern const char *acpi_gbl_TYPdecode[4]; extern const char *acpi_gbl_TYPdecode[4];
extern const char *acpi_gbl_BMdecode[2]; extern const char *acpi_gbl_BMdecode[2];
extern const char *acpi_gbl_SIZdecode[4]; extern const char *acpi_gbl_SIZdecode[4];
extern const NATIVE_CHAR *acpi_gbl_lock_rule[NUM_LOCK_RULES]; extern const NATIVE_CHAR *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES];
extern const NATIVE_CHAR *acpi_gbl_access_types[NUM_ACCESS_TYPES]; extern const NATIVE_CHAR *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES];
extern const NATIVE_CHAR *acpi_gbl_update_rules[NUM_UPDATE_RULES]; extern const NATIVE_CHAR *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES];
extern const NATIVE_CHAR *acpi_gbl_match_ops[NUM_MATCH_OPS]; extern const NATIVE_CHAR *acpi_gbl_match_ops[ACPI_NUM_MATCH_OPS];
typedef struct acpi_op_walk_info typedef struct acpi_op_walk_info
......
/****************************************************************************** /******************************************************************************
* *
* Name: acexcep.h - Exception codes returned by the ACPI subsystem * Name: acexcep.h - Exception codes returned by the ACPI subsystem
* $Revision: 64 $ * $Revision: 65 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -75,8 +75,9 @@ ...@@ -75,8 +75,9 @@
#define AE_NO_HARDWARE_RESPONSE (acpi_status) (0x0019 | 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_NO_GLOBAL_LOCK (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL)
#define AE_LOGICAL_ADDRESS (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL) #define AE_LOGICAL_ADDRESS (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL)
#define AE_ABORT_METHOD (acpi_status) (0x001C | AE_CODE_ENVIRONMENTAL)
#define AE_CODE_ENV_MAX 0x001B #define AE_CODE_ENV_MAX 0x001C
/* /*
* Programmer exceptions * Programmer exceptions
...@@ -199,7 +200,8 @@ NATIVE_CHAR const *acpi_gbl_exception_names_env[] = ...@@ -199,7 +200,8 @@ NATIVE_CHAR const *acpi_gbl_exception_names_env[] =
"AE_ALREADY_ACQUIRED", "AE_ALREADY_ACQUIRED",
"AE_NO_HARDWARE_RESPONSE", "AE_NO_HARDWARE_RESPONSE",
"AE_NO_GLOBAL_LOCK", "AE_NO_GLOBAL_LOCK",
"AE_LOGICAL_ADDRESS" "AE_LOGICAL_ADDRESS",
"AE_ABORT_METHOD"
}; };
NATIVE_CHAR const *acpi_gbl_exception_names_pgm[] = NATIVE_CHAR const *acpi_gbl_exception_names_pgm[] =
......
/****************************************************************************** /******************************************************************************
* *
* Name: acglobal.h - Declarations for global variables * Name: acglobal.h - Declarations for global variables
* $Revision: 132 $ * $Revision: 134 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -141,7 +141,7 @@ ACPI_EXTERN u8 acpi_gbl_events_initialized; ...@@ -141,7 +141,7 @@ ACPI_EXTERN u8 acpi_gbl_events_initialized;
extern u8 acpi_gbl_shutdown; extern u8 acpi_gbl_shutdown;
extern u32 acpi_gbl_startup_flags; extern u32 acpi_gbl_startup_flags;
extern const u8 acpi_gbl_decode_to8bit[8]; extern const u8 acpi_gbl_decode_to8bit[8];
extern const NATIVE_CHAR *acpi_gbl_db_sleep_states[ACPI_NUM_SLEEP_STATES]; extern const NATIVE_CHAR *acpi_gbl_db_sleep_states[ACPI_S_STATE_COUNT];
extern const acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; extern const acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES];
extern const NATIVE_CHAR *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS]; extern const NATIVE_CHAR *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
...@@ -253,6 +253,7 @@ ACPI_EXTERN u8 acpi_gbl_db_opt_verbose; ...@@ -253,6 +253,7 @@ ACPI_EXTERN u8 acpi_gbl_db_opt_verbose;
#ifdef ACPI_DEBUGGER #ifdef ACPI_DEBUGGER
extern u8 acpi_gbl_method_executing; extern u8 acpi_gbl_method_executing;
extern u8 acpi_gbl_abort_method;
extern u8 acpi_gbl_db_terminate_threads; extern u8 acpi_gbl_db_terminate_threads;
ACPI_EXTERN int optind; ACPI_EXTERN int optind;
......
/****************************************************************************** /******************************************************************************
* *
* Name: aclocal.h - Internal data types used across the ACPI subsystem * Name: aclocal.h - Internal data types used across the ACPI subsystem
* $Revision: 181 $ * $Revision: 182 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -496,7 +496,7 @@ typedef struct acpi_thread_state ...@@ -496,7 +496,7 @@ typedef struct acpi_thread_state
typedef struct acpi_result_values typedef struct acpi_result_values
{ {
ACPI_STATE_COMMON ACPI_STATE_COMMON
union acpi_operand_obj *obj_desc [OBJ_NUM_OPERANDS]; union acpi_operand_obj *obj_desc [ACPI_OBJ_NUM_OPERANDS];
u8 num_results; u8 num_results;
u8 last_insert; u8 last_insert;
......
/****************************************************************************** /******************************************************************************
* *
* Name: acmacros.h - C macros for the entire subsystem. * Name: acmacros.h - C macros for the entire subsystem.
* $Revision: 130 $ * $Revision: 132 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -367,6 +367,8 @@ ...@@ -367,6 +367,8 @@
acpi_os_printf ACPI_PARAM_LIST(fp);} acpi_os_printf ACPI_PARAM_LIST(fp);}
#define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error(_THIS_MODULE,__LINE__,_COMPONENT, s, e); #define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error(_THIS_MODULE,__LINE__,_COMPONENT, s, e);
#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) acpi_ns_report_method_error(_THIS_MODULE,__LINE__,_COMPONENT, s, n, p, e);
#else #else
#define ACPI_REPORT_INFO(fp) {acpi_ut_report_info("ACPI",__LINE__,_COMPONENT); \ #define ACPI_REPORT_INFO(fp) {acpi_ut_report_info("ACPI",__LINE__,_COMPONENT); \
...@@ -377,6 +379,8 @@ ...@@ -377,6 +379,8 @@
acpi_os_printf ACPI_PARAM_LIST(fp);} acpi_os_printf ACPI_PARAM_LIST(fp);}
#define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error("ACPI",__LINE__,_COMPONENT, s, e); #define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error("ACPI",__LINE__,_COMPONENT, s, e);
#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) acpi_ns_report_method_error("ACPI",__LINE__,_COMPONENT, s, n, p, e);
#endif #endif
/* Error reporting. These versions pass thru the module and line# */ /* Error reporting. These versions pass thru the module and line# */
...@@ -454,7 +458,7 @@ ...@@ -454,7 +458,7 @@
#define ACPI_DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b) #define ACPI_DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b)
#define ACPI_DUMP_TABLES(a,b) acpi_ns_dump_tables(a,b) #define ACPI_DUMP_TABLES(a,b) acpi_ns_dump_tables(a,b)
#define ACPI_DUMP_PATHNAME(a,b,c,d) (void) acpi_ns_dump_pathname(a,b,c,d) #define ACPI_DUMP_PATHNAME(a,b,c,d) acpi_ns_dump_pathname(a,b,c,d)
#define ACPI_DUMP_RESOURCE_LIST(a) acpi_rs_dump_resource_list(a) #define ACPI_DUMP_RESOURCE_LIST(a) acpi_rs_dump_resource_list(a)
#define ACPI_DUMP_BUFFER(a,b) acpi_ut_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT) #define ACPI_DUMP_BUFFER(a,b) acpi_ut_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT)
#define ACPI_BREAK_MSG(a) acpi_os_signal (ACPI_SIGNAL_BREAKPOINT,(a)) #define ACPI_BREAK_MSG(a) acpi_os_signal (ACPI_SIGNAL_BREAKPOINT,(a))
......
/****************************************************************************** /******************************************************************************
* *
* Name: acnamesp.h - Namespace subcomponent prototypes and defines * Name: acnamesp.h - Namespace subcomponent prototypes and defines
* $Revision: 129 $ * $Revision: 131 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -210,7 +210,7 @@ acpi_ns_dump_entry ( ...@@ -210,7 +210,7 @@ acpi_ns_dump_entry (
acpi_handle handle, acpi_handle handle,
u32 debug_level); u32 debug_level);
acpi_status void
acpi_ns_dump_pathname ( acpi_ns_dump_pathname (
acpi_handle handle, acpi_handle handle,
NATIVE_CHAR *msg, NATIVE_CHAR *msg,
...@@ -430,6 +430,21 @@ acpi_ns_report_error ( ...@@ -430,6 +430,21 @@ acpi_ns_report_error (
char *internal_name, char *internal_name,
acpi_status lookup_status); acpi_status lookup_status);
void
acpi_ns_report_method_error (
NATIVE_CHAR *module_name,
u32 line_number,
u32 component_id,
char *message,
acpi_namespace_node *node,
char *path,
acpi_status lookup_status);
void
acpi_ns_print_node_pathname (
acpi_namespace_node *node,
NATIVE_CHAR *msg);
acpi_status acpi_status
acpi_ns_build_internal_name ( acpi_ns_build_internal_name (
acpi_namestring_info *info); acpi_namestring_info *info);
......
/****************************************************************************** /******************************************************************************
* *
* Name: acoutput.h -- debug output * Name: acoutput.h -- debug output
* $Revision: 90 $ * $Revision: 91 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -53,7 +53,6 @@ ...@@ -53,7 +53,6 @@
#define ACPI_TOOLS 0x00002000 #define ACPI_TOOLS 0x00002000
#define ACPI_ALL_COMPONENTS 0x00003FFF #define ACPI_ALL_COMPONENTS 0x00003FFF
#define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS) #define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS)
...@@ -61,21 +60,20 @@ ...@@ -61,21 +60,20 @@
#define ACPI_ALL_DRIVERS 0xFFFF0000 #define ACPI_ALL_DRIVERS 0xFFFF0000
/* /*
* Raw debug output levels, do not use these in the DEBUG_PRINT macros * Raw debug output levels, do not use these in the DEBUG_PRINT macros
*/ */
#define ACPI_LV_ERROR 0x00000001
#define ACPI_LV_OK 0x00000001 #define ACPI_LV_WARN 0x00000002
#define ACPI_LV_INFO 0x00000002 #define ACPI_LV_INIT 0x00000004
#define ACPI_LV_WARN 0x00000004 #define ACPI_LV_DEBUG_OBJECT 0x00000008
#define ACPI_LV_ERROR 0x00000008 #define ACPI_LV_INFO 0x00000010
#define ACPI_LV_FATAL 0x00000010 #define ACPI_LV_ALL_EXCEPTIONS 0x0000001F
#define ACPI_LV_DEBUG_OBJECT 0x00000020
#define ACPI_LV_ALL_EXCEPTIONS 0x0000003F
/* Trace verbosity level 1 [Standard Trace Level] */ /* Trace verbosity level 1 [Standard Trace Level] */
#define ACPI_LV_INIT_NAMES 0x00000020
#define ACPI_LV_PARSE 0x00000040 #define ACPI_LV_PARSE 0x00000040
#define ACPI_LV_LOAD 0x00000080 #define ACPI_LV_LOAD 0x00000080
#define ACPI_LV_DISPATCH 0x00000100 #define ACPI_LV_DISPATCH 0x00000100
...@@ -89,8 +87,7 @@ ...@@ -89,8 +87,7 @@
#define ACPI_LV_RESOURCES 0x00010000 #define ACPI_LV_RESOURCES 0x00010000
#define ACPI_LV_USER_REQUESTS 0x00020000 #define ACPI_LV_USER_REQUESTS 0x00020000
#define ACPI_LV_PACKAGE 0x00040000 #define ACPI_LV_PACKAGE 0x00040000
#define ACPI_LV_INIT 0x00080000 #define ACPI_LV_VERBOSITY1 0x0007FF40 | ACPI_LV_ALL_EXCEPTIONS
#define ACPI_LV_VERBOSITY1 0x000FFF40 | ACPI_LV_ALL_EXCEPTIONS
/* Trace verbosity level 2 [Function tracing and memory allocation] */ /* Trace verbosity level 2 [Function tracing and memory allocation] */
...@@ -121,22 +118,21 @@ ...@@ -121,22 +118,21 @@
/* /*
* Debug level macros that are used in the DEBUG_PRINT macros * Debug level macros that are used in the DEBUG_PRINT macros
*/ */
#define ACPI_DEBUG_LEVEL(dl) dl,__LINE__,&_dbg #define ACPI_DEBUG_LEVEL(dl) dl,__LINE__,&_dbg
/* Exception level -- used in the global "Debug_level" */ /* Exception level -- used in the global "Debug_level" */
#define ACPI_DB_OK ACPI_DEBUG_LEVEL (ACPI_LV_OK)
#define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO)
#define ACPI_DB_WARN ACPI_DEBUG_LEVEL (ACPI_LV_WARN)
#define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR) #define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR)
#define ACPI_DB_FATAL ACPI_DEBUG_LEVEL (ACPI_LV_FATAL) #define ACPI_DB_WARN ACPI_DEBUG_LEVEL (ACPI_LV_WARN)
#define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT)
#define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) #define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT)
#define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO)
#define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS) #define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS)
/* Trace level -- also used in the global "Debug_level" */ /* Trace level -- also used in the global "Debug_level" */
#define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES)
#define ACPI_DB_THREADS ACPI_DEBUG_LEVEL (ACPI_LV_THREADS) #define ACPI_DB_THREADS ACPI_DEBUG_LEVEL (ACPI_LV_THREADS)
#define ACPI_DB_PARSE ACPI_DEBUG_LEVEL (ACPI_LV_PARSE) #define ACPI_DB_PARSE ACPI_DEBUG_LEVEL (ACPI_LV_PARSE)
#define ACPI_DB_DISPATCH ACPI_DEBUG_LEVEL (ACPI_LV_DISPATCH) #define ACPI_DB_DISPATCH ACPI_DEBUG_LEVEL (ACPI_LV_DISPATCH)
...@@ -157,23 +153,15 @@ ...@@ -157,23 +153,15 @@
#define ACPI_DB_USER_REQUESTS ACPI_DEBUG_LEVEL (ACPI_LV_USER_REQUESTS) #define ACPI_DB_USER_REQUESTS ACPI_DEBUG_LEVEL (ACPI_LV_USER_REQUESTS)
#define ACPI_DB_PACKAGE ACPI_DEBUG_LEVEL (ACPI_LV_PACKAGE) #define ACPI_DB_PACKAGE ACPI_DEBUG_LEVEL (ACPI_LV_PACKAGE)
#define ACPI_DB_MUTEX ACPI_DEBUG_LEVEL (ACPI_LV_MUTEX) #define ACPI_DB_MUTEX ACPI_DEBUG_LEVEL (ACPI_LV_MUTEX)
#define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT)
#define ACPI_DB_ALL ACPI_DEBUG_LEVEL (ACPI_LV_ALL) #define ACPI_DB_ALL ACPI_DEBUG_LEVEL (ACPI_LV_ALL)
/* Defaults for Debug_level, debug and normal */ /* Defaults for Debug_level, debug and normal */
#define DEBUG_DEFAULT (ACPI_LV_OK | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT) #define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT)
#define NORMAL_DEFAULT (ACPI_LV_OK | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT) #define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT)
#define DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) #define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL)
/* Misc defines */
#define HEX 0x01
#define ASCII 0x02
#define FULL_ADDRESS 0x04
#define CHARS_PER_LINE 16 /* used in Dump_buf function */
#endif /* __ACOUTPUT_H__ */ #endif /* __ACOUTPUT_H__ */
/****************************************************************************** /******************************************************************************
* *
* Name: acstruct.h - Internal structs * Name: acstruct.h - Internal structs
* $Revision: 20 $ * $Revision: 21 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -71,16 +71,16 @@ typedef struct acpi_walk_state ...@@ -71,16 +71,16 @@ typedef struct acpi_walk_state
u8 *aml_last_while; u8 *aml_last_while;
struct acpi_node arguments[MTH_NUM_ARGS]; /* Control method arguments */ struct acpi_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */
union acpi_operand_obj **caller_return_desc; union acpi_operand_obj **caller_return_desc;
acpi_generic_state *control_state; /* List of control states (nested IFs) */ acpi_generic_state *control_state; /* List of control states (nested IFs) */
struct acpi_node local_variables[MTH_NUM_LOCALS]; /* Control method locals */ struct acpi_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */
struct acpi_node *method_call_node; /* Called method Node*/ struct acpi_node *method_call_node; /* Called method Node*/
acpi_parse_object *method_call_op; /* Method_call Op if running a method */ acpi_parse_object *method_call_op; /* Method_call Op if running a method */
union acpi_operand_obj *method_desc; /* Method descriptor if running a method */ union acpi_operand_obj *method_desc; /* Method descriptor if running a method */
struct acpi_node *method_node; /* Method Node if running a method */ struct acpi_node *method_node; /* Method Node if running a method */
acpi_parse_object *op; /* Current parser op */ acpi_parse_object *op; /* Current parser op */
union acpi_operand_obj *operands[OBJ_NUM_OPERANDS+1]; /* Operands passed to the interpreter (+1 for NULL terminator) */ union acpi_operand_obj *operands[ACPI_OBJ_NUM_OPERANDS+1]; /* Operands passed to the interpreter (+1 for NULL terminator) */
const acpi_opcode_info *op_info; /* Info on current opcode */ const acpi_opcode_info *op_info; /* Info on current opcode */
acpi_parse_object *origin; /* Start of walk [Obsolete] */ acpi_parse_object *origin; /* Start of walk [Obsolete] */
union acpi_operand_obj **params; union acpi_operand_obj **params;
......
/****************************************************************************** /******************************************************************************
* *
* Name: actypes.h - Common data types for the entire ACPI subsystem * Name: actypes.h - Common data types for the entire ACPI subsystem
* $Revision: 241 $ * $Revision: 242 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -863,11 +863,6 @@ typedef struct ...@@ -863,11 +863,6 @@ typedef struct
} acpi_mem_space_context; } acpi_mem_space_context;
/* Sleep states */
#define ACPI_NUM_SLEEP_STATES 7
/* /*
* Definitions for Resource Attributes * Definitions for Resource Attributes
*/ */
......
/****************************************************************************** /******************************************************************************
* *
* Name: acutils.h -- prototypes for the common (subsystem-wide) procedures * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
* $Revision: 148 $ * $Revision: 149 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -447,6 +447,13 @@ acpi_ut_delete_internal_object_list ( ...@@ -447,6 +447,13 @@ acpi_ut_delete_internal_object_list (
#define METHOD_NAME__PRT "_PRT" #define METHOD_NAME__PRT "_PRT"
acpi_status
acpi_ut_evaluate_object (
acpi_namespace_node *prefix_node,
NATIVE_CHAR *path,
u32 expected_return_btypes,
acpi_operand_object **return_desc);
acpi_status acpi_status
acpi_ut_evaluate_numeric_object ( acpi_ut_evaluate_numeric_object (
NATIVE_CHAR *object_name, NATIVE_CHAR *object_name,
...@@ -698,7 +705,8 @@ acpi_ut_set_integer_width ( ...@@ -698,7 +705,8 @@ acpi_ut_set_integer_width (
#ifdef ACPI_DEBUG_OUTPUT #ifdef ACPI_DEBUG_OUTPUT
void void
acpi_ut_display_init_pathname ( acpi_ut_display_init_pathname (
acpi_handle obj_handle, u8 type,
acpi_namespace_node *obj_handle,
char *path); char *path);
#endif #endif
......
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
obj-y := nsaccess.o nsdumpdv.o nsload.o nssearch.o nsxfeval.o \ obj-y := nsaccess.o nsdumpdv.o nsload.o nssearch.o nsxfeval.o \
nsalloc.o nseval.o nsnames.o nsutils.o nsxfname.o \ nsalloc.o nseval.o nsnames.o nsutils.o nsxfname.o \
nsdump.o nsinit.o nsobject.o nswalk.o nsxfobj.o nsdump.o nsinit.o nsobject.o nswalk.o nsxfobj.o \
nsparse.o
EXTRA_CFLAGS += $(ACPI_CFLAGS) EXTRA_CFLAGS += $(ACPI_CFLAGS)
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: nsdump - table dumping routines for debug * Module Name: nsdump - table dumping routines for debug
* $Revision: 146 $ * $Revision: 149 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -90,16 +90,13 @@ acpi_ns_print_pathname ( ...@@ -90,16 +90,13 @@ acpi_ns_print_pathname (
* *
******************************************************************************/ ******************************************************************************/
acpi_status void
acpi_ns_dump_pathname ( acpi_ns_dump_pathname (
acpi_handle handle, acpi_handle handle,
NATIVE_CHAR *msg, NATIVE_CHAR *msg,
u32 level, u32 level,
u32 component) u32 component)
{ {
acpi_buffer buffer;
acpi_status status;
ACPI_FUNCTION_TRACE ("Ns_dump_pathname"); ACPI_FUNCTION_TRACE ("Ns_dump_pathname");
...@@ -107,20 +104,14 @@ acpi_ns_dump_pathname ( ...@@ -107,20 +104,14 @@ acpi_ns_dump_pathname (
/* Do this only if the requested debug level and component are enabled */ /* Do this only if the requested debug level and component are enabled */
if (!(acpi_dbg_level & level) || !(acpi_dbg_layer & component)) { if (!(acpi_dbg_level & level) || !(acpi_dbg_layer & component)) {
return_ACPI_STATUS (AE_OK); return_VOID;
} }
/* Convert handle to a full pathname and print it (with supplied message) */ /* Convert handle to a full pathname and print it (with supplied message) */
buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; acpi_ns_print_node_pathname (handle, msg);
acpi_os_printf ("\n");
status = acpi_ns_handle_to_pathname (handle, &buffer); return_VOID;
if (ACPI_SUCCESS (status)) {
acpi_os_printf ("%s %s (Node %p)\n", msg, (char *) buffer.pointer, handle);
ACPI_MEM_FREE (buffer.pointer);
}
return_ACPI_STATUS (status);
} }
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: nsinit - namespace initialization * Module Name: nsinit - namespace initialization
* $Revision: 50 $ * $Revision: 52 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -59,7 +59,7 @@ acpi_ns_initialize_objects ( ...@@ -59,7 +59,7 @@ acpi_ns_initialize_objects (
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"**** Starting initialization of namespace objects ****\n")); "**** Starting initialization of namespace objects ****\n"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "Completing Region/Field/Buffer/Package initialization:")); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Completing Region/Field/Buffer/Package initialization:"));
/* Set all init info to zero */ /* Set all init info to zero */
...@@ -75,12 +75,13 @@ acpi_ns_initialize_objects ( ...@@ -75,12 +75,13 @@ acpi_ns_initialize_objects (
acpi_format_exception (status))); acpi_format_exception (status)));
} }
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd Buffers %hd/%hd Packages (%hd nodes)\n", "\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd Buffers %hd/%hd Packages (%hd nodes)\n",
info.op_region_init, info.op_region_count, info.op_region_init, info.op_region_count,
info.field_init, info.field_count, info.field_init, info.field_count,
info.buffer_init, info.buffer_count, info.buffer_init, info.buffer_count,
info.package_init, info.package_count, info.object_count)); info.package_init, info.package_count, info.object_count));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"%hd Control Methods found\n", info.method_count)); "%hd Control Methods found\n", info.method_count));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
...@@ -123,7 +124,7 @@ acpi_ns_initialize_devices ( ...@@ -123,7 +124,7 @@ acpi_ns_initialize_devices (
info.num_STA = 0; info.num_STA = 0;
info.num_INI = 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_INIT, "Executing all Device _STA and_INI methods:"));
/* Walk namespace for all objects of type Device */ /* Walk namespace for all objects of type Device */
...@@ -135,7 +136,7 @@ acpi_ns_initialize_devices ( ...@@ -135,7 +136,7 @@ acpi_ns_initialize_devices (
acpi_format_exception (status))); acpi_format_exception (status)));
} }
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"\n%hd Devices found containing: %hd _STA, %hd _INI methods\n", "\n%hd Devices found containing: %hd _STA, %hd _INI methods\n",
info.device_count, info.num_STA, info.num_INI)); info.device_count, info.num_STA, info.num_INI));
...@@ -274,8 +275,10 @@ acpi_ns_init_one_object ( ...@@ -274,8 +275,10 @@ acpi_ns_init_one_object (
node->name.ascii, acpi_ut_get_type_name (type), acpi_format_exception (status))); node->name.ascii, acpi_ut_get_type_name (type), acpi_format_exception (status)));
} }
if (!(acpi_dbg_level & ACPI_LV_INIT)) { /* Print a dot for each object unless we are going to print the entire pathname */
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "."));
if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
acpi_os_printf (".");
} }
/* /*
...@@ -318,7 +321,7 @@ acpi_ns_init_one_device ( ...@@ -318,7 +321,7 @@ acpi_ns_init_one_device (
if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) && (!(acpi_dbg_level & ACPI_LV_INFO))) { if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) && (!(acpi_dbg_level & ACPI_LV_INFO))) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, ".")); acpi_os_printf (".");
} }
info->device_count++; info->device_count++;
...@@ -342,7 +345,7 @@ acpi_ns_init_one_device ( ...@@ -342,7 +345,7 @@ acpi_ns_init_one_device (
/* /*
* Run _STA to determine if we can run _INI on the device. * Run _STA to determine if we can run _INI on the device.
*/ */
ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (node, "_STA [Method]")); ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD, node, "_STA"));
status = acpi_ut_execute_STA (node, &flags); status = acpi_ut_execute_STA (node, &flags);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
/* Ignore error and move on to next device */ /* Ignore error and move on to next device */
...@@ -361,7 +364,7 @@ acpi_ns_init_one_device ( ...@@ -361,7 +364,7 @@ acpi_ns_init_one_device (
/* /*
* The device is present. Run _INI. * The device is present. Run _INI.
*/ */
ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (obj_handle, "_INI [Method]")); ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD, obj_handle, "_INI"));
status = acpi_ns_evaluate_relative (obj_handle, "_INI", NULL, NULL); status = acpi_ns_evaluate_relative (obj_handle, "_INI", NULL, NULL);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
/* No _INI (AE_NOT_FOUND) means device requires no initialization */ /* No _INI (AE_NOT_FOUND) means device requires no initialization */
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: nsload - namespace loading/expanding/contracting procedures * Module Name: nsload - namespace loading/expanding/contracting procedures
* $Revision: 59 $ * $Revision: 61 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -34,122 +34,6 @@ ...@@ -34,122 +34,6 @@
ACPI_MODULE_NAME ("nsload") ACPI_MODULE_NAME ("nsload")
/*******************************************************************************
*
* FUNCTION: Ns_one_complete_parse
*
* PARAMETERS: Pass_number - 1 or 2
* Table_desc - The table to be parsed.
*
* RETURN: Status
*
* DESCRIPTION: Perform one complete parse of an ACPI/AML table.
*
******************************************************************************/
acpi_status
acpi_ns_one_complete_parse (
u32 pass_number,
acpi_table_desc *table_desc)
{
acpi_parse_object *parse_root;
acpi_status status;
acpi_walk_state *walk_state;
ACPI_FUNCTION_TRACE ("Ns_one_complete_parse");
/* Create and init a Root Node */
parse_root = acpi_ps_create_scope_op ();
if (!parse_root) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Create and initialize a new walk state */
walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT,
NULL, NULL, NULL);
if (!walk_state) {
acpi_ps_free_op (parse_root);
return_ACPI_STATUS (AE_NO_MEMORY);
}
status = acpi_ds_init_aml_walk (walk_state, parse_root, NULL, table_desc->aml_start,
table_desc->aml_length, NULL, NULL, pass_number);
if (ACPI_FAILURE (status)) {
acpi_ds_delete_walk_state (walk_state);
return_ACPI_STATUS (status);
}
/* Parse the AML */
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", pass_number));
status = acpi_ps_parse_aml (walk_state);
acpi_ps_delete_parse_tree (parse_root);
return_ACPI_STATUS (status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_ns_parse_table
*
* PARAMETERS: Table_desc - An ACPI table descriptor for table to parse
* Start_node - Where to enter the table into the namespace
*
* RETURN: Status
*
* DESCRIPTION: Parse AML within an ACPI table and return a tree of ops
*
******************************************************************************/
acpi_status
acpi_ns_parse_table (
acpi_table_desc *table_desc,
acpi_namespace_node *start_node)
{
acpi_status status;
ACPI_FUNCTION_TRACE ("Ns_parse_table");
/*
* AML Parse, pass 1
*
* In this pass, we load most of the namespace. Control methods
* are not parsed until later. A parse tree is not created. Instead,
* each Parser Op subtree is deleted when it is finished. This saves
* a great deal of memory, and allows a small cache of parse objects
* to service the entire parse. The second pass of the parse then
* performs another complete parse of the AML..
*/
status = acpi_ns_one_complete_parse (1, table_desc);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/*
* AML Parse, pass 2
*
* In this pass, we resolve forward references and other things
* that could not be completed during the first pass.
* Another complete parse of the AML is performed, but the
* overhead of this is compensated for by the fact that the
* parse objects are all cached.
*/
status = acpi_ns_one_complete_parse (2, table_desc);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
return_ACPI_STATUS (status);
}
#ifndef ACPI_NO_METHOD_EXECUTION #ifndef ACPI_NO_METHOD_EXECUTION
/******************************************************************************* /*******************************************************************************
...@@ -411,7 +295,7 @@ acpi_ns_load_namespace ( ...@@ -411,7 +295,7 @@ acpi_ns_load_namespace (
(void) acpi_ns_load_table_by_type (ACPI_TABLE_SSDT); (void) acpi_ns_load_table_by_type (ACPI_TABLE_SSDT);
(void) acpi_ns_load_table_by_type (ACPI_TABLE_PSDT); (void) acpi_ns_load_table_by_type (ACPI_TABLE_PSDT);
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"ACPI Namespace successfully loaded at root %p\n", "ACPI Namespace successfully loaded at root %p\n",
acpi_gbl_root_node)); acpi_gbl_root_node));
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: nsnames - Name manipulation and search * Module Name: nsnames - Name manipulation and search
* $Revision: 79 $ * $Revision: 80 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -86,7 +86,7 @@ acpi_ns_build_external_path ( ...@@ -86,7 +86,7 @@ acpi_ns_build_external_path (
/* Prefix name with the path separator */ /* Prefix name with the path separator */
index--; index--;
name_buffer[index] = PATH_SEPARATOR; name_buffer[index] = ACPI_PATH_SEPARATOR;
} }
/* Overwrite final separator with the root prefix character */ /* Overwrite final separator with the root prefix character */
...@@ -180,7 +180,7 @@ acpi_ns_get_pathname_length ( ...@@ -180,7 +180,7 @@ acpi_ns_get_pathname_length (
next_node = node; next_node = node;
while (next_node && (next_node != acpi_gbl_root_node)) { while (next_node && (next_node != acpi_gbl_root_node)) {
size += PATH_SEGMENT_LENGTH; size += ACPI_PATH_SEGMENT_LENGTH;
next_node = acpi_ns_get_parent_node (next_node); next_node = acpi_ns_get_parent_node (next_node);
} }
......
/******************************************************************************
*
* Module Name: nsparse - namespace interface to AML parser
* $Revision: 1 $
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2002, R. Byron Moore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "acpi.h"
#include "acnamesp.h"
#include "acparser.h"
#include "acdispat.h"
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsparse")
/*******************************************************************************
*
* FUNCTION: Ns_one_complete_parse
*
* PARAMETERS: Pass_number - 1 or 2
* Table_desc - The table to be parsed.
*
* RETURN: Status
*
* DESCRIPTION: Perform one complete parse of an ACPI/AML table.
*
******************************************************************************/
acpi_status
acpi_ns_one_complete_parse (
u32 pass_number,
acpi_table_desc *table_desc)
{
acpi_parse_object *parse_root;
acpi_status status;
acpi_walk_state *walk_state;
ACPI_FUNCTION_TRACE ("Ns_one_complete_parse");
/* Create and init a Root Node */
parse_root = acpi_ps_create_scope_op ();
if (!parse_root) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Create and initialize a new walk state */
walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT,
NULL, NULL, NULL);
if (!walk_state) {
acpi_ps_free_op (parse_root);
return_ACPI_STATUS (AE_NO_MEMORY);
}
status = acpi_ds_init_aml_walk (walk_state, parse_root, NULL, table_desc->aml_start,
table_desc->aml_length, NULL, NULL, pass_number);
if (ACPI_FAILURE (status)) {
acpi_ds_delete_walk_state (walk_state);
return_ACPI_STATUS (status);
}
/* Parse the AML */
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", pass_number));
status = acpi_ps_parse_aml (walk_state);
acpi_ps_delete_parse_tree (parse_root);
return_ACPI_STATUS (status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_ns_parse_table
*
* PARAMETERS: Table_desc - An ACPI table descriptor for table to parse
* Start_node - Where to enter the table into the namespace
*
* RETURN: Status
*
* DESCRIPTION: Parse AML within an ACPI table and return a tree of ops
*
******************************************************************************/
acpi_status
acpi_ns_parse_table (
acpi_table_desc *table_desc,
acpi_namespace_node *start_node)
{
acpi_status status;
ACPI_FUNCTION_TRACE ("Ns_parse_table");
/*
* AML Parse, pass 1
*
* In this pass, we load most of the namespace. Control methods
* are not parsed until later. A parse tree is not created. Instead,
* each Parser Op subtree is deleted when it is finished. This saves
* a great deal of memory, and allows a small cache of parse objects
* to service the entire parse. The second pass of the parse then
* performs another complete parse of the AML..
*/
status = acpi_ns_one_complete_parse (1, table_desc);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/*
* AML Parse, pass 2
*
* In this pass, we resolve forward references and other things
* that could not be completed during the first pass.
* Another complete parse of the AML is performed, but the
* overhead of this is compensated for by the fact that the
* parse objects are all cached.
*/
status = acpi_ns_one_complete_parse (2, table_desc);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
return_ACPI_STATUS (status);
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* *
* Module Name: nsutils - Utilities for accessing ACPI namespace, accessing * Module Name: nsutils - Utilities for accessing ACPI namespace, accessing
* parents and siblings and Scope manipulation * parents and siblings and Scope manipulation
* $Revision: 116 $ * $Revision: 118 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -86,6 +86,82 @@ acpi_ns_report_error ( ...@@ -86,6 +86,82 @@ acpi_ns_report_error (
} }
/*******************************************************************************
*
* FUNCTION: Acpi_ns_report_method_error
*
* PARAMETERS: Module_name - Caller's module name (for error output)
* Line_number - Caller's line number (for error output)
* Component_id - Caller's component ID (for error output)
* Message - Error message to use on failure
*
* RETURN: None
*
* DESCRIPTION: Print warning message with full pathname
*
******************************************************************************/
void
acpi_ns_report_method_error (
NATIVE_CHAR *module_name,
u32 line_number,
u32 component_id,
char *message,
acpi_namespace_node *prefix_node,
char *path,
acpi_status method_status)
{
acpi_status status;
acpi_namespace_node *node = prefix_node;
if (path) {
status = acpi_ns_get_node_by_path (path, prefix_node, ACPI_NS_NO_UPSEARCH, &node);
if (ACPI_FAILURE (status)) {
acpi_os_printf ("Report_method_error: Could not get node\n");
return;
}
}
acpi_os_printf ("%8s-%04d: *** Error: ", module_name, line_number);
acpi_ns_print_node_pathname (node, message);
acpi_os_printf (", %s\n", acpi_format_exception (method_status));
}
/*******************************************************************************
*
* FUNCTION: Acpi_ns_print_node_pathname
*
* PARAMETERS: Node - Object
* Msg - Prefix message
*
* DESCRIPTION: Print an object's full namespace pathname
* Manages allocation/freeing of a pathname buffer
*
******************************************************************************/
void
acpi_ns_print_node_pathname (
acpi_namespace_node *node,
NATIVE_CHAR *msg)
{
acpi_buffer buffer;
acpi_status status;
/* Convert handle to a full pathname and print it (with supplied message) */
buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
status = acpi_ns_handle_to_pathname (node, &buffer);
if (ACPI_SUCCESS (status)) {
acpi_os_printf ("%s [%s] (Node %p)", msg, (char *) buffer.pointer, node);
ACPI_MEM_FREE (buffer.pointer);
}
}
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: Acpi_ns_valid_root_prefix * FUNCTION: Acpi_ns_valid_root_prefix
...@@ -802,16 +878,14 @@ acpi_ns_get_node_by_path ( ...@@ -802,16 +878,14 @@ acpi_ns_get_node_by_path (
ACPI_FUNCTION_TRACE_PTR ("Ns_get_node_by_path", pathname); ACPI_FUNCTION_TRACE_PTR ("Ns_get_node_by_path", pathname);
if (!pathname) { if (pathname) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Convert path to internal representation */ /* Convert path to internal representation */
status = acpi_ns_internalize_name (pathname, &internal_path); status = acpi_ns_internalize_name (pathname, &internal_path);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
}
/* Must lock namespace during lookup */ /* Must lock namespace during lookup */
...@@ -838,7 +912,10 @@ acpi_ns_get_node_by_path ( ...@@ -838,7 +912,10 @@ acpi_ns_get_node_by_path (
/* Cleanup */ /* Cleanup */
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
if (internal_path) {
ACPI_MEM_FREE (internal_path); ACPI_MEM_FREE (internal_path);
}
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* *
* Module Name: nsxfname - Public interfaces to the ACPI subsystem * Module Name: nsxfname - Public interfaces to the ACPI subsystem
* ACPI Namespace oriented interfaces * ACPI Namespace oriented interfaces
* $Revision: 91 $ * $Revision: 92 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -173,7 +173,7 @@ acpi_get_name ( ...@@ -173,7 +173,7 @@ acpi_get_name (
/* Validate/Allocate/Clear caller buffer */ /* Validate/Allocate/Clear caller buffer */
status = acpi_ut_initialize_buffer (buffer, PATH_SEGMENT_LENGTH); status = acpi_ut_initialize_buffer (buffer, ACPI_PATH_SEGMENT_LENGTH);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
goto unlock_and_exit; goto unlock_and_exit;
} }
......
...@@ -141,7 +141,7 @@ acpi_get_parent ( ...@@ -141,7 +141,7 @@ acpi_get_parent (
*ret_handle = *ret_handle =
acpi_ns_convert_entry_to_handle (acpi_ns_get_parent_node (node)); acpi_ns_convert_entry_to_handle (acpi_ns_get_parent_node (node));
/* Return exception if parent is null */ /* Return exeption if parent is null */
if (!acpi_ns_get_parent_node (node)) { if (!acpi_ns_get_parent_node (node)) {
status = AE_NULL_ENTRY; status = AE_NULL_ENTRY;
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: psparse - Parser top level AML parse routines * Module Name: psparse - Parser top level AML parse routines
* $Revision: 135 $ * $Revision: 137 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -1099,10 +1099,8 @@ acpi_ps_parse_aml ( ...@@ -1099,10 +1099,8 @@ acpi_ps_parse_aml (
status = AE_OK; status = AE_OK;
} }
else if (status != AE_OK) { else if (status != AE_OK) {
ACPI_REPORT_ERROR (("Method execution failed, %s\n", ACPI_REPORT_METHOD_ERROR ("Method execution failed",
acpi_format_exception (status))); walk_state->method_node, NULL, status);
ACPI_DUMP_PATHNAME (walk_state->method_node, "Method pathname: ",
ACPI_LV_ERROR, _COMPONENT);
} }
/* We are done with this walk, move on to the parent if any */ /* We are done with this walk, move on to the parent if any */
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: rscalc - Calculate stream and list lengths * Module Name: rscalc - Calculate stream and list lengths
* $Revision: 44 $ * $Revision: 45 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -791,10 +791,10 @@ acpi_rs_get_pci_routing_table_length ( ...@@ -791,10 +791,10 @@ acpi_rs_get_pci_routing_table_length (
if (name_found) { if (name_found) {
if (ACPI_GET_OBJECT_TYPE (*sub_object_list) == ACPI_TYPE_STRING) { if (ACPI_GET_OBJECT_TYPE (*sub_object_list) == ACPI_TYPE_STRING) {
/* /*
* The length String.Length field includes the * The length String.Length field does not include the
* terminating NULL * terminating NULL, add 1
*/ */
temp_size_needed += (*sub_object_list)->string.length; temp_size_needed += ((*sub_object_list)->string.length + 1);
} }
else { else {
temp_size_needed += acpi_ns_get_pathname_length ( temp_size_needed += acpi_ns_get_pathname_length (
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: rscreate - Create resource lists/tables * Module Name: rscreate - Create resource lists/tables
* $Revision: 61 $ * $Revision: 62 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -286,9 +286,9 @@ acpi_rs_create_pci_routing_table ( ...@@ -286,9 +286,9 @@ acpi_rs_create_pci_routing_table (
ACPI_STRCPY (user_prt->source, obj_desc->string.pointer); ACPI_STRCPY (user_prt->source, obj_desc->string.pointer);
/* Add to the Length field the length of the string */ /* Add to the Length field the length of the string (add 1 for terminator) */
user_prt->length += obj_desc->string.length; user_prt->length += obj_desc->string.length + 1;
break; break;
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: rsutils - Utilities for the resource manager * Module Name: rsutils - Utilities for the resource manager
* $Revision: 33 $ * $Revision: 34 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -68,30 +68,11 @@ acpi_rs_get_prt_method_data ( ...@@ -68,30 +68,11 @@ acpi_rs_get_prt_method_data (
/* /*
* Execute the method, no parameters * Execute the method, no parameters
*/ */
status = acpi_ns_evaluate_relative (handle, "_PRT", NULL, &obj_desc); status = acpi_ut_evaluate_object (handle, "_PRT", ACPI_BTYPE_PACKAGE, &obj_desc);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
if (!obj_desc) {
/* Return object is required */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _PRT\n"));
return_ACPI_STATUS (AE_TYPE);
}
/*
* The return object must be a package, so check the parameters. If the
* return object is not a package, then the underlying AML code is corrupt
* or improperly written.
*/
if (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_PACKAGE) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_PRT did not return a Package, returned %s\n",
acpi_ut_get_object_type_name (obj_desc)));
status = AE_AML_OPERAND_TYPE;
goto cleanup;
}
/* /*
* Create a resource linked list from the byte stream buffer that comes * Create a resource linked list from the byte stream buffer that comes
* back from the _CRS method execution. * back from the _CRS method execution.
...@@ -100,8 +81,6 @@ acpi_rs_get_prt_method_data ( ...@@ -100,8 +81,6 @@ acpi_rs_get_prt_method_data (
/* On exit, we must delete the object returned by Evaluate_object */ /* On exit, we must delete the object returned by Evaluate_object */
cleanup:
acpi_ut_remove_reference (obj_desc); acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -142,31 +121,11 @@ acpi_rs_get_crs_method_data ( ...@@ -142,31 +121,11 @@ acpi_rs_get_crs_method_data (
/* /*
* Execute the method, no parameters * Execute the method, no parameters
*/ */
status = acpi_ns_evaluate_relative (handle, "_CRS", NULL, &obj_desc); status = acpi_ut_evaluate_object (handle, "_CRS", ACPI_BTYPE_BUFFER, &obj_desc);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
if (!obj_desc) {
/* Return object is required */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _CRS\n"));
return_ACPI_STATUS (AE_TYPE);
}
/*
* The return object will be a buffer, but check the
* parameters. If the return object is not a buffer,
* then the underlying AML code is corrupt or improperly
* written.
*/
if (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_BUFFER) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_CRS did not return a Buffer, returned %s\n",
acpi_ut_get_object_type_name (obj_desc)));
status = AE_AML_OPERAND_TYPE;
goto cleanup;
}
/* /*
* Make the call to create a resource linked list from the * Make the call to create a resource linked list from the
* byte stream buffer that comes back from the _CRS method * byte stream buffer that comes back from the _CRS method
...@@ -176,8 +135,6 @@ acpi_rs_get_crs_method_data ( ...@@ -176,8 +135,6 @@ acpi_rs_get_crs_method_data (
/* On exit, we must delete the object returned by evaluate_object */ /* On exit, we must delete the object returned by evaluate_object */
cleanup:
acpi_ut_remove_reference (obj_desc); acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -218,31 +175,11 @@ acpi_rs_get_prs_method_data ( ...@@ -218,31 +175,11 @@ acpi_rs_get_prs_method_data (
/* /*
* Execute the method, no parameters * Execute the method, no parameters
*/ */
status = acpi_ns_evaluate_relative (handle, "_PRS", NULL, &obj_desc); status = acpi_ut_evaluate_object (handle, "_PRS", ACPI_BTYPE_BUFFER, &obj_desc);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
if (!obj_desc) {
/* Return object is required */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _PRS\n"));
return_ACPI_STATUS (AE_TYPE);
}
/*
* The return object will be a buffer, but check the
* parameters. If the return object is not a buffer,
* then the underlying AML code is corrupt or improperly
* written..
*/
if (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_BUFFER) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_PRS did not return a Buffer, returned %s\n",
acpi_ut_get_object_type_name (obj_desc)));
status = AE_AML_OPERAND_TYPE;
goto cleanup;
}
/* /*
* Make the call to create a resource linked list from the * Make the call to create a resource linked list from the
* byte stream buffer that comes back from the _CRS method * byte stream buffer that comes back from the _CRS method
...@@ -252,8 +189,6 @@ acpi_rs_get_prs_method_data ( ...@@ -252,8 +189,6 @@ acpi_rs_get_prs_method_data (
/* On exit, we must delete the object returned by evaluate_object */ /* On exit, we must delete the object returned by evaluate_object */
cleanup:
acpi_ut_remove_reference (obj_desc); acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* *
* Module Name: tbxface - Public interfaces to the ACPI subsystem * Module Name: tbxface - Public interfaces to the ACPI subsystem
* ACPI table oriented interfaces * ACPI table oriented interfaces
* $Revision: 59 $ * $Revision: 60 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -96,7 +96,7 @@ acpi_load_tables (void) ...@@ -96,7 +96,7 @@ acpi_load_tables (void)
goto error_exit; goto error_exit;
} }
ACPI_DEBUG_PRINT ((ACPI_DB_OK, "ACPI Tables successfully acquired\n")); ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n"));
/* Load the namespace from the tables */ /* Load the namespace from the tables */
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: tbxfroot - Find the root ACPI table (RSDT) * Module Name: tbxfroot - Find the root ACPI table (RSDT)
* $Revision: 65 $ * $Revision: 66 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -342,7 +342,7 @@ acpi_tb_scan_memory_for_rsdp ( ...@@ -342,7 +342,7 @@ acpi_tb_scan_memory_for_rsdp (
for (offset = 0, mem_rover = start_address; for (offset = 0, mem_rover = start_address;
offset < length; offset < length;
offset += RSDP_SCAN_STEP, mem_rover += RSDP_SCAN_STEP) { offset += ACPI_RSDP_SCAN_STEP, mem_rover += ACPI_RSDP_SCAN_STEP) {
/* The signature and checksum must both be correct */ /* The signature and checksum must both be correct */
...@@ -404,21 +404,21 @@ acpi_tb_find_rsdp ( ...@@ -404,21 +404,21 @@ acpi_tb_find_rsdp (
/* /*
* 1) Search EBDA (low memory) paragraphs * 1) Search EBDA (low memory) paragraphs
*/ */
status = acpi_os_map_memory ((u64) LO_RSDP_WINDOW_BASE, LO_RSDP_WINDOW_SIZE, status = acpi_os_map_memory ((u64) ACPI_LO_RSDP_WINDOW_BASE, ACPI_LO_RSDP_WINDOW_SIZE,
(void **) &table_ptr); (void **) &table_ptr);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %X for length %X\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %X for length %X\n",
LO_RSDP_WINDOW_BASE, LO_RSDP_WINDOW_SIZE)); ACPI_LO_RSDP_WINDOW_BASE, ACPI_LO_RSDP_WINDOW_SIZE));
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, LO_RSDP_WINDOW_SIZE); mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, ACPI_LO_RSDP_WINDOW_SIZE);
acpi_os_unmap_memory (table_ptr, LO_RSDP_WINDOW_SIZE); acpi_os_unmap_memory (table_ptr, ACPI_LO_RSDP_WINDOW_SIZE);
if (mem_rover) { if (mem_rover) {
/* Found it, return the physical address */ /* Found it, return the physical address */
phys_addr = LO_RSDP_WINDOW_BASE; phys_addr = ACPI_LO_RSDP_WINDOW_BASE;
phys_addr += ACPI_PTR_DIFF (mem_rover,table_ptr); phys_addr += ACPI_PTR_DIFF (mem_rover,table_ptr);
table_info->physical_address = phys_addr; table_info->physical_address = phys_addr;
...@@ -428,21 +428,21 @@ acpi_tb_find_rsdp ( ...@@ -428,21 +428,21 @@ acpi_tb_find_rsdp (
/* /*
* 2) Search upper memory: 16-byte boundaries in E0000h-F0000h * 2) Search upper memory: 16-byte boundaries in E0000h-F0000h
*/ */
status = acpi_os_map_memory ((u64) HI_RSDP_WINDOW_BASE, HI_RSDP_WINDOW_SIZE, status = acpi_os_map_memory ((u64) ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE,
(void **) &table_ptr); (void **) &table_ptr);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %X for length %X\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %X for length %X\n",
HI_RSDP_WINDOW_BASE, HI_RSDP_WINDOW_SIZE)); ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE));
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, HI_RSDP_WINDOW_SIZE); mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, ACPI_HI_RSDP_WINDOW_SIZE);
acpi_os_unmap_memory (table_ptr, HI_RSDP_WINDOW_SIZE); acpi_os_unmap_memory (table_ptr, ACPI_HI_RSDP_WINDOW_SIZE);
if (mem_rover) { if (mem_rover) {
/* Found it, return the physical address */ /* Found it, return the physical address */
phys_addr = HI_RSDP_WINDOW_BASE; phys_addr = ACPI_HI_RSDP_WINDOW_BASE;
phys_addr += ACPI_PTR_DIFF (mem_rover, table_ptr); phys_addr += ACPI_PTR_DIFF (mem_rover, table_ptr);
table_info->physical_address = phys_addr; table_info->physical_address = phys_addr;
...@@ -457,8 +457,8 @@ acpi_tb_find_rsdp ( ...@@ -457,8 +457,8 @@ acpi_tb_find_rsdp (
/* /*
* 1) Search EBDA (low memory) paragraphs * 1) Search EBDA (low memory) paragraphs
*/ */
mem_rover = acpi_tb_scan_memory_for_rsdp (ACPI_PHYSADDR_TO_PTR (LO_RSDP_WINDOW_BASE), mem_rover = acpi_tb_scan_memory_for_rsdp (ACPI_PHYSADDR_TO_PTR (ACPI_LO_RSDP_WINDOW_BASE),
LO_RSDP_WINDOW_SIZE); ACPI_LO_RSDP_WINDOW_SIZE);
if (mem_rover) { if (mem_rover) {
/* Found it, return the physical address */ /* Found it, return the physical address */
...@@ -469,8 +469,8 @@ acpi_tb_find_rsdp ( ...@@ -469,8 +469,8 @@ acpi_tb_find_rsdp (
/* /*
* 2) Search upper memory: 16-byte boundaries in E0000h-F0000h * 2) Search upper memory: 16-byte boundaries in E0000h-F0000h
*/ */
mem_rover = acpi_tb_scan_memory_for_rsdp (ACPI_PHYSADDR_TO_PTR (HI_RSDP_WINDOW_BASE), mem_rover = acpi_tb_scan_memory_for_rsdp (ACPI_PHYSADDR_TO_PTR (ACPI_HI_RSDP_WINDOW_BASE),
HI_RSDP_WINDOW_SIZE); ACPI_HI_RSDP_WINDOW_SIZE);
if (mem_rover) { if (mem_rover) {
/* Found it, return the physical address */ /* Found it, return the physical address */
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: utalloc - local cache and memory allocation routines * Module Name: utalloc - local cache and memory allocation routines
* $Revision: 127 $ * $Revision: 128 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -968,11 +968,11 @@ acpi_ut_dump_allocations ( ...@@ -968,11 +968,11 @@ acpi_ut_dump_allocations (
/* Print summary */ /* Print summary */
if (!num_outstanding) { if (!num_outstanding) {
ACPI_DEBUG_PRINT ((ACPI_DB_OK, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"No outstanding allocations.\n")); "No outstanding allocations.\n"));
} }
else { else {
ACPI_DEBUG_PRINT ((ACPI_DB_OK, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"%d(%X) Outstanding allocations\n", "%d(%X) Outstanding allocations\n",
num_outstanding, num_outstanding)); num_outstanding, num_outstanding));
} }
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: utcopy - Internal to external object translation utilities * Module Name: utcopy - Internal to external object translation utilities
* $Revision: 106 $ * $Revision: 107 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -625,8 +625,23 @@ acpi_ut_copy_simple_object ( ...@@ -625,8 +625,23 @@ acpi_ut_copy_simple_object (
dest_desc->buffer.node = NULL; dest_desc->buffer.node = NULL;
dest_desc->common.flags = source_desc->common.flags; dest_desc->common.flags = source_desc->common.flags;
/* Fall through to common string/buffer case */ /*
/*lint -fallthrough */ * Allocate and copy the actual buffer if and only if:
* 1) There is a valid buffer (length > 0)
* 2) The buffer is not static (not in an ACPI table) (in this case,
* the actual pointer was already copied above)
*/
if ((source_desc->buffer.length) &&
(!(source_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
dest_desc->buffer.pointer = ACPI_MEM_ALLOCATE (source_desc->buffer.length);
if (!dest_desc->buffer.pointer) {
return (AE_NO_MEMORY);
}
ACPI_MEMCPY (dest_desc->buffer.pointer, source_desc->buffer.pointer,
source_desc->buffer.length);
}
break;
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
...@@ -638,13 +653,13 @@ acpi_ut_copy_simple_object ( ...@@ -638,13 +653,13 @@ acpi_ut_copy_simple_object (
*/ */
if ((source_desc->string.length) && if ((source_desc->string.length) &&
(!(source_desc->common.flags & AOPOBJ_STATIC_POINTER))) { (!(source_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
dest_desc->string.pointer = ACPI_MEM_ALLOCATE (source_desc->string.length); dest_desc->string.pointer = ACPI_MEM_ALLOCATE (source_desc->string.length + 1);
if (!dest_desc->string.pointer) { if (!dest_desc->string.pointer) {
return (AE_NO_MEMORY); return (AE_NO_MEMORY);
} }
ACPI_MEMCPY (dest_desc->string.pointer, source_desc->string.pointer, ACPI_MEMCPY (dest_desc->string.pointer, source_desc->string.pointer,
source_desc->string.length); source_desc->string.length + 1);
} }
break; break;
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: utdelete - object deletion and reference count utilities * Module Name: utdelete - object deletion and reference count utilities
* $Revision: 92 $ * $Revision: 93 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -329,7 +329,7 @@ acpi_ut_update_ref_count ( ...@@ -329,7 +329,7 @@ acpi_ut_update_ref_count (
* Sanity check the reference count, for debug purposes only. * Sanity check the reference count, for debug purposes only.
* (A deleted object will have a huge reference count) * (A deleted object will have a huge reference count)
*/ */
if (count > MAX_REFERENCE_COUNT) { if (count > ACPI_MAX_REFERENCE_COUNT) {
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, ACPI_DEBUG_PRINT ((ACPI_DB_WARN,
"**** Warning **** Large Reference Count (%X) in object %p\n\n", "**** Warning **** Large Reference Count (%X) in object %p\n\n",
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: uteval - Object evaluation * Module Name: uteval - Object evaluation
* $Revision: 41 $ * $Revision: 42 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -35,80 +35,157 @@ ...@@ -35,80 +35,157 @@
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: Acpi_ut_evaluate_numeric_object * FUNCTION: Acpi_ut_evaluate_object
* *
* PARAMETERS: *Object_name - Object name to be evaluated * PARAMETERS: Prefix_node - Starting node
* Device_node - Node for the device * Path - Path to object from starting node
* *Address - Where the value is returned * Expected_return_types - Bitmap of allowed return types
* Return_desc - Where a return value is stored
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: evaluates a numeric namespace object for a selected device * DESCRIPTION: Evaluates a namespace object and verifies the type of the
* and stores results in *Address. * return object. Common code that simplifies accessing objects
* that have required return objects of fixed types.
* *
* NOTE: Internal function, no parameter validation * NOTE: Internal function, no parameter validation
* *
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ut_evaluate_numeric_object ( acpi_ut_evaluate_object (
NATIVE_CHAR *object_name, acpi_namespace_node *prefix_node,
acpi_namespace_node *device_node, NATIVE_CHAR *path,
acpi_integer *address) u32 expected_return_btypes,
acpi_operand_object **return_desc)
{ {
acpi_operand_object *obj_desc; acpi_operand_object *obj_desc;
acpi_status status; acpi_status status;
u32 return_btype;
ACPI_FUNCTION_TRACE ("Ut_evaluate_numeric_object"); ACPI_FUNCTION_TRACE ("Ut_evaluate_object");
/* Execute the method */ /* Evaluate the object/method */
status = acpi_ns_evaluate_relative (device_node, object_name, NULL, &obj_desc); status = acpi_ns_evaluate_relative (prefix_node, path, NULL, &obj_desc);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
if (status == AE_NOT_FOUND) { if (status == AE_NOT_FOUND) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s on %4.4s was not found\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s.%s] was not found\n",
object_name, device_node->name.ascii)); prefix_node->name.ascii, path));
} }
else { else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s on %4.4s failed with status %s\n", ACPI_REPORT_METHOD_ERROR ("Method execution failed",
object_name, device_node->name.ascii, prefix_node, path, status);
acpi_format_exception (status)));
} }
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
/* Did we get a return object? */ /* Did we get a return object? */
if (!obj_desc) { if (!obj_desc) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from %s\n", if (expected_return_btypes) {
object_name)); ACPI_REPORT_METHOD_ERROR ("No object was returned from",
return_ACPI_STATUS (AE_TYPE); prefix_node, path, AE_NOT_EXIST);
return_ACPI_STATUS (AE_NOT_EXIST);
} }
/* Is the return object of the correct type? */ return_ACPI_STATUS (AE_OK);
}
/* Map the return object type to the bitmapped type */
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_INTEGER:
return_btype = ACPI_BTYPE_INTEGER;
break;
case ACPI_TYPE_BUFFER:
return_btype = ACPI_BTYPE_BUFFER;
break;
case ACPI_TYPE_STRING:
return_btype = ACPI_BTYPE_STRING;
break;
case ACPI_TYPE_PACKAGE:
return_btype = ACPI_BTYPE_PACKAGE;
break;
default:
return_btype = 0;
break;
}
/* Is the return object one of the expected types? */
if (!(expected_return_btypes & return_btype)) {
ACPI_REPORT_METHOD_ERROR ("Return object type is incorrect",
prefix_node, path, AE_TYPE);
if (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_INTEGER) {
status = AE_TYPE;
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Type returned from %s was not an Integer: %X \n", "Type returned from %s was incorrect: %X\n",
object_name, ACPI_GET_OBJECT_TYPE (obj_desc))); path, ACPI_GET_OBJECT_TYPE (obj_desc)));
/* On error exit, we must delete the return object */
acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (AE_TYPE);
} }
else {
/* /* Object type is OK, return it */
* Since the structure is a union, setting any field will set all
* of the variables in the union *return_desc = obj_desc;
*/ return_ACPI_STATUS (AE_OK);
*address = obj_desc->integer.value; }
/*******************************************************************************
*
* FUNCTION: Acpi_ut_evaluate_numeric_object
*
* PARAMETERS: *Object_name - Object name to be evaluated
* Device_node - Node for the device
* *Address - Where the value is returned
*
* RETURN: Status
*
* DESCRIPTION: Evaluates a numeric namespace object for a selected device
* and stores result in *Address.
*
* NOTE: Internal function, no parameter validation
*
******************************************************************************/
acpi_status
acpi_ut_evaluate_numeric_object (
NATIVE_CHAR *object_name,
acpi_namespace_node *device_node,
acpi_integer *address)
{
acpi_operand_object *obj_desc;
acpi_status status;
ACPI_FUNCTION_TRACE ("Ut_evaluate_numeric_object");
status = acpi_ut_evaluate_object (device_node, object_name,
ACPI_BTYPE_INTEGER, &obj_desc);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
} }
/* Get the returned Integer */
*address = obj_desc->integer.value;
/* On exit, we must delete the return object */ /* On exit, we must delete the return object */
acpi_ut_remove_reference (obj_desc); acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -141,43 +218,12 @@ acpi_ut_execute_HID ( ...@@ -141,43 +218,12 @@ acpi_ut_execute_HID (
ACPI_FUNCTION_TRACE ("Ut_execute_HID"); ACPI_FUNCTION_TRACE ("Ut_execute_HID");
/* Execute the method */ status = acpi_ut_evaluate_object (device_node, METHOD_NAME__HID,
ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &obj_desc);
status = acpi_ns_evaluate_relative (device_node,
METHOD_NAME__HID, NULL, &obj_desc);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
if (status == AE_NOT_FOUND) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "_HID on %4.4s was not found\n",
device_node->name.ascii));
}
else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_HID on %4.4s failed %s\n",
device_node->name.ascii, acpi_format_exception (status)));
}
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
/* Did we get a return object? */
if (!obj_desc) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _HID\n"));
return_ACPI_STATUS (AE_TYPE);
}
/*
* A _HID can return either a Number (32 bit compressed EISA ID) or
* a string
*/
if ((ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_INTEGER) &&
(ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_STRING)) {
status = AE_TYPE;
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Type returned from _HID not a number or string: %s(%X) \n",
acpi_ut_get_object_type_name (obj_desc),
ACPI_GET_OBJECT_TYPE (obj_desc)));
}
else {
if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) {
/* Convert the Numeric HID to string */ /* Convert the Numeric HID to string */
...@@ -188,12 +234,10 @@ acpi_ut_execute_HID ( ...@@ -188,12 +234,10 @@ acpi_ut_execute_HID (
ACPI_STRNCPY (hid->buffer, obj_desc->string.pointer, sizeof(hid->buffer)); ACPI_STRNCPY (hid->buffer, obj_desc->string.pointer, sizeof(hid->buffer));
} }
}
/* On exit, we must delete the return object */ /* On exit, we must delete the return object */
acpi_ut_remove_reference (obj_desc); acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -225,30 +269,13 @@ acpi_ut_execute_CID ( ...@@ -225,30 +269,13 @@ acpi_ut_execute_CID (
ACPI_FUNCTION_TRACE ("Ut_execute_CID"); ACPI_FUNCTION_TRACE ("Ut_execute_CID");
/* Execute the method */
status = acpi_ns_evaluate_relative (device_node, status = acpi_ut_evaluate_object (device_node, METHOD_NAME__CID,
METHOD_NAME__CID, NULL, &obj_desc); ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_PACKAGE, &obj_desc);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
if (status == AE_NOT_FOUND) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "_CID on %4.4s was not found\n",
device_node->name.ascii));
}
else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_CID on %4.4s failed %s\n",
device_node->name.ascii, acpi_format_exception (status)));
}
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
/* Did we get a return object? */
if (!obj_desc) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _CID\n"));
return_ACPI_STATUS (AE_TYPE);
}
/* /*
* A _CID can return either a single compatible ID or a package of compatible * A _CID can return either a single compatible ID or a package of compatible
* IDs. Each compatible ID can be a Number (32 bit compressed EISA ID) or * IDs. Each compatible ID can be a Number (32 bit compressed EISA ID) or
...@@ -266,28 +293,25 @@ acpi_ut_execute_CID ( ...@@ -266,28 +293,25 @@ acpi_ut_execute_CID (
/* Copy the String CID from the returned object */ /* Copy the String CID from the returned object */
ACPI_STRNCPY (cid->buffer, obj_desc->string.pointer, sizeof(cid->buffer)); ACPI_STRNCPY (cid->buffer, obj_desc->string.pointer, sizeof (cid->buffer));
break; break;
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
/* TBD: Parse package elements; need different return struct, etc. */ /* TBD: Parse package elements; need different return struct, etc. */
status = AE_SUPPORT;
break; break;
default: default:
status = AE_TYPE; status = AE_TYPE;
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Type returned from _CID not a number, string, or package: %s(%X) \n",
acpi_ut_get_object_type_name (obj_desc),
ACPI_GET_OBJECT_TYPE (obj_desc)));
break; break;
} }
/* On exit, we must delete the return object */ /* On exit, we must delete the return object */
acpi_ut_remove_reference (obj_desc); acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -317,46 +341,15 @@ acpi_ut_execute_UID ( ...@@ -317,46 +341,15 @@ acpi_ut_execute_UID (
acpi_status status; acpi_status status;
ACPI_FUNCTION_NAME ("Ut_execute_UID"); ACPI_FUNCTION_TRACE ("Ut_execute_UID");
/* Execute the method */ status = acpi_ut_evaluate_object (device_node, METHOD_NAME__UID,
ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &obj_desc);
status = acpi_ns_evaluate_relative (device_node,
METHOD_NAME__UID, NULL, &obj_desc);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
if (status == AE_NOT_FOUND) { return_ACPI_STATUS (status);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "_UID on %4.4s was not found\n",
device_node->name.ascii));
}
else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"_UID on %4.4s failed %s\n",
device_node->name.ascii, acpi_format_exception (status)));
}
return (status);
}
/* Did we get a return object? */
if (!obj_desc) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _UID\n"));
return (AE_TYPE);
} }
/*
* A _UID can return either a Number (32 bit compressed EISA ID) or
* a string
*/
if ((ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_INTEGER) &&
(ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_STRING)) {
status = AE_TYPE;
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Type returned from _UID was not a number or string: %X \n",
ACPI_GET_OBJECT_TYPE (obj_desc)));
}
else {
if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) {
/* Convert the Numeric UID to string */ /* Convert the Numeric UID to string */
...@@ -365,16 +358,13 @@ acpi_ut_execute_UID ( ...@@ -365,16 +358,13 @@ acpi_ut_execute_UID (
else { else {
/* Copy the String UID from the returned object */ /* Copy the String UID from the returned object */
ACPI_STRNCPY (uid->buffer, obj_desc->string.pointer, sizeof(uid->buffer)); ACPI_STRNCPY (uid->buffer, obj_desc->string.pointer, sizeof (uid->buffer));
} }
}
/* On exit, we must delete the return object */ /* On exit, we must delete the return object */
acpi_ut_remove_reference (obj_desc); acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status);
return (status);
} }
...@@ -406,51 +396,27 @@ acpi_ut_execute_STA ( ...@@ -406,51 +396,27 @@ acpi_ut_execute_STA (
ACPI_FUNCTION_TRACE ("Ut_execute_STA"); ACPI_FUNCTION_TRACE ("Ut_execute_STA");
/* Execute the method */ status = acpi_ut_evaluate_object (device_node, METHOD_NAME__STA,
ACPI_BTYPE_INTEGER, &obj_desc);
status = acpi_ns_evaluate_relative (device_node, if (ACPI_FAILURE (status)) {
METHOD_NAME__STA, NULL, &obj_desc);
if (AE_NOT_FOUND == status) { if (AE_NOT_FOUND == status) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"_STA on %4.4s was not found, assuming present.\n", "_STA on %4.4s was not found, assuming device is present\n",
device_node->name.ascii)); device_node->name.ascii));
*flags = 0x0F; *flags = 0x0F;
status = AE_OK; status = AE_OK;
} }
else if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status);
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_STA on %4.4s failed %s\n",
device_node->name.ascii,
acpi_format_exception (status)));
}
else /* success */ {
/* Did we get a return object? */
if (!obj_desc) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _STA\n"));
return_ACPI_STATUS (AE_TYPE);
} }
/* Is the return object of the correct type? */
if (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_INTEGER) {
status = AE_TYPE;
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Type returned from _STA was not a number: %X \n",
ACPI_GET_OBJECT_TYPE (obj_desc)));
}
else {
/* Extract the status flags */ /* Extract the status flags */
*flags = (u32) obj_desc->integer.value; *flags = (u32) obj_desc->integer.value;
}
/* On exit, we must delete the return object */ /* On exit, we must delete the return object */
acpi_ut_remove_reference (obj_desc); acpi_ut_remove_reference (obj_desc);
}
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
/****************************************************************************** /******************************************************************************
* *
* Module Name: utglobal - Global variables for the ACPI subsystem * Module Name: utglobal - Global variables for the ACPI subsystem
* $Revision: 172 $ * $Revision: 176 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -126,9 +126,9 @@ acpi_format_exception ( ...@@ -126,9 +126,9 @@ acpi_format_exception (
/* Debug switch - level and trace mask */ /* Debug switch - level and trace mask */
#ifdef ACPI_DEBUG_OUTPUT #ifdef ACPI_DEBUG_OUTPUT
u32 acpi_dbg_level = DEBUG_DEFAULT; u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT;
#else #else
u32 acpi_dbg_level = NORMAL_DEFAULT; u32 acpi_dbg_level = ACPI_NORMAL_DEFAULT;
#endif #endif
/* Debug switch - layer (component) mask */ /* Debug switch - layer (component) mask */
...@@ -140,6 +140,7 @@ u32 acpi_gbl_nesting_level = 0; ...@@ -140,6 +140,7 @@ u32 acpi_gbl_nesting_level = 0;
/* Debugger globals */ /* Debugger globals */
u8 acpi_gbl_db_terminate_threads = FALSE; u8 acpi_gbl_db_terminate_threads = FALSE;
u8 acpi_gbl_abort_method = FALSE;
u8 acpi_gbl_method_executing = FALSE; u8 acpi_gbl_method_executing = FALSE;
/* System flags */ /* System flags */
...@@ -152,9 +153,13 @@ u8 acpi_gbl_shutdown = TRUE; ...@@ -152,9 +153,13 @@ u8 acpi_gbl_shutdown = TRUE;
const u8 acpi_gbl_decode_to8bit [8] = {1,2,4,8,16,32,64,128}; const u8 acpi_gbl_decode_to8bit [8] = {1,2,4,8,16,32,64,128};
const NATIVE_CHAR *acpi_gbl_db_sleep_states[ACPI_NUM_SLEEP_STATES] = { const NATIVE_CHAR *acpi_gbl_db_sleep_states[ACPI_S_STATE_COUNT] = {
"\\_S0_","\\_S1_","\\_S2_","\\_S3_", "\\_S0_",
"\\_S4_","\\_S5_","\\_S4B"}; "\\_S1_",
"\\_S2_",
"\\_S3_",
"\\_S4_",
"\\_S5_"};
/****************************************************************************** /******************************************************************************
...@@ -669,11 +674,11 @@ acpi_ut_init_globals ( ...@@ -669,11 +674,11 @@ acpi_ut_init_globals (
acpi_gbl_memory_lists[ACPI_MEM_LIST_OPERAND].object_size = sizeof (acpi_operand_object); acpi_gbl_memory_lists[ACPI_MEM_LIST_OPERAND].object_size = sizeof (acpi_operand_object);
acpi_gbl_memory_lists[ACPI_MEM_LIST_WALK].object_size = sizeof (acpi_walk_state); acpi_gbl_memory_lists[ACPI_MEM_LIST_WALK].object_size = sizeof (acpi_walk_state);
acpi_gbl_memory_lists[ACPI_MEM_LIST_STATE].max_cache_depth = MAX_STATE_CACHE_DEPTH; acpi_gbl_memory_lists[ACPI_MEM_LIST_STATE].max_cache_depth = ACPI_MAX_STATE_CACHE_DEPTH;
acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE].max_cache_depth = MAX_PARSE_CACHE_DEPTH; acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE].max_cache_depth = ACPI_MAX_PARSE_CACHE_DEPTH;
acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE_EXT].max_cache_depth = MAX_EXTPARSE_CACHE_DEPTH; acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE_EXT].max_cache_depth = ACPI_MAX_EXTPARSE_CACHE_DEPTH;
acpi_gbl_memory_lists[ACPI_MEM_LIST_OPERAND].max_cache_depth = MAX_OBJECT_CACHE_DEPTH; acpi_gbl_memory_lists[ACPI_MEM_LIST_OPERAND].max_cache_depth = ACPI_MAX_OBJECT_CACHE_DEPTH;
acpi_gbl_memory_lists[ACPI_MEM_LIST_WALK].max_cache_depth = MAX_WALK_CACHE_DEPTH; acpi_gbl_memory_lists[ACPI_MEM_LIST_WALK].max_cache_depth = ACPI_MAX_WALK_CACHE_DEPTH;
ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].list_name = "Global Memory Allocation"); ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].list_name = "Global Memory Allocation");
ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].list_name = "Namespace Nodes"); ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].list_name = "Namespace Nodes");
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: utmisc - common utility procedures * Module Name: utmisc - common utility procedures
* $Revision: 87 $ * $Revision: 90 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -200,39 +200,66 @@ acpi_ut_set_integer_width ( ...@@ -200,39 +200,66 @@ acpi_ut_set_integer_width (
* FUNCTION: Acpi_ut_display_init_pathname * FUNCTION: Acpi_ut_display_init_pathname
* *
* PARAMETERS: Obj_handle - Handle whose pathname will be displayed * PARAMETERS: Obj_handle - Handle whose pathname will be displayed
* Path - Additional path string to be appended * Path - Additional path string to be appended.
* (NULL if no extra path)
* *
* RETURN: acpi_status * RETURN: acpi_status
* *
* DESCRIPTION: Display full pathnbame of an object, DEBUG ONLY * DESCRIPTION: Display full pathname of an object, DEBUG ONLY
* *
******************************************************************************/ ******************************************************************************/
void void
acpi_ut_display_init_pathname ( acpi_ut_display_init_pathname (
acpi_handle obj_handle, u8 type,
acpi_namespace_node *obj_handle,
char *path) char *path)
{ {
acpi_status status; acpi_status status;
acpi_buffer buffer; acpi_buffer buffer;
ACPI_FUNCTION_NAME ("Ut_display_init_pathname"); ACPI_FUNCTION_ENTRY ();
buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; /* Only print the path if the appropriate debug level is enabled */
if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
return;
}
/* Get the full pathname to the node */
buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
status = acpi_ns_handle_to_pathname (obj_handle, &buffer); status = acpi_ns_handle_to_pathname (obj_handle, &buffer);
if (ACPI_SUCCESS (status)) { if (ACPI_FAILURE (status)) {
if (path) { return;
ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "%s.%s\n", (char *) buffer.pointer, path));
} }
else {
ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "%s\n", (char *) buffer.pointer)); /* Print what we're doing */
switch (type) {
case ACPI_TYPE_METHOD:
acpi_os_printf ("Executing ");
break;
default:
acpi_os_printf ("Initializing ");
break;
} }
ACPI_MEM_FREE (buffer.pointer); /* Print the object type and pathname */
acpi_os_printf ("%-12s %s", acpi_ut_get_type_name (type), (char *) buffer.pointer);
/* Extra path is used to append names like _STA, _INI, etc. */
if (path) {
acpi_os_printf (".%s", path);
} }
acpi_os_printf ("\n");
ACPI_MEM_FREE (buffer.pointer);
} }
#endif #endif
......
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