Commit 26cffe4a authored by Andy Grover's avatar Andy Grover

resolve merge of Dom's patch

parents cc6baa4f dda0273d
/* /*
* acpi_ac.c - ACPI AC Adapter Driver ($Revision: 26 $) * acpi_ac.c - ACPI AC Adapter Driver ($Revision: 27 $)
* *
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
...@@ -47,13 +47,13 @@ int acpi_ac_add (struct acpi_device *device); ...@@ -47,13 +47,13 @@ int acpi_ac_add (struct acpi_device *device);
int acpi_ac_remove (struct acpi_device *device, int type); int acpi_ac_remove (struct acpi_device *device, int type);
static struct acpi_driver acpi_ac_driver = { static struct acpi_driver acpi_ac_driver = {
name: ACPI_AC_DRIVER_NAME, .name = ACPI_AC_DRIVER_NAME,
class: ACPI_AC_CLASS, .class = ACPI_AC_CLASS,
ids: ACPI_AC_HID, .ids = ACPI_AC_HID,
ops: { .ops = {
add: acpi_ac_add, .add = acpi_ac_add,
remove: acpi_ac_remove, .remove = acpi_ac_remove,
}, },
}; };
struct acpi_ac { struct acpi_ac {
......
/* /*
* acpi_battery.c - ACPI Battery Driver ($Revision: 36 $) * acpi_battery.c - ACPI Battery Driver ($Revision: 37 $)
* *
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
...@@ -52,13 +52,13 @@ static int acpi_battery_add (struct acpi_device *device); ...@@ -52,13 +52,13 @@ static int acpi_battery_add (struct acpi_device *device);
static int acpi_battery_remove (struct acpi_device *device, int type); static int acpi_battery_remove (struct acpi_device *device, int type);
static struct acpi_driver acpi_battery_driver = { static struct acpi_driver acpi_battery_driver = {
name: ACPI_BATTERY_DRIVER_NAME, .name = ACPI_BATTERY_DRIVER_NAME,
class: ACPI_BATTERY_CLASS, .class = ACPI_BATTERY_CLASS,
ids: ACPI_BATTERY_HID, .ids = ACPI_BATTERY_HID,
ops: { .ops = {
add: acpi_battery_add, .add = acpi_battery_add,
remove: acpi_battery_remove, .remove = acpi_battery_remove,
}, },
}; };
struct acpi_battery_status { struct acpi_battery_status {
......
/* /*
* acpi_bus.c - ACPI Bus Driver ($Revision: 79 $) * acpi_bus.c - ACPI Bus Driver ($Revision: 80 $)
* *
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
* *
...@@ -97,10 +97,10 @@ static int acpi_device_suspend(struct device *dev, u32 state, u32 stage); ...@@ -97,10 +97,10 @@ static int acpi_device_suspend(struct device *dev, u32 state, u32 stage);
static int acpi_device_resume(struct device *dev, u32 stage); static int acpi_device_resume(struct device *dev, u32 stage);
static struct device_driver acpi_bus_driver = { static struct device_driver acpi_bus_driver = {
probe: acpi_device_probe, .probe = acpi_device_probe,
remove: acpi_device_remove, .remove = acpi_device_remove,
suspend: acpi_device_suspend, .suspend = acpi_device_suspend,
resume: acpi_device_resume, .resume = acpi_device_resume,
}; };
......
/* /*
* acpi_button.c - ACPI Button Driver ($Revision: 29 $) * acpi_button.c - ACPI Button Driver ($Revision: 30 $)
* *
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
...@@ -47,13 +47,13 @@ int acpi_button_add (struct acpi_device *device); ...@@ -47,13 +47,13 @@ int acpi_button_add (struct acpi_device *device);
int acpi_button_remove (struct acpi_device *device, int type); int acpi_button_remove (struct acpi_device *device, int type);
static struct acpi_driver acpi_button_driver = { static struct acpi_driver acpi_button_driver = {
name: ACPI_BUTTON_DRIVER_NAME, .name = ACPI_BUTTON_DRIVER_NAME,
class: ACPI_BUTTON_CLASS, .class = ACPI_BUTTON_CLASS,
ids: "ACPI_FPB,ACPI_FSB,PNP0C0D,PNP0C0C,PNP0C0E", .ids = "ACPI_FPB,ACPI_FSB,PNP0C0D,PNP0C0C,PNP0C0E",
ops: { .ops = {
add: acpi_button_add, .add = acpi_button_add,
remove: acpi_button_remove, .remove = acpi_button_remove,
}, },
}; };
struct acpi_button { struct acpi_button {
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dbcmds - debug commands and output routines * Module Name: dbcmds - debug commands and output routines
* $Revision: 84 $ * $Revision: 85 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "acevents.h" #include "acevents.h"
#include "acdebug.h" #include "acdebug.h"
#include "acresrc.h" #include "acresrc.h"
#include "acdisasm.h"
#ifdef ENABLE_DEBUGGER #ifdef ENABLE_DEBUGGER
...@@ -342,7 +343,7 @@ acpi_db_disassemble_aml ( ...@@ -342,7 +343,7 @@ acpi_db_disassemble_aml (
num_statements = ACPI_STRTOUL (statements, NULL, 0); num_statements = ACPI_STRTOUL (statements, NULL, 0);
} }
acpi_db_display_op (NULL, op, num_statements); acpi_dm_disassemble (NULL, op, num_statements);
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* *
* Module Name: dbfileio - Debugger file I/O commands. These can't usually * Module Name: dbfileio - Debugger file I/O commands. These can't usually
* be used when running the debugger in Ring 0 (Kernel mode) * be used when running the debugger in Ring 0 (Kernel mode)
* $Revision: 64 $ * $Revision: 67 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "acnamesp.h" #include "acnamesp.h"
#include "actables.h" #include "actables.h"
#ifdef ENABLE_DEBUGGER #if (defined ENABLE_DEBUGGER || defined ACPI_DISASSEMBLER)
#define _COMPONENT ACPI_DEBUGGER #define _COMPONENT ACPI_DEBUGGER
ACPI_MODULE_NAME ("dbfileio") ACPI_MODULE_NAME ("dbfileio")
...@@ -86,6 +86,7 @@ acpi_db_match_argument ( ...@@ -86,6 +86,7 @@ acpi_db_match_argument (
} }
#ifdef ENABLE_DEBUGGER
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: Acpi_db_close_debug_file * FUNCTION: Acpi_db_close_debug_file
...@@ -148,6 +149,7 @@ acpi_db_open_debug_file ( ...@@ -148,6 +149,7 @@ acpi_db_open_debug_file (
#endif #endif
} }
#endif
#ifdef ACPI_APPLICATION #ifdef ACPI_APPLICATION
...@@ -190,7 +192,7 @@ acpi_db_load_table( ...@@ -190,7 +192,7 @@ acpi_db_load_table(
status = acpi_tb_validate_table_header (&table_header); status = acpi_tb_validate_table_header (&table_header);
if ((ACPI_FAILURE (status)) || if ((ACPI_FAILURE (status)) ||
(table_header.length > 524288)) /* 1/2 Mbyte should be enough */ { (table_header.length > 0x800000)) /* 8 Mbyte should be enough */ {
acpi_os_printf ("Table header is invalid!\n"); acpi_os_printf ("Table header is invalid!\n");
return (AE_ERROR); return (AE_ERROR);
} }
...@@ -296,7 +298,7 @@ ae_local_load_table ( ...@@ -296,7 +298,7 @@ ae_local_load_table (
} }
#ifndef PARSER_ONLY #if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
status = acpi_ns_load_table (table_info.installed_desc, acpi_gbl_root_node); status = acpi_ns_load_table (table_info.installed_desc, acpi_gbl_root_node);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
/* Uninstall table and free the buffer */ /* Uninstall table and free the buffer */
...@@ -330,7 +332,7 @@ acpi_db_get_acpi_table ( ...@@ -330,7 +332,7 @@ acpi_db_get_acpi_table (
/* Get the entire file */ /* Get the entire file */
acpi_os_printf ("Loading Acpi table from file %s\n", filename); fprintf (stderr, "Loading Acpi table from file %s\n", filename);
status = acpi_db_load_table (fp, &acpi_gbl_db_table_ptr, &table_length); status = acpi_db_load_table (fp, &acpi_gbl_db_table_ptr, &table_length);
fclose(fp); fclose(fp);
...@@ -383,8 +385,8 @@ acpi_db_load_acpi_table ( ...@@ -383,8 +385,8 @@ acpi_db_load_acpi_table (
return (status); return (status);
} }
acpi_os_printf ("%4.4s at %p successfully installed and loaded\n", fprintf (stderr, "Acpi table [%4.4s] successfully installed and loaded\n",
acpi_gbl_db_table_ptr->signature, acpi_gbl_db_table_ptr); acpi_gbl_db_table_ptr->signature);
acpi_gbl_acpi_hardware_present = FALSE; acpi_gbl_acpi_hardware_present = FALSE;
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dbxface - AML Debugger external interfaces * Module Name: dbxface - AML Debugger external interfaces
* $Revision: 59 $ * $Revision: 61 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "acpi.h" #include "acpi.h"
#include "amlcode.h" #include "amlcode.h"
#include "acdebug.h" #include "acdebug.h"
#include "acdisasm.h"
#ifdef ENABLE_DEBUGGER #ifdef ENABLE_DEBUGGER
...@@ -164,7 +165,7 @@ acpi_db_single_step ( ...@@ -164,7 +165,7 @@ acpi_db_single_step (
/* Now we can display it */ /* Now we can display it */
acpi_db_display_op (walk_state, display_op, ACPI_UINT32_MAX); acpi_dm_disassemble (walk_state, display_op, ACPI_UINT32_MAX);
if ((op->common.aml_opcode == AML_IF_OP) || if ((op->common.aml_opcode == AML_IF_OP) ||
(op->common.aml_opcode == AML_WHILE_OP)) { (op->common.aml_opcode == AML_WHILE_OP)) {
...@@ -351,7 +352,6 @@ acpi_db_initialize (void) ...@@ -351,7 +352,6 @@ acpi_db_initialize (void)
} }
if (!acpi_gbl_db_opt_verbose) { if (!acpi_gbl_db_opt_verbose) {
acpi_gbl_db_disasm_indent = " ";
acpi_gbl_db_opt_disasm = TRUE; acpi_gbl_db_opt_disasm = TRUE;
acpi_gbl_db_opt_stats = FALSE; acpi_gbl_db_opt_stats = FALSE;
} }
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: dsobject - Dispatcher object management routines * Module Name: dsobject - Dispatcher object management routines
* $Revision: 104 $ * $Revision: 105 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
ACPI_MODULE_NAME ("dsobject") ACPI_MODULE_NAME ("dsobject")
#ifndef ACPI_NO_METHOD_EXECUTION
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: Acpi_ds_init_one_object * FUNCTION: Acpi_ds_init_one_object
...@@ -216,199 +217,6 @@ acpi_ds_initialize_objects ( ...@@ -216,199 +217,6 @@ acpi_ds_initialize_objects (
} }
/*****************************************************************************
*
* FUNCTION: Acpi_ds_init_object_from_op
*
* PARAMETERS: Walk_state - Current walk state
* Op - Parser op used to init the internal object
* Opcode - AML opcode associated with the object
* Ret_obj_desc - Namespace object to be initialized
*
* RETURN: Status
*
* DESCRIPTION: Initialize a namespace object from a parser Op and its
* associated arguments. The namespace object is a more compact
* representation of the Op and its arguments.
*
****************************************************************************/
acpi_status
acpi_ds_init_object_from_op (
acpi_walk_state *walk_state,
acpi_parse_object *op,
u16 opcode,
acpi_operand_object **ret_obj_desc)
{
const acpi_opcode_info *op_info;
acpi_operand_object *obj_desc;
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE ("Ds_init_object_from_op");
obj_desc = *ret_obj_desc;
op_info = acpi_ps_get_opcode_info (opcode);
if (op_info->class == AML_CLASS_UNKNOWN) {
/* Unknown opcode */
return_ACPI_STATUS (AE_TYPE);
}
/* Perform per-object initialization */
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_BUFFER:
/*
* Defer evaluation of Buffer Term_arg operand
*/
obj_desc->buffer.node = (acpi_namespace_node *) walk_state->operands[0];
obj_desc->buffer.aml_start = op->named.data;
obj_desc->buffer.aml_length = op->named.length;
break;
case ACPI_TYPE_PACKAGE:
/*
* Defer evaluation of Package Term_arg operand
*/
obj_desc->package.node = (acpi_namespace_node *) walk_state->operands[0];
obj_desc->package.aml_start = op->named.data;
obj_desc->package.aml_length = op->named.length;
break;
case ACPI_TYPE_INTEGER:
switch (op_info->type) {
case AML_TYPE_CONSTANT:
/*
* Resolve AML Constants here - AND ONLY HERE!
* All constants are integers.
* We mark the integer with a flag that indicates that it started life
* as a constant -- so that stores to constants will perform as expected (noop).
* (Zero_op is used as a placeholder for optional target operands.)
*/
obj_desc->common.flags = AOPOBJ_AML_CONSTANT;
switch (opcode) {
case AML_ZERO_OP:
obj_desc->integer.value = 0;
break;
case AML_ONE_OP:
obj_desc->integer.value = 1;
break;
case AML_ONES_OP:
obj_desc->integer.value = ACPI_INTEGER_MAX;
/* Truncate value if we are executing from a 32-bit ACPI table */
acpi_ex_truncate_for32bit_table (obj_desc);
break;
case AML_REVISION_OP:
obj_desc->integer.value = ACPI_CA_SUPPORT_LEVEL;
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown constant opcode %X\n", opcode));
status = AE_AML_OPERAND_TYPE;
break;
}
break;
case AML_TYPE_LITERAL:
obj_desc->integer.value = op->common.value.integer;
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n", op_info->type));
status = AE_AML_OPERAND_TYPE;
break;
}
break;
case ACPI_TYPE_STRING:
obj_desc->string.pointer = op->common.value.string;
obj_desc->string.length = ACPI_STRLEN (op->common.value.string);
/*
* The string is contained in the ACPI table, don't ever try
* to delete it
*/
obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
break;
case ACPI_TYPE_METHOD:
break;
case INTERNAL_TYPE_REFERENCE:
switch (op_info->type) {
case AML_TYPE_LOCAL_VARIABLE:
/* Split the opcode into a base opcode + offset */
obj_desc->reference.opcode = AML_LOCAL_OP;
obj_desc->reference.offset = opcode - AML_LOCAL_OP;
acpi_ds_method_data_get_node (AML_LOCAL_OP, obj_desc->reference.offset,
walk_state, (acpi_namespace_node **) &obj_desc->reference.object);
break;
case AML_TYPE_METHOD_ARGUMENT:
/* Split the opcode into a base opcode + offset */
obj_desc->reference.opcode = AML_ARG_OP;
obj_desc->reference.offset = opcode - AML_ARG_OP;
break;
default: /* Other literals, etc.. */
if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
/* Node was saved in Op */
obj_desc->reference.node = op->common.node;
}
obj_desc->reference.opcode = opcode;
break;
}
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type: %X\n",
ACPI_GET_OBJECT_TYPE (obj_desc)));
status = AE_AML_OPERAND_TYPE;
break;
}
return_ACPI_STATUS (status);
}
/***************************************************************************** /*****************************************************************************
* *
* FUNCTION: Acpi_ds_build_internal_object * FUNCTION: Acpi_ds_build_internal_object
...@@ -781,4 +589,202 @@ acpi_ds_create_node ( ...@@ -781,4 +589,202 @@ acpi_ds_create_node (
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
#endif /* ACPI_NO_METHOD_EXECUTION */
/*****************************************************************************
*
* FUNCTION: Acpi_ds_init_object_from_op
*
* PARAMETERS: Walk_state - Current walk state
* Op - Parser op used to init the internal object
* Opcode - AML opcode associated with the object
* Ret_obj_desc - Namespace object to be initialized
*
* RETURN: Status
*
* DESCRIPTION: Initialize a namespace object from a parser Op and its
* associated arguments. The namespace object is a more compact
* representation of the Op and its arguments.
*
****************************************************************************/
acpi_status
acpi_ds_init_object_from_op (
acpi_walk_state *walk_state,
acpi_parse_object *op,
u16 opcode,
acpi_operand_object **ret_obj_desc)
{
const acpi_opcode_info *op_info;
acpi_operand_object *obj_desc;
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE ("Ds_init_object_from_op");
obj_desc = *ret_obj_desc;
op_info = acpi_ps_get_opcode_info (opcode);
if (op_info->class == AML_CLASS_UNKNOWN) {
/* Unknown opcode */
return_ACPI_STATUS (AE_TYPE);
}
/* Perform per-object initialization */
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_BUFFER:
/*
* Defer evaluation of Buffer Term_arg operand
*/
obj_desc->buffer.node = (acpi_namespace_node *) walk_state->operands[0];
obj_desc->buffer.aml_start = op->named.data;
obj_desc->buffer.aml_length = op->named.length;
break;
case ACPI_TYPE_PACKAGE:
/*
* Defer evaluation of Package Term_arg operand
*/
obj_desc->package.node = (acpi_namespace_node *) walk_state->operands[0];
obj_desc->package.aml_start = op->named.data;
obj_desc->package.aml_length = op->named.length;
break;
case ACPI_TYPE_INTEGER:
switch (op_info->type) {
case AML_TYPE_CONSTANT:
/*
* Resolve AML Constants here - AND ONLY HERE!
* All constants are integers.
* We mark the integer with a flag that indicates that it started life
* as a constant -- so that stores to constants will perform as expected (noop).
* (Zero_op is used as a placeholder for optional target operands.)
*/
obj_desc->common.flags = AOPOBJ_AML_CONSTANT;
switch (opcode) {
case AML_ZERO_OP:
obj_desc->integer.value = 0;
break;
case AML_ONE_OP:
obj_desc->integer.value = 1;
break;
case AML_ONES_OP:
obj_desc->integer.value = ACPI_INTEGER_MAX;
/* Truncate value if we are executing from a 32-bit ACPI table */
#ifndef ACPI_NO_METHOD_EXECUTION
acpi_ex_truncate_for32bit_table (obj_desc);
#endif
break;
case AML_REVISION_OP:
obj_desc->integer.value = ACPI_CA_SUPPORT_LEVEL;
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown constant opcode %X\n", opcode));
status = AE_AML_OPERAND_TYPE;
break;
}
break;
case AML_TYPE_LITERAL:
obj_desc->integer.value = op->common.value.integer;
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n", op_info->type));
status = AE_AML_OPERAND_TYPE;
break;
}
break;
case ACPI_TYPE_STRING:
obj_desc->string.pointer = op->common.value.string;
obj_desc->string.length = ACPI_STRLEN (op->common.value.string);
/*
* The string is contained in the ACPI table, don't ever try
* to delete it
*/
obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
break;
case ACPI_TYPE_METHOD:
break;
case INTERNAL_TYPE_REFERENCE:
switch (op_info->type) {
case AML_TYPE_LOCAL_VARIABLE:
/* Split the opcode into a base opcode + offset */
obj_desc->reference.opcode = AML_LOCAL_OP;
obj_desc->reference.offset = opcode - AML_LOCAL_OP;
#ifndef ACPI_NO_METHOD_EXECUTION
acpi_ds_method_data_get_node (AML_LOCAL_OP, obj_desc->reference.offset,
walk_state, (acpi_namespace_node **) &obj_desc->reference.object);
#endif
break;
case AML_TYPE_METHOD_ARGUMENT:
/* Split the opcode into a base opcode + offset */
obj_desc->reference.opcode = AML_ARG_OP;
obj_desc->reference.offset = opcode - AML_ARG_OP;
break;
default: /* Other literals, etc.. */
if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
/* Node was saved in Op */
obj_desc->reference.node = op->common.node;
}
obj_desc->reference.opcode = opcode;
break;
}
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type: %X\n",
ACPI_GET_OBJECT_TYPE (obj_desc)));
status = AE_AML_OPERAND_TYPE;
break;
}
return_ACPI_STATUS (status);
}
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dsutils - Dispatcher utilities * Module Name: dsutils - Dispatcher utilities
* $Revision: 93 $ * $Revision: 94 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#define _COMPONENT ACPI_DISPATCHER #define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsutils") ACPI_MODULE_NAME ("dsutils")
#ifndef ACPI_NO_METHOD_EXECUTION
/******************************************************************************* /*******************************************************************************
* *
...@@ -235,6 +236,47 @@ acpi_ds_delete_result_if_not_used ( ...@@ -235,6 +236,47 @@ acpi_ds_delete_result_if_not_used (
} }
/*******************************************************************************
*
* FUNCTION: Acpi_ds_resolve_operands
*
* PARAMETERS: Walk_state - Current walk state with operands on stack
*
* RETURN: Status
*
* DESCRIPTION: Resolve all operands to their values. Used to prepare
* arguments to a control method invocation (a call from one
* method to another.)
*
******************************************************************************/
acpi_status
acpi_ds_resolve_operands (
acpi_walk_state *walk_state)
{
u32 i;
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE_PTR ("Ds_resolve_operands", walk_state);
/*
* Attempt to resolve each of the valid operands
* Method arguments are passed by value, not by reference
*/
for (i = 0; i < walk_state->num_operands; i++) {
status = acpi_ex_resolve_to_value (&walk_state->operands[i], walk_state);
if (ACPI_FAILURE (status)) {
break;
}
}
return_ACPI_STATUS (status);
}
#endif
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: Acpi_ds_create_operand * FUNCTION: Acpi_ds_create_operand
...@@ -515,42 +557,3 @@ acpi_ds_create_operands ( ...@@ -515,42 +557,3 @@ acpi_ds_create_operands (
} }
/*******************************************************************************
*
* FUNCTION: Acpi_ds_resolve_operands
*
* PARAMETERS: Walk_state - Current walk state with operands on stack
*
* RETURN: Status
*
* DESCRIPTION: Resolve all operands to their values. Used to prepare
* arguments to a control method invocation (a call from one
* method to another.)
*
******************************************************************************/
acpi_status
acpi_ds_resolve_operands (
acpi_walk_state *walk_state)
{
u32 i;
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE_PTR ("Ds_resolve_operands", walk_state);
/*
* Attempt to resolve each of the valid operands
* Method arguments are passed by value, not by reference
*/
for (i = 0; i < walk_state->num_operands; i++) {
status = acpi_ex_resolve_to_value (&walk_state->operands[i], walk_state);
if (ACPI_FAILURE (status)) {
break;
}
}
return_ACPI_STATUS (status);
}
/****************************************************************************** /******************************************************************************
* *
* Module Name: dswload - Dispatcher namespace load callbacks * Module Name: dswload - Dispatcher namespace load callbacks
* $Revision: 67 $ * $Revision: 69 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -70,9 +70,11 @@ acpi_ds_init_callbacks ( ...@@ -70,9 +70,11 @@ acpi_ds_init_callbacks (
break; break;
case 3: case 3:
#ifndef ACPI_NO_METHOD_EXECUTION
walk_state->parse_flags |= ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE; walk_state->parse_flags |= ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE;
walk_state->descending_callback = acpi_ds_exec_begin_op; walk_state->descending_callback = acpi_ds_exec_begin_op;
walk_state->ascending_callback = acpi_ds_exec_end_op; walk_state->ascending_callback = acpi_ds_exec_end_op;
#endif
break; break;
default: default:
...@@ -169,6 +171,11 @@ acpi_ds_load1_begin_op ( ...@@ -169,6 +171,11 @@ acpi_ds_load1_begin_op (
op->named.name = node->name.integer; op->named.name = node->name.integer;
#if (defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY))
op->named.path = (u8 *) path;
#endif
/* /*
* Put the Node in the "op" object that the parser uses, so we * Put the Node in the "op" object that the parser uses, so we
* can get it again quickly when this scope is closed * can get it again quickly when this scope is closed
...@@ -221,6 +228,7 @@ acpi_ds_load1_end_op ( ...@@ -221,6 +228,7 @@ acpi_ds_load1_end_op (
object_type = walk_state->op_info->object_type; object_type = walk_state->op_info->object_type;
#ifndef ACPI_NO_METHOD_EXECUTION
if (walk_state->op_info->flags & AML_FIELD) { if (walk_state->op_info->flags & AML_FIELD) {
if (walk_state->opcode == AML_FIELD_OP || if (walk_state->opcode == AML_FIELD_OP ||
walk_state->opcode == AML_BANK_FIELD_OP || walk_state->opcode == AML_BANK_FIELD_OP ||
...@@ -238,6 +246,7 @@ acpi_ds_load1_end_op ( ...@@ -238,6 +246,7 @@ acpi_ds_load1_end_op (
return (status); return (status);
} }
} }
#endif
if (op->common.aml_opcode == AML_NAME_OP) { if (op->common.aml_opcode == AML_NAME_OP) {
/* For Name opcode, get the object type from the argument */ /* For Name opcode, get the object type from the argument */
...@@ -430,7 +439,9 @@ acpi_ds_load2_end_op ( ...@@ -430,7 +439,9 @@ acpi_ds_load2_end_op (
acpi_namespace_node *node; acpi_namespace_node *node;
acpi_parse_object *arg; acpi_parse_object *arg;
acpi_namespace_node *new_node; acpi_namespace_node *new_node;
#ifndef ACPI_NO_METHOD_EXECUTION
u32 i; u32 i;
#endif
ACPI_FUNCTION_NAME ("Ds_load2_end_op"); ACPI_FUNCTION_NAME ("Ds_load2_end_op");
...@@ -478,6 +489,7 @@ acpi_ds_load2_end_op ( ...@@ -478,6 +489,7 @@ acpi_ds_load2_end_op (
} }
} }
/* /*
* Named operations are as follows: * Named operations are as follows:
* *
...@@ -515,6 +527,8 @@ acpi_ds_load2_end_op ( ...@@ -515,6 +527,8 @@ acpi_ds_load2_end_op (
arg = op->common.value.arg; arg = op->common.value.arg;
switch (walk_state->op_info->type) { switch (walk_state->op_info->type) {
#ifndef ACPI_NO_METHOD_EXECUTION
case AML_TYPE_CREATE_FIELD: case AML_TYPE_CREATE_FIELD:
/* /*
...@@ -604,7 +618,7 @@ acpi_ds_load2_end_op ( ...@@ -604,7 +618,7 @@ acpi_ds_load2_end_op (
} }
break; break;
#endif /* ACPI_NO_METHOD_EXECUTION */
case AML_TYPE_NAMED_COMPLEX: case AML_TYPE_NAMED_COMPLEX:
...@@ -629,6 +643,7 @@ acpi_ds_load2_end_op ( ...@@ -629,6 +643,7 @@ acpi_ds_load2_end_op (
break; break;
#ifndef ACPI_NO_METHOD_EXECUTION
case AML_REGION_OP: case AML_REGION_OP:
/* /*
* The Op_region is not fully parsed at this time. Only valid argument is the Space_id. * The Op_region is not fully parsed at this time. Only valid argument is the Space_id.
...@@ -656,6 +671,7 @@ acpi_ds_load2_end_op ( ...@@ -656,6 +671,7 @@ acpi_ds_load2_end_op (
status = acpi_ds_create_node (walk_state, node, op); status = acpi_ds_create_node (walk_state, node, op);
break; break;
#endif /* ACPI_NO_METHOD_EXECUTION */
default: default:
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: dswstate - Dispatcher parse tree walk management routines * Module Name: dswstate - Dispatcher parse tree walk management routines
* $Revision: 65 $ * $Revision: 67 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -837,7 +837,7 @@ acpi_ds_create_walk_state ( ...@@ -837,7 +837,7 @@ acpi_ds_create_walk_state (
/* Init the method args/local */ /* Init the method args/local */
#ifndef _ACPI_ASL_COMPILER #if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
acpi_ds_method_data_init (walk_state); acpi_ds_method_data_init (walk_state);
#endif #endif
...@@ -858,7 +858,6 @@ acpi_ds_create_walk_state ( ...@@ -858,7 +858,6 @@ acpi_ds_create_walk_state (
} }
#ifndef _ACPI_ASL_COMPILER
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: Acpi_ds_init_aml_walk * FUNCTION: Acpi_ds_init_aml_walk
...@@ -943,7 +942,6 @@ acpi_ds_init_aml_walk ( ...@@ -943,7 +942,6 @@ acpi_ds_init_aml_walk (
status = acpi_ds_init_callbacks (walk_state, pass_number); status = acpi_ds_init_callbacks (walk_state, pass_number);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
#endif
/******************************************************************************* /*******************************************************************************
......
/* /*
* acpi_ec.c - ACPI Embedded Controller Driver ($Revision: 35 $) * acpi_ec.c - ACPI Embedded Controller Driver ($Revision: 38 $)
* *
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
...@@ -62,15 +62,15 @@ static int acpi_ec_start (struct acpi_device *device); ...@@ -62,15 +62,15 @@ static int acpi_ec_start (struct acpi_device *device);
static int acpi_ec_stop (struct acpi_device *device, int type); static int acpi_ec_stop (struct acpi_device *device, int type);
static struct acpi_driver acpi_ec_driver = { static struct acpi_driver acpi_ec_driver = {
name: ACPI_EC_DRIVER_NAME, .name = ACPI_EC_DRIVER_NAME,
class: ACPI_EC_CLASS, .class = ACPI_EC_CLASS,
ids: ACPI_EC_HID, .ids = ACPI_EC_HID,
ops: { .ops = {
add: acpi_ec_add, .add = acpi_ec_add,
remove: acpi_ec_remove, .remove = acpi_ec_remove,
start: acpi_ec_start, .start = acpi_ec_start,
stop: acpi_ec_stop, .stop = acpi_ec_stop,
}, },
}; };
struct acpi_ec { struct acpi_ec {
...@@ -398,7 +398,7 @@ acpi_ec_space_handler ( ...@@ -398,7 +398,7 @@ acpi_ec_space_handler (
{ {
int result = 0; int result = 0;
struct acpi_ec *ec = NULL; struct acpi_ec *ec = NULL;
u32 tmp = 0; u32 temp = 0;
ACPI_FUNCTION_TRACE("acpi_ec_space_handler"); ACPI_FUNCTION_TRACE("acpi_ec_space_handler");
...@@ -409,8 +409,8 @@ acpi_ec_space_handler ( ...@@ -409,8 +409,8 @@ acpi_ec_space_handler (
switch (function) { switch (function) {
case ACPI_READ: case ACPI_READ:
result = acpi_ec_read(ec, (u8) address, &tmp); result = acpi_ec_read(ec, (u8) address, &temp);
*value = (acpi_integer) tmp; *value = (acpi_integer) temp;
break; break;
case ACPI_WRITE: case ACPI_WRITE:
result = acpi_ec_write(ec, (u8) address, (u8) *value); result = acpi_ec_write(ec, (u8) address, (u8) *value);
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: excreate - Named object creation * Module Name: excreate - Named object creation
* $Revision: 92 $ * $Revision: 93 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
ACPI_MODULE_NAME ("excreate") ACPI_MODULE_NAME ("excreate")
#ifndef ACPI_NO_METHOD_EXECUTION
/***************************************************************************** /*****************************************************************************
* *
* FUNCTION: Acpi_ex_create_alias * FUNCTION: Acpi_ex_create_alias
...@@ -490,6 +491,7 @@ acpi_ex_create_power_resource ( ...@@ -490,6 +491,7 @@ acpi_ex_create_power_resource (
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
#endif
/***************************************************************************** /*****************************************************************************
* *
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: exdump - Interpreter debug output routines * Module Name: exdump - Interpreter debug output routines
* $Revision: 156 $ * $Revision: 157 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -575,14 +575,14 @@ acpi_ex_dump_object_descriptor ( ...@@ -575,14 +575,14 @@ acpi_ex_dump_object_descriptor (
{ {
if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer)))
{ {
return; return_VOID;
} }
} }
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND) if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND)
{ {
acpi_os_printf ("Ex_dump_object_descriptor: %p is not a valid ACPI object\n", obj_desc); acpi_os_printf ("Ex_dump_object_descriptor: %p is not a valid ACPI object\n", obj_desc);
return; return_VOID;
} }
/* Common Fields */ /* Common Fields */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: exoparg1 - AML execution - opcodes with 1 argument * Module Name: exoparg1 - AML execution - opcodes with 1 argument
* $Revision: 140 $ * $Revision: 141 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -804,16 +804,7 @@ acpi_ex_opcode_1A_0T_1R ( ...@@ -804,16 +804,7 @@ acpi_ex_opcode_1A_0T_1R (
switch (operand[0]->reference.target_type) { switch (operand[0]->reference.target_type) {
case ACPI_TYPE_BUFFER_FIELD: case ACPI_TYPE_BUFFER_FIELD:
/* Ensure that the Buffer arguments are evaluated */
temp_desc = operand[0]->reference.object; temp_desc = operand[0]->reference.object;
#if 0
status = acpi_ds_get_buffer_arguments (temp_desc);
if (ACPI_FAILURE (status)) {
goto cleanup;
}
#endif
/* /*
* Create a new object that contains one element of the * Create a new object that contains one element of the
...@@ -841,14 +832,6 @@ acpi_ex_opcode_1A_0T_1R ( ...@@ -841,14 +832,6 @@ acpi_ex_opcode_1A_0T_1R (
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
#if 0
/* Ensure that the Package arguments are evaluated */
status = acpi_ds_get_package_arguments (operand[0]->reference.object);
if (ACPI_FAILURE (status)) {
goto cleanup;
}
#endif
/* /*
* Return the referenced element of the package. We must add * Return the referenced element of the package. We must add
* another reference to the referenced object, however. * another reference to the referenced object, however.
...@@ -884,6 +867,11 @@ acpi_ex_opcode_1A_0T_1R ( ...@@ -884,6 +867,11 @@ acpi_ex_opcode_1A_0T_1R (
return_desc = operand[0]->reference.object; return_desc = operand[0]->reference.object;
if (ACPI_GET_DESCRIPTOR_TYPE (return_desc) == ACPI_DESC_TYPE_NAMED) {
return_desc = acpi_ns_get_attached_object ((acpi_namespace_node *) return_desc);
}
/* Add another reference to the object! */ /* Add another reference to the object! */
acpi_ut_add_reference (return_desc); acpi_ut_add_reference (return_desc);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: exutils - interpreter/scanner utilities * Module Name: exutils - interpreter/scanner utilities
* $Revision: 100 $ * $Revision: 102 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -50,6 +50,34 @@ ...@@ -50,6 +50,34 @@
ACPI_MODULE_NAME ("exutils") ACPI_MODULE_NAME ("exutils")
/*******************************************************************************
*
* FUNCTION: Acpi_ex_validate_object_type
*
* PARAMETERS: Type Object type to validate
*
* DESCRIPTION: Determine if a type is a valid ACPI object type
*
******************************************************************************/
u8
acpi_ex_validate_object_type (
acpi_object_type type)
{
ACPI_FUNCTION_ENTRY ();
if ((type > ACPI_TYPE_MAX && type < INTERNAL_TYPE_BEGIN) ||
(type > INTERNAL_TYPE_MAX)) {
return (FALSE);
}
return (TRUE);
}
#ifndef ACPI_NO_METHOD_EXECUTION
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: Acpi_ex_enter_interpreter * FUNCTION: Acpi_ex_enter_interpreter
...@@ -116,33 +144,6 @@ acpi_ex_exit_interpreter (void) ...@@ -116,33 +144,6 @@ acpi_ex_exit_interpreter (void)
} }
/*******************************************************************************
*
* FUNCTION: Acpi_ex_validate_object_type
*
* PARAMETERS: Type Object type to validate
*
* DESCRIPTION: Determine if a type is a valid ACPI object type
*
******************************************************************************/
u8
acpi_ex_validate_object_type (
acpi_object_type type)
{
ACPI_FUNCTION_ENTRY ();
if ((type > ACPI_TYPE_MAX && type < INTERNAL_TYPE_BEGIN) ||
(type > INTERNAL_TYPE_MAX)) {
return (FALSE);
}
return (TRUE);
}
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: Acpi_ex_truncate_for32bit_table * FUNCTION: Acpi_ex_truncate_for32bit_table
...@@ -263,6 +264,8 @@ acpi_ex_release_global_lock ( ...@@ -263,6 +264,8 @@ acpi_ex_release_global_lock (
ACPI_REPORT_ERROR (("Could not release ACPI Global Lock\n")); ACPI_REPORT_ERROR (("Could not release ACPI Global Lock\n"));
} }
} }
return_VOID;
} }
...@@ -378,4 +381,4 @@ acpi_ex_unsigned_integer_to_string ( ...@@ -378,4 +381,4 @@ acpi_ex_unsigned_integer_to_string (
} }
} }
#endif
/* /*
* acpi_fan.c - ACPI Fan Driver ($Revision: 28 $) * acpi_fan.c - ACPI Fan Driver ($Revision: 29 $)
* *
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
...@@ -47,13 +47,13 @@ int acpi_fan_add (struct acpi_device *device); ...@@ -47,13 +47,13 @@ int acpi_fan_add (struct acpi_device *device);
int acpi_fan_remove (struct acpi_device *device, int type); int acpi_fan_remove (struct acpi_device *device, int type);
static struct acpi_driver acpi_fan_driver = { static struct acpi_driver acpi_fan_driver = {
name: ACPI_FAN_DRIVER_NAME, .name = ACPI_FAN_DRIVER_NAME,
class: ACPI_FAN_CLASS, .class = ACPI_FAN_CLASS,
ids: ACPI_FAN_HID, .ids = ACPI_FAN_HID,
ops: { .ops = {
add: acpi_fan_add, .add = acpi_fan_add,
remove: acpi_fan_remove, .remove = acpi_fan_remove,
}, },
}; };
struct acpi_fan { struct acpi_fan {
......
/****************************************************************************** /******************************************************************************
* *
* Name: acconfig.h - Global configuration constants * Name: acconfig.h - Global configuration constants
* $Revision: 105 $ * $Revision: 107 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
/* Version string */ /* Version string */
#define ACPI_CA_VERSION 0x20020702 #define ACPI_CA_VERSION 0x20020725
/* Version of ACPI supported */ /* Version of ACPI supported */
...@@ -152,6 +152,15 @@ ...@@ -152,6 +152,15 @@
#define ACPI_MAX_ADDRESS_SPACE 255 #define ACPI_MAX_ADDRESS_SPACE 255
/* 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
/* RSDP checksums */ /* RSDP checksums */
#define ACPI_RSDP_CHECKSUM_LENGTH 20 #define ACPI_RSDP_CHECKSUM_LENGTH 20
......
/****************************************************************************** /******************************************************************************
* *
* Name: acdebug.h - ACPI/AML debugger * Name: acdebug.h - ACPI/AML debugger
* $Revision: 62 $ * $Revision: 63 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#define ACPI_DEBUG_BUFFER_SIZE 4196 #define ACPI_DEBUG_BUFFER_SIZE 4196
typedef struct command_info typedef struct command_info
{ {
NATIVE_CHAR *name; /* Command Name */ NATIVE_CHAR *name; /* Command Name */
...@@ -185,47 +184,6 @@ acpi_db_walk_for_specific_objects ( ...@@ -185,47 +184,6 @@ acpi_db_walk_for_specific_objects (
void **return_value); void **return_value);
/*
* dbdisasm - AML disassembler
*/
void
acpi_db_display_op (
acpi_walk_state *walk_state,
acpi_parse_object *origin,
u32 num_opcodes);
void
acpi_db_display_namestring (
NATIVE_CHAR *name);
void
acpi_db_display_path (
acpi_parse_object *op);
void
acpi_db_display_opcode (
acpi_walk_state *walk_state,
acpi_parse_object *op);
void
acpi_db_decode_internal_object (
acpi_operand_object *obj_desc);
void
acpi_db_decode_node (
acpi_namespace_node *node);
u32
acpi_db_block_type (
acpi_parse_object *op);
acpi_status
acpi_ps_display_object_pathname (
acpi_walk_state *walk_state,
acpi_parse_object *op);
/* /*
* dbdisply - debug display commands * dbdisply - debug display commands
*/ */
...@@ -282,6 +240,10 @@ void * ...@@ -282,6 +240,10 @@ void *
acpi_db_get_pointer ( acpi_db_get_pointer (
void *target); void *target);
void
acpi_db_decode_internal_object (
acpi_operand_object *obj_desc);
/* /*
* dbexec - debugger control method execution * dbexec - debugger control method execution
......
/******************************************************************************
*
* Name: acdisasm.h - AML disassembler
* $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
*/
#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_string (
char *string);
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);
/*
* 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: acglobal.h - Declarations for global variables * Name: acglobal.h - Declarations for global variables
* $Revision: 126 $ * $Revision: 128 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -140,8 +140,9 @@ ACPI_EXTERN u8 acpi_gbl_global_lock_present; ...@@ -140,8 +140,9 @@ ACPI_EXTERN u8 acpi_gbl_global_lock_present;
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_NUM_SLEEP_STATES];
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];
/***************************************************************************** /*****************************************************************************
...@@ -237,6 +238,12 @@ ACPI_EXTERN ACPI_GPE_INDEX_INFO *acpi_gbl_gpe_number_to_index; ...@@ -237,6 +238,12 @@ ACPI_EXTERN ACPI_GPE_INDEX_INFO *acpi_gbl_gpe_number_to_index;
ACPI_EXTERN u8 acpi_gbl_db_output_flags; ACPI_EXTERN u8 acpi_gbl_db_output_flags;
#ifdef ACPI_DISASSEMBLER
ACPI_EXTERN u8 acpi_gbl_db_opt_disasm;
ACPI_EXTERN u8 acpi_gbl_db_opt_verbose;
#endif
#ifdef ENABLE_DEBUGGER #ifdef ENABLE_DEBUGGER
...@@ -247,9 +254,7 @@ ACPI_EXTERN int optind; ...@@ -247,9 +254,7 @@ ACPI_EXTERN int optind;
ACPI_EXTERN NATIVE_CHAR *optarg; ACPI_EXTERN NATIVE_CHAR *optarg;
ACPI_EXTERN u8 acpi_gbl_db_opt_tables; ACPI_EXTERN u8 acpi_gbl_db_opt_tables;
ACPI_EXTERN u8 acpi_gbl_db_opt_disasm;
ACPI_EXTERN u8 acpi_gbl_db_opt_stats; ACPI_EXTERN u8 acpi_gbl_db_opt_stats;
ACPI_EXTERN u8 acpi_gbl_db_opt_verbose;
ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods; ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods;
...@@ -261,7 +266,6 @@ ACPI_EXTERN NATIVE_CHAR acpi_gbl_db_debug_filename[40]; ...@@ -261,7 +266,6 @@ ACPI_EXTERN NATIVE_CHAR acpi_gbl_db_debug_filename[40];
ACPI_EXTERN u8 acpi_gbl_db_output_to_file; ACPI_EXTERN u8 acpi_gbl_db_output_to_file;
ACPI_EXTERN NATIVE_CHAR *acpi_gbl_db_buffer; ACPI_EXTERN NATIVE_CHAR *acpi_gbl_db_buffer;
ACPI_EXTERN NATIVE_CHAR *acpi_gbl_db_filename; ACPI_EXTERN NATIVE_CHAR *acpi_gbl_db_filename;
ACPI_EXTERN NATIVE_CHAR *acpi_gbl_db_disasm_indent;
ACPI_EXTERN u32 acpi_gbl_db_debug_level; ACPI_EXTERN u32 acpi_gbl_db_debug_level;
ACPI_EXTERN u32 acpi_gbl_db_console_debug_level; ACPI_EXTERN u32 acpi_gbl_db_console_debug_level;
ACPI_EXTERN acpi_table_header *acpi_gbl_db_table_ptr; ACPI_EXTERN acpi_table_header *acpi_gbl_db_table_ptr;
......
/****************************************************************************** /******************************************************************************
* *
* Name: aclocal.h - Internal data types used across the ACPI subsystem * Name: aclocal.h - Internal data types used across the ACPI subsystem
* $Revision: 168 $ * $Revision: 172 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -567,8 +567,8 @@ acpi_status (*ACPI_EXECUTE_OP) ( ...@@ -567,8 +567,8 @@ acpi_status (*ACPI_EXECUTE_OP) (
*/ */
typedef struct acpi_opcode_info typedef struct acpi_opcode_info
{ {
#ifdef _OPCODE_NAMES #ifdef ACPI_DISASSEMBLER
NATIVE_CHAR *name; /* Opcode name (debug only) */ NATIVE_CHAR *name; /* Opcode name (disassembler/debug only) */
#endif #endif
u32 parse_args; /* Grammar/Parse time arguments */ u32 parse_args; /* Grammar/Parse time arguments */
u32 runtime_args; /* Interpret time arguments */ u32 runtime_args; /* Interpret time arguments */
...@@ -603,15 +603,23 @@ typedef union acpi_parse_val ...@@ -603,15 +603,23 @@ typedef union acpi_parse_val
u32 aml_offset; /* offset of declaration in AML */\ u32 aml_offset; /* offset of declaration in AML */\
union acpi_parse_obj *parent; /* parent op */\ union acpi_parse_obj *parent; /* parent op */\
union acpi_parse_obj *next; /* next op */\ union acpi_parse_obj *next; /* next op */\
ACPI_DEBUG_ONLY_MEMBERS (\ ACPI_DISASM_ONLY_MEMBERS (\
u8 disasm_flags; /* Used during AML disassembly */\
u8 disasm_opcode; /* Subtype used for disassembly */\
NATIVE_CHAR aml_op_name[16]) /* op name (debug only) */\ NATIVE_CHAR aml_op_name[16]) /* op name (debug only) */\
/* NON-DEBUG members below: */\ /* NON-DEBUG members below: */\
acpi_namespace_node *node; /* for use by interpreter */\ acpi_namespace_node *node; /* for use by interpreter */\
acpi_parse_value value; /* Value or args associated with the opcode */\ acpi_parse_value value; /* Value or args associated with the opcode */\
#define ACPI_DASM_BUFFER 0x00
#define ACPI_DASM_RESOURCE 0x01
#define ACPI_DASM_STRING 0x02
#define ACPI_DASM_UNICODE 0x03
#define ACPI_DASM_EISAID 0x04
#define ACPI_DASM_MATCHOP 0x05
/* /*
* generic operation (eg. If, While, Store) * generic operation (for example: If, While, Store)
*/ */
typedef struct acpi_parseobj_common typedef struct acpi_parseobj_common
{ {
...@@ -626,6 +634,7 @@ typedef struct acpi_parseobj_common ...@@ -626,6 +634,7 @@ typedef struct acpi_parseobj_common
typedef struct acpi_parseobj_named typedef struct acpi_parseobj_named
{ {
ACPI_PARSE_COMMON ACPI_PARSE_COMMON
u8 *path;
u8 *data; /* AML body or bytelist data */ u8 *data; /* AML body or bytelist data */
u32 length; /* AML length */ u32 length; /* AML length */
u32 name; /* 4-byte name or zero if no name */ u32 name; /* 4-byte name or zero if no name */
...@@ -653,15 +662,15 @@ typedef struct acpi_parseobj_asl ...@@ -653,15 +662,15 @@ typedef struct acpi_parseobj_asl
u32 logical_byte_offset; u32 logical_byte_offset;
u32 end_line; u32 end_line;
u32 end_logical_line; u32 end_logical_line;
u16 parse_opcode;
u32 acpi_btype; u32 acpi_btype;
u32 aml_length; u32 aml_length;
u32 aml_subtree_length; u32 aml_subtree_length;
u32 final_aml_length; u32 final_aml_length;
u32 final_aml_offset; u32 final_aml_offset;
u16 parse_opcode;
u16 compile_flags;
u8 aml_opcode_length; u8 aml_opcode_length;
u8 aml_pkg_len_bytes; u8 aml_pkg_len_bytes;
u16 compile_flags;
u8 extra; u8 extra;
char parse_op_name[12]; char parse_op_name[12];
...@@ -705,6 +714,13 @@ typedef struct acpi_parse_state ...@@ -705,6 +714,13 @@ typedef struct acpi_parse_state
#define ACPI_PARSEOP_BYTELIST 0x08 #define ACPI_PARSEOP_BYTELIST 0x08
#define ACPI_PARSEOP_IN_CACHE 0x80 #define ACPI_PARSEOP_IN_CACHE 0x80
/* Parse object Disasm_flags */
#define ACPI_PARSEOP_IGNORE 0x01
#define ACPI_PARSEOP_PARAMLIST 0x02
#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
#define ACPI_PARSEOP_SPECIAL 0x10
/***************************************************************************** /*****************************************************************************
* *
......
/****************************************************************************** /******************************************************************************
* *
* Name: acmacros.h - C macros for the entire subsystem. * Name: acmacros.h - C macros for the entire subsystem.
* $Revision: 124 $ * $Revision: 125 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -287,10 +287,12 @@ ...@@ -287,10 +287,12 @@
/* /*
* Macros for the master AML opcode table * Macros for the master AML opcode table
*/ */
#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER) #ifdef ACPI_DISASSEMBLER
#define ACPI_OP(name,Pargs,Iargs,obj_type,class,type,flags) {name,Pargs,Iargs,flags,obj_type,class,type} #define ACPI_OP(name,Pargs,Iargs,obj_type,class,type,flags) {name,Pargs,Iargs,flags,obj_type,class,type}
#define ACPI_DISASM_ONLY_MEMBERS(a) a;
#else #else
#define ACPI_OP(name,Pargs,Iargs,obj_type,class,type,flags) {Pargs,Iargs,flags,obj_type,class,type} #define ACPI_OP(name,Pargs,Iargs,obj_type,class,type,flags) {Pargs,Iargs,flags,obj_type,class,type}
#define ACPI_DISASM_ONLY_MEMBERS(a)
#endif #endif
#define ARG_TYPE_WIDTH 5 #define ARG_TYPE_WIDTH 5
...@@ -435,7 +437,6 @@ ...@@ -435,7 +437,6 @@
#define ACPI_DEBUG_DEFINE(a) a; #define ACPI_DEBUG_DEFINE(a) a;
#define ACPI_DEBUG_ONLY_MEMBERS(a) a; #define ACPI_DEBUG_ONLY_MEMBERS(a) a;
#define _OPCODE_NAMES
#define _VERBOSE_STRUCTURES #define _VERBOSE_STRUCTURES
...@@ -515,10 +516,6 @@ ...@@ -515,10 +516,6 @@
#define return_VALUE(s) return(s) #define return_VALUE(s) return(s)
#define return_PTR(s) return(s) #define return_PTR(s) return(s)
#ifdef ENABLE_DEBUGGER
#define _OPCODE_NAMES
#endif
#endif #endif
/* /*
......
/****************************************************************************** /******************************************************************************
* *
* Name: acnamesp.h - Namespace subcomponent prototypes and defines * Name: acnamesp.h - Namespace subcomponent prototypes and defines
* $Revision: 125 $ * $Revision: 126 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
/* Definitions of the predefined namespace names */ /* Definitions of the predefined namespace names */
#define ACPI_UNKNOWN_NAME (u32) 0x3F3F3F3F /* Unknown name is "????" */ #define ACPI_UNKNOWN_NAME (u32) 0x3F3F3F3F /* Unknown name is "????" */
#define ACPI_ROOT_NAME (u32) 0x2F202020 /* Root name is "/ " */ #define ACPI_ROOT_NAME (u32) 0x5F5F5F5C /* Root name is "\___" */
#define ACPI_SYS_BUS_NAME (u32) 0x5F53425F /* Sys bus name is "_SB_" */ #define ACPI_SYS_BUS_NAME (u32) 0x5F53425F /* Sys bus name is "_SB_" */
#define ACPI_NS_ROOT_PATH "\\" #define ACPI_NS_ROOT_PATH "\\"
......
...@@ -204,7 +204,6 @@ acpi_os_read_port ( ...@@ -204,7 +204,6 @@ acpi_os_read_port (
void *value, void *value,
u32 width); u32 width);
acpi_status acpi_status
acpi_os_write_port ( acpi_os_write_port (
ACPI_IO_ADDRESS address, ACPI_IO_ADDRESS address,
...@@ -222,7 +221,6 @@ acpi_os_read_memory ( ...@@ -222,7 +221,6 @@ acpi_os_read_memory (
void *value, void *value,
u32 width); u32 width);
acpi_status acpi_status
acpi_os_write_memory ( acpi_os_write_memory (
ACPI_PHYSICAL_ADDRESS address, ACPI_PHYSICAL_ADDRESS address,
...@@ -241,7 +239,6 @@ acpi_os_read_pci_configuration ( ...@@ -241,7 +239,6 @@ acpi_os_read_pci_configuration (
void *value, void *value,
u32 width); u32 width);
acpi_status acpi_status
acpi_os_write_pci_configuration ( acpi_os_write_pci_configuration (
acpi_pci_id *pci_id, acpi_pci_id *pci_id,
...@@ -259,7 +256,6 @@ acpi_os_readable ( ...@@ -259,7 +256,6 @@ acpi_os_readable (
void *pointer, void *pointer,
u32 length); u32 length);
u8 u8
acpi_os_writable ( acpi_os_writable (
void *pointer, void *pointer,
...@@ -288,6 +284,10 @@ acpi_os_vprintf ( ...@@ -288,6 +284,10 @@ acpi_os_vprintf (
const NATIVE_CHAR *format, const NATIVE_CHAR *format,
va_list args); va_list args);
void
acpi_os_redirect_output (
void *destination);
/* /*
* Debug input * Debug input
......
/****************************************************************************** /******************************************************************************
* *
* Name: acutils.h -- prototypes for the common (subsystem-wide) procedures * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
* $Revision: 140 $ * $Revision: 142 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -224,6 +224,9 @@ extern const u8 _acpi_ctype[]; ...@@ -224,6 +224,9 @@ extern const u8 _acpi_ctype[];
#define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD)) #define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
#define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP)) #define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
#define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO)) #define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
#define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
#define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
#define ACPI_IS_ASCII(c) ((c) < 0x80)
#endif /* ACPI_USE_SYSTEM_CLIBRARY */ #endif /* ACPI_USE_SYSTEM_CLIBRARY */
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Name: amlcode.h - Definitions for AML, as included in "definition blocks" * Name: amlcode.h - Definitions for AML, as included in "definition blocks"
* Declarations and definitions contained herein are derived * Declarations and definitions contained herein are derived
* directly from the ACPI specification. * directly from the ACPI specification.
* $Revision: 68 $ * $Revision: 69 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -474,13 +474,4 @@ typedef enum ...@@ -474,13 +474,4 @@ typedef enum
#define METHOD_FLAGS_SYNCH_LEVEL 0xF0 #define METHOD_FLAGS_SYNCH_LEVEL 0xF0
/* Array sizes. Used for range checking also */
#define NUM_ACCESS_TYPES 6
#define NUM_UPDATE_RULES 3
#define NUM_MATCH_OPS 7
#define NUM_OPCODES 256
#define NUM_FIELD_NAMES 2
#endif /* __AMLCODE_H__ */ #endif /* __AMLCODE_H__ */
/****************************************************************************** /******************************************************************************
* *
* Module Name: aslresource.h - ASL resource descriptors * Module Name: amlresrc.h - AML resource descriptors
* $Revision: 19 $ * $Revision: 20 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
*/ */
#ifndef __ASLRESOURCE_H #ifndef __AMLRESRC_H
#define __ASLRESOURCE_H #define __AMLRESRC_H
#define ASL_RESNAME_ADDRESS "_ADR" #define ASL_RESNAME_ADDRESS "_ADR"
...@@ -80,11 +80,13 @@ typedef struct asl_resource_node ...@@ -80,11 +80,13 @@ typedef struct asl_resource_node
/* /*
* Resource descriptors defined in the ACPI specification * Resource descriptors defined in the ACPI specification.
*
* Alignment must be BYTE because these descriptors
* are used to overlay the AML byte stream.
*/ */
#pragma pack(1) #pragma pack(1)
typedef struct asl_irq_format_desc typedef struct asl_irq_format_desc
{ {
u8 descriptor_type; u8 descriptor_type;
...@@ -94,7 +96,6 @@ typedef struct asl_irq_format_desc ...@@ -94,7 +96,6 @@ typedef struct asl_irq_format_desc
} ASL_IRQ_FORMAT_DESC; } ASL_IRQ_FORMAT_DESC;
#pragma pack(1)
typedef struct asl_irq_noflags_desc typedef struct asl_irq_noflags_desc
{ {
u8 descriptor_type; u8 descriptor_type;
...@@ -103,7 +104,6 @@ typedef struct asl_irq_noflags_desc ...@@ -103,7 +104,6 @@ typedef struct asl_irq_noflags_desc
} ASL_IRQ_NOFLAGS_DESC; } ASL_IRQ_NOFLAGS_DESC;
#pragma pack(1)
typedef struct asl_dma_format_desc typedef struct asl_dma_format_desc
{ {
u8 descriptor_type; u8 descriptor_type;
...@@ -113,7 +113,6 @@ typedef struct asl_dma_format_desc ...@@ -113,7 +113,6 @@ typedef struct asl_dma_format_desc
} ASL_DMA_FORMAT_DESC; } ASL_DMA_FORMAT_DESC;
#pragma pack(1)
typedef struct asl_start_dependent_desc typedef struct asl_start_dependent_desc
{ {
u8 descriptor_type; u8 descriptor_type;
...@@ -122,7 +121,6 @@ typedef struct asl_start_dependent_desc ...@@ -122,7 +121,6 @@ typedef struct asl_start_dependent_desc
} ASL_START_DEPENDENT_DESC; } ASL_START_DEPENDENT_DESC;
#pragma pack(1)
typedef struct asl_start_dependent_noprio_desc typedef struct asl_start_dependent_noprio_desc
{ {
u8 descriptor_type; u8 descriptor_type;
...@@ -130,7 +128,6 @@ typedef struct asl_start_dependent_noprio_desc ...@@ -130,7 +128,6 @@ typedef struct asl_start_dependent_noprio_desc
} ASL_START_DEPENDENT_NOPRIO_DESC; } ASL_START_DEPENDENT_NOPRIO_DESC;
#pragma pack(1)
typedef struct asl_end_dependent_desc typedef struct asl_end_dependent_desc
{ {
u8 descriptor_type; u8 descriptor_type;
...@@ -138,7 +135,6 @@ typedef struct asl_end_dependent_desc ...@@ -138,7 +135,6 @@ typedef struct asl_end_dependent_desc
} ASL_END_DEPENDENT_DESC; } ASL_END_DEPENDENT_DESC;
#pragma pack(1)
typedef struct asl_io_port_desc typedef struct asl_io_port_desc
{ {
u8 descriptor_type; u8 descriptor_type;
...@@ -151,7 +147,6 @@ typedef struct asl_io_port_desc ...@@ -151,7 +147,6 @@ typedef struct asl_io_port_desc
} ASL_IO_PORT_DESC; } ASL_IO_PORT_DESC;
#pragma pack(1)
typedef struct asl_fixed_io_port_desc typedef struct asl_fixed_io_port_desc
{ {
u8 descriptor_type; u8 descriptor_type;
...@@ -161,7 +156,6 @@ typedef struct asl_fixed_io_port_desc ...@@ -161,7 +156,6 @@ typedef struct asl_fixed_io_port_desc
} ASL_FIXED_IO_PORT_DESC; } ASL_FIXED_IO_PORT_DESC;
#pragma pack(1)
typedef struct asl_small_vendor_desc typedef struct asl_small_vendor_desc
{ {
u8 descriptor_type; u8 descriptor_type;
...@@ -170,7 +164,6 @@ typedef struct asl_small_vendor_desc ...@@ -170,7 +164,6 @@ typedef struct asl_small_vendor_desc
} ASL_SMALL_VENDOR_DESC; } ASL_SMALL_VENDOR_DESC;
#pragma pack(1)
typedef struct asl_end_tag_desc typedef struct asl_end_tag_desc
{ {
u8 descriptor_type; u8 descriptor_type;
...@@ -181,7 +174,6 @@ typedef struct asl_end_tag_desc ...@@ -181,7 +174,6 @@ typedef struct asl_end_tag_desc
/* LARGE descriptors */ /* LARGE descriptors */
#pragma pack(1)
typedef struct asl_memory_24_desc typedef struct asl_memory_24_desc
{ {
u8 descriptor_type; u8 descriptor_type;
...@@ -195,7 +187,6 @@ typedef struct asl_memory_24_desc ...@@ -195,7 +187,6 @@ typedef struct asl_memory_24_desc
} ASL_MEMORY_24_DESC; } ASL_MEMORY_24_DESC;
#pragma pack(1)
typedef struct asl_large_vendor_desc typedef struct asl_large_vendor_desc
{ {
u8 descriptor_type; u8 descriptor_type;
...@@ -205,7 +196,6 @@ typedef struct asl_large_vendor_desc ...@@ -205,7 +196,6 @@ typedef struct asl_large_vendor_desc
} ASL_LARGE_VENDOR_DESC; } ASL_LARGE_VENDOR_DESC;
#pragma pack(1)
typedef struct asl_memory_32_desc typedef struct asl_memory_32_desc
{ {
u8 descriptor_type; u8 descriptor_type;
...@@ -219,7 +209,6 @@ typedef struct asl_memory_32_desc ...@@ -219,7 +209,6 @@ typedef struct asl_memory_32_desc
} ASL_MEMORY_32_DESC; } ASL_MEMORY_32_DESC;
#pragma pack(1)
typedef struct asl_fixed_memory_32_desc typedef struct asl_fixed_memory_32_desc
{ {
u8 descriptor_type; u8 descriptor_type;
...@@ -231,7 +220,6 @@ typedef struct asl_fixed_memory_32_desc ...@@ -231,7 +220,6 @@ typedef struct asl_fixed_memory_32_desc
} ASL_FIXED_MEMORY_32_DESC; } ASL_FIXED_MEMORY_32_DESC;
#pragma pack(1)
typedef struct asl_qword_address_desc typedef struct asl_qword_address_desc
{ {
u8 descriptor_type; u8 descriptor_type;
...@@ -249,7 +237,6 @@ typedef struct asl_qword_address_desc ...@@ -249,7 +237,6 @@ typedef struct asl_qword_address_desc
} ASL_QWORD_ADDRESS_DESC; } ASL_QWORD_ADDRESS_DESC;
#pragma pack(1)
typedef struct asl_dword_address_desc typedef struct asl_dword_address_desc
{ {
u8 descriptor_type; u8 descriptor_type;
...@@ -267,7 +254,6 @@ typedef struct asl_dword_address_desc ...@@ -267,7 +254,6 @@ typedef struct asl_dword_address_desc
} ASL_DWORD_ADDRESS_DESC; } ASL_DWORD_ADDRESS_DESC;
#pragma pack(1)
typedef struct asl_word_address_desc typedef struct asl_word_address_desc
{ {
u8 descriptor_type; u8 descriptor_type;
...@@ -285,7 +271,6 @@ typedef struct asl_word_address_desc ...@@ -285,7 +271,6 @@ typedef struct asl_word_address_desc
} ASL_WORD_ADDRESS_DESC; } ASL_WORD_ADDRESS_DESC;
#pragma pack(1)
typedef struct asl_extended_xrupt_desc typedef struct asl_extended_xrupt_desc
{ {
u8 descriptor_type; u8 descriptor_type;
...@@ -298,7 +283,6 @@ typedef struct asl_extended_xrupt_desc ...@@ -298,7 +283,6 @@ typedef struct asl_extended_xrupt_desc
} ASL_EXTENDED_XRUPT_DESC; } ASL_EXTENDED_XRUPT_DESC;
#pragma pack(1)
typedef struct asl_general_register_desc typedef struct asl_general_register_desc
{ {
u8 descriptor_type; u8 descriptor_type;
...@@ -311,6 +295,9 @@ typedef struct asl_general_register_desc ...@@ -311,6 +295,9 @@ typedef struct asl_general_register_desc
} ASL_GENERAL_REGISTER_DESC; } ASL_GENERAL_REGISTER_DESC;
/* restore default alignment */
#pragma pack()
/* Union of all resource descriptors, sow we can allocate the worst case */ /* Union of all resource descriptors, sow we can allocate the worst case */
......
/****************************************************************************** /******************************************************************************
* *
* Name: acenv.h - Generation environment specific items * Name: acenv.h - Generation environment specific items
* $Revision: 95 $ * $Revision: 99 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -32,11 +32,13 @@ ...@@ -32,11 +32,13 @@
*/ */
#ifdef _ACPI_DUMP_APP #ifdef _ACPI_DUMP_APP
#ifndef MSDOS
#define ACPI_DEBUG #define ACPI_DEBUG
#endif
#define ACPI_APPLICATION #define ACPI_APPLICATION
#define ENABLE_DEBUGGER #define ACPI_DISASSEMBLER
#define ACPI_NO_METHOD_EXECUTION
#define ACPI_USE_SYSTEM_CLIBRARY #define ACPI_USE_SYSTEM_CLIBRARY
#define PARSER_ONLY
#endif #endif
#ifdef _ACPI_EXEC_APP #ifdef _ACPI_EXEC_APP
...@@ -45,13 +47,15 @@ ...@@ -45,13 +47,15 @@
#define ACPI_DEBUG #define ACPI_DEBUG
#define ACPI_APPLICATION #define ACPI_APPLICATION
#define ENABLE_DEBUGGER #define ENABLE_DEBUGGER
#define ACPI_DISASSEMBLER
#define ACPI_USE_SYSTEM_CLIBRARY #define ACPI_USE_SYSTEM_CLIBRARY
#endif #endif
#ifdef _ACPI_ASL_COMPILER #ifdef _ACPI_ASL_COMPILER
#define ACPI_DEBUG #define ACPI_DEBUG
#define ACPI_APPLICATION #define ACPI_APPLICATION
/* #define ENABLE_DEBUGGER */ #define ACPI_DISASSEMBLER
#define ACPI_CONSTANT_EVAL_ONLY
#define ACPI_USE_SYSTEM_CLIBRARY #define ACPI_USE_SYSTEM_CLIBRARY
#endif #endif
...@@ -183,7 +187,6 @@ ...@@ -183,7 +187,6 @@
/* /*
* Use the standard C library headers. * Use the standard C library headers.
* We want to keep these to a minimum. * We want to keep these to a minimum.
*
*/ */
#ifdef ACPI_USE_STANDARD_HEADERS #ifdef ACPI_USE_STANDARD_HEADERS
...@@ -213,12 +216,16 @@ ...@@ -213,12 +216,16 @@
#define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (ACPI_SIZE)(n)) #define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (ACPI_SIZE)(n))
#define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (ACPI_SIZE)(n)) #define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (ACPI_SIZE)(n))
#define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (ACPI_SIZE)(n)) #define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (ACPI_SIZE)(n))
#define ACPI_TOUPPER toupper #define ACPI_TOUPPER toupper
#define ACPI_TOLOWER tolower #define ACPI_TOLOWER tolower
#define ACPI_IS_XDIGIT isxdigit #define ACPI_IS_XDIGIT isxdigit
#define ACPI_IS_DIGIT isdigit #define ACPI_IS_DIGIT isdigit
#define ACPI_IS_SPACE isspace #define ACPI_IS_SPACE isspace
#define ACPI_IS_UPPER isupper #define ACPI_IS_UPPER isupper
#define ACPI_IS_PRINT isprint
#define ACPI_IS_ALPHA isalpha
#define ACPI_IS_ASCII isascii
/****************************************************************************** /******************************************************************************
* *
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: nsdump - table dumping routines for debug * Module Name: nsdump - table dumping routines for debug
* $Revision: 136 $ * $Revision: 137 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -619,93 +619,6 @@ acpi_ns_dump_objects ( ...@@ -619,93 +619,6 @@ acpi_ns_dump_objects (
} }
#ifndef _ACPI_ASL_COMPILER
/*******************************************************************************
*
* FUNCTION: Acpi_ns_dump_one_device
*
* PARAMETERS: Handle - Node to be dumped
* Level - Nesting level of the handle
* Context - Passed into Walk_namespace
*
* DESCRIPTION: Dump a single Node that represents a device
* This procedure is a User_function called by Acpi_ns_walk_namespace.
*
******************************************************************************/
acpi_status
acpi_ns_dump_one_device (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value)
{
acpi_device_info info;
acpi_status status;
u32 i;
ACPI_FUNCTION_NAME ("Ns_dump_one_device");
status = acpi_ns_dump_one_object (obj_handle, level, context, return_value);
status = acpi_get_object_info (obj_handle, &info);
if (ACPI_SUCCESS (status)) {
for (i = 0; i < level; i++) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " "));
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
info.hardware_id,
ACPI_HIDWORD (info.address), ACPI_LODWORD (info.address),
info.current_status));
}
return (status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_ns_dump_root_devices
*
* PARAMETERS: None
*
* DESCRIPTION: Dump all objects of type "device"
*
******************************************************************************/
void
acpi_ns_dump_root_devices (void)
{
acpi_handle sys_bus_handle;
acpi_status status;
ACPI_FUNCTION_NAME ("Ns_dump_root_devices");
/* Only dump the table if tracing is enabled */
if (!(ACPI_LV_TABLES & acpi_dbg_level)) {
return;
}
status = acpi_get_handle (0, ACPI_NS_SYSTEM_BUS, &sys_bus_handle);
if (ACPI_FAILURE (status)) {
return;
}
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Display of all devices in the namespace:\n"));
status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE, sys_bus_handle,
ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
acpi_ns_dump_one_device, NULL, NULL);
}
#endif
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: Acpi_ns_dump_tables * FUNCTION: Acpi_ns_dump_tables
......
/******************************************************************************
*
* Module Name: nsdump - table dumping routines for debug
* $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"
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsdumpdv")
#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
/*******************************************************************************
*
* FUNCTION: Acpi_ns_dump_one_device
*
* PARAMETERS: Handle - Node to be dumped
* Level - Nesting level of the handle
* Context - Passed into Walk_namespace
*
* DESCRIPTION: Dump a single Node that represents a device
* This procedure is a User_function called by Acpi_ns_walk_namespace.
*
******************************************************************************/
acpi_status
acpi_ns_dump_one_device (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value)
{
acpi_device_info info;
acpi_status status;
u32 i;
ACPI_FUNCTION_NAME ("Ns_dump_one_device");
status = acpi_ns_dump_one_object (obj_handle, level, context, return_value);
status = acpi_get_object_info (obj_handle, &info);
if (ACPI_SUCCESS (status)) {
for (i = 0; i < level; i++) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " "));
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
info.hardware_id,
ACPI_HIDWORD (info.address), ACPI_LODWORD (info.address),
info.current_status));
}
return (status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_ns_dump_root_devices
*
* PARAMETERS: None
*
* DESCRIPTION: Dump all objects of type "device"
*
******************************************************************************/
void
acpi_ns_dump_root_devices (void)
{
acpi_handle sys_bus_handle;
acpi_status status;
ACPI_FUNCTION_NAME ("Ns_dump_root_devices");
/* Only dump the table if tracing is enabled */
if (!(ACPI_LV_TABLES & acpi_dbg_level)) {
return;
}
status = acpi_get_handle (0, ACPI_NS_SYSTEM_BUS, &sys_bus_handle);
if (ACPI_FAILURE (status)) {
return;
}
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Display of all devices in the namespace:\n"));
status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE, sys_bus_handle,
ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
acpi_ns_dump_one_device, NULL, NULL);
}
#endif
/****************************************************************************** /******************************************************************************
* *
* Module Name: nsload - namespace loading/expanding/contracting procedures * Module Name: nsload - namespace loading/expanding/contracting procedures
* $Revision: 56 $ * $Revision: 57 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -37,59 +37,7 @@ ...@@ -37,59 +37,7 @@
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: Acpi_load_namespace * FUNCTION: Ns_one_complete_parse
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Load the name space from what ever is pointed to by DSDT.
* (DSDT points to either the BIOS or a buffer.)
*
******************************************************************************/
acpi_status
acpi_ns_load_namespace (
void)
{
acpi_status status;
ACPI_FUNCTION_TRACE ("Acpi_load_name_space");
/* There must be at least a DSDT installed */
if (acpi_gbl_DSDT == NULL) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "DSDT is not in memory\n"));
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
/*
* Load the namespace. The DSDT is required,
* but the SSDT and PSDT tables are optional.
*/
status = acpi_ns_load_table_by_type (ACPI_TABLE_DSDT);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* Ignore exceptions from these */
(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 Namespace successfully loaded at root %p\n",
acpi_gbl_root_node));
return_ACPI_STATUS (status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_ns_one_parse_pass
* *
* PARAMETERS: Pass_number - 1 or 2 * PARAMETERS: Pass_number - 1 or 2
* Table_desc - The table to be parsed. * Table_desc - The table to be parsed.
...@@ -203,6 +151,7 @@ acpi_ns_parse_table ( ...@@ -203,6 +151,7 @@ acpi_ns_parse_table (
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
#ifndef ACPI_NO_METHOD_EXECUTION
/******************************************************************************* /*******************************************************************************
* *
...@@ -419,6 +368,58 @@ acpi_ns_load_table_by_type ( ...@@ -419,6 +368,58 @@ acpi_ns_load_table_by_type (
} }
/*******************************************************************************
*
* FUNCTION: Acpi_load_namespace
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Load the name space from what ever is pointed to by DSDT.
* (DSDT points to either the BIOS or a buffer.)
*
******************************************************************************/
acpi_status
acpi_ns_load_namespace (
void)
{
acpi_status status;
ACPI_FUNCTION_TRACE ("Acpi_load_name_space");
/* There must be at least a DSDT installed */
if (acpi_gbl_DSDT == NULL) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "DSDT is not in memory\n"));
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
/*
* Load the namespace. The DSDT is required,
* but the SSDT and PSDT tables are optional.
*/
status = acpi_ns_load_table_by_type (ACPI_TABLE_DSDT);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* Ignore exceptions from these */
(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 Namespace successfully loaded at root %p\n",
acpi_gbl_root_node));
return_ACPI_STATUS (status);
}
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: Acpi_ns_delete_subtree * FUNCTION: Acpi_ns_delete_subtree
...@@ -550,4 +551,5 @@ acpi_ns_unload_namespace ( ...@@ -550,4 +551,5 @@ acpi_ns_unload_namespace (
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
#endif
/*******************************************************************************
*
* Module Name: nsxfeval - Public interfaces to the ACPI subsystem
* ACPI Object evaluation interfaces
* $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"
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsxfeval")
/*******************************************************************************
*
* FUNCTION: Acpi_evaluate_object_typed
*
* PARAMETERS: Handle - Object handle (optional)
* *Pathname - Object pathname (optional)
* **External_params - List of parameters to pass to method,
* terminated by NULL. May be NULL
* if no parameters are being passed.
* *Return_buffer - Where to put method's return value (if
* any). If NULL, no value is returned.
* Return_type - Expected type of return object
*
* RETURN: Status
*
* DESCRIPTION: Find and evaluate the given object, passing the given
* parameters if necessary. One of "Handle" or "Pathname" must
* be valid (non-null)
*
******************************************************************************/
acpi_status
acpi_evaluate_object_typed (
acpi_handle handle,
acpi_string pathname,
acpi_object_list *external_params,
acpi_buffer *return_buffer,
acpi_object_type return_type)
{
acpi_status status;
u8 must_free = FALSE;
ACPI_FUNCTION_TRACE ("Acpi_evaluate_object_typed");
/* Return buffer must be valid */
if (!return_buffer) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
if (return_buffer->length == ACPI_ALLOCATE_BUFFER) {
must_free = TRUE;
}
/* Evaluate the object */
status = acpi_evaluate_object (handle, pathname, external_params, return_buffer);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* Type ANY means "don't care" */
if (return_type == ACPI_TYPE_ANY) {
return_ACPI_STATUS (AE_OK);
}
if (return_buffer->length == 0) {
/* Error because caller specifically asked for a return value */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"No return value\n"));
return_ACPI_STATUS (AE_NULL_OBJECT);
}
/* Examine the object type returned from Evaluate_object */
if (((acpi_object *) return_buffer->pointer)->type == return_type) {
return_ACPI_STATUS (AE_OK);
}
/* Return object type does not match requested type */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Incorrect return type [%s] requested [%s]\n",
acpi_ut_get_type_name (((acpi_object *) return_buffer->pointer)->type),
acpi_ut_get_type_name (return_type)));
if (must_free) {
/* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */
acpi_os_free (return_buffer->pointer);
return_buffer->pointer = NULL;
}
return_buffer->length = 0;
return_ACPI_STATUS (AE_TYPE);
}
/*******************************************************************************
*
* FUNCTION: Acpi_evaluate_object
*
* PARAMETERS: Handle - Object handle (optional)
* *Pathname - Object pathname (optional)
* **External_params - List of parameters to pass to method,
* terminated by NULL. May be NULL
* if no parameters are being passed.
* *Return_buffer - Where to put method's return value (if
* any). If NULL, no value is returned.
*
* RETURN: Status
*
* DESCRIPTION: Find and evaluate the given object, passing the given
* parameters if necessary. One of "Handle" or "Pathname" must
* be valid (non-null)
*
******************************************************************************/
acpi_status
acpi_evaluate_object (
acpi_handle handle,
acpi_string pathname,
acpi_object_list *external_params,
acpi_buffer *return_buffer)
{
acpi_status status;
acpi_operand_object **internal_params = NULL;
acpi_operand_object *internal_return_obj = NULL;
ACPI_SIZE buffer_space_needed;
u32 i;
ACPI_FUNCTION_TRACE ("Acpi_evaluate_object");
/*
* If there are parameters to be passed to the object
* (which must be a control method), the external objects
* must be converted to internal objects
*/
if (external_params && external_params->count) {
/*
* Allocate a new parameter block for the internal objects
* Add 1 to count to allow for null terminated internal list
*/
internal_params = ACPI_MEM_CALLOCATE (((ACPI_SIZE) external_params->count + 1) *
sizeof (void *));
if (!internal_params) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
/*
* Convert each external object in the list to an
* internal object
*/
for (i = 0; i < external_params->count; i++) {
status = acpi_ut_copy_eobject_to_iobject (&external_params->pointer[i],
&internal_params[i]);
if (ACPI_FAILURE (status)) {
acpi_ut_delete_internal_object_list (internal_params);
return_ACPI_STATUS (status);
}
}
internal_params[external_params->count] = NULL;
}
/*
* Three major cases:
* 1) Fully qualified pathname
* 2) No handle, not fully qualified pathname (error)
* 3) Valid handle
*/
if ((pathname) &&
(acpi_ns_valid_root_prefix (pathname[0]))) {
/*
* The path is fully qualified, just evaluate by name
*/
status = acpi_ns_evaluate_by_name (pathname, internal_params,
&internal_return_obj);
}
else if (!handle) {
/*
* A handle is optional iff a fully qualified pathname
* is specified. Since we've already handled fully
* qualified names above, this is an error
*/
if (!pathname) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Both Handle and Pathname are NULL\n"));
}
else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Handle is NULL and Pathname is relative\n"));
}
status = AE_BAD_PARAMETER;
}
else {
/*
* We get here if we have a handle -- and if we have a
* pathname it is relative. The handle will be validated
* in the lower procedures
*/
if (!pathname) {
/*
* The null pathname case means the handle is for
* the actual object to be evaluated
*/
status = acpi_ns_evaluate_by_handle (handle, internal_params,
&internal_return_obj);
}
else {
/*
* Both a Handle and a relative Pathname
*/
status = acpi_ns_evaluate_relative (handle, pathname, internal_params,
&internal_return_obj);
}
}
/*
* If we are expecting a return value, and all went well above,
* copy the return value to an external object.
*/
if (return_buffer) {
if (!internal_return_obj) {
return_buffer->length = 0;
}
else {
if (ACPI_GET_DESCRIPTOR_TYPE (internal_return_obj) == ACPI_DESC_TYPE_NAMED) {
/*
* If we received a NS Node as a return object, this means that
* the object we are evaluating has nothing interesting to
* return (such as a mutex, etc.) We return an error because
* these types are essentially unsupported by this interface.
* We don't check up front because this makes it easier to add
* support for various types at a later date if necessary.
*/
status = AE_TYPE;
internal_return_obj = NULL; /* No need to delete a NS Node */
return_buffer->length = 0;
}
if (ACPI_SUCCESS (status)) {
/*
* Find out how large a buffer is needed
* to contain the returned object
*/
status = acpi_ut_get_object_size (internal_return_obj,
&buffer_space_needed);
if (ACPI_SUCCESS (status)) {
/* Validate/Allocate/Clear caller buffer */
status = acpi_ut_initialize_buffer (return_buffer, buffer_space_needed);
if (ACPI_FAILURE (status)) {
/*
* Caller's buffer is too small or a new one can't be allocated
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Needed buffer size %X, %s\n",
(u32) buffer_space_needed, acpi_format_exception (status)));
}
else {
/*
* We have enough space for the object, build it
*/
status = acpi_ut_copy_iobject_to_eobject (internal_return_obj,
return_buffer);
}
}
}
}
}
/* Delete the return and parameter objects */
if (internal_return_obj) {
/*
* Delete the internal return object. (Or at least
* decrement the reference count by one)
*/
acpi_ut_remove_reference (internal_return_obj);
}
/*
* Free the input parameter list (if we created one),
*/
if (internal_params) {
/* Free the allocated parameter block */
acpi_ut_delete_internal_object_list (internal_params);
}
return_ACPI_STATUS (status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_walk_namespace
*
* PARAMETERS: Type - acpi_object_type to search for
* Start_object - Handle in namespace where search begins
* Max_depth - Depth to which search is to reach
* User_function - Called when an object of "Type" is found
* Context - Passed to user function
* Return_value - Location where return value of
* User_function is put if terminated early
*
* RETURNS Return value from the User_function if terminated early.
* Otherwise, returns NULL.
*
* DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
* starting (and ending) at the object specified by Start_handle.
* The User_function is called whenever an object that matches
* the type parameter is found. If the user function returns
* a non-zero value, the search is terminated immediately and this
* value is returned to the caller.
*
* The point of this procedure is to provide a generic namespace
* walk routine that can be called from multiple places to
* provide multiple services; the User Function can be tailored
* to each task, whether it is a print function, a compare
* function, etc.
*
******************************************************************************/
acpi_status
acpi_walk_namespace (
acpi_object_type type,
acpi_handle start_object,
u32 max_depth,
acpi_walk_callback user_function,
void *context,
void **return_value)
{
acpi_status status;
ACPI_FUNCTION_TRACE ("Acpi_walk_namespace");
/* Parameter validation */
if ((type > ACPI_TYPE_MAX) ||
(!max_depth) ||
(!user_function)) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/*
* Lock the namespace around the walk.
* The namespace will be unlocked/locked around each call
* to the user function - since this function
* must be allowed to make Acpi calls itself.
*/
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
status = acpi_ns_walk_namespace (type, start_object, max_depth, ACPI_NS_WALK_UNLOCK,
user_function, context, return_value);
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_ns_get_device_callback
*
* PARAMETERS: Callback from Acpi_get_device
*
* RETURN: Status
*
* DESCRIPTION: Takes callbacks from Walk_namespace and filters out all non-
* present devices, or if they specified a HID, it filters based
* on that.
*
******************************************************************************/
static acpi_status
acpi_ns_get_device_callback (
acpi_handle obj_handle,
u32 nesting_level,
void *context,
void **return_value)
{
acpi_status status;
acpi_namespace_node *node;
u32 flags;
acpi_device_id hid;
acpi_device_id cid;
acpi_get_devices_info *info;
info = context;
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) {
return (status);
}
node = acpi_ns_map_handle_to_node (obj_handle);
status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) {
return (status);
}
if (!node) {
return (AE_BAD_PARAMETER);
}
/*
* Run _STA to determine if device is present
*/
status = acpi_ut_execute_STA (node, &flags);
if (ACPI_FAILURE (status)) {
return (AE_CTRL_DEPTH);
}
if (!(flags & 0x01)) {
/* Don't return at the device or children of the device if not there */
return (AE_CTRL_DEPTH);
}
/*
* Filter based on device HID & CID
*/
if (info->hid != NULL) {
status = acpi_ut_execute_HID (node, &hid);
if (status == AE_NOT_FOUND) {
return (AE_OK);
}
else if (ACPI_FAILURE (status)) {
return (AE_CTRL_DEPTH);
}
if (ACPI_STRNCMP (hid.buffer, info->hid, sizeof (hid.buffer)) != 0) {
status = acpi_ut_execute_CID (node, &cid);
if (status == AE_NOT_FOUND) {
return (AE_OK);
}
else if (ACPI_FAILURE (status)) {
return (AE_CTRL_DEPTH);
}
/* TBD: Handle CID packages */
if (ACPI_STRNCMP (cid.buffer, info->hid, sizeof (cid.buffer)) != 0) {
return (AE_OK);
}
}
}
status = info->user_function (obj_handle, nesting_level, info->context, return_value);
return (status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_get_devices
*
* PARAMETERS: HID - HID to search for. Can be NULL.
* User_function - Called when a matching object is found
* Context - Passed to user function
* Return_value - Location where return value of
* User_function is put if terminated early
*
* RETURNS Return value from the User_function if terminated early.
* Otherwise, returns NULL.
*
* DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
* starting (and ending) at the object specified by Start_handle.
* The User_function is called whenever an object that matches
* the type parameter is found. If the user function returns
* a non-zero value, the search is terminated immediately and this
* value is returned to the caller.
*
* This is a wrapper for Walk_namespace, but the callback performs
* additional filtering. Please see Acpi_get_device_callback.
*
******************************************************************************/
acpi_status
acpi_get_devices (
NATIVE_CHAR *HID,
acpi_walk_callback user_function,
void *context,
void **return_value)
{
acpi_status status;
acpi_get_devices_info info;
ACPI_FUNCTION_TRACE ("Acpi_get_devices");
/* Parameter validation */
if (!user_function) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/*
* We're going to call their callback from OUR callback, so we need
* to know what it is, and their context parameter.
*/
info.context = context;
info.user_function = user_function;
info.hid = HID;
/*
* Lock the namespace around the walk.
* The namespace will be unlocked/locked around each call
* to the user function - since this function
* must be allowed to make Acpi calls itself.
*/
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE,
ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
ACPI_NS_WALK_UNLOCK,
acpi_ns_get_device_callback, &info,
return_value);
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_attach_data
*
* PARAMETERS:
*
* RETURN: Status
*
* DESCRIPTION:
*
******************************************************************************/
acpi_status
acpi_attach_data (
acpi_handle obj_handle,
ACPI_OBJECT_HANDLER handler,
void *data)
{
acpi_namespace_node *node;
acpi_status status;
/* Parameter validation */
if (!obj_handle ||
!handler ||
!data) {
return (AE_BAD_PARAMETER);
}
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) {
return (status);
}
/* Convert and validate the handle */
node = acpi_ns_map_handle_to_node (obj_handle);
if (!node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
}
status = acpi_ns_attach_data (node, handler, data);
unlock_and_exit:
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return (status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_detach_data
*
* PARAMETERS:
*
* RETURN: Status
*
* DESCRIPTION:
*
******************************************************************************/
acpi_status
acpi_detach_data (
acpi_handle obj_handle,
ACPI_OBJECT_HANDLER handler)
{
acpi_namespace_node *node;
acpi_status status;
/* Parameter validation */
if (!obj_handle ||
!handler) {
return (AE_BAD_PARAMETER);
}
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) {
return (status);
}
/* Convert and validate the handle */
node = acpi_ns_map_handle_to_node (obj_handle);
if (!node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
}
status = acpi_ns_detach_data (node, handler);
unlock_and_exit:
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return (status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_get_data
*
* PARAMETERS:
*
* RETURN: Status
*
* DESCRIPTION:
*
******************************************************************************/
acpi_status
acpi_get_data (
acpi_handle obj_handle,
ACPI_OBJECT_HANDLER handler,
void **data)
{
acpi_namespace_node *node;
acpi_status status;
/* Parameter validation */
if (!obj_handle ||
!handler ||
!data) {
return (AE_BAD_PARAMETER);
}
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) {
return (status);
}
/* Convert and validate the handle */
node = acpi_ns_map_handle_to_node (obj_handle);
if (!node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
}
status = acpi_ns_get_attached_data (node, handler, data);
unlock_and_exit:
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return (status);
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* *
* Module Name: nsxfobj - Public interfaces to the ACPI subsystem * Module Name: nsxfobj - Public interfaces to the ACPI subsystem
* ACPI Object oriented interfaces * ACPI Object oriented interfaces
* $Revision: 112 $ * $Revision: 113 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -32,384 +32,6 @@ ...@@ -32,384 +32,6 @@
#define _COMPONENT ACPI_NAMESPACE #define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsxfobj") ACPI_MODULE_NAME ("nsxfobj")
/*******************************************************************************
*
* FUNCTION: Acpi_evaluate_object_typed
*
* PARAMETERS: Handle - Object handle (optional)
* *Pathname - Object pathname (optional)
* **External_params - List of parameters to pass to method,
* terminated by NULL. May be NULL
* if no parameters are being passed.
* *Return_buffer - Where to put method's return value (if
* any). If NULL, no value is returned.
* Return_type - Expected type of return object
*
* RETURN: Status
*
* DESCRIPTION: Find and evaluate the given object, passing the given
* parameters if necessary. One of "Handle" or "Pathname" must
* be valid (non-null)
*
******************************************************************************/
acpi_status
acpi_evaluate_object_typed (
acpi_handle handle,
acpi_string pathname,
acpi_object_list *external_params,
acpi_buffer *return_buffer,
acpi_object_type return_type)
{
acpi_status status;
u8 must_free = FALSE;
ACPI_FUNCTION_TRACE ("Acpi_evaluate_object_typed");
/* Return buffer must be valid */
if (!return_buffer) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
if (return_buffer->length == ACPI_ALLOCATE_BUFFER) {
must_free = TRUE;
}
/* Evaluate the object */
status = acpi_evaluate_object (handle, pathname, external_params, return_buffer);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* Type ANY means "don't care" */
if (return_type == ACPI_TYPE_ANY) {
return_ACPI_STATUS (AE_OK);
}
if (return_buffer->length == 0) {
/* Error because caller specifically asked for a return value */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"No return value\n"));
return_ACPI_STATUS (AE_NULL_OBJECT);
}
/* Examine the object type returned from Evaluate_object */
if (((acpi_object *) return_buffer->pointer)->type == return_type) {
return_ACPI_STATUS (AE_OK);
}
/* Return object type does not match requested type */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Incorrect return type [%s] requested [%s]\n",
acpi_ut_get_type_name (((acpi_object *) return_buffer->pointer)->type),
acpi_ut_get_type_name (return_type)));
if (must_free) {
/* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */
acpi_os_free (return_buffer->pointer);
return_buffer->pointer = NULL;
}
return_buffer->length = 0;
return_ACPI_STATUS (AE_TYPE);
}
/*******************************************************************************
*
* FUNCTION: Acpi_evaluate_object
*
* PARAMETERS: Handle - Object handle (optional)
* *Pathname - Object pathname (optional)
* **External_params - List of parameters to pass to method,
* terminated by NULL. May be NULL
* if no parameters are being passed.
* *Return_buffer - Where to put method's return value (if
* any). If NULL, no value is returned.
*
* RETURN: Status
*
* DESCRIPTION: Find and evaluate the given object, passing the given
* parameters if necessary. One of "Handle" or "Pathname" must
* be valid (non-null)
*
******************************************************************************/
acpi_status
acpi_evaluate_object (
acpi_handle handle,
acpi_string pathname,
acpi_object_list *external_params,
acpi_buffer *return_buffer)
{
acpi_status status;
acpi_operand_object **internal_params = NULL;
acpi_operand_object *internal_return_obj = NULL;
ACPI_SIZE buffer_space_needed;
u32 i;
ACPI_FUNCTION_TRACE ("Acpi_evaluate_object");
/*
* If there are parameters to be passed to the object
* (which must be a control method), the external objects
* must be converted to internal objects
*/
if (external_params && external_params->count) {
/*
* Allocate a new parameter block for the internal objects
* Add 1 to count to allow for null terminated internal list
*/
internal_params = ACPI_MEM_CALLOCATE (((ACPI_SIZE) external_params->count + 1) *
sizeof (void *));
if (!internal_params) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
/*
* Convert each external object in the list to an
* internal object
*/
for (i = 0; i < external_params->count; i++) {
status = acpi_ut_copy_eobject_to_iobject (&external_params->pointer[i],
&internal_params[i]);
if (ACPI_FAILURE (status)) {
acpi_ut_delete_internal_object_list (internal_params);
return_ACPI_STATUS (status);
}
}
internal_params[external_params->count] = NULL;
}
/*
* Three major cases:
* 1) Fully qualified pathname
* 2) No handle, not fully qualified pathname (error)
* 3) Valid handle
*/
if ((pathname) &&
(acpi_ns_valid_root_prefix (pathname[0]))) {
/*
* The path is fully qualified, just evaluate by name
*/
status = acpi_ns_evaluate_by_name (pathname, internal_params,
&internal_return_obj);
}
else if (!handle) {
/*
* A handle is optional iff a fully qualified pathname
* is specified. Since we've already handled fully
* qualified names above, this is an error
*/
if (!pathname) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Both Handle and Pathname are NULL\n"));
}
else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Handle is NULL and Pathname is relative\n"));
}
status = AE_BAD_PARAMETER;
}
else {
/*
* We get here if we have a handle -- and if we have a
* pathname it is relative. The handle will be validated
* in the lower procedures
*/
if (!pathname) {
/*
* The null pathname case means the handle is for
* the actual object to be evaluated
*/
status = acpi_ns_evaluate_by_handle (handle, internal_params,
&internal_return_obj);
}
else {
/*
* Both a Handle and a relative Pathname
*/
status = acpi_ns_evaluate_relative (handle, pathname, internal_params,
&internal_return_obj);
}
}
/*
* If we are expecting a return value, and all went well above,
* copy the return value to an external object.
*/
if (return_buffer) {
if (!internal_return_obj) {
return_buffer->length = 0;
}
else {
if (ACPI_GET_DESCRIPTOR_TYPE (internal_return_obj) == ACPI_DESC_TYPE_NAMED) {
/*
* If we received a NS Node as a return object, this means that
* the object we are evaluating has nothing interesting to
* return (such as a mutex, etc.) We return an error because
* these types are essentially unsupported by this interface.
* We don't check up front because this makes it easier to add
* support for various types at a later date if necessary.
*/
status = AE_TYPE;
internal_return_obj = NULL; /* No need to delete a NS Node */
return_buffer->length = 0;
}
if (ACPI_SUCCESS (status)) {
/*
* Find out how large a buffer is needed
* to contain the returned object
*/
status = acpi_ut_get_object_size (internal_return_obj,
&buffer_space_needed);
if (ACPI_SUCCESS (status)) {
/* Validate/Allocate/Clear caller buffer */
status = acpi_ut_initialize_buffer (return_buffer, buffer_space_needed);
if (ACPI_FAILURE (status)) {
/*
* Caller's buffer is too small or a new one can't be allocated
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Needed buffer size %X, %s\n",
(u32) buffer_space_needed, acpi_format_exception (status)));
}
else {
/*
* We have enough space for the object, build it
*/
status = acpi_ut_copy_iobject_to_eobject (internal_return_obj,
return_buffer);
}
}
}
}
}
/* Delete the return and parameter objects */
if (internal_return_obj) {
/*
* Delete the internal return object. (Or at least
* decrement the reference count by one)
*/
acpi_ut_remove_reference (internal_return_obj);
}
/*
* Free the input parameter list (if we created one),
*/
if (internal_params) {
/* Free the allocated parameter block */
acpi_ut_delete_internal_object_list (internal_params);
}
return_ACPI_STATUS (status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_get_next_object
*
* PARAMETERS: Type - Type of object to be searched for
* Parent - Parent object whose children we are getting
* Last_child - Previous child that was found.
* The NEXT child will be returned
* Ret_handle - Where handle to the next object is placed
*
* RETURN: Status
*
* DESCRIPTION: Return the next peer object within the namespace. If Handle is
* valid, Scope is ignored. Otherwise, the first object within
* Scope is returned.
*
******************************************************************************/
acpi_status
acpi_get_next_object (
acpi_object_type type,
acpi_handle parent,
acpi_handle child,
acpi_handle *ret_handle)
{
acpi_status status;
acpi_namespace_node *node;
acpi_namespace_node *parent_node = NULL;
acpi_namespace_node *child_node = NULL;
/* Parameter validation */
if (type > ACPI_TYPE_MAX) {
return (AE_BAD_PARAMETER);
}
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) {
return (status);
}
/* If null handle, use the parent */
if (!child) {
/* Start search at the beginning of the specified scope */
parent_node = acpi_ns_map_handle_to_node (parent);
if (!parent_node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
}
}
else {
/* Non-null handle, ignore the parent */
/* Convert and validate the handle */
child_node = acpi_ns_map_handle_to_node (child);
if (!child_node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
}
}
/* Internal function does the real work */
node = acpi_ns_get_next_node (type, parent_node, child_node);
if (!node) {
status = AE_NOT_FOUND;
goto unlock_and_exit;
}
if (ret_handle) {
*ret_handle = acpi_ns_convert_entry_to_handle (node);
}
unlock_and_exit:
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return (status);
}
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: Acpi_get_type * FUNCTION: Acpi_get_type
...@@ -535,271 +157,38 @@ acpi_get_parent ( ...@@ -535,271 +157,38 @@ acpi_get_parent (
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: Acpi_walk_namespace * FUNCTION: Acpi_get_next_object
*
* PARAMETERS: Type - acpi_object_type to search for
* Start_object - Handle in namespace where search begins
* Max_depth - Depth to which search is to reach
* User_function - Called when an object of "Type" is found
* Context - Passed to user function
* Return_value - Location where return value of
* User_function is put if terminated early
*
* RETURNS Return value from the User_function if terminated early.
* Otherwise, returns NULL.
*
* DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
* starting (and ending) at the object specified by Start_handle.
* The User_function is called whenever an object that matches
* the type parameter is found. If the user function returns
* a non-zero value, the search is terminated immediately and this
* value is returned to the caller.
*
* The point of this procedure is to provide a generic namespace
* walk routine that can be called from multiple places to
* provide multiple services; the User Function can be tailored
* to each task, whether it is a print function, a compare
* function, etc.
*
******************************************************************************/
acpi_status
acpi_walk_namespace (
acpi_object_type type,
acpi_handle start_object,
u32 max_depth,
acpi_walk_callback user_function,
void *context,
void **return_value)
{
acpi_status status;
ACPI_FUNCTION_TRACE ("Acpi_walk_namespace");
/* Parameter validation */
if ((type > ACPI_TYPE_MAX) ||
(!max_depth) ||
(!user_function)) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/*
* Lock the namespace around the walk.
* The namespace will be unlocked/locked around each call
* to the user function - since this function
* must be allowed to make Acpi calls itself.
*/
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
status = acpi_ns_walk_namespace (type, start_object, max_depth, ACPI_NS_WALK_UNLOCK,
user_function, context, return_value);
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_ns_get_device_callback
* *
* PARAMETERS: Callback from Acpi_get_device * PARAMETERS: Type - Type of object to be searched for
* Parent - Parent object whose children we are getting
* Last_child - Previous child that was found.
* The NEXT child will be returned
* Ret_handle - Where handle to the next object is placed
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Takes callbacks from Walk_namespace and filters out all non- * DESCRIPTION: Return the next peer object within the namespace. If Handle is
* present devices, or if they specified a HID, it filters based * valid, Scope is ignored. Otherwise, the first object within
* on that. * Scope is returned.
*
******************************************************************************/
static acpi_status
acpi_ns_get_device_callback (
acpi_handle obj_handle,
u32 nesting_level,
void *context,
void **return_value)
{
acpi_status status;
acpi_namespace_node *node;
u32 flags;
acpi_device_id hid;
acpi_device_id cid;
acpi_get_devices_info *info;
info = context;
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) {
return (status);
}
node = acpi_ns_map_handle_to_node (obj_handle);
status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) {
return (status);
}
if (!node) {
return (AE_BAD_PARAMETER);
}
/*
* Run _STA to determine if device is present
*/
status = acpi_ut_execute_STA (node, &flags);
if (ACPI_FAILURE (status)) {
return (AE_CTRL_DEPTH);
}
if (!(flags & 0x01)) {
/* Don't return at the device or children of the device if not there */
return (AE_CTRL_DEPTH);
}
/*
* Filter based on device HID & CID
*/
if (info->hid != NULL) {
status = acpi_ut_execute_HID (node, &hid);
if (status == AE_NOT_FOUND) {
return (AE_OK);
}
else if (ACPI_FAILURE (status)) {
return (AE_CTRL_DEPTH);
}
if (ACPI_STRNCMP (hid.buffer, info->hid, sizeof (hid.buffer)) != 0) {
status = acpi_ut_execute_CID (node, &cid);
if (status == AE_NOT_FOUND) {
return (AE_OK);
}
else if (ACPI_FAILURE (status)) {
return (AE_CTRL_DEPTH);
}
/* TBD: Handle CID packages */
if (ACPI_STRNCMP (cid.buffer, info->hid, sizeof (cid.buffer)) != 0) {
return (AE_OK);
}
}
}
status = info->user_function (obj_handle, nesting_level, info->context, return_value);
return (status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_get_devices
*
* PARAMETERS: HID - HID to search for. Can be NULL.
* User_function - Called when a matching object is found
* Context - Passed to user function
* Return_value - Location where return value of
* User_function is put if terminated early
*
* RETURNS Return value from the User_function if terminated early.
* Otherwise, returns NULL.
*
* DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
* starting (and ending) at the object specified by Start_handle.
* The User_function is called whenever an object that matches
* the type parameter is found. If the user function returns
* a non-zero value, the search is terminated immediately and this
* value is returned to the caller.
*
* This is a wrapper for Walk_namespace, but the callback performs
* additional filtering. Please see Acpi_get_device_callback.
* *
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_get_devices ( acpi_get_next_object (
NATIVE_CHAR *HID, acpi_object_type type,
acpi_walk_callback user_function, acpi_handle parent,
void *context, acpi_handle child,
void **return_value) acpi_handle *ret_handle)
{ {
acpi_status status; acpi_status status;
acpi_get_devices_info info;
ACPI_FUNCTION_TRACE ("Acpi_get_devices");
/* Parameter validation */
if (!user_function) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/*
* We're going to call their callback from OUR callback, so we need
* to know what it is, and their context parameter.
*/
info.context = context;
info.user_function = user_function;
info.hid = HID;
/*
* Lock the namespace around the walk.
* The namespace will be unlocked/locked around each call
* to the user function - since this function
* must be allowed to make Acpi calls itself.
*/
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE,
ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
ACPI_NS_WALK_UNLOCK,
acpi_ns_get_device_callback, &info,
return_value);
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_attach_data
*
* PARAMETERS:
*
* RETURN: Status
*
* DESCRIPTION:
*
******************************************************************************/
acpi_status
acpi_attach_data (
acpi_handle obj_handle,
ACPI_OBJECT_HANDLER handler,
void *data)
{
acpi_namespace_node *node; acpi_namespace_node *node;
acpi_status status; acpi_namespace_node *parent_node = NULL;
acpi_namespace_node *child_node = NULL;
/* Parameter validation */ /* Parameter validation */
if (!obj_handle || if (type > ACPI_TYPE_MAX) {
!handler ||
!data) {
return (AE_BAD_PARAMETER); return (AE_BAD_PARAMETER);
} }
...@@ -808,117 +197,43 @@ acpi_attach_data ( ...@@ -808,117 +197,43 @@ acpi_attach_data (
return (status); return (status);
} }
/* Convert and validate the handle */ /* If null handle, use the parent */
node = acpi_ns_map_handle_to_node (obj_handle);
if (!node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
}
status = acpi_ns_attach_data (node, handler, data);
unlock_and_exit:
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return (status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_detach_data
*
* PARAMETERS:
*
* RETURN: Status
*
* DESCRIPTION:
*
******************************************************************************/
acpi_status
acpi_detach_data (
acpi_handle obj_handle,
ACPI_OBJECT_HANDLER handler)
{
acpi_namespace_node *node;
acpi_status status;
/* Parameter validation */ if (!child) {
/* Start search at the beginning of the specified scope */
if (!obj_handle || parent_node = acpi_ns_map_handle_to_node (parent);
!handler) { if (!parent_node) {
return (AE_BAD_PARAMETER); status = AE_BAD_PARAMETER;
goto unlock_and_exit;
}
} }
else {
/* Non-null handle, ignore the parent */
/* Convert and validate the handle */
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); child_node = acpi_ns_map_handle_to_node (child);
if (ACPI_FAILURE (status)) { if (!child_node) {
return (status); status = AE_BAD_PARAMETER;
goto unlock_and_exit;
}
} }
/* Convert and validate the handle */ /* Internal function does the real work */
node = acpi_ns_map_handle_to_node (obj_handle); node = acpi_ns_get_next_node (type, parent_node, child_node);
if (!node) { if (!node) {
status = AE_BAD_PARAMETER; status = AE_NOT_FOUND;
goto unlock_and_exit; goto unlock_and_exit;
} }
status = acpi_ns_detach_data (node, handler); if (ret_handle) {
*ret_handle = acpi_ns_convert_entry_to_handle (node);
unlock_and_exit:
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return (status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_get_data
*
* PARAMETERS:
*
* RETURN: Status
*
* DESCRIPTION:
*
******************************************************************************/
acpi_status
acpi_get_data (
acpi_handle obj_handle,
ACPI_OBJECT_HANDLER handler,
void **data)
{
acpi_namespace_node *node;
acpi_status status;
/* Parameter validation */
if (!obj_handle ||
!handler ||
!data) {
return (AE_BAD_PARAMETER);
}
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) {
return (status);
}
/* Convert and validate the handle */
node = acpi_ns_map_handle_to_node (obj_handle);
if (!node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
} }
status = acpi_ns_get_attached_data (node, handler, data);
unlock_and_exit: unlock_and_exit:
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return (status); return (status);
} }
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: psargs - Parse AML opcode arguments * Module Name: psargs - Parse AML opcode arguments
* $Revision: 61 $ * $Revision: 62 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -332,7 +332,7 @@ acpi_ps_get_next_namepath ( ...@@ -332,7 +332,7 @@ acpi_ps_get_next_namepath (
NATIVE_CHAR *path; NATIVE_CHAR *path;
acpi_parse_object *name_op; acpi_parse_object *name_op;
acpi_status status; acpi_status status;
acpi_namespace_node *method_node = NULL; acpi_operand_object *method_desc;
acpi_namespace_node *node; acpi_namespace_node *node;
acpi_generic_state scope_info; acpi_generic_state scope_info;
...@@ -369,30 +369,36 @@ acpi_ps_get_next_namepath ( ...@@ -369,30 +369,36 @@ acpi_ps_get_next_namepath (
&node); &node);
if (ACPI_SUCCESS (status)) { if (ACPI_SUCCESS (status)) {
if (node->type == ACPI_TYPE_METHOD) { if (node->type == ACPI_TYPE_METHOD) {
method_node = node; method_desc = acpi_ns_get_attached_object (node);
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "method - %p Path=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Control Method - %p Desc %p Path=%p\n",
method_node, path)); node, method_desc, path));
name_op = acpi_ps_alloc_op (AML_INT_NAMEPATH_OP); name_op = acpi_ps_alloc_op (AML_INT_NAMEPATH_OP);
if (name_op) { if (!name_op) {
/* Change arg into a METHOD CALL and attach name to it */ return_VOID;
}
acpi_ps_init_op (arg, AML_INT_METHODCALL_OP); /* Change arg into a METHOD CALL and attach name to it */
name_op->common.value.name = path; acpi_ps_init_op (arg, AML_INT_METHODCALL_OP);
/* Point METHODCALL/NAME to the METHOD Node */ name_op->common.value.name = path;
name_op->common.node = method_node; /* Point METHODCALL/NAME to the METHOD Node */
acpi_ps_append_arg (arg, name_op);
if (!acpi_ns_get_attached_object (method_node)) { name_op->common.node = node;
return_VOID; acpi_ps_append_arg (arg, name_op);
}
*arg_count = (acpi_ns_get_attached_object (method_node))->method.param_count; if (!method_desc) {
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Control Method - %p has no attached object\n",
node));
return_VOID;
} }
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Control Method - %p Args %X\n",
node, method_desc->method.param_count));
*arg_count = method_desc->method.param_count;
return_VOID; return_VOID;
} }
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: psopcode - Parser/Interpreter opcode information table * Module Name: psopcode - Parser/Interpreter opcode information table
* $Revision: 70 $ * $Revision: 71 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -734,7 +734,7 @@ NATIVE_CHAR * ...@@ -734,7 +734,7 @@ NATIVE_CHAR *
acpi_ps_get_opcode_name ( acpi_ps_get_opcode_name (
u16 opcode) u16 opcode)
{ {
#ifdef ACPI_DEBUG #ifdef ACPI_DISASSEMBLER
const acpi_opcode_info *op; const acpi_opcode_info *op;
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: psparse - Parser top level AML parse routines * Module Name: psparse - Parser top level AML parse routines
* $Revision: 128 $ * $Revision: 129 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -473,7 +473,7 @@ acpi_ps_parse_loop ( ...@@ -473,7 +473,7 @@ acpi_ps_parse_loop (
parser_state = &walk_state->parser_state; parser_state = &walk_state->parser_state;
walk_state->arg_types = 0; walk_state->arg_types = 0;
#ifndef PARSER_ONLY #if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) { if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) {
/* We are restarting a preempted control method */ /* We are restarting a preempted control method */
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: psutils - Parser miscellaneous utilities (Parser only) * Module Name: psutils - Parser miscellaneous utilities (Parser only)
* $Revision: 52 $ * $Revision: 53 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -186,7 +186,7 @@ acpi_ps_free_op ( ...@@ -186,7 +186,7 @@ acpi_ps_free_op (
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", op)); ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", op));
} }
if (op->common.flags == ACPI_PARSEOP_GENERIC) { if (op->common.flags & ACPI_PARSEOP_GENERIC) {
acpi_ut_release_to_cache (ACPI_MEM_LIST_PSNODE, op); acpi_ut_release_to_cache (ACPI_MEM_LIST_PSNODE, op);
} }
else { else {
......
/* /*
* pci_irq.c - ACPI PCI Interrupt Routing ($Revision: 10 $) * pci_irq.c - ACPI PCI Interrupt Routing ($Revision: 11 $)
* *
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......
/* /*
* pci_link.c - ACPI PCI Interrupt Link Device Driver ($Revision: 33 $) * pci_link.c - ACPI PCI Interrupt Link Device Driver ($Revision: 34 $)
* *
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
...@@ -54,13 +54,13 @@ static int acpi_pci_link_add (struct acpi_device *device); ...@@ -54,13 +54,13 @@ static int acpi_pci_link_add (struct acpi_device *device);
static int acpi_pci_link_remove (struct acpi_device *device, int type); static int acpi_pci_link_remove (struct acpi_device *device, int type);
static struct acpi_driver acpi_pci_link_driver = { static struct acpi_driver acpi_pci_link_driver = {
name: ACPI_PCI_LINK_DRIVER_NAME, .name = ACPI_PCI_LINK_DRIVER_NAME,
class: ACPI_PCI_LINK_CLASS, .class = ACPI_PCI_LINK_CLASS,
ids: ACPI_PCI_LINK_HID, .ids = ACPI_PCI_LINK_HID,
ops: { .ops = {
add: acpi_pci_link_add, .add = acpi_pci_link_add,
remove: acpi_pci_link_remove, .remove = acpi_pci_link_remove,
}, },
}; };
struct acpi_pci_link_irq { struct acpi_pci_link_irq {
......
/* /*
* pci_root.c - ACPI PCI Root Bridge Driver ($Revision: 39 $) * pci_root.c - ACPI PCI Root Bridge Driver ($Revision: 40 $)
* *
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
...@@ -47,13 +47,13 @@ static int acpi_pci_root_add (struct acpi_device *device); ...@@ -47,13 +47,13 @@ static int acpi_pci_root_add (struct acpi_device *device);
static int acpi_pci_root_remove (struct acpi_device *device, int type); static int acpi_pci_root_remove (struct acpi_device *device, int type);
static struct acpi_driver acpi_pci_root_driver = { static struct acpi_driver acpi_pci_root_driver = {
name: ACPI_PCI_ROOT_DRIVER_NAME, .name = ACPI_PCI_ROOT_DRIVER_NAME,
class: ACPI_PCI_ROOT_CLASS, .class = ACPI_PCI_ROOT_CLASS,
ids: ACPI_PCI_ROOT_HID, .ids = ACPI_PCI_ROOT_HID,
ops: { .ops = {
add: acpi_pci_root_add, .add = acpi_pci_root_add,
remove: acpi_pci_root_remove, .remove = acpi_pci_root_remove,
}, },
}; };
struct acpi_pci_root { struct acpi_pci_root {
......
/* /*
* acpi_power.c - ACPI Bus Power Management ($Revision: 38 $) * acpi_power.c - ACPI Bus Power Management ($Revision: 39 $)
* *
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
...@@ -43,13 +43,13 @@ int acpi_power_add (struct acpi_device *device); ...@@ -43,13 +43,13 @@ int acpi_power_add (struct acpi_device *device);
int acpi_power_remove (struct acpi_device *device, int type); int acpi_power_remove (struct acpi_device *device, int type);
static struct acpi_driver acpi_power_driver = { static struct acpi_driver acpi_power_driver = {
name: ACPI_POWER_DRIVER_NAME, .name = ACPI_POWER_DRIVER_NAME,
class: ACPI_POWER_CLASS, .class = ACPI_POWER_CLASS,
ids: ACPI_POWER_HID, .ids = ACPI_POWER_HID,
ops: { .ops = {
add: acpi_power_add, .add = acpi_power_add,
remove: acpi_power_remove, .remove = acpi_power_remove,
}, },
}; };
struct acpi_power_resource struct acpi_power_resource
......
/* /*
* acpi_processor.c - ACPI Processor Driver ($Revision: 69 $) * acpi_processor.c - ACPI Processor Driver ($Revision: 71 $)
* *
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
...@@ -78,13 +78,13 @@ static int acpi_processor_add (struct acpi_device *device); ...@@ -78,13 +78,13 @@ static int acpi_processor_add (struct acpi_device *device);
static int acpi_processor_remove (struct acpi_device *device, int type); static int acpi_processor_remove (struct acpi_device *device, int type);
static struct acpi_driver acpi_processor_driver = { static struct acpi_driver acpi_processor_driver = {
name: ACPI_PROCESSOR_DRIVER_NAME, .name = ACPI_PROCESSOR_DRIVER_NAME,
class: ACPI_PROCESSOR_CLASS, .class = ACPI_PROCESSOR_CLASS,
ids: ACPI_PROCESSOR_HID, .ids = ACPI_PROCESSOR_HID,
ops: { .ops = {
add: acpi_processor_add, .add = acpi_processor_add,
remove: acpi_processor_remove, .remove = acpi_processor_remove,
}, },
}; };
/* Power Management */ /* Power Management */
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: rsio - IO and DMA resource descriptors * Module Name: rsio - IO and DMA resource descriptors
* $Revision: 21 $ * $Revision: 22 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -399,7 +399,7 @@ acpi_rs_dma_resource ( ...@@ -399,7 +399,7 @@ acpi_rs_dma_resource (
buffer += 1; buffer += 1;
temp8 = *buffer; temp8 = *buffer;
/* Decode the IRQ bits */ /* Decode the DMA channel bits */
for (i = 0, index = 0; index < 8; index++) { for (i = 0, index = 0; index < 8; index++) {
if ((temp8 >> index) & 0x01) { if ((temp8 >> index) & 0x01) {
...@@ -407,19 +407,16 @@ acpi_rs_dma_resource ( ...@@ -407,19 +407,16 @@ acpi_rs_dma_resource (
i++; i++;
} }
} }
if (i == 0) {
/* Zero channels is invalid! */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Found Zero DMA channels in resource list\n"));
return_ACPI_STATUS (AE_BAD_DATA);
}
output_struct->data.dma.number_of_channels = i;
/* Zero DMA channels is valid */
/* output_struct->data.dma.number_of_channels = i;
* Calculate the structure size based upon the number of interrupts if (i > 0) {
*/ /*
struct_size += ((ACPI_SIZE) output_struct->data.dma.number_of_channels - 1) * 4; * Calculate the structure size based upon the number of interrupts
*/
struct_size += ((ACPI_SIZE) i - 1) * 4;
}
/* /*
* Point to Byte 2 * Point to Byte 2
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: rsirq - IRQ resource descriptors * Module Name: rsirq - IRQ resource descriptors
* $Revision: 29 $ * $Revision: 30 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -96,18 +96,15 @@ acpi_rs_irq_resource ( ...@@ -96,18 +96,15 @@ acpi_rs_irq_resource (
} }
} }
if (i == 0) { /* Zero interrupts is valid */
/* Zero interrupts is invalid! */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Found Zero interrupt levels in resource list\n"));
return_ACPI_STATUS (AE_BAD_DATA);
}
output_struct->data.irq.number_of_interrupts = i; output_struct->data.irq.number_of_interrupts = i;
if (i > 0) {
/* /*
* Calculate the structure size based upon the number of interrupts * Calculate the structure size based upon the number of interrupts
*/ */
struct_size += ((ACPI_SIZE) output_struct->data.irq.number_of_interrupts - 1) * 4; struct_size += ((ACPI_SIZE) i - 1) * 4;
}
/* /*
* Point to Byte 3 if it is used * Point to Byte 3 if it is used
......
/* /*
* acpi_system.c - ACPI System Driver ($Revision: 60 $) * acpi_system.c - ACPI System Driver ($Revision: 63 $)
* *
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
...@@ -63,13 +63,13 @@ static int acpi_system_add (struct acpi_device *device); ...@@ -63,13 +63,13 @@ static int acpi_system_add (struct acpi_device *device);
static int acpi_system_remove (struct acpi_device *device, int type); static int acpi_system_remove (struct acpi_device *device, int type);
static struct acpi_driver acpi_system_driver = { static struct acpi_driver acpi_system_driver = {
name: ACPI_SYSTEM_DRIVER_NAME, .name = ACPI_SYSTEM_DRIVER_NAME,
class: ACPI_SYSTEM_CLASS, .class = ACPI_SYSTEM_CLASS,
ids: ACPI_SYSTEM_HID, .ids = ACPI_SYSTEM_HID,
ops: { .ops = {
add: acpi_system_add, .add = acpi_system_add,
remove: acpi_system_remove .remove = acpi_system_remove
}, },
}; };
struct acpi_system struct acpi_system
...@@ -383,10 +383,10 @@ static unsigned int acpi_system_poll_event(struct file *file, poll_table *wait); ...@@ -383,10 +383,10 @@ static unsigned int acpi_system_poll_event(struct file *file, poll_table *wait);
static struct file_operations acpi_system_event_ops = { static struct file_operations acpi_system_event_ops = {
open: acpi_system_open_event, .open = acpi_system_open_event,
read: acpi_system_read_event, .read = acpi_system_read_event,
release: acpi_system_close_event, .release = acpi_system_close_event,
poll: acpi_system_poll_event, .poll = acpi_system_poll_event,
}; };
static int static int
...@@ -479,7 +479,7 @@ acpi_system_poll_event( ...@@ -479,7 +479,7 @@ acpi_system_poll_event(
static ssize_t acpi_system_read_dsdt (struct file*, char*, size_t, loff_t*); static ssize_t acpi_system_read_dsdt (struct file*, char*, size_t, loff_t*);
static struct file_operations acpi_system_dsdt_ops = { static struct file_operations acpi_system_dsdt_ops = {
read: acpi_system_read_dsdt, .read = acpi_system_read_dsdt,
}; };
static ssize_t static ssize_t
...@@ -522,7 +522,7 @@ acpi_system_read_dsdt ( ...@@ -522,7 +522,7 @@ acpi_system_read_dsdt (
static ssize_t acpi_system_read_fadt (struct file*, char*, size_t, loff_t*); static ssize_t acpi_system_read_fadt (struct file*, char*, size_t, loff_t*);
static struct file_operations acpi_system_fadt_ops = { static struct file_operations acpi_system_fadt_ops = {
read: acpi_system_read_fadt, .read = acpi_system_read_fadt,
}; };
static ssize_t static ssize_t
...@@ -1165,15 +1165,15 @@ acpi_system_remove_fs ( ...@@ -1165,15 +1165,15 @@ acpi_system_remove_fs (
/* Simple wrapper calling power down function. */ /* Simple wrapper calling power down function. */
static void acpi_sysrq_power_off(int key, struct pt_regs *pt_regs, static void acpi_sysrq_power_off(int key, struct pt_regs *pt_regs,
struct tty_struct *tty) struct tty_struct *tty)
{ {
acpi_power_off(); acpi_power_off();
} }
struct sysrq_key_op sysrq_acpi_poweroff_op = { struct sysrq_key_op sysrq_acpi_poweroff_op = {
handler: &acpi_sysrq_power_off, .handler = &acpi_sysrq_power_off,
help_msg: "Off", .help_msg = "Off",
action_msg: "Power Off\n" .action_msg = "Power Off\n"
}; };
#endif /* CONFIG_MAGIC_SYSRQ */ #endif /* CONFIG_MAGIC_SYSRQ */
......
...@@ -330,6 +330,11 @@ acpi_table_get_sdt ( ...@@ -330,6 +330,11 @@ acpi_table_get_sdt (
return -ENODEV; return -ENODEV;
} }
if (acpi_table_compute_checksum(header, header->length)) {
printk(KERN_WARNING PREFIX "Invalid XSDT checksum\n");
return -ENODEV;
}
sdt.count = (header->length - sizeof(struct acpi_table_header)) >> 3; sdt.count = (header->length - sizeof(struct acpi_table_header)) >> 3;
if (sdt.count > ACPI_MAX_TABLES) { if (sdt.count > ACPI_MAX_TABLES) {
printk(KERN_WARNING PREFIX "Truncated %lu XSDT entries\n", printk(KERN_WARNING PREFIX "Truncated %lu XSDT entries\n",
...@@ -370,6 +375,11 @@ acpi_table_get_sdt ( ...@@ -370,6 +375,11 @@ acpi_table_get_sdt (
return -ENODEV; return -ENODEV;
} }
if (acpi_table_compute_checksum(header, header->length)) {
printk(KERN_WARNING PREFIX "Invalid RSDT checksum\n");
return -ENODEV;
}
sdt.count = (header->length - sizeof(struct acpi_table_header)) >> 2; sdt.count = (header->length - sizeof(struct acpi_table_header)) >> 2;
if (sdt.count > ACPI_MAX_TABLES) { if (sdt.count > ACPI_MAX_TABLES) {
printk(KERN_WARNING PREFIX "Truncated %lu RSDT entries\n", printk(KERN_WARNING PREFIX "Truncated %lu RSDT entries\n",
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: tbrsdt - ACPI RSDT table utilities * Module Name: tbrsdt - ACPI RSDT table utilities
* $Revision: 1 $ * $Revision: 2 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -271,12 +271,6 @@ acpi_tb_get_table_rsdt ( ...@@ -271,12 +271,6 @@ acpi_tb_get_table_rsdt (
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
/*
* Valid RSDT signature, verify the checksum. If it fails, just
* print a warning and ignore it.
*/
status = acpi_tb_verify_table_checksum (table_info.pointer);
/* Get the number of tables defined in the RSDT or XSDT */ /* Get the number of tables defined in the RSDT or XSDT */
acpi_gbl_rsdt_table_count = acpi_tb_get_table_count (acpi_gbl_RSDP, table_info.pointer); acpi_gbl_rsdt_table_count = acpi_tb_get_table_count (acpi_gbl_RSDP, table_info.pointer);
......
/* /*
* acpi_thermal.c - ACPI Thermal Zone Driver ($Revision: 40 $) * acpi_thermal.c - ACPI Thermal Zone Driver ($Revision: 41 $)
* *
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
...@@ -65,13 +65,13 @@ static int acpi_thermal_add (struct acpi_device *device); ...@@ -65,13 +65,13 @@ static int acpi_thermal_add (struct acpi_device *device);
static int acpi_thermal_remove (struct acpi_device *device, int type); static int acpi_thermal_remove (struct acpi_device *device, int type);
static struct acpi_driver acpi_thermal_driver = { static struct acpi_driver acpi_thermal_driver = {
name: ACPI_THERMAL_DRIVER_NAME, .name = ACPI_THERMAL_DRIVER_NAME,
class: ACPI_THERMAL_CLASS, .class = ACPI_THERMAL_CLASS,
ids: ACPI_THERMAL_HID, .ids = ACPI_THERMAL_HID,
ops: { .ops = {
add: acpi_thermal_add, .add = acpi_thermal_add,
remove: acpi_thermal_remove, .remove = acpi_thermal_remove,
}, },
}; };
struct acpi_thermal_state { struct acpi_thermal_state {
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: utglobal - Global variables for the ACPI subsystem * Module Name: utglobal - Global variables for the ACPI subsystem
* $Revision: 164 $ * $Revision: 165 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "acpi.h" #include "acpi.h"
#include "acnamesp.h" #include "acnamesp.h"
#include "amlcode.h"
#define _COMPONENT ACPI_UTILITIES #define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utglobal") ACPI_MODULE_NAME ("utglobal")
...@@ -357,15 +358,15 @@ acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = ...@@ -357,15 +358,15 @@ acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] =
/* Region type decoding */ /* Region type decoding */
static const NATIVE_CHAR *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = const NATIVE_CHAR *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] =
{ {
"System_memory", "System_memory",
"System_iO", "System_iO",
"PCIConfig", "PCI_Config",
"Embedded_control", "Embedded_control",
"SMBus", "SMBus",
"CMOS", "CMOS",
"PCIBar_target", "PCIBARTarget",
"Data_table", "Data_table",
}; };
...@@ -555,55 +556,6 @@ acpi_ut_get_mutex_name ( ...@@ -555,55 +556,6 @@ acpi_ut_get_mutex_name (
} }
/* Various strings for future use */
#if 0
#include "amlcode.h"
/* Data used in keeping track of fields */
static const NATIVE_CHAR *acpi_gbl_FEnames[NUM_FIELD_NAMES] =
{
"skip",
"?access?"
}; /* FE = Field Element */
static const NATIVE_CHAR *acpi_gbl_match_ops[NUM_MATCH_OPS] =
{
"Error",
"MTR",
"MEQ",
"MLE",
"MLT",
"MGE",
"MGT"
};
/* Access type decoding */
static const NATIVE_CHAR *acpi_gbl_access_types[NUM_ACCESS_TYPES] =
{
"Any_acc",
"Byte_acc",
"Word_acc",
"DWord_acc",
"QWord_acc",
"Buffer_acc",
};
/* Update rule decoding */
static const NATIVE_CHAR *acpi_gbl_update_rules[NUM_UPDATE_RULES] =
{
"Preserve",
"Write_as_ones",
"Write_as_zeros"
};
#endif /* Future use */
#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