Commit 6050790e authored by Andy Grover's avatar Andy Grover
Browse files

Interpreter update

parent fe65ee28
/*******************************************************************************
*
* Module Name: dbcmds - debug commands and output routines
* $Revision: 84 $
* $Revision: 85 $
*
******************************************************************************/
......@@ -31,6 +31,7 @@
#include "acevents.h"
#include "acdebug.h"
#include "acresrc.h"
#include "acdisasm.h"
#ifdef ENABLE_DEBUGGER
......@@ -342,7 +343,7 @@ acpi_db_disassemble_aml (
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 @@
*
* Module Name: dbfileio - Debugger file I/O commands. These can't usually
* be used when running the debugger in Ring 0 (Kernel mode)
* $Revision: 64 $
* $Revision: 67 $
*
******************************************************************************/
......@@ -30,7 +30,7 @@
#include "acnamesp.h"
#include "actables.h"
#ifdef ENABLE_DEBUGGER
#if (defined ENABLE_DEBUGGER || defined ACPI_DISASSEMBLER)
#define _COMPONENT ACPI_DEBUGGER
ACPI_MODULE_NAME ("dbfileio")
......@@ -86,6 +86,7 @@ acpi_db_match_argument (
}
#ifdef ENABLE_DEBUGGER
/*******************************************************************************
*
* FUNCTION: Acpi_db_close_debug_file
......@@ -148,6 +149,7 @@ acpi_db_open_debug_file (
#endif
}
#endif
#ifdef ACPI_APPLICATION
......@@ -190,7 +192,7 @@ acpi_db_load_table(
status = acpi_tb_validate_table_header (&table_header);
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");
return (AE_ERROR);
}
......@@ -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);
if (ACPI_FAILURE (status)) {
/* Uninstall table and free the buffer */
......@@ -330,7 +332,7 @@ acpi_db_get_acpi_table (
/* 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);
fclose(fp);
......@@ -383,8 +385,8 @@ acpi_db_load_acpi_table (
return (status);
}
acpi_os_printf ("%4.4s at %p successfully installed and loaded\n",
acpi_gbl_db_table_ptr->signature, acpi_gbl_db_table_ptr);
fprintf (stderr, "Acpi table [%4.4s] successfully installed and loaded\n",
acpi_gbl_db_table_ptr->signature);
acpi_gbl_acpi_hardware_present = FALSE;
......
/*******************************************************************************
*
* Module Name: dbxface - AML Debugger external interfaces
* $Revision: 59 $
* $Revision: 61 $
*
******************************************************************************/
......@@ -27,6 +27,7 @@
#include "acpi.h"
#include "amlcode.h"
#include "acdebug.h"
#include "acdisasm.h"
#ifdef ENABLE_DEBUGGER
......@@ -164,7 +165,7 @@ acpi_db_single_step (
/* 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) ||
(op->common.aml_opcode == AML_WHILE_OP)) {
......@@ -351,7 +352,6 @@ acpi_db_initialize (void)
}
if (!acpi_gbl_db_opt_verbose) {
acpi_gbl_db_disasm_indent = " ";
acpi_gbl_db_opt_disasm = TRUE;
acpi_gbl_db_opt_stats = FALSE;
}
......
/******************************************************************************
*
* Module Name: dsobject - Dispatcher object management routines
* $Revision: 104 $
* $Revision: 105 $
*
*****************************************************************************/
......@@ -35,6 +35,7 @@
ACPI_MODULE_NAME ("dsobject")
#ifndef ACPI_NO_METHOD_EXECUTION
/*******************************************************************************
*
* FUNCTION: Acpi_ds_init_one_object
......@@ -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
......@@ -781,4 +589,202 @@ acpi_ds_create_node (
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
* $Revision: 93 $
* $Revision: 94 $
*
******************************************************************************/
......@@ -35,6 +35,7 @@
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsutils")
#ifndef ACPI_NO_METHOD_EXECUTION
/*******************************************************************************
*
......@@ -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
......@@ -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
* $Revision: 67 $
* $Revision: 69 $
*
*****************************************************************************/
......@@ -70,9 +70,11 @@ acpi_ds_init_callbacks (
break;
case 3:
#ifndef ACPI_NO_METHOD_EXECUTION
walk_state->parse_flags |= ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE;
walk_state->descending_callback = acpi_ds_exec_begin_op;
walk_state->ascending_callback = acpi_ds_exec_end_op;
#endif
break;
default:
......@@ -169,6 +171,11 @@ acpi_ds_load1_begin_op (
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
* can get it again quickly when this scope is closed
......@@ -221,6 +228,7 @@ acpi_ds_load1_end_op (
object_type = walk_state->op_info->object_type;
#ifndef ACPI_NO_METHOD_EXECUTION
if (walk_state->op_info->flags & AML_FIELD) {
if (walk_state->opcode == AML_FIELD_OP ||
walk_state->opcode == AML_BANK_FIELD_OP ||
......@@ -238,6 +246,7 @@ acpi_ds_load1_end_op (
return (status);
}
}
#endif
if (op->common.aml_opcode == AML_NAME_OP) {
/* For Name opcode, get the object type from the argument */
......@@ -430,7 +439,9 @@ acpi_ds_load2_end_op (
acpi_namespace_node *node;
acpi_parse_object *arg;
acpi_namespace_node *new_node;
#ifndef ACPI_NO_METHOD_EXECUTION
u32 i;
#endif
ACPI_FUNCTION_NAME ("Ds_load2_end_op");
......@@ -478,6 +489,7 @@ acpi_ds_load2_end_op (
}
}
/*
* Named operations are as follows:
*
......@@ -515,6 +527,8 @@ acpi_ds_load2_end_op (
arg = op->common.value.arg;
switch (walk_state->op_info->type) {
#ifndef ACPI_NO_METHOD_EXECUTION
case AML_TYPE_CREATE_FIELD:
/*
......@@ -604,7 +618,7 @@ acpi_ds_load2_end_op (
}
break;
#endif /* ACPI_NO_METHOD_EXECUTION */
case AML_TYPE_NAMED_COMPLEX:
......@@ -629,6 +643,7 @@ acpi_ds_load2_end_op (
break;
#ifndef ACPI_NO_METHOD_EXECUTION
case AML_REGION_OP:
/*
* 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 (
status = acpi_ds_create_node (walk_state, node, op);
break;
#endif /* ACPI_NO_METHOD_EXECUTION */
default:
......
/******************************************************************************
*
* Module Name: dswstate - Dispatcher parse tree walk management routines
* $Revision: 65 $
* $Revision: 67 $
*
*****************************************************************************/
......@@ -837,7 +837,7 @@ acpi_ds_create_walk_state (
/* 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);
#endif
......@@ -858,7 +858,6 @@ acpi_ds_create_walk_state (
}
#ifndef _ACPI_ASL_COMPILER
/*******************************************************************************
*
* FUNCTION: Acpi_ds_init_aml_walk
......@@ -943,7 +942,6 @@ acpi_ds_init_aml_walk (
status = acpi_ds_init_callbacks (walk_state, pass_number);
return_ACPI_STATUS (status);
}
#endif
/*******************************************************************************
......
/******************************************************************************
*
* Module Name: excreate - Named object creation
* $Revision: 92 $
* $Revision: 93 $
*
*****************************************************************************/
......@@ -36,6 +36,7 @@
ACPI_MODULE_NAME ("excreate")
#ifndef ACPI_NO_METHOD_EXECUTION
/*****************************************************************************
*
* FUNCTION: Acpi_ex_create_alias
......@@ -490,6 +491,7 @@ acpi_ex_create_power_resource (
return_ACPI_STATUS (status);
}
#endif
/*****************************************************************************
*
......
/******************************************************************************
*
* Module Name: exdump - Interpreter debug output routines
* $Revision: 156 $
* $Revision: 157 $
*
*****************************************************************************/
......@@ -575,14 +575,14 @@ acpi_ex_dump_object_descriptor (
{
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)
{
acpi_os_printf ("Ex_dump_object_descriptor: %p is not a valid ACPI object\n", obj_desc);
return;
return_VOID;
}
/* Common Fields */
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg1 - AML execution - opcodes with 1 argument
* $Revision: 140 $
* $Revision: 141 $
*
*****************************************************************************/
......@@ -804,16 +804,7 @@ acpi_ex_opcode_1A_0T_1R (
switch (operand[0]->reference.target_type) {
case ACPI_TYPE_BUFFER_FIELD:
/* Ensure that the Buffer arguments are evaluated */
temp_desc = operand[0]->reference.object;
#if 0
status = acpi_ds_get_buffer_arguments (temp_desc);
if (ACPI_FAILURE (status)) {
goto cleanup;
}
#endif
/*
* Create a new object that contains one element of the
......@@ -841,14 +832,6 @@ acpi_ex_opcode_1A_0T_1R (
case ACPI_TYPE_PACKAGE:
#if 0
/* Ensure that the Package arguments are evaluated */
status = acpi_ds_get_package_arguments (operand[0]->reference.object);
if (ACPI_FAILURE (status)) {
goto cleanup;
}
#endif
/*
* Return the referenced element of the package. We must add
* another reference to the referenced object, however.
......@@ -884,6 +867,11 @@ acpi_ex_opcode_1A_0T_1R (
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! */
acpi_ut_add_reference (return_desc);
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exutils - interpreter/scanner utilities
* $Revision: 100 $
* $Revision: 102 $
*
*****************************************************************************/
......@@ -50,6 +50,34 @@
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
......@@ -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
......@@ -263,6 +264,8 @@ acpi_ex_release_global_lock (
ACPI_REPORT_ERROR (("Could not release ACPI Global Lock\n"));
}
}
return_VOID;
}
......@@ -378,4 +381,4 @@ acpi_ex_unsigned_integer_to_string (
}
}
#endif
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
* $Revision: 105 $
* $Revision: 107 $
*
*****************************************************************************/
......@@ -54,7 +54,7 @@
/* Version string */
#define ACPI_CA_VERSION 0x20020702
#define ACPI_CA_VERSION 0x20020725
/* Version of ACPI supported */
......@@ -152,6 +152,15 @@
#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 */
#define ACPI_RSDP_CHECKSUM_LENGTH 20
......
/******************************************************************************
*
* Name: acdebug.h - ACPI/AML debugger
* $Revision: 62 $
* $Revision: 63 $
*
*****************************************************************************/
......@@ -29,7 +29,6 @@
#define ACPI_DEBUG_BUFFER_SIZE 4196
typedef struct command_info
{
NATIVE_CHAR *name; /* Command Name */
......@@ -185,47 +184,6 @@ acpi_db_walk_for_specific_objects (
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
*/
......@@ -282,6 +240,10 @@ void *
acpi_db_get_pointer (
void *target);
void
acpi_db_decode_internal_object (
acpi_operand_object *obj_desc);
/*
* 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
* $Revision: 126 $
* $Revision: 128 $
*
*****************************************************************************/
......@@ -140,8 +140,9 @@ ACPI_EXTERN u8 acpi_gbl_global_lock_present;
extern u8 acpi_gbl_shutdown;
extern u32 acpi_gbl_startup_flags;
extern const u8 acpi_gbl_decode_to8bit[8];
extern const NATIVE_CHAR *acpi_gbl_db_sleep_states[ACPI_NUM_SLEEP_STATES];
extern const NATIVE_CHAR *acpi_gbl_db_sleep_states[ACPI_NUM_SLEEP_STATES];
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;
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
......@@ -247,9 +254,7 @@ ACPI_EXTERN int optind;
ACPI_EXTERN NATIVE_CHAR *optarg;
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_verbose;
ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods;
......@@ -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 NATIVE_CHAR *acpi_gbl_db_buffer;
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_console_debug_level;
ACPI_EXTERN acpi_table_header *acpi_gbl_db_table_ptr;
......
/******************************************************************************
*
* Name: aclocal.h - Internal data types used across the ACPI subsystem
* $Revision: 168 $
* $Revision: 172 $
*
*****************************************************************************/
......@@ -567,8 +567,8 @@ acpi_status (*ACPI_EXECUTE_OP) (
*/
typedef struct acpi_opcode_info
{
#ifdef _OPCODE_NAMES
NATIVE_CHAR *name; /* Opcode name (debug only) */
#ifdef ACPI_DISASSEMBLER
NATIVE_CHAR *name; /* Opcode name (disassembler/debug only) */
#endif
u32 parse_args; /* Grammar/Parse time arguments */
u32 runtime_args; /* Interpret time arguments */
......@@ -603,15 +603,23 @@ typedef union acpi_parse_val
u32 aml_offset; /* offset of declaration in AML */\
union acpi_parse_obj *parent; /* parent 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) */\
/* NON-DEBUG members below: */\
acpi_namespace_node *node; /* for use by interpreter */\
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
{
......@@ -626,6 +634,7 @@ typedef struct acpi_parseobj_common
typedef struct acpi_parseobj_named
{
ACPI_PARSE_COMMON
u8 *path;
u8 *data; /* AML body or bytelist data */
u32 length; /* AML length */
u32 name; /* 4-byte name or zero if no name */
......@@ -653,15 +662,15 @@ typedef struct acpi_parseobj_asl
u32 logical_byte_offset;
u32 end_line;
u32 end_logical_line;
u16 parse_opcode;
u32 acpi_btype;
u32 aml_length;
u32 aml_subtree_length;
u32 final_aml_length;
u32 final_aml_offset;
u16 parse_opcode;
u16 compile_flags;
u8 aml_opcode_length;
u8 aml_pkg_len_bytes;
u16 compile_flags;
u8 extra;
char parse_op_name[12];
......@@ -705,6 +714,13 @@ typedef struct acpi_parse_state
#define ACPI_PARSEOP_BYTELIST 0x08
#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.
* $Revision: 124 $
* $Revision: 125 $
*
*****************************************************************************/
......@@ -287,10 +287,12 @@
/*
* 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_DISASM_ONLY_MEMBERS(a) a;
#else
#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
#define ARG_TYPE_WIDTH 5
......@@ -435,7 +437,6 @@
#define ACPI_DEBUG_DEFINE(a) a;
#define ACPI_DEBUG_ONLY_MEMBERS(a) a;
#define _OPCODE_NAMES
#define _VERBOSE_STRUCTURES
......@@ -515,10 +516,6 @@
#define return_VALUE(s) return(s)
#define return_PTR(s) return(s)
#ifdef ENABLE_DEBUGGER
#define _OPCODE_NAMES
#endif
#endif
/*
......
/******************************************************************************
*
* Name: acnamesp.h - Namespace subcomponent prototypes and defines
* $Revision: 125 $
* $Revision: 126 $
*
*****************************************************************************/
......@@ -43,7 +43,7 @@
/* Definitions of the predefined namespace names */
#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_NS_ROOT_PATH "\\"
......
......@@ -204,7 +204,6 @@ acpi_os_read_port (
void *value,
u32 width);
acpi_status
acpi_os_write_port (
ACPI_IO_ADDRESS address,
......@@ -222,7 +221,6 @@ acpi_os_read_memory (
void *value,
u32 width);
acpi_status
acpi_os_write_memory (
ACPI_PHYSICAL_ADDRESS address,
......@@ -241,7 +239,6 @@ acpi_os_read_pci_configuration (
void *value,
u32 width);
acpi_status
acpi_os_write_pci_configuration (
acpi_pci_id *pci_id,
......@@ -259,7 +256,6 @@ acpi_os_readable (
void *pointer,
u32 length);
u8
acpi_os_writable (
void *pointer,
......@@ -288,6 +284,10 @@ acpi_os_vprintf (
const NATIVE_CHAR *format,
va_list args);
void
acpi_os_redirect_output (
void *destination);
/*
* Debug input
......
/******************************************************************************
*
* Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
* $Revision: 140 $
* $Revision: 142 $
*
*****************************************************************************/
......@@ -224,6 +224,9 @@ extern const u8 _acpi_ctype[];
#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_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 */
......
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