Commit 942abc30 authored by Linus Torvalds's avatar Linus Torvalds

Merge http://linux-acpi.bkbits.net/linux-acpi

into home.transmeta.com:/home/torvalds/v2.5/linux
parents 80ca75c4 afde3991
......@@ -142,7 +142,7 @@ acpi_set_debug (
switch (flag) {
case ACPI_DEBUG_LOW:
acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS;
acpi_dbg_level = DEBUG_DEFAULT;
acpi_dbg_level = ACPI_DEBUG_DEFAULT;
break;
case ACPI_DEBUG_MEDIUM:
acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS;
......
......@@ -3,7 +3,8 @@
#
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)
......
/******************************************************************************
*
* 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
* $Revision: 66 $
* $Revision: 67 $
*
******************************************************************************/
......@@ -68,7 +68,7 @@ acpi_ds_method_data_init (
/* 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,
NAMEOF_ARG_NTE);
walk_state->arguments[i].name.integer |= (i << 24);
......@@ -79,7 +79,7 @@ acpi_ds_method_data_init (
/* 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,
NAMEOF_LOCAL_NTE);
......@@ -118,7 +118,7 @@ acpi_ds_method_data_delete_all (
/* 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) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%d=%p\n",
index, walk_state->local_variables[index].object));
......@@ -131,7 +131,7 @@ acpi_ds_method_data_delete_all (
/* 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) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%d=%p\n",
index, walk_state->arguments[index].object));
......@@ -182,7 +182,7 @@ acpi_ds_method_data_init_args (
/* 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.
* Store the argument in the method/walk descriptor
......@@ -230,9 +230,9 @@ acpi_ds_method_data_get_node (
switch (opcode) {
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",
index, MTH_MAX_LOCAL));
index, ACPI_METHOD_MAX_LOCAL));
return_ACPI_STATUS (AE_AML_INVALID_INDEX);
}
......@@ -243,9 +243,9 @@ acpi_ds_method_data_get_node (
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",
index, MTH_MAX_ARG));
index, ACPI_METHOD_MAX_ARG));
return_ACPI_STATUS (AE_AML_INVALID_INDEX);
}
......
/******************************************************************************
*
* Module Name: dsobject - Dispatcher object management routines
* $Revision: 110 $
* $Revision: 111 $
*
*****************************************************************************/
......@@ -36,187 +36,6 @@
#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
......
......@@ -2,7 +2,7 @@
*
* Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes
* $Revision: 83 $
* $Revision: 84 $
*
*****************************************************************************/
......@@ -173,7 +173,7 @@ acpi_ds_get_buffer_field_arguments (
extra_desc = acpi_ns_get_secondary_object (obj_desc);
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",
node->name.ascii));
......@@ -317,7 +317,7 @@ acpi_ds_get_region_arguments (
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",
node->name.ascii, extra_desc->extra.aml_start));
......
/******************************************************************************
*
* Module Name: dswload - Dispatcher namespace load callbacks
* $Revision: 78 $
* $Revision: 80 $
*
*****************************************************************************/
......@@ -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 */
if (acpi_ns_opens_scope (object_type)) {
......@@ -651,11 +682,10 @@ acpi_ds_load2_end_op (
status = acpi_ds_scope_stack_pop (walk_state);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
goto cleanup;
}
}
/*
* Named operations are as follows:
*
......@@ -789,26 +819,6 @@ acpi_ds_load2_end_op (
case AML_TYPE_NAMED_COMPLEX:
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
case AML_REGION_OP:
/*
......@@ -842,6 +852,7 @@ acpi_ds_load2_end_op (
default:
/* All NAMED_COMPLEX opcodes must be handled above */
/* Note: Method objects were already created in Pass 1 */
break;
}
break;
......@@ -891,7 +902,6 @@ acpi_ds_load2_end_op (
break;
}
cleanup:
/* Remove the Node pushed at the very beginning */
......
/******************************************************************************
*
* Module Name: dswstate - Dispatcher parse tree walk management routines
* $Revision: 70 $
* $Revision: 71 $
*
*****************************************************************************/
......@@ -65,7 +65,7 @@ acpi_ds_result_insert (
return (AE_NOT_EXIST);
}
if (index >= OBJ_NUM_OPERANDS) {
if (index >= ACPI_OBJ_NUM_OPERANDS) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Index out of range: %X Obj=%p State=%p Num=%X\n",
index, object, walk_state, state->results.num_results));
......@@ -124,7 +124,7 @@ acpi_ds_result_remove (
return (AE_NOT_EXIST);
}
if (index >= OBJ_MAX_OPERAND) {
if (index >= ACPI_OBJ_MAX_OPERAND) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Index out of range: %X State=%p Num=%X\n",
index, walk_state, state->results.num_results));
......@@ -196,7 +196,7 @@ acpi_ds_result_pop (
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 */
if (state->results.obj_desc [index -1]) {
......@@ -312,7 +312,7 @@ acpi_ds_result_push (
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,
"Result stack overflow: Obj=%p State=%p Num=%X\n",
object, walk_state, state->results.num_results));
......@@ -440,7 +440,7 @@ acpi_ds_obj_stack_delete_all (
/* 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]) {
acpi_ut_remove_reference (walk_state->operands[i]);
walk_state->operands[i] = NULL;
......@@ -474,7 +474,7 @@ acpi_ds_obj_stack_push (
/* 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,
"overflow! Obj=%p State=%p #Ops=%X\n",
object, walk_state, walk_state->num_operands));
......@@ -922,7 +922,7 @@ acpi_ds_init_aml_walk (
/* 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)) {
return_ACPI_STATUS (status);
}
......
......@@ -3,7 +3,8 @@
#
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)
......
This diff is collapsed.
This diff is collapsed.
/******************************************************************************
*
* Module Name: evregion - ACPI Address_space (Op_region) handler dispatch
* $Revision: 135 $
* $Revision: 136 $
*
*****************************************************************************/
......@@ -172,7 +172,7 @@ acpi_ev_execute_reg_method (
/*
* 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);
acpi_ut_remove_reference (params[1]);
......
/******************************************************************************
*
* Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
* $Revision: 57 $
* $Revision: 59 $
*
*****************************************************************************/
......@@ -60,18 +60,18 @@ acpi_enable (void)
}
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 {
/* Transition to ACPI mode */
status = acpi_hw_set_mode (ACPI_SYS_MODE_ACPI);
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);
}
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);
......@@ -104,18 +104,19 @@ acpi_disable (void)
}
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 {
/* Transition to LEGACY mode */
status = acpi_hw_set_mode (ACPI_SYS_MODE_LEGACY);
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);
}
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);
......
/******************************************************************************
*
* Module Name: exconvrt - Object conversion routines
* $Revision: 44 $
* $Revision: 45 $
*
*****************************************************************************/
......@@ -230,7 +230,7 @@ acpi_ex_convert_to_buffer (
* Create a new Buffer object
* 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) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
......
/******************************************************************************
*
* Module Name: exfield - ACPI AML (p-code) execution - field manipulation
* $Revision: 115 $
* $Revision: 116 $
*
*****************************************************************************/
......@@ -56,7 +56,7 @@ acpi_ex_read_data_from_field (
{
acpi_status status;
acpi_operand_object *buffer_desc;
u32 length;
ACPI_SIZE length;
void *buffer;
u8 locked;
......@@ -118,7 +118,7 @@ acpi_ex_read_data_from_field (
*
* 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) {
/* Field is too large for an Integer, create a Buffer instead */
......@@ -143,7 +143,7 @@ acpi_ex_read_data_from_field (
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"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,
"Field_write: Bit_len=%X Bit_off=%X Byte_off=%X\n",
obj_desc->common_field.bit_length,
......@@ -156,7 +156,7 @@ acpi_ex_read_data_from_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);
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
* $Revision: 112 $
* $Revision: 113 $
*
*****************************************************************************/
......@@ -281,8 +281,8 @@ acpi_ex_do_concatenate (
/* Operand0 is string */
new_buf = ACPI_MEM_ALLOCATE ((ACPI_SIZE) obj_desc1->string.length +
(ACPI_SIZE) obj_desc2->string.length + 1);
new_buf = ACPI_MEM_CALLOCATE ((ACPI_SIZE) obj_desc1->string.length +
(ACPI_SIZE) obj_desc2->string.length + 1);
if (!new_buf) {
ACPI_REPORT_ERROR
(("Ex_do_concatenate: String allocation failure\n"));
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exregion - ACPI default Op_region (address space) handlers
* $Revision: 80 $
* $Revision: 81 $
*
*****************************************************************************/
......@@ -133,8 +133,8 @@ acpi_ex_system_memory_space_handler (
* constrain the maximum mapping size to something reasonable.
*/
window_size = (ACPI_SIZE) ((mem_info->address + mem_info->length) - address);
if (window_size > SYSMEM_REGION_WINDOW_SIZE) {
window_size = SYSMEM_REGION_WINDOW_SIZE;
if (window_size > ACPI_SYSMEM_REGION_WINDOW_SIZE) {
window_size = ACPI_SYSMEM_REGION_WINDOW_SIZE;
}
/* Create a new mapping starting at the address given */
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* 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 (
length = source_desc->buffer.length;
/*
* If target is a buffer of length zero, allocate a new
* buffer of the proper length
* If target is a buffer of length zero or is a static buffer,
* 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);
if (!target_desc->buffer.pointer) {
return (AE_NO_MEMORY);
}
target_desc->common.flags &= ~AOPOBJ_STATIC_POINTER;
target_desc->buffer.length = length;
}
......@@ -137,11 +139,13 @@ acpi_ex_store_string_to_string (
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
*/
ACPI_MEMSET (target_desc->string.pointer, 0, (ACPI_SIZE) target_desc->string.length + 1);
......@@ -165,6 +169,7 @@ acpi_ex_store_string_to_string (
return (AE_NO_MEMORY);
}
target_desc->common.flags &= ~AOPOBJ_STATIC_POINTER;
ACPI_MEMCPY (target_desc->string.pointer, buffer, length);
}
......
......@@ -3,7 +3,7 @@
*
* Module Name: hwregs - Read/write access functions for the various ACPI
* control and status registers.
* $Revision: 134 $
* $Revision: 137 $
*
******************************************************************************/
......@@ -142,6 +142,9 @@ acpi_get_sleep_type_data (
status = acpi_ns_evaluate_by_name ((NATIVE_CHAR *) acpi_gbl_db_sleep_states[sleep_state],
NULL, &obj_desc);
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);
}
......@@ -184,8 +187,8 @@ acpi_get_sleep_type_data (
}
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad Sleep object %p type %s\n",
obj_desc, acpi_ut_get_object_type_name (obj_desc)));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "While evaluating Sleep_state [%s], bad Sleep object %p type %s\n",
acpi_gbl_db_sleep_states[sleep_state], obj_desc, acpi_ut_get_object_type_name (obj_desc)));
}
acpi_ut_remove_reference (obj_desc);
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface
* $Revision: 47 $
* $Revision: 48 $
*
*****************************************************************************/
......@@ -236,7 +236,7 @@ acpi_enter_sleep_state (
if (ACPI_FAILURE (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 */
......
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
* $Revision: 119 $
* $Revision: 122 $
*
*****************************************************************************/
......@@ -54,7 +54,7 @@
/* Version string */
#define ACPI_CA_VERSION 0x20021122
#define ACPI_CA_VERSION 0x20021205
/* Version of ACPI supported */
......@@ -62,28 +62,28 @@
/* Maximum objects in the various object caches */
#define MAX_STATE_CACHE_DEPTH 64 /* State objects for stacks */
#define MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */
#define MAX_EXTPARSE_CACHE_DEPTH 64 /* Parse tree objects */
#define MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */
#define MAX_WALK_CACHE_DEPTH 4 /* Objects for parse tree walks */
#define ACPI_MAX_STATE_CACHE_DEPTH 64 /* State objects for stacks */
#define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */
#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 64 /* Parse tree objects */
#define ACPI_MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */
#define ACPI_MAX_WALK_CACHE_DEPTH 4 /* Objects for parse tree walks */
/* String size constants */
#define MAX_STRING_LENGTH 512
#define PATHNAME_MAX 256 /* A full namespace pathname */
#define ACPI_MAX_STRING_LENGTH 512
#define ACPI_PATHNAME_MAX 256 /* A full namespace pathname */
/* Maximum count for a semaphore object */
#define MAX_SEMAPHORE_COUNT 256
#define ACPI_MAX_SEMAPHORE_COUNT 256
/* 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 */
#define SYSMEM_REGION_WINDOW_SIZE 4096
#define ACPI_SYSMEM_REGION_WINDOW_SIZE 4096
/******************************************************************************
......@@ -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_GPE_REGISTER_WIDTH 8
/*
* Method info (in WALK_STATE), containing local variables and argumetns
*/
#define MTH_NUM_LOCALS 8
#define MTH_MAX_LOCAL 7
#define ACPI_METHOD_NUM_LOCALS 8
#define ACPI_METHOD_MAX_LOCAL 7
#define MTH_NUM_ARGS 7
#define MTH_MAX_ARG 6
#define ACPI_METHOD_NUM_ARGS 7
#define ACPI_METHOD_MAX_ARG 6
/* Maximum length of resulting string when converting from a buffer */
#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 OBJ_MAX_OPERAND 7
#define ACPI_OBJ_NUM_OPERANDS 8
#define ACPI_OBJ_MAX_OPERAND 7
/* Names within the namespace are 4 bytes long */
#define ACPI_NAME_SIZE 4
#define PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */
#define PATH_SEPARATOR '.'
#define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */
#define ACPI_PATH_SEPARATOR '.'
/* Constants used in searching for the RSDP in low memory */
#define LO_RSDP_WINDOW_BASE 0 /* Physical Address */
#define HI_RSDP_WINDOW_BASE 0xE0000 /* Physical Address */
#define LO_RSDP_WINDOW_SIZE 0x400
#define HI_RSDP_WINDOW_SIZE 0x20000
#define RSDP_SCAN_STEP 16
#define ACPI_LO_RSDP_WINDOW_BASE 0 /* Physical Address */
#define ACPI_HI_RSDP_WINDOW_BASE 0xE0000 /* Physical Address */
#define ACPI_LO_RSDP_WINDOW_SIZE 0x400
#define ACPI_HI_RSDP_WINDOW_SIZE 0x20000
#define ACPI_RSDP_SCAN_STEP 16
/* Operation regions */
......@@ -154,12 +155,12 @@
/* Array sizes. Used for range checking also */
#define NUM_ACCESS_TYPES 6
#define NUM_UPDATE_RULES 3
#define NUM_LOCK_RULES 2
#define NUM_MATCH_OPS 6
#define NUM_OPCODES 256
#define NUM_FIELD_NAMES 2
#define ACPI_NUM_ACCESS_TYPES 6
#define ACPI_NUM_UPDATE_RULES 3
#define ACPI_NUM_LOCK_RULES 2
#define ACPI_NUM_MATCH_OPS 6
#define ACPI_NUM_OPCODES 256
#define ACPI_NUM_FIELD_NAMES 2
/* RSDP checksums */
......
/******************************************************************************
*
* Name: acdisasm.h - AML disassembler
* $Revision: 5 $
*
*****************************************************************************/
/*
* 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
*/
#ifndef __ACDISASM_H__
#define __ACDISASM_H__
#include "amlresrc.h"
#define BLOCK_NONE 0
#define BLOCK_PAREN 1
#define BLOCK_BRACE 2
#define BLOCK_COMMA_LIST 4
extern const char *acpi_gbl_io_decode[2];
extern const char *acpi_gbl_word_decode[4];
extern const char *acpi_gbl_consume_decode[2];
extern const char *acpi_gbl_min_decode[2];
extern const char *acpi_gbl_max_decode[2];
extern const char *acpi_gbl_DECdecode[2];
extern const char *acpi_gbl_RNGdecode[4];
extern const char *acpi_gbl_MEMdecode[4];
extern const char *acpi_gbl_RWdecode[2];
extern const char *acpi_gbl_irq_decode[2];
extern const char *acpi_gbl_HEdecode[2];
extern const char *acpi_gbl_LLdecode[2];
extern const char *acpi_gbl_SHRdecode[2];
extern const char *acpi_gbl_TYPdecode[4];
extern const char *acpi_gbl_BMdecode[2];
extern const char *acpi_gbl_SIZdecode[4];
extern const NATIVE_CHAR *acpi_gbl_lock_rule[NUM_LOCK_RULES];
extern const NATIVE_CHAR *acpi_gbl_access_types[NUM_ACCESS_TYPES];
extern const NATIVE_CHAR *acpi_gbl_update_rules[NUM_UPDATE_RULES];
extern const NATIVE_CHAR *acpi_gbl_match_ops[NUM_MATCH_OPS];
typedef struct acpi_op_walk_info
{
u32 level;
u32 bit_offset;
} ACPI_OP_WALK_INFO;
typedef
acpi_status (*ASL_WALK_CALLBACK) (
acpi_parse_object *op,
u32 level,
void *context);
/*
* dmwalk
*/
void
acpi_dm_walk_parse_tree (
acpi_parse_object *op,
ASL_WALK_CALLBACK descending_callback,
ASL_WALK_CALLBACK ascending_callback,
void *context);
acpi_status
acpi_dm_descending_op (
acpi_parse_object *op,
u32 level,
void *context);
acpi_status
acpi_dm_ascending_op (
acpi_parse_object *op,
u32 level,
void *context);
/*
* dmopcode
*/
void
acpi_dm_validate_name (
char *name,
acpi_parse_object *op);
u32
acpi_dm_dump_name (
char *name);
void
acpi_dm_unicode (
acpi_parse_object *op);
void
acpi_dm_disassemble (
acpi_walk_state *walk_state,
acpi_parse_object *origin,
u32 num_opcodes);
void
acpi_dm_namestring (
NATIVE_CHAR *name);
void
acpi_dm_display_path (
acpi_parse_object *op);
void
acpi_dm_disassemble_one_op (
acpi_walk_state *walk_state,
ACPI_OP_WALK_INFO *info,
acpi_parse_object *op);
void
acpi_dm_decode_internal_object (
acpi_operand_object *obj_desc);
void
acpi_dm_decode_node (
acpi_namespace_node *node);
u32
acpi_dm_block_type (
acpi_parse_object *op);
u32
acpi_dm_list_type (
acpi_parse_object *op);
acpi_status
acpi_ps_display_object_pathname (
acpi_walk_state *walk_state,
acpi_parse_object *op);
void
acpi_dm_method_flags (
acpi_parse_object *op);
void
acpi_dm_field_flags (
acpi_parse_object *op);
void
acpi_dm_address_space (
u8 space_id);
void
acpi_dm_region_flags (
acpi_parse_object *op);
void
acpi_dm_match_op (
acpi_parse_object *op);
void
acpi_dm_match_keyword (
acpi_parse_object *op);
u8
acpi_dm_comma_if_list_member (
acpi_parse_object *op);
void
acpi_dm_comma_if_field_member (
acpi_parse_object *op);
/*
* dmbuffer
*/
void
acpi_is_eisa_id (
acpi_parse_object *op);
void
acpi_dm_eisa_id (
u32 encoded_id);
u8
acpi_dm_is_unicode_buffer (
acpi_parse_object *op);
u8
acpi_dm_is_string_buffer (
acpi_parse_object *op);
/*
* dmresrc
*/
void
acpi_dm_disasm_byte_list (
u32 level,
u8 *byte_data,
u32 byte_count);
void
acpi_dm_byte_list (
ACPI_OP_WALK_INFO *info,
acpi_parse_object *op);
void
acpi_dm_resource_descriptor (
ACPI_OP_WALK_INFO *info,
u8 *byte_data,
u32 byte_count);
u8
acpi_dm_is_resource_descriptor (
acpi_parse_object *op);
void
acpi_dm_indent (
u32 level);
void
acpi_dm_bit_list (
u16 mask);
void
acpi_dm_decode_attribute (
u8 attribute);
/*
* dmresrcl
*/
void
acpi_dm_io_flags (
u8 flags);
void
acpi_dm_memory_flags (
u8 flags,
u8 specific_flags);
void
acpi_dm_word_descriptor (
ASL_WORD_ADDRESS_DESC *resource,
u32 length,
u32 level);
void
acpi_dm_dword_descriptor (
ASL_DWORD_ADDRESS_DESC *resource,
u32 length,
u32 level);
void
acpi_dm_qword_descriptor (
ASL_QWORD_ADDRESS_DESC *resource,
u32 length,
u32 level);
void
acpi_dm_memory24_descriptor (
ASL_MEMORY_24_DESC *resource,
u32 length,
u32 level);
void
acpi_dm_memory32_descriptor (
ASL_MEMORY_32_DESC *resource,
u32 length,
u32 level);
void
acpi_dm_fixed_mem32_descriptor (
ASL_FIXED_MEMORY_32_DESC *resource,
u32 length,
u32 level);
void
acpi_dm_generic_register_descriptor (
ASL_GENERAL_REGISTER_DESC *resource,
u32 length,
u32 level);
void
acpi_dm_interrupt_descriptor (
ASL_EXTENDED_XRUPT_DESC *resource,
u32 length,
u32 level);
void
acpi_dm_vendor_large_descriptor (
ASL_LARGE_VENDOR_DESC *resource,
u32 length,
u32 level);
/*
* dmresrcs
*/
void
acpi_dm_irq_descriptor (
ASL_IRQ_FORMAT_DESC *resource,
u32 length,
u32 level);
void
acpi_dm_dma_descriptor (
ASL_DMA_FORMAT_DESC *resource,
u32 length,
u32 level);
void
acpi_dm_io_descriptor (
ASL_IO_PORT_DESC *resource,
u32 length,
u32 level);
void
acpi_dm_fixed_io_descriptor (
ASL_FIXED_IO_PORT_DESC *resource,
u32 length,
u32 level);
void
acpi_dm_start_dependent_descriptor (
ASL_START_DEPENDENT_DESC *resource,
u32 length,
u32 level);
void
acpi_dm_end_dependent_descriptor (
ASL_START_DEPENDENT_DESC *resource,
u32 length,
u32 level);
void
acpi_dm_vendor_small_descriptor (
ASL_SMALL_VENDOR_DESC *resource,
u32 length,
u32 level);
#endif /* __ACDISASM_H__ */
/******************************************************************************
*
* Name: acexcep.h - Exception codes returned by the ACPI subsystem
* $Revision: 64 $
* $Revision: 65 $
*
*****************************************************************************/
......@@ -75,8 +75,9 @@
#define AE_NO_HARDWARE_RESPONSE (acpi_status) (0x0019 | AE_CODE_ENVIRONMENTAL)
#define AE_NO_GLOBAL_LOCK (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL)
#define AE_LOGICAL_ADDRESS (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL)
#define AE_ABORT_METHOD (acpi_status) (0x001C | AE_CODE_ENVIRONMENTAL)
#define AE_CODE_ENV_MAX 0x001B
#define AE_CODE_ENV_MAX 0x001C
/*
* Programmer exceptions
......@@ -199,7 +200,8 @@ NATIVE_CHAR const *acpi_gbl_exception_names_env[] =
"AE_ALREADY_ACQUIRED",
"AE_NO_HARDWARE_RESPONSE",
"AE_NO_GLOBAL_LOCK",
"AE_LOGICAL_ADDRESS"
"AE_LOGICAL_ADDRESS",
"AE_ABORT_METHOD"
};
NATIVE_CHAR const *acpi_gbl_exception_names_pgm[] =
......
/******************************************************************************
*
* Name: acglobal.h - Declarations for global variables
* $Revision: 132 $
* $Revision: 134 $
*
*****************************************************************************/
......@@ -141,7 +141,7 @@ ACPI_EXTERN u8 acpi_gbl_events_initialized;
extern u8 acpi_gbl_shutdown;
extern u32 acpi_gbl_startup_flags;
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 NATIVE_CHAR *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
......@@ -253,6 +253,7 @@ ACPI_EXTERN u8 acpi_gbl_db_opt_verbose;
#ifdef ACPI_DEBUGGER
extern u8 acpi_gbl_method_executing;
extern u8 acpi_gbl_abort_method;
extern u8 acpi_gbl_db_terminate_threads;
ACPI_EXTERN int optind;
......
/******************************************************************************
*
* Name: aclocal.h - Internal data types used across the ACPI subsystem
* $Revision: 181 $
* $Revision: 182 $
*
*****************************************************************************/
......@@ -496,7 +496,7 @@ typedef struct acpi_thread_state
typedef struct acpi_result_values
{
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 last_insert;
......
/******************************************************************************
*
* Name: acmacros.h - C macros for the entire subsystem.
* $Revision: 130 $
* $Revision: 133 $
*
*****************************************************************************/
......@@ -367,6 +367,8 @@
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_METHOD_ERROR(s,n,p,e) acpi_ns_report_method_error(_THIS_MODULE,__LINE__,_COMPONENT, s, n, p, e);
#else
#define ACPI_REPORT_INFO(fp) {acpi_ut_report_info("ACPI",__LINE__,_COMPONENT); \
......@@ -377,6 +379,8 @@
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_METHOD_ERROR(s,n,p,e) acpi_ns_report_method_error("ACPI",__LINE__,_COMPONENT, s, n, p, e);
#endif
/* Error reporting. These versions pass thru the module and line# */
......@@ -394,7 +398,7 @@
#ifdef ACPI_DEBUG_OUTPUT
#define ACPI_MODULE_NAME(name) static char *_THIS_MODULE = name;
#define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_THIS_MODULE = name;
/*
* Function entry tracing.
......@@ -454,7 +458,7 @@
#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_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_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))
......
/******************************************************************************
*
* Name: acnamesp.h - Namespace subcomponent prototypes and defines
* $Revision: 129 $
* $Revision: 131 $
*
*****************************************************************************/
......@@ -210,7 +210,7 @@ acpi_ns_dump_entry (
acpi_handle handle,
u32 debug_level);
acpi_status
void
acpi_ns_dump_pathname (
acpi_handle handle,
NATIVE_CHAR *msg,
......@@ -430,6 +430,21 @@ acpi_ns_report_error (
char *internal_name,
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_ns_build_internal_name (
acpi_namestring_info *info);
......
/******************************************************************************
*
* Name: acoutput.h -- debug output
* $Revision: 90 $
* $Revision: 91 $
*
*****************************************************************************/
......@@ -53,7 +53,6 @@
#define ACPI_TOOLS 0x00002000
#define ACPI_ALL_COMPONENTS 0x00003FFF
#define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS)
......@@ -61,21 +60,20 @@
#define ACPI_ALL_DRIVERS 0xFFFF0000
/*
* Raw debug output levels, do not use these in the DEBUG_PRINT macros
*/
#define ACPI_LV_OK 0x00000001
#define ACPI_LV_INFO 0x00000002
#define ACPI_LV_WARN 0x00000004
#define ACPI_LV_ERROR 0x00000008
#define ACPI_LV_FATAL 0x00000010
#define ACPI_LV_DEBUG_OBJECT 0x00000020
#define ACPI_LV_ALL_EXCEPTIONS 0x0000003F
#define ACPI_LV_ERROR 0x00000001
#define ACPI_LV_WARN 0x00000002
#define ACPI_LV_INIT 0x00000004
#define ACPI_LV_DEBUG_OBJECT 0x00000008
#define ACPI_LV_INFO 0x00000010
#define ACPI_LV_ALL_EXCEPTIONS 0x0000001F
/* Trace verbosity level 1 [Standard Trace Level] */
#define ACPI_LV_INIT_NAMES 0x00000020
#define ACPI_LV_PARSE 0x00000040
#define ACPI_LV_LOAD 0x00000080
#define ACPI_LV_DISPATCH 0x00000100
......@@ -89,8 +87,7 @@
#define ACPI_LV_RESOURCES 0x00010000
#define ACPI_LV_USER_REQUESTS 0x00020000
#define ACPI_LV_PACKAGE 0x00040000
#define ACPI_LV_INIT 0x00080000
#define ACPI_LV_VERBOSITY1 0x000FFF40 | ACPI_LV_ALL_EXCEPTIONS
#define ACPI_LV_VERBOSITY1 0x0007FF40 | ACPI_LV_ALL_EXCEPTIONS
/* Trace verbosity level 2 [Function tracing and memory allocation] */
......@@ -121,22 +118,21 @@
/*
* Debug level macros that are used in the DEBUG_PRINT macros
*/
#define ACPI_DEBUG_LEVEL(dl) dl,__LINE__,&_dbg
/* 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_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_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO)
#define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS)
/* 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_PARSE ACPI_DEBUG_LEVEL (ACPI_LV_PARSE)
#define ACPI_DB_DISPATCH ACPI_DEBUG_LEVEL (ACPI_LV_DISPATCH)
......@@ -157,23 +153,15 @@
#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_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)
/* Defaults for Debug_level, debug and normal */
#define DEBUG_DEFAULT (ACPI_LV_OK | 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 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 */
#define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | 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 ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL)
#endif /* __ACOUTPUT_H__ */
/******************************************************************************
*
* Name: acstruct.h - Internal structs
* $Revision: 20 $
* $Revision: 21 $
*
*****************************************************************************/
......@@ -71,16 +71,16 @@ typedef struct acpi_walk_state
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;
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*/
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 */
struct acpi_node *method_node; /* Method Node if running a method */
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 */
acpi_parse_object *origin; /* Start of walk [Obsolete] */
union acpi_operand_obj **params;
......
/******************************************************************************
*
* Name: actypes.h - Common data types for the entire ACPI subsystem
* $Revision: 241 $
* $Revision: 242 $
*
*****************************************************************************/
......@@ -863,11 +863,6 @@ typedef struct
} acpi_mem_space_context;
/* Sleep states */
#define ACPI_NUM_SLEEP_STATES 7
/*
* Definitions for Resource Attributes
*/
......
/******************************************************************************
*
* Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
* $Revision: 148 $
* $Revision: 149 $
*
*****************************************************************************/
......@@ -447,6 +447,13 @@ acpi_ut_delete_internal_object_list (
#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_ut_evaluate_numeric_object (
NATIVE_CHAR *object_name,
......@@ -698,7 +705,8 @@ acpi_ut_set_integer_width (
#ifdef ACPI_DEBUG_OUTPUT
void
acpi_ut_display_init_pathname (
acpi_handle obj_handle,
u8 type,
acpi_namespace_node *obj_handle,
char *path);
#endif
......
/******************************************************************************
*
* Name: acgcc.h - GCC specific defines, etc.
* $Revision: 23 $
* $Revision: 24 $
*
*****************************************************************************/
......@@ -31,4 +31,11 @@
*/
#define ACPI_PRINTF_LIKE_FUNC __attribute__ ((__format__ (__printf__, 4, 5)))
/* Some compilers complain about unused variables. Sometimes we don't want to
* use all the variables (most specifically for _THIS_MODULE). This allow us
* to to tell the compiler warning in a per-variable manner that a variable
* is unused.
*/
#define ACPI_UNUSED_VAR __attribute__ ((unused))
#endif /* __ACGCC_H__ */
......@@ -4,7 +4,8 @@
obj-y := nsaccess.o nsdumpdv.o nsload.o nssearch.o nsxfeval.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)
......
/******************************************************************************
*
* Module Name: nsdump - table dumping routines for debug
* $Revision: 146 $
* $Revision: 149 $
*
*****************************************************************************/
......@@ -90,16 +90,13 @@ acpi_ns_print_pathname (
*
******************************************************************************/
acpi_status
void
acpi_ns_dump_pathname (
acpi_handle handle,
NATIVE_CHAR *msg,
u32 level,
u32 component)
{
acpi_buffer buffer;
acpi_status status;
ACPI_FUNCTION_TRACE ("Ns_dump_pathname");
......@@ -107,20 +104,14 @@ acpi_ns_dump_pathname (
/* Do this only if the requested debug level and component are enabled */
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) */
buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
status = acpi_ns_handle_to_pathname (handle, &buffer);
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);
acpi_ns_print_node_pathname (handle, msg);
acpi_os_printf ("\n");
return_VOID;
}
......
/******************************************************************************
*
* Module Name: nsinit - namespace initialization
* $Revision: 50 $
* $Revision: 52 $
*
*****************************************************************************/
......@@ -59,7 +59,7 @@ acpi_ns_initialize_objects (
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"**** Starting initialization of namespace objects ****\n"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "Completing Region/Field/Buffer/Package initialization:"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Completing Region/Field/Buffer/Package initialization:"));
/* Set all init info to zero */
......@@ -75,12 +75,13 @@ acpi_ns_initialize_objects (
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",
info.op_region_init, info.op_region_count,
info.field_init, info.field_count,
info.buffer_init, info.buffer_count,
info.package_init, info.package_count, info.object_count));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"%hd Control Methods found\n", info.method_count));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
......@@ -123,7 +124,7 @@ acpi_ns_initialize_devices (
info.num_STA = 0;
info.num_INI = 0;
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "Executing all Device _STA and_INI methods:"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Executing all Device _STA and_INI methods:"));
/* Walk namespace for all objects of type Device */
......@@ -135,7 +136,7 @@ acpi_ns_initialize_devices (
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",
info.device_count, info.num_STA, info.num_INI));
......@@ -274,8 +275,10 @@ acpi_ns_init_one_object (
node->name.ascii, acpi_ut_get_type_name (type), acpi_format_exception (status)));
}
if (!(acpi_dbg_level & ACPI_LV_INIT)) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "."));
/* Print a dot for each object unless we are going to print the entire pathname */
if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
acpi_os_printf (".");
}
/*
......@@ -318,7 +321,7 @@ acpi_ns_init_one_device (
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++;
......@@ -342,7 +345,7 @@ acpi_ns_init_one_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);
if (ACPI_FAILURE (status)) {
/* Ignore error and move on to next device */
......@@ -361,7 +364,7 @@ acpi_ns_init_one_device (
/*
* 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);
if (ACPI_FAILURE (status)) {
/* No _INI (AE_NOT_FOUND) means device requires no initialization */
......
/******************************************************************************
*
* Module Name: nsload - namespace loading/expanding/contracting procedures
* $Revision: 59 $
* $Revision: 61 $
*
*****************************************************************************/
......@@ -34,122 +34,6 @@
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
/*******************************************************************************
......@@ -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_PSDT);
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"ACPI Namespace successfully loaded at root %p\n",
acpi_gbl_root_node));
......
/*******************************************************************************
*
* Module Name: nsnames - Name manipulation and search
* $Revision: 79 $
* $Revision: 80 $
*
******************************************************************************/
......@@ -86,7 +86,7 @@ acpi_ns_build_external_path (
/* Prefix name with the path separator */
index--;
name_buffer[index] = PATH_SEPARATOR;
name_buffer[index] = ACPI_PATH_SEPARATOR;
}
/* Overwrite final separator with the root prefix character */
......@@ -180,7 +180,7 @@ acpi_ns_get_pathname_length (
next_node = 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);
}
......
/******************************************************************************
*
* 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 @@
*
* Module Name: nsutils - Utilities for accessing ACPI namespace, accessing
* parents and siblings and Scope manipulation
* $Revision: 116 $
* $Revision: 118 $
*
*****************************************************************************/
......@@ -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
......@@ -802,15 +878,13 @@ acpi_ns_get_node_by_path (
ACPI_FUNCTION_TRACE_PTR ("Ns_get_node_by_path", pathname);
if (!pathname) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
if (pathname) {
/* Convert path to internal representation */
/* Convert path to internal representation */
status = acpi_ns_internalize_name (pathname, &internal_path);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
status = acpi_ns_internalize_name (pathname, &internal_path);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
}
/* Must lock namespace during lookup */
......@@ -838,7 +912,10 @@ acpi_ns_get_node_by_path (
/* Cleanup */
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
ACPI_MEM_FREE (internal_path);
if (internal_path) {
ACPI_MEM_FREE (internal_path);
}
return_ACPI_STATUS (status);
}
......
......@@ -2,7 +2,7 @@
*
* Module Name: nsxfname - Public interfaces to the ACPI subsystem
* ACPI Namespace oriented interfaces
* $Revision: 91 $
* $Revision: 92 $
*
*****************************************************************************/
......@@ -173,7 +173,7 @@ acpi_get_name (
/* 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)) {
goto unlock_and_exit;
}
......
......@@ -141,7 +141,7 @@ acpi_get_parent (
*ret_handle =
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)) {
status = AE_NULL_ENTRY;
......
......@@ -484,7 +484,7 @@ acpi_os_write_pci_configuration (
return (result ? AE_ERROR : AE_OK);
}
/* TODO: Rewrite this code!!! */
/* TODO: Change code to take advantage of driver model more */
void
acpi_os_derive_pci_id (
acpi_handle rhandle, /* upper bound */
......@@ -650,7 +650,7 @@ acpi_os_queue_for_execution(
task = (void *)(dpc+1);
INIT_WORK(task, acpi_os_schedule_exec, (void*)dpc);
if (schedule_work(task) < 0) {
if (!schedule_work(task)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Call to schedule_work() failed.\n"));
kfree(dpc);
status = AE_ERROR;
......
/******************************************************************************
*
* Module Name: psparse - Parser top level AML parse routines
* $Revision: 135 $
* $Revision: 137 $
*
*****************************************************************************/
......@@ -1099,10 +1099,8 @@ acpi_ps_parse_aml (
status = AE_OK;
}
else if (status != AE_OK) {
ACPI_REPORT_ERROR (("Method execution failed, %s\n",
acpi_format_exception (status)));
ACPI_DUMP_PATHNAME (walk_state->method_node, "Method pathname: ",
ACPI_LV_ERROR, _COMPONENT);
ACPI_REPORT_METHOD_ERROR ("Method execution failed",
walk_state->method_node, NULL, status);
}
/* We are done with this walk, move on to the parent if any */
......
......@@ -124,8 +124,8 @@ acpi_pci_bind (
acpi_status status = AE_OK;
struct acpi_pci_data *data = NULL;
struct acpi_pci_data *pdata = NULL;
char pathname[PATHNAME_MAX] = {0};
acpi_buffer buffer = {PATHNAME_MAX, pathname};
char pathname[ACPI_PATHNAME_MAX] = {0};
acpi_buffer buffer = {ACPI_PATHNAME_MAX, pathname};
acpi_handle handle = NULL;
ACPI_FUNCTION_TRACE("acpi_pci_bind");
......@@ -267,8 +267,8 @@ acpi_pci_bind_root (
int result = 0;
acpi_status status = AE_OK;
struct acpi_pci_data *data = NULL;
char pathname[PATHNAME_MAX] = {0};
acpi_buffer buffer = {PATHNAME_MAX, pathname};
char pathname[ACPI_PATHNAME_MAX] = {0};
acpi_buffer buffer = {ACPI_PATHNAME_MAX, pathname};
ACPI_FUNCTION_TRACE("acpi_pci_bind_root");
......
......@@ -158,7 +158,7 @@ acpi_pci_irq_add_prt (
int bus)
{
acpi_status status = AE_OK;
char pathname[PATHNAME_MAX] = {0};
char pathname[ACPI_PATHNAME_MAX] = {0};
acpi_buffer buffer = {0, NULL};
acpi_pci_routing_table *prt = NULL;
acpi_pci_routing_table *entry = NULL;
......@@ -346,9 +346,13 @@ acpi_pci_irq_enable (
*/
if (!irq) {
printk(KERN_WARNING PREFIX "No IRQ known for interrupt pin %c of device %s", ('A' + pin), dev->slot_name);
if (dev->irq)
/* Interrupt Line values above 0xF are forbidden */
if (dev->irq && dev->irq >= 0xF) {
printk(" - using IRQ %d\n", dev->irq);
return_VALUE(dev->irq);
return_VALUE(dev->irq);
}
else
return_VALUE(0);
}
dev->irq = irq;
......
/*******************************************************************************
*
* Module Name: rscalc - Calculate stream and list lengths
* $Revision: 44 $
* $Revision: 45 $
*
******************************************************************************/
......@@ -791,10 +791,10 @@ acpi_rs_get_pci_routing_table_length (
if (name_found) {
if (ACPI_GET_OBJECT_TYPE (*sub_object_list) == ACPI_TYPE_STRING) {
/*
* The length String.Length field includes the
* terminating NULL
* The length String.Length field does not include the
* terminating NULL, add 1
*/
temp_size_needed += (*sub_object_list)->string.length;
temp_size_needed += ((*sub_object_list)->string.length + 1);
}
else {
temp_size_needed += acpi_ns_get_pathname_length (
......
/*******************************************************************************
*
* Module Name: rscreate - Create resource lists/tables
* $Revision: 61 $
* $Revision: 62 $
*
******************************************************************************/
......@@ -286,9 +286,9 @@ acpi_rs_create_pci_routing_table (
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;
......
/*******************************************************************************
*
* Module Name: rsutils - Utilities for the resource manager
* $Revision: 33 $
* $Revision: 34 $
*
******************************************************************************/
......@@ -66,32 +66,13 @@ acpi_rs_get_prt_method_data (
/* Parameters guaranteed valid by caller */
/*
* 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)) {
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
* back from the _CRS method execution.
......@@ -100,8 +81,6 @@ acpi_rs_get_prt_method_data (
/* On exit, we must delete the object returned by Evaluate_object */
cleanup:
acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status);
}
......@@ -142,31 +121,11 @@ acpi_rs_get_crs_method_data (
/*
* 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)) {
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
* byte stream buffer that comes back from the _CRS method
......@@ -176,8 +135,6 @@ acpi_rs_get_crs_method_data (
/* On exit, we must delete the object returned by evaluate_object */
cleanup:
acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status);
}
......@@ -218,31 +175,11 @@ acpi_rs_get_prs_method_data (
/*
* 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)) {
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
* byte stream buffer that comes back from the _CRS method
......@@ -252,8 +189,6 @@ acpi_rs_get_prs_method_data (
/* On exit, we must delete the object returned by evaluate_object */
cleanup:
acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status);
}
......
......@@ -2,7 +2,7 @@
*
* Module Name: tbxface - Public interfaces to the ACPI subsystem
* ACPI table oriented interfaces
* $Revision: 59 $
* $Revision: 60 $
*
*****************************************************************************/
......@@ -96,7 +96,7 @@ acpi_load_tables (void)
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 */
......
/******************************************************************************
*
* Module Name: tbxfroot - Find the root ACPI table (RSDT)
* $Revision: 65 $
* $Revision: 66 $
*
*****************************************************************************/
......@@ -342,7 +342,7 @@ acpi_tb_scan_memory_for_rsdp (
for (offset = 0, mem_rover = start_address;
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 */
......@@ -404,21 +404,21 @@ acpi_tb_find_rsdp (
/*
* 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);
if (ACPI_FAILURE (status)) {
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);
}
mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, LO_RSDP_WINDOW_SIZE);
acpi_os_unmap_memory (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, ACPI_LO_RSDP_WINDOW_SIZE);
if (mem_rover) {
/* 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);
table_info->physical_address = phys_addr;
......@@ -428,21 +428,21 @@ acpi_tb_find_rsdp (
/*
* 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);
if (ACPI_FAILURE (status)) {
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);
}
mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, HI_RSDP_WINDOW_SIZE);
acpi_os_unmap_memory (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, ACPI_HI_RSDP_WINDOW_SIZE);
if (mem_rover) {
/* 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);
table_info->physical_address = phys_addr;
......@@ -457,8 +457,8 @@ acpi_tb_find_rsdp (
/*
* 1) Search EBDA (low memory) paragraphs
*/
mem_rover = acpi_tb_scan_memory_for_rsdp (ACPI_PHYSADDR_TO_PTR (LO_RSDP_WINDOW_BASE),
LO_RSDP_WINDOW_SIZE);
mem_rover = acpi_tb_scan_memory_for_rsdp (ACPI_PHYSADDR_TO_PTR (ACPI_LO_RSDP_WINDOW_BASE),
ACPI_LO_RSDP_WINDOW_SIZE);
if (mem_rover) {
/* Found it, return the physical address */
......@@ -469,8 +469,8 @@ acpi_tb_find_rsdp (
/*
* 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),
HI_RSDP_WINDOW_SIZE);
mem_rover = acpi_tb_scan_memory_for_rsdp (ACPI_PHYSADDR_TO_PTR (ACPI_HI_RSDP_WINDOW_BASE),
ACPI_HI_RSDP_WINDOW_SIZE);
if (mem_rover) {
/* Found it, return the physical address */
......
/******************************************************************************
*
* Module Name: utalloc - local cache and memory allocation routines
* $Revision: 127 $
* $Revision: 128 $
*
*****************************************************************************/
......@@ -968,11 +968,11 @@ acpi_ut_dump_allocations (
/* Print summary */
if (!num_outstanding) {
ACPI_DEBUG_PRINT ((ACPI_DB_OK,
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"No outstanding allocations.\n"));
}
else {
ACPI_DEBUG_PRINT ((ACPI_DB_OK,
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"%d(%X) Outstanding allocations\n",
num_outstanding, num_outstanding));
}
......
/******************************************************************************
*
* Module Name: utcopy - Internal to external object translation utilities
* $Revision: 106 $
* $Revision: 107 $
*
*****************************************************************************/
......@@ -625,8 +625,23 @@ acpi_ut_copy_simple_object (
dest_desc->buffer.node = NULL;
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:
......@@ -638,13 +653,13 @@ acpi_ut_copy_simple_object (
*/
if ((source_desc->string.length) &&
(!(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) {
return (AE_NO_MEMORY);
}
ACPI_MEMCPY (dest_desc->string.pointer, source_desc->string.pointer,
source_desc->string.length);
source_desc->string.length + 1);
}
break;
......
/*******************************************************************************
*
* Module Name: utdelete - object deletion and reference count utilities
* $Revision: 92 $
* $Revision: 93 $
*
******************************************************************************/
......@@ -329,7 +329,7 @@ acpi_ut_update_ref_count (
* Sanity check the reference count, for debug purposes only.
* (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,
"**** Warning **** Large Reference Count (%X) in object %p\n\n",
......
This diff is collapsed.
/******************************************************************************
*
* Module Name: utglobal - Global variables for the ACPI subsystem
* $Revision: 172 $
* $Revision: 176 $
*
*****************************************************************************/
......@@ -126,9 +126,9 @@ acpi_format_exception (
/* Debug switch - level and trace mask */
#ifdef ACPI_DEBUG_OUTPUT
u32 acpi_dbg_level = DEBUG_DEFAULT;
u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT;
#else
u32 acpi_dbg_level = NORMAL_DEFAULT;
u32 acpi_dbg_level = ACPI_NORMAL_DEFAULT;
#endif
/* Debug switch - layer (component) mask */
......@@ -140,6 +140,7 @@ u32 acpi_gbl_nesting_level = 0;
/* Debugger globals */
u8 acpi_gbl_db_terminate_threads = FALSE;
u8 acpi_gbl_abort_method = FALSE;
u8 acpi_gbl_method_executing = FALSE;
/* System flags */
......@@ -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 NATIVE_CHAR *acpi_gbl_db_sleep_states[ACPI_NUM_SLEEP_STATES] = {
"\\_S0_","\\_S1_","\\_S2_","\\_S3_",
"\\_S4_","\\_S5_","\\_S4B"};
const NATIVE_CHAR *acpi_gbl_db_sleep_states[ACPI_S_STATE_COUNT] = {
"\\_S0_",
"\\_S1_",
"\\_S2_",
"\\_S3_",
"\\_S4_",
"\\_S5_"};
/******************************************************************************
......@@ -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_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_PSNODE].max_cache_depth = 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_OPERAND].max_cache_depth = 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_STATE].max_cache_depth = ACPI_MAX_STATE_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 = ACPI_MAX_EXTPARSE_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 = 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_NSNODE].list_name = "Namespace Nodes");
......
/*******************************************************************************
*
* Module Name: utmisc - common utility procedures
* $Revision: 87 $
* $Revision: 90 $
*
******************************************************************************/
......@@ -200,39 +200,66 @@ acpi_ut_set_integer_width (
* FUNCTION: Acpi_ut_display_init_pathname
*
* 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
*
* DESCRIPTION: Display full pathnbame of an object, DEBUG ONLY
* DESCRIPTION: Display full pathname of an object, DEBUG ONLY
*
******************************************************************************/
void
acpi_ut_display_init_pathname (
acpi_handle obj_handle,
u8 type,
acpi_namespace_node *obj_handle,
char *path)
{
acpi_status status;
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);
if (ACPI_SUCCESS (status)) {
if (path) {
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));
}
if (ACPI_FAILURE (status)) {
return;
}
/* Print what we're doing */
switch (type) {
case ACPI_TYPE_METHOD:
acpi_os_printf ("Executing ");
break;
default:
acpi_os_printf ("Initializing ");
break;
}
/* Print the object type and pathname */
ACPI_MEM_FREE (buffer.pointer);
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
......
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