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

ACPI interpreter update

parent f647e3df
......@@ -2,7 +2,7 @@
*
* Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes
* $Revision: 81 $
* $Revision: 82 $
*
*****************************************************************************/
......@@ -93,7 +93,7 @@ acpi_ds_execute_arguments (
return_ACPI_STATUS (status);
}
walk_state->parse_flags = 0;
walk_state->parse_flags = ACPI_PARSE_DEFERRED_OP;
/* Pass1: Parse the entire declaration */
......
/******************************************************************************
*
* Module Name: dswload - Dispatcher namespace load callbacks
* $Revision: 70 $
* $Revision: 71 $
*
*****************************************************************************/
......@@ -109,22 +109,27 @@ acpi_ds_load1_begin_op (
acpi_status status;
acpi_object_type object_type;
NATIVE_CHAR *path;
u32 flags;
ACPI_FUNCTION_NAME ("Ds_load1_begin_op");
op = walk_state->op;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
if (op && (op->common.aml_opcode == AML_INT_NAMEDFIELD_OP)) {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
}
/* We are only interested in opcodes that have an associated name */
if (op) {
if (!(walk_state->op_info->flags & AML_NAMED)) {
#if 0
if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
(walk_state->op_info->class == AML_CLASS_CONTROL)) {
acpi_os_printf ("\n\n***EXECUTABLE OPCODE %s***\n\n", walk_state->op_info->name);
*out_op = op;
return (AE_CTRL_SKIP);
}
#endif
*out_op = op;
return (AE_OK);
}
......@@ -144,7 +149,31 @@ acpi_ds_load1_begin_op (
object_type = walk_state->op_info->object_type;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"State=%p Op=%p Type=%X\n", walk_state, op, object_type));
"State=%p Op=%p [%s] ", walk_state, op, acpi_ut_get_type_name (object_type)));
/*
* Setup the search flags.
*
* Since we are entering a name into the namespace, we do not want to
* enable the search-to-root upsearch.
*
* There are only two conditions where it is acceptable that the name
* already exists:
* 1) the Scope() operator can reopen a scoping object that was
* previously defined (Scope, Method, Device, etc.)
* 2) Whenever we are parsing a deferred opcode (Op_region, Buffer,
* Buffer_field, or Package), the name of the object is already
* in the namespace.
*/
flags = ACPI_NS_NO_UPSEARCH;
if ((walk_state->opcode != AML_SCOPE_OP) &&
(!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) {
flags |= ACPI_NS_ERROR_IF_FOUND;
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "Cannot already exist\n"));
}
else {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "Both Find or Create allowed\n"));
}
/*
* Enter the named type into the internal namespace. We enter the name
......@@ -152,12 +181,38 @@ acpi_ds_load1_begin_op (
* arguments to the opcode must be created as we go back up the parse tree later.
*/
status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH, walk_state, &(node));
ACPI_IMODE_LOAD_PASS1, flags, walk_state, &(node));
if (ACPI_FAILURE (status)) {
return (status);
}
/*
* For the scope op, we must check to make sure that the target is
* one of the opcodes that actually opens a scope
*/
if (walk_state->opcode == AML_SCOPE_OP) {
switch (node->type) {
case ACPI_TYPE_ANY: /* Scope nodes are untyped (ANY) */
case ACPI_TYPE_DEVICE:
case ACPI_TYPE_METHOD:
case ACPI_TYPE_POWER:
case ACPI_TYPE_PROCESSOR:
case ACPI_TYPE_THERMAL:
/* These are acceptable types */
break;
default:
/* All other types are an error */
ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s]\n",
acpi_ut_get_type_name (node->type), path));
return (AE_AML_OPERAND_TYPE);
}
}
if (!op) {
/* Create a new op */
......@@ -214,10 +269,10 @@ acpi_ds_load1_end_op (
ACPI_FUNCTION_NAME ("Ds_load1_end_op");
op = walk_state->op;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
/* We are only interested in opcodes that have an associated name */
if (!(walk_state->op_info->flags & (AML_NAMED | AML_FIELD))) {
......
/******************************************************************************
*
* Module Name: evevent - Fixed and General Purpose Even handling and dispatch
* $Revision: 90 $
* $Revision: 91 $
*
*****************************************************************************/
......@@ -137,6 +137,7 @@ acpi_ev_handler_initialize (
return_ACPI_STATUS (status);
}
acpi_gbl_events_initialized = TRUE;
return_ACPI_STATUS (status);
}
......
/******************************************************************************
*
* Module Name: evmisc - Miscellaneous event manager support functions
* $Revision: 56 $
* $Revision: 57 $
*
*****************************************************************************/
......@@ -547,7 +547,7 @@ acpi_ev_release_global_lock (void)
*
* RETURN: none
*
* DESCRIPTION: free memory allocated for table storage.
* DESCRIPTION: Disable events and free memory allocated for table storage.
*
******************************************************************************/
......@@ -560,39 +560,42 @@ acpi_ev_terminate (void)
ACPI_FUNCTION_TRACE ("Ev_terminate");
/*
* Disable all event-related functionality.
* In all cases, on error, print a message but obviously we don't abort.
*/
/*
* Disable all fixed events
*/
for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
status = acpi_disable_event(i, ACPI_EVENT_FIXED, 0);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Failed to disable fixed event %d.\n", i));
}
}
if (acpi_gbl_events_initialized) {
/*
* Disable all event-related functionality.
* In all cases, on error, print a message but obviously we don't abort.
*/
/*
* Disable all GPEs
*/
for (i = 0; i < acpi_gbl_gpe_number_max; i++) {
if (acpi_ev_get_gpe_number_index(i) != ACPI_GPE_INVALID) {
status = acpi_hw_disable_gpe(i);
/*
* Disable all fixed events
*/
for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
status = acpi_disable_event(i, ACPI_EVENT_FIXED, 0);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Failed to disable GPE %d.\n", i));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not disable fixed event %d\n", i));
}
}
}
/*
* Remove SCI handler
*/
status = acpi_ev_remove_sci_handler();
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unable to remove SCI handler.\n"));
/*
* Disable all GPEs
*/
for (i = 0; i < acpi_gbl_gpe_number_max; i++) {
if (acpi_ev_get_gpe_number_index(i) != ACPI_GPE_INVALID) {
status = acpi_hw_disable_gpe(i);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not disable GPE %d\n", i));
}
}
}
/*
* Remove SCI handler
*/
status = acpi_ev_remove_sci_handler();
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not remove SCI handler\n"));
}
}
/*
......@@ -601,7 +604,7 @@ acpi_ev_terminate (void)
if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) {
status = acpi_disable ();
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Acpi_disable failed.\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Acpi_disable failed\n"));
}
}
......
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
* $Revision: 109 $
* $Revision: 110 $
*
*****************************************************************************/
......@@ -54,7 +54,7 @@
/* Version string */
#define ACPI_CA_VERSION 0x20020815
#define ACPI_CA_VERSION 0x20020829
/* Version of ACPI supported */
......
/******************************************************************************
*
* Name: acglobal.h - Declarations for global variables
* $Revision: 130 $
* $Revision: 131 $
*
*****************************************************************************/
......@@ -136,6 +136,7 @@ ACPI_EXTERN u8 acpi_gbl_global_lock_acquired;
ACPI_EXTERN u8 acpi_gbl_step_to_next_call;
ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present;
ACPI_EXTERN u8 acpi_gbl_global_lock_present;
ACPI_EXTERN u8 acpi_gbl_events_initialized;
extern u8 acpi_gbl_shutdown;
extern u32 acpi_gbl_startup_flags;
......
/******************************************************************************
*
* Name: aclocal.h - Internal data types used across the ACPI subsystem
* $Revision: 175 $
* $Revision: 176 $
*
*****************************************************************************/
......@@ -667,8 +667,8 @@ typedef struct acpi_parseobj_asl
u32 aml_subtree_length;
u32 final_aml_length;
u32 final_aml_offset;
u32 compile_flags;
u16 parse_opcode;
u16 compile_flags;
u8 aml_opcode_length;
u8 aml_pkg_len_bytes;
u8 extra;
......
/******************************************************************************
*
* Module Name: acparser.h - AML Parser subcomponent prototypes and defines
* $Revision: 61 $
* $Revision: 62 $
*
*****************************************************************************/
......@@ -44,6 +44,7 @@
#define ACPI_PARSE_EXECUTE 0x0030
#define ACPI_PARSE_MODE_MASK 0x0030
#define ACPI_PARSE_DEFERRED_OP 0x0100
/* Parser external interfaces */
......
/******************************************************************************
*
* Name: actbl2.h - ACPI Specification Revision 2.0 Tables
* $Revision: 27 $
* $Revision: 28 $
*
*****************************************************************************/
......@@ -139,8 +139,8 @@ typedef struct
u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */
u16 flush_size; /* Number of flush strides that need to be read */
u16 flush_stride; /* Processor's memory cache line width, in bytes */
u8 duty_offset; /* Processors duty cycle index in processor's P_CNT reg*/
u8 duty_width; /* Processors duty cycle value bit width in P_CNT register.*/
u8 duty_offset; /* Processor's duty cycle index in processor's P_CNT reg*/
u8 duty_width; /* Processor's duty cycle value bit width in P_CNT register.*/
u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */
u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */
u8 century; /* Index to century in RTC CMOS RAM */
......
/******************************************************************************
*
* Name: aclinux.h - OS specific defines, etc.
* $Revision: 26 $
* $Revision: 27 $
*
*****************************************************************************/
......@@ -51,6 +51,7 @@
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <unistd.h>
#if defined(__ia64__) || defined(__x86_64__)
#define ACPI_MACHINE_WIDTH 64
......
/******************************************************************************
*
* Module Name: utglobal - Global variables for the ACPI subsystem
* $Revision: 168 $
* $Revision: 170 $
*
*****************************************************************************/
......@@ -166,10 +166,10 @@ const NATIVE_CHAR *acpi_gbl_db_sleep_states[ACPI_NUM_SLEEP_STATES] = {
/*
* Names built-in to the interpreter
* Predefined ACPI Names (Built-in to the Interpreter)
*
* Initial values are currently supported only for types String and Number.
* To avoid type punning, both are specified as strings in this table.
* Both are specified as strings in this table.
*
* NOTES:
* 1) _SB_ is defined to be a device to allow _SB_/_INI to be run
......@@ -177,11 +177,11 @@ const NATIVE_CHAR *acpi_gbl_db_sleep_states[ACPI_NUM_SLEEP_STATES] = {
*/
const acpi_predefined_names acpi_gbl_pre_defined_names[] =
{ {"_GPE", INTERNAL_TYPE_DEF_ANY, NULL},
{"_PR_", INTERNAL_TYPE_DEF_ANY, NULL},
{ {"_GPE", INTERNAL_TYPE_SCOPE, NULL},
{"_PR_", INTERNAL_TYPE_SCOPE, NULL},
{"_SB_", ACPI_TYPE_DEVICE, NULL},
{"_SI_", INTERNAL_TYPE_DEF_ANY, NULL},
{"_TZ_", INTERNAL_TYPE_DEF_ANY, NULL},
{"_SI_", INTERNAL_TYPE_SCOPE, NULL},
{"_TZ_", INTERNAL_TYPE_SCOPE, NULL},
{"_REV", ACPI_TYPE_INTEGER, "2"},
{"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
{"_GL_", ACPI_TYPE_MUTEX, "0"},
......@@ -195,9 +195,7 @@ const acpi_predefined_names acpi_gbl_pre_defined_names[] =
/*
* Properties of the ACPI Object Types, both internal and external.
*
* Elements of Acpi_ns_properties are bit significant
* and the table is indexed by values of acpi_object_type
* The table is indexed by values of acpi_object_type
*/
const u8 acpi_gbl_ns_properties[] =
......@@ -530,7 +528,6 @@ acpi_ut_get_object_type_name (
/*
* Strings and procedures used for debug only
*
*/
......@@ -763,6 +760,7 @@ acpi_ut_init_globals (
acpi_gbl_gpe_register_info = NULL;
acpi_gbl_gpe_number_info = NULL;
acpi_gbl_events_initialized = FALSE;
/* Namespace */
......
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