提交 44f6c012 编写于 作者: R Robert Moore 提交者: Len Brown

ACPICA 20050408 from Bob Moore

Fixed three cases in the interpreter where an "index"
argument to an ASL function was still (internally) 32
bits instead of the required 64 bits.  This was the Index
argument to the Index, Mid, and Match operators.

The "strupr" function is now permanently local
(acpi_ut_strupr), since this is not a POSIX-defined
function and not present in most kernel-level C
libraries. References to the C library strupr function
have been removed from the headers.

Completed the deployment of static
functions/prototypes. All prototypes with the static
attribute have been moved from the headers to the owning
C file.

ACPICA 20050329 from Bob Moore

An error is now generated if an attempt is made to create
a Buffer Field of length zero (A CreateField with a length
operand of zero.)

The interpreter now issues a warning whenever executable
code at the module level is detected during ACPI table
load. This will give some idea of the prevalence of this
type of code.

Implemented support for references to named objects (other
than control methods) within package objects.

Enhanced package object output for the debug
object. Package objects are now completely dumped, showing
all elements.

Enhanced miscellaneous object output for the debug
object. Any object can now be written to the debug object
(for example, a device object can be written, and the type
of the object will be displayed.)

The "static" qualifier has been added to all local
functions across the core subsystem.

The number of "long" lines (> 80 chars) within the source
has been significantly reduced, by about 1/3.

Cleaned up all header files to ensure that all CA/iASL
functions are prototyped (even static functions) and the
formatting is consistent.

Two new header files have been added, acopcode.h and
acnames.h.

Removed several obsolete functions that were no longer
used.
Signed-off-by: NLen Brown <len.brown@intel.com>
上级 ebb6e1a6
...@@ -53,13 +53,20 @@ ...@@ -53,13 +53,20 @@
#define _COMPONENT ACPI_DISPATCHER #define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsfield") ACPI_MODULE_NAME ("dsfield")
/* Local prototypes */
static acpi_status
acpi_ds_get_field_names (
struct acpi_create_field_info *info,
struct acpi_walk_state *walk_state,
union acpi_parse_object *arg);
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ds_create_buffer_field * FUNCTION: acpi_ds_create_buffer_field
* *
* PARAMETERS: Opcode - The opcode to be executed * PARAMETERS: Op - Current parse op (create_xXField)
* Operands - List of operands for the opcode
* walk_state - Current state * walk_state - Current state
* *
* RETURN: Status * RETURN: Status
...@@ -70,7 +77,7 @@ ...@@ -70,7 +77,7 @@
* create_word_field_op, * create_word_field_op,
* create_dword_field_op, * create_dword_field_op,
* create_qword_field_op, * create_qword_field_op,
* create_field_op (all of which define fields in buffers) * create_field_op (all of which define a field in a buffer)
* *
******************************************************************************/ ******************************************************************************/
...@@ -119,7 +126,8 @@ acpi_ds_create_buffer_field ( ...@@ -119,7 +126,8 @@ acpi_ds_create_buffer_field (
flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE; flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE;
} }
else { else {
flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND; flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
ACPI_NS_ERROR_IF_FOUND;
} }
/* /*
...@@ -134,16 +142,16 @@ acpi_ds_create_buffer_field ( ...@@ -134,16 +142,16 @@ acpi_ds_create_buffer_field (
} }
} }
/* We could put the returned object (Node) on the object stack for later, but /* We could put the returned object (Node) on the object stack for later,
* for now, we will put it in the "op" object that the parser uses, so we * but for now, we will put it in the "op" object that the parser uses,
* can get it again at the end of this scope * so we can get it again at the end of this scope
*/ */
op->common.node = node; op->common.node = node;
/* /*
* If there is no object attached to the node, this node was just created and * If there is no object attached to the node, this node was just created
* we need to create the field object. Otherwise, this was a lookup of an * and we need to create the field object. Otherwise, this was a lookup
* existing node and we don't want to create the field object again. * of an existing node and we don't want to create the field object again.
*/ */
obj_desc = acpi_ns_get_attached_object (node); obj_desc = acpi_ns_get_attached_object (node);
if (obj_desc) { if (obj_desc) {
...@@ -205,7 +213,7 @@ acpi_ds_create_buffer_field ( ...@@ -205,7 +213,7 @@ acpi_ds_create_buffer_field (
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ds_get_field_names ( acpi_ds_get_field_names (
struct acpi_create_field_info *info, struct acpi_create_field_info *info,
struct acpi_walk_state *walk_state, struct acpi_walk_state *walk_state,
...@@ -238,7 +246,8 @@ acpi_ds_get_field_names ( ...@@ -238,7 +246,8 @@ acpi_ds_get_field_names (
+ (acpi_integer) arg->common.value.size; + (acpi_integer) arg->common.value.size;
if (position > ACPI_UINT32_MAX) { if (position > ACPI_UINT32_MAX) {
ACPI_REPORT_ERROR (("Bit offset within field too large (> 0xFFFFFFFF)\n")); ACPI_REPORT_ERROR ((
"Bit offset within field too large (> 0xFFFFFFFF)\n"));
return_ACPI_STATUS (AE_SUPPORT); return_ACPI_STATUS (AE_SUPPORT);
} }
...@@ -250,12 +259,15 @@ acpi_ds_get_field_names ( ...@@ -250,12 +259,15 @@ acpi_ds_get_field_names (
/* /*
* Get a new access_type and access_attribute -- to be used for all * Get a new access_type and access_attribute -- to be used for all
* field units that follow, until field end or another access_as keyword. * field units that follow, until field end or another access_as
* keyword.
* *
* In field_flags, preserve the flag bits other than the ACCESS_TYPE bits * In field_flags, preserve the flag bits other than the
* ACCESS_TYPE bits
*/ */
info->field_flags = (u8) ((info->field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) | info->field_flags = (u8)
((u8) ((u32) arg->common.value.integer >> 8))); ((info->field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
((u8) ((u32) arg->common.value.integer >> 8)));
info->attribute = (u8) (arg->common.value.integer); info->attribute = (u8) (arg->common.value.integer);
break; break;
...@@ -267,7 +279,8 @@ acpi_ds_get_field_names ( ...@@ -267,7 +279,8 @@ acpi_ds_get_field_names (
status = acpi_ns_lookup (walk_state->scope_info, status = acpi_ns_lookup (walk_state->scope_info,
(char *) &arg->named.name, (char *) &arg->named.name,
info->field_type, ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, info->field_type, ACPI_IMODE_EXECUTE,
ACPI_NS_DONT_OPEN_SCOPE,
walk_state, &info->field_node); walk_state, &info->field_node);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR ((char *) &arg->named.name, status); ACPI_REPORT_NSERROR ((char *) &arg->named.name, status);
...@@ -295,8 +308,9 @@ acpi_ds_get_field_names ( ...@@ -295,8 +308,9 @@ acpi_ds_get_field_names (
+ (acpi_integer) arg->common.value.size; + (acpi_integer) arg->common.value.size;
if (position > ACPI_UINT32_MAX) { if (position > ACPI_UINT32_MAX) {
ACPI_REPORT_ERROR (("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", ACPI_REPORT_ERROR ((
(char *) &info->field_node->name)); "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n",
(char *) &info->field_node->name));
return_ACPI_STATUS (AE_SUPPORT); return_ACPI_STATUS (AE_SUPPORT);
} }
...@@ -306,7 +320,8 @@ acpi_ds_get_field_names ( ...@@ -306,7 +320,8 @@ acpi_ds_get_field_names (
default: default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid opcode in field list: %X\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Invalid opcode in field list: %X\n",
arg->common.aml_opcode)); arg->common.aml_opcode));
return_ACPI_STATUS (AE_AML_BAD_OPCODE); return_ACPI_STATUS (AE_AML_BAD_OPCODE);
} }
...@@ -435,7 +450,8 @@ acpi_ds_init_field_objects ( ...@@ -435,7 +450,8 @@ acpi_ds_init_field_objects (
status = acpi_ns_lookup (walk_state->scope_info, status = acpi_ns_lookup (walk_state->scope_info,
(char *) &arg->named.name, (char *) &arg->named.name,
type, ACPI_IMODE_LOAD_PASS1, type, ACPI_IMODE_LOAD_PASS1,
ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND, ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
ACPI_NS_ERROR_IF_FOUND,
walk_state, &node); walk_state, &node);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR ((char *) &arg->named.name, status); ACPI_REPORT_NSERROR ((char *) &arg->named.name, status);
......
...@@ -49,12 +49,21 @@ ...@@ -49,12 +49,21 @@
#define _COMPONENT ACPI_DISPATCHER #define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsinit") ACPI_MODULE_NAME ("dsinit")
/* Local prototypes */
static acpi_status
acpi_ds_init_one_object (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value);
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ds_init_one_object * FUNCTION: acpi_ds_init_one_object
* *
* PARAMETERS: obj_handle - Node * PARAMETERS: obj_handle - Node for the object
* Level - Current nesting level * Level - Current nesting level
* Context - Points to a init info struct * Context - Points to a init info struct
* return_value - Not used * return_value - Not used
...@@ -70,7 +79,7 @@ ...@@ -70,7 +79,7 @@
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ds_init_one_object ( acpi_ds_init_one_object (
acpi_handle obj_handle, acpi_handle obj_handle,
u32 level, u32 level,
...@@ -105,7 +114,8 @@ acpi_ds_init_one_object ( ...@@ -105,7 +114,8 @@ acpi_ds_init_one_object (
status = acpi_ds_initialize_region (obj_handle); status = acpi_ds_initialize_region (obj_handle);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region %p [%4.4s] - Init failure, %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Region %p [%4.4s] - Init failure, %s\n",
obj_handle, acpi_ut_get_node_name (obj_handle), obj_handle, acpi_ut_get_node_name (obj_handle),
acpi_format_exception (status))); acpi_format_exception (status)));
} }
...@@ -118,8 +128,10 @@ acpi_ds_init_one_object ( ...@@ -118,8 +128,10 @@ acpi_ds_init_one_object (
info->method_count++; info->method_count++;
/* Print a dot for each method unless we are going to print the entire pathname */ /*
* Print a dot for each method unless we are going to print
* the entire pathname
*/
if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, ".")); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
} }
...@@ -140,7 +152,8 @@ acpi_ds_init_one_object ( ...@@ -140,7 +152,8 @@ acpi_ds_init_one_object (
*/ */
status = acpi_ds_parse_method (obj_handle); status = acpi_ds_parse_method (obj_handle);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] - parse failure, %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Method %p [%4.4s] - parse failure, %s\n",
obj_handle, acpi_ut_get_node_name (obj_handle), obj_handle, acpi_ut_get_node_name (obj_handle),
acpi_format_exception (status))); acpi_format_exception (status)));
...@@ -154,7 +167,8 @@ acpi_ds_init_one_object ( ...@@ -154,7 +167,8 @@ acpi_ds_init_one_object (
* for every execution since there isn't much overhead * for every execution since there isn't much overhead
*/ */
acpi_ns_delete_namespace_subtree (obj_handle); acpi_ns_delete_namespace_subtree (obj_handle);
acpi_ns_delete_namespace_by_owner (((struct acpi_namespace_node *) obj_handle)->object->method.owning_id); acpi_ns_delete_namespace_by_owner (
((struct acpi_namespace_node *) obj_handle)->object->method.owning_id);
break; break;
......
...@@ -153,12 +153,11 @@ acpi_ds_parse_method ( ...@@ -153,12 +153,11 @@ acpi_ds_parse_method (
/* /*
* Parse the method, first pass * Parse the method, first pass
* *
* The first pass load is where newly declared named objects are * The first pass load is where newly declared named objects are added into
* added into the namespace. Actual evaluation of * the namespace. Actual evaluation of the named objects (what would be
* the named objects (what would be called a "second * called a "second pass") happens during the actual execution of the
* pass") happens during the actual execution of the * method so that operands to the named objects can take on dynamic
* method so that operands to the named objects can * run-time values.
* take on dynamic run-time values.
*/ */
status = acpi_ps_parse_aml (walk_state); status = acpi_ps_parse_aml (walk_state);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
......
...@@ -52,6 +52,29 @@ ...@@ -52,6 +52,29 @@
#define _COMPONENT ACPI_DISPATCHER #define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsmthdat") ACPI_MODULE_NAME ("dsmthdat")
/* Local prototypes */
static void
acpi_ds_method_data_delete_value (
u16 opcode,
u32 index,
struct acpi_walk_state *walk_state);
static acpi_status
acpi_ds_method_data_set_value (
u16 opcode,
u32 index,
union acpi_operand_object *object,
struct acpi_walk_state *walk_state);
#ifdef ACPI_OBSOLETE_FUNCTIONS
acpi_object_type
acpi_ds_method_data_get_type (
u16 opcode,
u32 index,
struct acpi_walk_state *walk_state);
#endif
/******************************************************************************* /*******************************************************************************
* *
...@@ -62,8 +85,8 @@ ...@@ -62,8 +85,8 @@
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Initialize the data structures that hold the method's arguments * DESCRIPTION: Initialize the data structures that hold the method's arguments
* and locals. The data struct is an array of NTEs for each. * and locals. The data struct is an array of namespace nodes for
* This allows ref_of and de_ref_of to work properly for these * each - this allows ref_of and de_ref_of to work properly for these
* special data types. * special data types.
* *
* NOTES: walk_state fields are initialized to zero by the * NOTES: walk_state fields are initialized to zero by the
...@@ -92,7 +115,8 @@ acpi_ds_method_data_init ( ...@@ -92,7 +115,8 @@ acpi_ds_method_data_init (
walk_state->arguments[i].name.integer |= (i << 24); walk_state->arguments[i].name.integer |= (i << 24);
walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED; walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED;
walk_state->arguments[i].type = ACPI_TYPE_ANY; walk_state->arguments[i].type = ACPI_TYPE_ANY;
walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG; walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST |
ANOBJ_METHOD_ARG;
} }
/* Init the method locals */ /* Init the method locals */
...@@ -104,7 +128,8 @@ acpi_ds_method_data_init ( ...@@ -104,7 +128,8 @@ acpi_ds_method_data_init (
walk_state->local_variables[i].name.integer |= (i << 24); walk_state->local_variables[i].name.integer |= (i << 24);
walk_state->local_variables[i].descriptor = ACPI_DESC_TYPE_NAMED; walk_state->local_variables[i].descriptor = ACPI_DESC_TYPE_NAMED;
walk_state->local_variables[i].type = ACPI_TYPE_ANY; walk_state->local_variables[i].type = ACPI_TYPE_ANY;
walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL; walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST |
ANOBJ_METHOD_LOCAL;
} }
return_VOID; return_VOID;
...@@ -198,15 +223,18 @@ acpi_ds_method_data_init_args ( ...@@ -198,15 +223,18 @@ acpi_ds_method_data_init_args (
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
/* Copy passed parameters into the new method stack frame */ /* Copy passed parameters into the new method stack frame */
while ((index < ACPI_METHOD_NUM_ARGS) && (index < max_param_count) && params[index]) { while ((index < ACPI_METHOD_NUM_ARGS) &&
(index < max_param_count) &&
params[index]) {
/* /*
* A valid parameter. * A valid parameter.
* Store the argument in the method/walk descriptor. * Store the argument in the method/walk descriptor.
* Do not copy the arg in order to implement call by reference * Do not copy the arg in order to implement call by reference
*/ */
status = acpi_ds_method_data_set_value (AML_ARG_OP, index, params[index], walk_state); status = acpi_ds_method_data_set_value (AML_ARG_OP, index,
params[index], walk_state);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -224,11 +252,13 @@ acpi_ds_method_data_init_args ( ...@@ -224,11 +252,13 @@ acpi_ds_method_data_init_args (
* FUNCTION: acpi_ds_method_data_get_node * FUNCTION: acpi_ds_method_data_get_node
* *
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
* Index - which local_var or argument whose type * Index - Which Local or Arg whose type to get
* to get
* walk_state - Current walk state object * walk_state - Current walk state object
* Node - Where the node is returned.
* *
* RETURN: Get the Node associated with a local or arg. * RETURN: Status and node
*
* DESCRIPTION: Get the Node associated with a local or arg.
* *
******************************************************************************/ ******************************************************************************/
...@@ -249,7 +279,8 @@ acpi_ds_method_data_get_node ( ...@@ -249,7 +279,8 @@ acpi_ds_method_data_get_node (
case AML_LOCAL_OP: case AML_LOCAL_OP:
if (index > ACPI_METHOD_MAX_LOCAL) { if (index > ACPI_METHOD_MAX_LOCAL) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Local index %d is invalid (max %d)\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Local index %d is invalid (max %d)\n",
index, ACPI_METHOD_MAX_LOCAL)); index, ACPI_METHOD_MAX_LOCAL));
return_ACPI_STATUS (AE_AML_INVALID_INDEX); return_ACPI_STATUS (AE_AML_INVALID_INDEX);
} }
...@@ -262,7 +293,8 @@ acpi_ds_method_data_get_node ( ...@@ -262,7 +293,8 @@ acpi_ds_method_data_get_node (
case AML_ARG_OP: case AML_ARG_OP:
if (index > ACPI_METHOD_MAX_ARG) { if (index > ACPI_METHOD_MAX_ARG) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Arg index %d is invalid (max %d)\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Arg index %d is invalid (max %d)\n",
index, ACPI_METHOD_MAX_ARG)); index, ACPI_METHOD_MAX_ARG));
return_ACPI_STATUS (AE_AML_INVALID_INDEX); return_ACPI_STATUS (AE_AML_INVALID_INDEX);
} }
...@@ -286,7 +318,7 @@ acpi_ds_method_data_get_node ( ...@@ -286,7 +318,7 @@ acpi_ds_method_data_get_node (
* FUNCTION: acpi_ds_method_data_set_value * FUNCTION: acpi_ds_method_data_set_value
* *
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
* Index - which local_var or argument to get * Index - Which Local or Arg to get
* Object - Object to be inserted into the stack entry * Object - Object to be inserted into the stack entry
* walk_state - Current walk state object * walk_state - Current walk state object
* *
...@@ -297,7 +329,7 @@ acpi_ds_method_data_get_node ( ...@@ -297,7 +329,7 @@ acpi_ds_method_data_get_node (
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ds_method_data_set_value ( acpi_ds_method_data_set_value (
u16 opcode, u16 opcode,
u32 index, u32 index,
...@@ -338,56 +370,6 @@ acpi_ds_method_data_set_value ( ...@@ -338,56 +370,6 @@ acpi_ds_method_data_set_value (
} }
/*******************************************************************************
*
* FUNCTION: acpi_ds_method_data_get_type
*
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
* Index - which local_var or argument whose type
* to get
* walk_state - Current walk state object
*
* RETURN: Data type of current value of the selected Arg or Local
*
******************************************************************************/
#ifdef ACPI_FUTURE_USAGE
acpi_object_type
acpi_ds_method_data_get_type (
u16 opcode,
u32 index,
struct acpi_walk_state *walk_state)
{
acpi_status status;
struct acpi_namespace_node *node;
union acpi_operand_object *object;
ACPI_FUNCTION_TRACE ("ds_method_data_get_type");
/* Get the namespace node for the arg/local */
status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
if (ACPI_FAILURE (status)) {
return_VALUE ((ACPI_TYPE_NOT_FOUND));
}
/* Get the object */
object = acpi_ns_get_attached_object (node);
if (!object) {
/* Uninitialized local/arg, return TYPE_ANY */
return_VALUE (ACPI_TYPE_ANY);
}
/* Get the object type */
return_VALUE (ACPI_GET_OBJECT_TYPE (object));
}
#endif /* ACPI_FUTURE_USAGE */
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ds_method_data_get_value * FUNCTION: acpi_ds_method_data_get_value
...@@ -395,13 +377,11 @@ acpi_ds_method_data_get_type ( ...@@ -395,13 +377,11 @@ acpi_ds_method_data_get_type (
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
* Index - which local_var or argument to get * Index - which local_var or argument to get
* walk_state - Current walk state object * walk_state - Current walk state object
* *dest_desc - Ptr to Descriptor into which selected Arg * dest_desc - Where Arg or Local value is returned
* or Local value should be copied
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Retrieve value of selected Arg or Local from the method frame * DESCRIPTION: Retrieve value of selected Arg or Local for this method
* at the current top of the method stack.
* Used only in acpi_ex_resolve_to_value(). * Used only in acpi_ex_resolve_to_value().
* *
******************************************************************************/ ******************************************************************************/
...@@ -467,14 +447,16 @@ acpi_ds_method_data_get_value ( ...@@ -467,14 +447,16 @@ acpi_ds_method_data_get_value (
else switch (opcode) { else switch (opcode) {
case AML_ARG_OP: case AML_ARG_OP:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Arg[%d] at node %p\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Uninitialized Arg[%d] at node %p\n",
index, node)); index, node));
return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG); return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG);
case AML_LOCAL_OP: case AML_LOCAL_OP:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Local[%d] at node %p\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Uninitialized Local[%d] at node %p\n",
index, node)); index, node));
return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL); return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
...@@ -506,12 +488,12 @@ acpi_ds_method_data_get_value ( ...@@ -506,12 +488,12 @@ acpi_ds_method_data_get_value (
* *
* RETURN: None * RETURN: None
* *
* DESCRIPTION: Delete the entry at Opcode:Index on the method stack. Inserts * DESCRIPTION: Delete the entry at Opcode:Index. Inserts
* a null into the stack slot after the object is deleted. * a null into the stack slot after the object is deleted.
* *
******************************************************************************/ ******************************************************************************/
void static void
acpi_ds_method_data_delete_value ( acpi_ds_method_data_delete_value (
u16 opcode, u16 opcode,
u32 index, u32 index,
...@@ -562,7 +544,7 @@ acpi_ds_method_data_delete_value ( ...@@ -562,7 +544,7 @@ acpi_ds_method_data_delete_value (
* FUNCTION: acpi_ds_store_object_to_local * FUNCTION: acpi_ds_store_object_to_local
* *
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
* Index - which local_var or argument to set * Index - Which Local or Arg to set
* obj_desc - Value to be stored * obj_desc - Value to be stored
* walk_state - Current walk state * walk_state - Current walk state
* *
...@@ -651,19 +633,20 @@ acpi_ds_store_object_to_local ( ...@@ -651,19 +633,20 @@ acpi_ds_store_object_to_local (
*/ */
if (opcode == AML_ARG_OP) { if (opcode == AML_ARG_OP) {
/* /*
* Make sure that the object is the correct type. This may be overkill, but * Make sure that the object is the correct type. This may be
* it is here because references were NS nodes in the past. Now they are * overkill, butit is here because references were NS nodes in
* operand objects of type Reference. * the past. Now they are operand objects of type Reference.
*/ */
if (ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) != ACPI_DESC_TYPE_OPERAND) { if (ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) != ACPI_DESC_TYPE_OPERAND) {
ACPI_REPORT_ERROR (("Invalid descriptor type while storing to method arg: [%s]\n", ACPI_REPORT_ERROR ((
acpi_ut_get_descriptor_name (current_obj_desc))); "Invalid descriptor type while storing to method arg: [%s]\n",
acpi_ut_get_descriptor_name (current_obj_desc)));
return_ACPI_STATUS (AE_AML_INTERNAL); return_ACPI_STATUS (AE_AML_INTERNAL);
} }
/* /*
* If we have a valid reference object that came from ref_of(), do the * If we have a valid reference object that came from ref_of(),
* indirect store * do the indirect store
*/ */
if ((current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) && if ((current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
(current_obj_desc->reference.opcode == AML_REF_OF_OP)) { (current_obj_desc->reference.opcode == AML_REF_OF_OP)) {
...@@ -713,3 +696,55 @@ acpi_ds_store_object_to_local ( ...@@ -713,3 +696,55 @@ acpi_ds_store_object_to_local (
} }
#ifdef ACPI_OBSOLETE_FUNCTIONS
/*******************************************************************************
*
* FUNCTION: acpi_ds_method_data_get_type
*
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
* Index - Which Local or Arg whose type to get
* walk_state - Current walk state object
*
* RETURN: Data type of current value of the selected Arg or Local
*
* DESCRIPTION: Get the type of the object stored in the Local or Arg
*
******************************************************************************/
acpi_object_type
acpi_ds_method_data_get_type (
u16 opcode,
u32 index,
struct acpi_walk_state *walk_state)
{
acpi_status status;
struct acpi_namespace_node *node;
union acpi_operand_object *object;
ACPI_FUNCTION_TRACE ("ds_method_data_get_type");
/* Get the namespace node for the arg/local */
status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
if (ACPI_FAILURE (status)) {
return_VALUE ((ACPI_TYPE_NOT_FOUND));
}
/* Get the object */
object = acpi_ns_get_attached_object (node);
if (!object) {
/* Uninitialized local/arg, return TYPE_ANY */
return_VALUE (ACPI_TYPE_ANY);
}
/* Get the object type */
return_VALUE (ACPI_GET_OBJECT_TYPE (object));
}
#endif
...@@ -52,9 +52,15 @@ ...@@ -52,9 +52,15 @@
#define _COMPONENT ACPI_DISPATCHER #define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsobject") ACPI_MODULE_NAME ("dsobject")
static acpi_status
acpi_ds_build_internal_object (
struct acpi_walk_state *walk_state,
union acpi_parse_object *op,
union acpi_operand_object **obj_desc_ptr);
#ifndef ACPI_NO_METHOD_EXECUTION #ifndef ACPI_NO_METHOD_EXECUTION
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ds_build_internal_object * FUNCTION: acpi_ds_build_internal_object
* *
...@@ -67,9 +73,9 @@ ...@@ -67,9 +73,9 @@
* DESCRIPTION: Translate a parser Op object to the equivalent namespace object * DESCRIPTION: Translate a parser Op object to the equivalent namespace object
* Simple objects are any objects other than a package object! * Simple objects are any objects other than a package object!
* *
****************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ds_build_internal_object ( acpi_ds_build_internal_object (
struct acpi_walk_state *walk_state, struct acpi_walk_state *walk_state,
union acpi_parse_object *op, union acpi_parse_object *op,
...@@ -90,9 +96,11 @@ acpi_ds_build_internal_object ( ...@@ -90,9 +96,11 @@ acpi_ds_build_internal_object (
* Otherwise, go ahead and look it up now * Otherwise, go ahead and look it up now
*/ */
if (!op->common.node) { if (!op->common.node) {
status = acpi_ns_lookup (walk_state->scope_info, op->common.value.string, status = acpi_ns_lookup (walk_state->scope_info,
op->common.value.string,
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
NULL,
(struct acpi_namespace_node **) &(op->common.node)); (struct acpi_namespace_node **) &(op->common.node));
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
...@@ -104,12 +112,14 @@ acpi_ds_build_internal_object ( ...@@ -104,12 +112,14 @@ acpi_ds_build_internal_object (
/* Create and init the internal ACPI object */ /* Create and init the internal ACPI object */
obj_desc = acpi_ut_create_internal_object ((acpi_ps_get_opcode_info (op->common.aml_opcode))->object_type); obj_desc = acpi_ut_create_internal_object (
(acpi_ps_get_opcode_info (op->common.aml_opcode))->object_type);
if (!obj_desc) { if (!obj_desc) {
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
} }
status = acpi_ds_init_object_from_op (walk_state, op, op->common.aml_opcode, &obj_desc); status = acpi_ds_init_object_from_op (walk_state, op, op->common.aml_opcode,
&obj_desc);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
acpi_ut_remove_reference (obj_desc); acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
...@@ -120,7 +130,7 @@ acpi_ds_build_internal_object ( ...@@ -120,7 +130,7 @@ acpi_ds_build_internal_object (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ds_build_internal_buffer_obj * FUNCTION: acpi_ds_build_internal_buffer_obj
* *
...@@ -134,7 +144,7 @@ acpi_ds_build_internal_object ( ...@@ -134,7 +144,7 @@ acpi_ds_build_internal_object (
* DESCRIPTION: Translate a parser Op package object to the equivalent * DESCRIPTION: Translate a parser Op package object to the equivalent
* namespace object * namespace object
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ds_build_internal_buffer_obj ( acpi_ds_build_internal_buffer_obj (
...@@ -229,7 +239,7 @@ acpi_ds_build_internal_buffer_obj ( ...@@ -229,7 +239,7 @@ acpi_ds_build_internal_buffer_obj (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ds_build_internal_package_obj * FUNCTION: acpi_ds_build_internal_package_obj
* *
...@@ -243,7 +253,7 @@ acpi_ds_build_internal_buffer_obj ( ...@@ -243,7 +253,7 @@ acpi_ds_build_internal_buffer_obj (
* DESCRIPTION: Translate a parser Op package object to the equivalent * DESCRIPTION: Translate a parser Op package object to the equivalent
* namespace object * namespace object
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ds_build_internal_package_obj ( acpi_ds_build_internal_package_obj (
...@@ -331,11 +341,12 @@ acpi_ds_build_internal_package_obj ( ...@@ -331,11 +341,12 @@ acpi_ds_build_internal_package_obj (
if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) {
/* Object (package or buffer) is already built */ /* Object (package or buffer) is already built */
obj_desc->package.elements[i] = ACPI_CAST_PTR (union acpi_operand_object, arg->common.node); obj_desc->package.elements[i] =
ACPI_CAST_PTR (union acpi_operand_object, arg->common.node);
} }
else { else {
status = acpi_ds_build_internal_object (walk_state, arg, status = acpi_ds_build_internal_object (walk_state, arg,
&obj_desc->package.elements[i]); &obj_desc->package.elements[i]);
} }
i++; i++;
...@@ -348,7 +359,7 @@ acpi_ds_build_internal_package_obj ( ...@@ -348,7 +359,7 @@ acpi_ds_build_internal_package_obj (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ds_create_node * FUNCTION: acpi_ds_create_node
* *
...@@ -360,7 +371,7 @@ acpi_ds_build_internal_package_obj ( ...@@ -360,7 +371,7 @@ acpi_ds_build_internal_package_obj (
* *
* DESCRIPTION: Create the object to be associated with a namespace node * DESCRIPTION: Create the object to be associated with a namespace node
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ds_create_node ( acpi_ds_create_node (
...@@ -392,7 +403,8 @@ acpi_ds_create_node ( ...@@ -392,7 +403,8 @@ acpi_ds_create_node (
/* Build an internal object for the argument(s) */ /* Build an internal object for the argument(s) */
status = acpi_ds_build_internal_object (walk_state, op->common.value.arg, &obj_desc); status = acpi_ds_build_internal_object (walk_state, op->common.value.arg,
&obj_desc);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -414,7 +426,7 @@ acpi_ds_create_node ( ...@@ -414,7 +426,7 @@ acpi_ds_create_node (
#endif /* ACPI_NO_METHOD_EXECUTION */ #endif /* ACPI_NO_METHOD_EXECUTION */
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ds_init_object_from_op * FUNCTION: acpi_ds_init_object_from_op
* *
...@@ -429,7 +441,7 @@ acpi_ds_create_node ( ...@@ -429,7 +441,7 @@ acpi_ds_create_node (
* associated arguments. The namespace object is a more compact * associated arguments. The namespace object is a more compact
* representation of the Op and its arguments. * representation of the Op and its arguments.
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ds_init_object_from_op ( acpi_ds_init_object_from_op (
...@@ -462,7 +474,8 @@ acpi_ds_init_object_from_op ( ...@@ -462,7 +474,8 @@ acpi_ds_init_object_from_op (
/* /*
* Defer evaluation of Buffer term_arg operand * Defer evaluation of Buffer term_arg operand
*/ */
obj_desc->buffer.node = (struct acpi_namespace_node *) walk_state->operands[0]; obj_desc->buffer.node = (struct acpi_namespace_node *)
walk_state->operands[0];
obj_desc->buffer.aml_start = op->named.data; obj_desc->buffer.aml_start = op->named.data;
obj_desc->buffer.aml_length = op->named.length; obj_desc->buffer.aml_length = op->named.length;
break; break;
...@@ -473,7 +486,8 @@ acpi_ds_init_object_from_op ( ...@@ -473,7 +486,8 @@ acpi_ds_init_object_from_op (
/* /*
* Defer evaluation of Package term_arg operand * Defer evaluation of Package term_arg operand
*/ */
obj_desc->package.node = (struct acpi_namespace_node *) walk_state->operands[0]; obj_desc->package.node = (struct acpi_namespace_node *)
walk_state->operands[0];
obj_desc->package.aml_start = op->named.data; obj_desc->package.aml_start = op->named.data;
obj_desc->package.aml_length = op->named.length; obj_desc->package.aml_length = op->named.length;
break; break;
...@@ -486,9 +500,10 @@ acpi_ds_init_object_from_op ( ...@@ -486,9 +500,10 @@ acpi_ds_init_object_from_op (
/* /*
* Resolve AML Constants here - AND ONLY HERE! * Resolve AML Constants here - AND ONLY HERE!
* All constants are integers. * All constants are integers.
* We mark the integer with a flag that indicates that it started life * We mark the integer with a flag that indicates that it started
* as a constant -- so that stores to constants will perform as expected (noop). * life as a constant -- so that stores to constants will perform
* (zero_op is used as a placeholder for optional target operands.) * as expected (noop). zero_op is used as a placeholder for optional
* target operands.
*/ */
obj_desc->common.flags = AOPOBJ_AML_CONSTANT; obj_desc->common.flags = AOPOBJ_AML_CONSTANT;
...@@ -521,7 +536,8 @@ acpi_ds_init_object_from_op ( ...@@ -521,7 +536,8 @@ acpi_ds_init_object_from_op (
default: default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown constant opcode %X\n", opcode)); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unknown constant opcode %X\n", opcode));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
break; break;
} }
...@@ -535,7 +551,8 @@ acpi_ds_init_object_from_op ( ...@@ -535,7 +551,8 @@ acpi_ds_init_object_from_op (
default: default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n", op_info->type)); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n",
op_info->type));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
break; break;
} }
...@@ -570,8 +587,10 @@ acpi_ds_init_object_from_op ( ...@@ -570,8 +587,10 @@ acpi_ds_init_object_from_op (
obj_desc->reference.offset = opcode - AML_LOCAL_OP; obj_desc->reference.offset = opcode - AML_LOCAL_OP;
#ifndef ACPI_NO_METHOD_EXECUTION #ifndef ACPI_NO_METHOD_EXECUTION
status = acpi_ds_method_data_get_node (AML_LOCAL_OP, obj_desc->reference.offset, status = acpi_ds_method_data_get_node (AML_LOCAL_OP,
walk_state, (struct acpi_namespace_node **) &obj_desc->reference.object); obj_desc->reference.offset,
walk_state,
(struct acpi_namespace_node **) &obj_desc->reference.object);
#endif #endif
break; break;
...@@ -584,8 +603,10 @@ acpi_ds_init_object_from_op ( ...@@ -584,8 +603,10 @@ acpi_ds_init_object_from_op (
obj_desc->reference.offset = opcode - AML_ARG_OP; obj_desc->reference.offset = opcode - AML_ARG_OP;
#ifndef ACPI_NO_METHOD_EXECUTION #ifndef ACPI_NO_METHOD_EXECUTION
status = acpi_ds_method_data_get_node (AML_ARG_OP, obj_desc->reference.offset, status = acpi_ds_method_data_get_node (AML_ARG_OP,
walk_state, (struct acpi_namespace_node **) &obj_desc->reference.object); obj_desc->reference.offset,
walk_state,
(struct acpi_namespace_node **) &obj_desc->reference.object);
#endif #endif
break; break;
......
...@@ -54,12 +54,31 @@ ...@@ -54,12 +54,31 @@
#define _COMPONENT ACPI_DISPATCHER #define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsopcode") ACPI_MODULE_NAME ("dsopcode")
/* Local prototypes */
/***************************************************************************** static acpi_status
acpi_ds_execute_arguments (
struct acpi_namespace_node *node,
struct acpi_namespace_node *scope_node,
u32 aml_length,
u8 *aml_start);
static acpi_status
acpi_ds_init_buffer_field (
u16 aml_opcode,
union acpi_operand_object *obj_desc,
union acpi_operand_object *buffer_desc,
union acpi_operand_object *offset_desc,
union acpi_operand_object *length_desc,
union acpi_operand_object *result_desc);
/*******************************************************************************
* *
* FUNCTION: acpi_ds_execute_arguments * FUNCTION: acpi_ds_execute_arguments
* *
* PARAMETERS: Node - Parent NS node * PARAMETERS: Node - Object NS node
* scope_node - Parent NS node
* aml_length - Length of executable AML * aml_length - Length of executable AML
* aml_start - Pointer to the AML * aml_start - Pointer to the AML
* *
...@@ -67,9 +86,9 @@ ...@@ -67,9 +86,9 @@
* *
* DESCRIPTION: Late (deferred) execution of region or field arguments * DESCRIPTION: Late (deferred) execution of region or field arguments
* *
****************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ds_execute_arguments ( acpi_ds_execute_arguments (
struct acpi_namespace_node *node, struct acpi_namespace_node *node,
struct acpi_namespace_node *scope_node, struct acpi_namespace_node *scope_node,
...@@ -162,7 +181,7 @@ acpi_ds_execute_arguments ( ...@@ -162,7 +181,7 @@ acpi_ds_execute_arguments (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ds_get_buffer_field_arguments * FUNCTION: acpi_ds_get_buffer_field_arguments
* *
...@@ -173,7 +192,7 @@ acpi_ds_execute_arguments ( ...@@ -173,7 +192,7 @@ acpi_ds_execute_arguments (
* DESCRIPTION: Get buffer_field Buffer and Index. This implements the late * DESCRIPTION: Get buffer_field Buffer and Index. This implements the late
* evaluation of these field attributes. * evaluation of these field attributes.
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ds_get_buffer_field_arguments ( acpi_ds_get_buffer_field_arguments (
...@@ -208,7 +227,7 @@ acpi_ds_get_buffer_field_arguments ( ...@@ -208,7 +227,7 @@ acpi_ds_get_buffer_field_arguments (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ds_get_buffer_arguments * FUNCTION: acpi_ds_get_buffer_arguments
* *
...@@ -219,7 +238,7 @@ acpi_ds_get_buffer_field_arguments ( ...@@ -219,7 +238,7 @@ acpi_ds_get_buffer_field_arguments (
* DESCRIPTION: Get Buffer length and initializer byte list. This implements * DESCRIPTION: Get Buffer length and initializer byte list. This implements
* the late evaluation of these attributes. * the late evaluation of these attributes.
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ds_get_buffer_arguments ( acpi_ds_get_buffer_arguments (
...@@ -255,7 +274,7 @@ acpi_ds_get_buffer_arguments ( ...@@ -255,7 +274,7 @@ acpi_ds_get_buffer_arguments (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ds_get_package_arguments * FUNCTION: acpi_ds_get_package_arguments
* *
...@@ -266,7 +285,7 @@ acpi_ds_get_buffer_arguments ( ...@@ -266,7 +285,7 @@ acpi_ds_get_buffer_arguments (
* DESCRIPTION: Get Package length and initializer byte list. This implements * DESCRIPTION: Get Package length and initializer byte list. This implements
* the late evaluation of these attributes. * the late evaluation of these attributes.
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ds_get_package_arguments ( acpi_ds_get_package_arguments (
...@@ -353,17 +372,17 @@ acpi_ds_get_region_arguments ( ...@@ -353,17 +372,17 @@ acpi_ds_get_region_arguments (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ds_initialize_region * FUNCTION: acpi_ds_initialize_region
* *
* PARAMETERS: Op - A valid region Op object * PARAMETERS: obj_handle - Region namespace node
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Front end to ev_initialize_region * DESCRIPTION: Front end to ev_initialize_region
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ds_initialize_region ( acpi_ds_initialize_region (
...@@ -382,7 +401,7 @@ acpi_ds_initialize_region ( ...@@ -382,7 +401,7 @@ acpi_ds_initialize_region (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ds_init_buffer_field * FUNCTION: acpi_ds_init_buffer_field
* *
...@@ -390,16 +409,16 @@ acpi_ds_initialize_region ( ...@@ -390,16 +409,16 @@ acpi_ds_initialize_region (
* obj_desc - buffer_field object * obj_desc - buffer_field object
* buffer_desc - Host Buffer * buffer_desc - Host Buffer
* offset_desc - Offset into buffer * offset_desc - Offset into buffer
* Length - Length of field (CREATE_FIELD_OP only) * length_desc - Length of field (CREATE_FIELD_OP only)
* Result - Where to store the result * result_desc - Where to store the result
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Perform actual initialization of a buffer field * DESCRIPTION: Perform actual initialization of a buffer field
* *
****************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ds_init_buffer_field ( acpi_ds_init_buffer_field (
u16 aml_opcode, u16 aml_opcode,
union acpi_operand_object *obj_desc, union acpi_operand_object *obj_desc,
...@@ -435,8 +454,10 @@ acpi_ds_init_buffer_field ( ...@@ -435,8 +454,10 @@ acpi_ds_init_buffer_field (
* after resolution in acpi_ex_resolve_operands(). * after resolution in acpi_ex_resolve_operands().
*/ */
if (ACPI_GET_DESCRIPTOR_TYPE (result_desc) != ACPI_DESC_TYPE_NAMED) { if (ACPI_GET_DESCRIPTOR_TYPE (result_desc) != ACPI_DESC_TYPE_NAMED) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) destination not a NS Node [%s]\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
acpi_ps_get_opcode_name (aml_opcode), acpi_ut_get_descriptor_name (result_desc))); "(%s) destination not a NS Node [%s]\n",
acpi_ps_get_opcode_name (aml_opcode),
acpi_ut_get_descriptor_name (result_desc)));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
goto cleanup; goto cleanup;
...@@ -452,9 +473,18 @@ acpi_ds_init_buffer_field ( ...@@ -452,9 +473,18 @@ acpi_ds_init_buffer_field (
/* Offset is in bits, count is in bits */ /* Offset is in bits, count is in bits */
field_flags = AML_FIELD_ACCESS_BYTE;
bit_offset = offset; bit_offset = offset;
bit_count = (u32) length_desc->integer.value; bit_count = (u32) length_desc->integer.value;
field_flags = AML_FIELD_ACCESS_BYTE;
/* Must have a valid (>0) bit count */
if (bit_count == 0) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Attempt to create_field of length 0\n"));
status = AE_AML_OPERAND_VALUE;
goto cleanup;
}
break; break;
case AML_CREATE_BIT_FIELD_OP: case AML_CREATE_BIT_FIELD_OP:
...@@ -527,7 +557,8 @@ acpi_ds_init_buffer_field ( ...@@ -527,7 +557,8 @@ acpi_ds_init_buffer_field (
/* /*
* Initialize areas of the field object that are common to all fields * Initialize areas of the field object that are common to all fields
* For field_flags, use LOCK_RULE = 0 (NO_LOCK), UPDATE_RULE = 0 (UPDATE_PRESERVE) * For field_flags, use LOCK_RULE = 0 (NO_LOCK),
* UPDATE_RULE = 0 (UPDATE_PRESERVE)
*/ */
status = acpi_ex_prep_common_field_object (obj_desc, field_flags, 0, status = acpi_ex_prep_common_field_object (obj_desc, field_flags, 0,
bit_offset, bit_count); bit_offset, bit_count);
...@@ -539,8 +570,8 @@ acpi_ds_init_buffer_field ( ...@@ -539,8 +570,8 @@ acpi_ds_init_buffer_field (
/* Reference count for buffer_desc inherits obj_desc count */ /* Reference count for buffer_desc inherits obj_desc count */
buffer_desc->common.reference_count = (u16) (buffer_desc->common.reference_count + buffer_desc->common.reference_count = (u16)
obj_desc->common.reference_count); (buffer_desc->common.reference_count + obj_desc->common.reference_count);
cleanup: cleanup:
...@@ -569,7 +600,7 @@ acpi_ds_init_buffer_field ( ...@@ -569,7 +600,7 @@ acpi_ds_init_buffer_field (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ds_eval_buffer_field_operands * FUNCTION: acpi_ds_eval_buffer_field_operands
* *
...@@ -581,7 +612,7 @@ acpi_ds_init_buffer_field ( ...@@ -581,7 +612,7 @@ acpi_ds_init_buffer_field (
* DESCRIPTION: Get buffer_field Buffer and Index * DESCRIPTION: Get buffer_field Buffer and Index
* Called from acpi_ds_exec_end_op during buffer_field parse tree walk * Called from acpi_ds_exec_end_op during buffer_field parse tree walk
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ds_eval_buffer_field_operands ( acpi_ds_eval_buffer_field_operands (
...@@ -656,7 +687,7 @@ acpi_ds_eval_buffer_field_operands ( ...@@ -656,7 +687,7 @@ acpi_ds_eval_buffer_field_operands (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ds_eval_region_operands * FUNCTION: acpi_ds_eval_region_operands
* *
...@@ -668,7 +699,7 @@ acpi_ds_eval_buffer_field_operands ( ...@@ -668,7 +699,7 @@ acpi_ds_eval_buffer_field_operands (
* DESCRIPTION: Get region address and length * DESCRIPTION: Get region address and length
* Called from acpi_ds_exec_end_op during op_region parse tree walk * Called from acpi_ds_exec_end_op during op_region parse tree walk
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ds_eval_region_operands ( acpi_ds_eval_region_operands (
...@@ -686,7 +717,8 @@ acpi_ds_eval_region_operands ( ...@@ -686,7 +717,8 @@ acpi_ds_eval_region_operands (
/* /*
* This is where we evaluate the address and length fields of the op_region declaration * This is where we evaluate the address and length fields of the
* op_region declaration
*/ */
node = op->common.node; node = op->common.node;
...@@ -707,7 +739,8 @@ acpi_ds_eval_region_operands ( ...@@ -707,7 +739,8 @@ acpi_ds_eval_region_operands (
/* Resolve the length and address operands to numbers */ /* Resolve the length and address operands to numbers */
status = acpi_ex_resolve_operands (op->common.aml_opcode, ACPI_WALK_OPERANDS, walk_state); status = acpi_ex_resolve_operands (op->common.aml_opcode,
ACPI_WALK_OPERANDS, walk_state);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -736,7 +769,8 @@ acpi_ds_eval_region_operands ( ...@@ -736,7 +769,8 @@ acpi_ds_eval_region_operands (
*/ */
operand_desc = walk_state->operands[walk_state->num_operands - 2]; operand_desc = walk_state->operands[walk_state->num_operands - 2];
obj_desc->region.address = (acpi_physical_address) operand_desc->integer.value; obj_desc->region.address = (acpi_physical_address)
operand_desc->integer.value;
acpi_ut_remove_reference (operand_desc); acpi_ut_remove_reference (operand_desc);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n",
...@@ -752,7 +786,7 @@ acpi_ds_eval_region_operands ( ...@@ -752,7 +786,7 @@ acpi_ds_eval_region_operands (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ds_eval_data_object_operands * FUNCTION: acpi_ds_eval_data_object_operands
* *
...@@ -765,7 +799,7 @@ acpi_ds_eval_region_operands ( ...@@ -765,7 +799,7 @@ acpi_ds_eval_region_operands (
* DESCRIPTION: Get the operands and complete the following data object types: * DESCRIPTION: Get the operands and complete the following data object types:
* Buffer, Package. * Buffer, Package.
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ds_eval_data_object_operands ( acpi_ds_eval_data_object_operands (
...@@ -830,7 +864,7 @@ acpi_ds_eval_data_object_operands ( ...@@ -830,7 +864,7 @@ acpi_ds_eval_data_object_operands (
if (ACPI_SUCCESS (status)) { if (ACPI_SUCCESS (status)) {
/* /*
* Return the object in the walk_state, unless the parent is a package -- * Return the object in the walk_state, unless the parent is a package -
* in this case, the return object will be stored in the parse tree * in this case, the return object will be stored in the parse tree
* for the package. * for the package.
*/ */
...@@ -988,7 +1022,8 @@ acpi_ds_exec_end_control_op ( ...@@ -988,7 +1022,8 @@ acpi_ds_exec_end_control_op (
status = AE_CTRL_PENDING; status = AE_CTRL_PENDING;
} }
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] termination! Op=%p\n", op)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"[WHILE_OP] termination! Op=%p\n",op));
/* Pop this control state and free it */ /* Pop this control state and free it */
......
...@@ -100,7 +100,6 @@ acpi_ds_clear_implicit_return ( ...@@ -100,7 +100,6 @@ acpi_ds_clear_implicit_return (
#ifndef ACPI_NO_METHOD_EXECUTION #ifndef ACPI_NO_METHOD_EXECUTION
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ds_do_implicit_return * FUNCTION: acpi_ds_do_implicit_return
...@@ -205,7 +204,7 @@ acpi_ds_is_result_used ( ...@@ -205,7 +204,7 @@ acpi_ds_is_result_used (
* NOTE: this is optional because the ASL language does not actually * NOTE: this is optional because the ASL language does not actually
* support this behavior. * support this behavior.
*/ */
acpi_ds_do_implicit_return (walk_state->result_obj, walk_state, TRUE); (void) acpi_ds_do_implicit_return (walk_state->result_obj, walk_state, TRUE);
/* /*
* Now determine if the parent will use the result * Now determine if the parent will use the result
...@@ -219,8 +218,9 @@ acpi_ds_is_result_used ( ...@@ -219,8 +218,9 @@ acpi_ds_is_result_used (
(op->common.parent->common.aml_opcode == AML_SCOPE_OP)) { (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) {
/* No parent, the return value cannot possibly be used */ /* No parent, the return value cannot possibly be used */
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "At Method level, result of [%s] not used\n", ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
acpi_ps_get_opcode_name (op->common.aml_opcode))); "At Method level, result of [%s] not used\n",
acpi_ps_get_opcode_name (op->common.aml_opcode)));
return_VALUE (FALSE); return_VALUE (FALSE);
} }
...@@ -228,7 +228,8 @@ acpi_ds_is_result_used ( ...@@ -228,7 +228,8 @@ acpi_ds_is_result_used (
parent_info = acpi_ps_get_opcode_info (op->common.parent->common.aml_opcode); parent_info = acpi_ps_get_opcode_info (op->common.parent->common.aml_opcode);
if (parent_info->class == AML_CLASS_UNKNOWN) { if (parent_info->class == AML_CLASS_UNKNOWN) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown parent opcode. Op=%p\n", op)); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unknown parent opcode. Op=%p\n", op));
return_VALUE (FALSE); return_VALUE (FALSE);
} }
...@@ -309,17 +310,19 @@ acpi_ds_is_result_used ( ...@@ -309,17 +310,19 @@ acpi_ds_is_result_used (
result_used: result_used:
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] used by Parent [%s] Op=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
acpi_ps_get_opcode_name (op->common.aml_opcode), "Result of [%s] used by Parent [%s] Op=%p\n",
acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op)); acpi_ps_get_opcode_name (op->common.aml_opcode),
acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op));
return_VALUE (TRUE); return_VALUE (TRUE);
result_not_used: result_not_used:
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] not used by Parent [%s] Op=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
acpi_ps_get_opcode_name (op->common.aml_opcode), "Result of [%s] not used by Parent [%s] Op=%p\n",
acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op)); acpi_ps_get_opcode_name (op->common.aml_opcode),
acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op));
return_VALUE (FALSE); return_VALUE (FALSE);
} }
...@@ -522,7 +525,8 @@ acpi_ds_create_operand ( ...@@ -522,7 +525,8 @@ acpi_ds_create_operand (
if ((walk_state->deferred_node) && if ((walk_state->deferred_node) &&
(walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) && (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) &&
(arg_index != 0)) { (arg_index != 0)) {
obj_desc = ACPI_CAST_PTR (union acpi_operand_object, walk_state->deferred_node); obj_desc = ACPI_CAST_PTR (
union acpi_operand_object, walk_state->deferred_node);
status = AE_OK; status = AE_OK;
} }
else /* All other opcodes */ { else /* All other opcodes */ {
...@@ -565,7 +569,8 @@ acpi_ds_create_operand ( ...@@ -565,7 +569,8 @@ acpi_ds_create_operand (
* indicate this to the interpreter, set the * indicate this to the interpreter, set the
* object to the root * object to the root
*/ */
obj_desc = ACPI_CAST_PTR (union acpi_operand_object, acpi_gbl_root_node); obj_desc = ACPI_CAST_PTR (
union acpi_operand_object, acpi_gbl_root_node);
status = AE_OK; status = AE_OK;
} }
else { else {
...@@ -612,7 +617,8 @@ acpi_ds_create_operand ( ...@@ -612,7 +617,8 @@ acpi_ds_create_operand (
*/ */
opcode = AML_ZERO_OP; /* Has no arguments! */ opcode = AML_ZERO_OP; /* Has no arguments! */
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Null namepath: Arg=%p\n", arg)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Null namepath: Arg=%p\n", arg));
} }
else { else {
opcode = arg->common.aml_opcode; opcode = arg->common.aml_opcode;
...@@ -642,7 +648,8 @@ acpi_ds_create_operand ( ...@@ -642,7 +648,8 @@ acpi_ds_create_operand (
* Only error is underflow, and this indicates * Only error is underflow, and this indicates
* a missing or null operand! * a missing or null operand!
*/ */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Missing or null operand, %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Missing or null operand, %s\n",
acpi_format_exception (status))); acpi_format_exception (status)));
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -657,8 +664,8 @@ acpi_ds_create_operand ( ...@@ -657,8 +664,8 @@ acpi_ds_create_operand (
/* Initialize the new object */ /* Initialize the new object */
status = acpi_ds_init_object_from_op (walk_state, arg, status = acpi_ds_init_object_from_op (
opcode, &obj_desc); walk_state, arg, opcode, &obj_desc);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
acpi_ut_delete_object_desc (obj_desc); acpi_ut_delete_object_desc (obj_desc);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
......
...@@ -73,11 +73,13 @@ static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = { ...@@ -73,11 +73,13 @@ static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = {
acpi_ex_opcode_3A_1T_1R, acpi_ex_opcode_3A_1T_1R,
acpi_ex_opcode_6A_0T_1R}; acpi_ex_opcode_6A_0T_1R};
/***************************************************************************** /*****************************************************************************
* *
* FUNCTION: acpi_ds_get_predicate_value * FUNCTION: acpi_ds_get_predicate_value
* *
* PARAMETERS: walk_state - Current state of the parse tree walk * PARAMETERS: walk_state - Current state of the parse tree walk
* result_obj - if non-zero, pop result from result stack
* *
* RETURN: Status * RETURN: Status
* *
...@@ -124,7 +126,8 @@ acpi_ds_get_predicate_value ( ...@@ -124,7 +126,8 @@ acpi_ds_get_predicate_value (
} }
if (!obj_desc) { if (!obj_desc) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No predicate obj_desc=%p State=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"No predicate obj_desc=%p State=%p\n",
obj_desc, walk_state)); obj_desc, walk_state));
return_ACPI_STATUS (AE_AML_NO_OPERAND); return_ACPI_STATUS (AE_AML_NO_OPERAND);
...@@ -197,7 +200,7 @@ acpi_ds_get_predicate_value ( ...@@ -197,7 +200,7 @@ acpi_ds_get_predicate_value (
* FUNCTION: acpi_ds_exec_begin_op * FUNCTION: acpi_ds_exec_begin_op
* *
* PARAMETERS: walk_state - Current state of the parse tree walk * PARAMETERS: walk_state - Current state of the parse tree walk
* out_op - Return op if a new one is created * out_op - Where to return op if a new one is created
* *
* RETURN: Status * RETURN: Status
* *
...@@ -233,7 +236,8 @@ acpi_ds_exec_begin_op ( ...@@ -233,7 +236,8 @@ acpi_ds_exec_begin_op (
walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
if (acpi_ns_opens_scope (walk_state->op_info->object_type)) { if (acpi_ns_opens_scope (walk_state->op_info->object_type)) {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"(%s) Popping scope for Op %p\n",
acpi_ut_get_type_name (walk_state->op_info->object_type), op)); acpi_ut_get_type_name (walk_state->op_info->object_type), op));
status = acpi_ds_scope_stack_pop (walk_state); status = acpi_ds_scope_stack_pop (walk_state);
...@@ -297,11 +301,10 @@ acpi_ds_exec_begin_op ( ...@@ -297,11 +301,10 @@ acpi_ds_exec_begin_op (
if (walk_state->walk_type == ACPI_WALK_METHOD) { if (walk_state->walk_type == ACPI_WALK_METHOD) {
/* /*
* Found a named object declaration during method * Found a named object declaration during method execution;
* execution; we must enter this object into the * we must enter this object into the namespace. The created
* namespace. The created object is temporary and * object is temporary and will be deleted upon completion of
* will be deleted upon completion of the execution * the execution of this method.
* of this method.
*/ */
status = acpi_ds_load2_begin_op (walk_state, NULL); status = acpi_ds_load2_begin_op (walk_state, NULL);
} }
...@@ -338,8 +341,6 @@ acpi_ds_exec_begin_op ( ...@@ -338,8 +341,6 @@ acpi_ds_exec_begin_op (
* FUNCTION: acpi_ds_exec_end_op * FUNCTION: acpi_ds_exec_end_op
* *
* PARAMETERS: walk_state - Current state of the parse tree walk * PARAMETERS: walk_state - Current state of the parse tree walk
* Op - Op that has been just been completed in the
* walk; Arguments have now been evaluated.
* *
* RETURN: Status * RETURN: Status
* *
...@@ -389,7 +390,7 @@ acpi_ds_exec_end_op ( ...@@ -389,7 +390,7 @@ acpi_ds_exec_end_op (
/* Decode the Opcode Class */ /* Decode the Opcode Class */
switch (op_class) { switch (op_class) {
case AML_CLASS_ARGUMENT: /* constants, literals, etc. -- do nothing */ case AML_CLASS_ARGUMENT: /* constants, literals, etc. - do nothing */
break; break;
...@@ -417,12 +418,12 @@ acpi_ds_exec_end_op ( ...@@ -417,12 +418,12 @@ acpi_ds_exec_end_op (
/* Resolve all operands */ /* Resolve all operands */
status = acpi_ex_resolve_operands (walk_state->opcode, status = acpi_ex_resolve_operands (walk_state->opcode,
&(walk_state->operands [walk_state->num_operands -1]), &(walk_state->operands [walk_state->num_operands -1]),
walk_state); walk_state);
if (ACPI_SUCCESS (status)) { if (ACPI_SUCCESS (status)) {
ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
acpi_ps_get_opcode_name (walk_state->opcode), acpi_ps_get_opcode_name (walk_state->opcode),
walk_state->num_operands, "after ex_resolve_operands"); walk_state->num_operands, "after ex_resolve_operands");
} }
} }
...@@ -506,7 +507,8 @@ acpi_ds_exec_end_op ( ...@@ -506,7 +507,8 @@ acpi_ds_exec_end_op (
if ((op->asl.parent) && if ((op->asl.parent) &&
((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP) || ((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP) ||
(op->asl.parent->asl.aml_opcode == AML_VAR_PACKAGE_OP))) { (op->asl.parent->asl.aml_opcode == AML_VAR_PACKAGE_OP))) {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method Reference in a Package, Op=%p\n", op)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Method Reference in a Package, Op=%p\n", op));
op->common.node = (struct acpi_namespace_node *) op->asl.value.arg->asl.node->object; op->common.node = (struct acpi_namespace_node *) op->asl.value.arg->asl.node->object;
acpi_ut_add_reference (op->asl.value.arg->asl.node->object); acpi_ut_add_reference (op->asl.value.arg->asl.node->object);
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
...@@ -583,13 +585,15 @@ acpi_ds_exec_end_op ( ...@@ -583,13 +585,15 @@ acpi_ds_exec_end_op (
case AML_NAME_OP: case AML_NAME_OP:
/* /*
* Put the Node on the object stack (Contains the ACPI Name of * Put the Node on the object stack (Contains the ACPI Name
* this object) * of this object)
*/ */
walk_state->operands[0] = (void *) op->common.parent->common.node; walk_state->operands[0] = (void *) op->common.parent->common.node;
walk_state->num_operands = 1; walk_state->num_operands = 1;
status = acpi_ds_create_node (walk_state, op->common.parent->common.node, op->common.parent); status = acpi_ds_create_node (walk_state,
op->common.parent->common.node,
op->common.parent);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
break; break;
} }
...@@ -600,7 +604,7 @@ acpi_ds_exec_end_op ( ...@@ -600,7 +604,7 @@ acpi_ds_exec_end_op (
case AML_INT_EVAL_SUBTREE_OP: case AML_INT_EVAL_SUBTREE_OP:
status = acpi_ds_eval_data_object_operands (walk_state, op, status = acpi_ds_eval_data_object_operands (walk_state, op,
acpi_ns_get_attached_object (op->common.parent->common.node)); acpi_ns_get_attached_object (op->common.parent->common.node));
break; break;
default: default:
...@@ -609,7 +613,7 @@ acpi_ds_exec_end_op ( ...@@ -609,7 +613,7 @@ acpi_ds_exec_end_op (
break; break;
} }
/* Done with this result state (Now that operand stack is built) */ /* Done with result state (Now that operand stack is built) */
status = acpi_ds_result_stack_pop (walk_state); status = acpi_ds_result_stack_pop (walk_state);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
...@@ -620,8 +624,7 @@ acpi_ds_exec_end_op ( ...@@ -620,8 +624,7 @@ acpi_ds_exec_end_op (
* If a result object was returned from above, push it on the * If a result object was returned from above, push it on the
* current result stack * current result stack
*/ */
if (ACPI_SUCCESS (status) && if (walk_state->result_obj) {
walk_state->result_obj) {
status = acpi_ds_result_push (walk_state->result_obj, walk_state); status = acpi_ds_result_push (walk_state->result_obj, walk_state);
} }
break; break;
...@@ -654,7 +657,8 @@ acpi_ds_exec_end_op ( ...@@ -654,7 +657,8 @@ acpi_ds_exec_end_op (
case AML_TYPE_UNDEFINED: case AML_TYPE_UNDEFINED:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Undefined opcode type Op=%p\n", op)); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Undefined opcode type Op=%p\n", op));
return_ACPI_STATUS (AE_NOT_IMPLEMENTED); return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
...@@ -709,13 +713,14 @@ acpi_ds_exec_end_op ( ...@@ -709,13 +713,14 @@ acpi_ds_exec_end_op (
status = acpi_gbl_exception_handler (status, status = acpi_gbl_exception_handler (status,
walk_state->method_node->name.integer, walk_state->opcode, walk_state->method_node->name.integer, walk_state->opcode,
walk_state->aml_offset, NULL); walk_state->aml_offset, NULL);
acpi_ex_enter_interpreter (); (void) acpi_ex_enter_interpreter ();
} }
if (walk_state->result_obj) { if (walk_state->result_obj) {
/* Break to debugger to display result */ /* Break to debugger to display result */
ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (walk_state->result_obj, walk_state)); ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (walk_state->result_obj,
walk_state));
/* /*
* Delete the result op if and only if: * Delete the result op if and only if:
......
...@@ -79,20 +79,23 @@ acpi_ds_init_callbacks ( ...@@ -79,20 +79,23 @@ acpi_ds_init_callbacks (
switch (pass_number) { switch (pass_number) {
case 1: case 1:
walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE; walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 |
ACPI_PARSE_DELETE_TREE;
walk_state->descending_callback = acpi_ds_load1_begin_op; walk_state->descending_callback = acpi_ds_load1_begin_op;
walk_state->ascending_callback = acpi_ds_load1_end_op; walk_state->ascending_callback = acpi_ds_load1_end_op;
break; break;
case 2: case 2:
walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE; walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 |
ACPI_PARSE_DELETE_TREE;
walk_state->descending_callback = acpi_ds_load2_begin_op; walk_state->descending_callback = acpi_ds_load2_begin_op;
walk_state->ascending_callback = acpi_ds_load2_end_op; walk_state->ascending_callback = acpi_ds_load2_end_op;
break; break;
case 3: case 3:
#ifndef ACPI_NO_METHOD_EXECUTION #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 #endif
...@@ -111,8 +114,7 @@ acpi_ds_init_callbacks ( ...@@ -111,8 +114,7 @@ acpi_ds_init_callbacks (
* FUNCTION: acpi_ds_load1_begin_op * FUNCTION: acpi_ds_load1_begin_op
* *
* PARAMETERS: walk_state - Current state of the parse tree walk * PARAMETERS: walk_state - Current state of the parse tree walk
* Op - Op that has been just been reached in the * out_op - Where to return op if a new one is created
* walk; Arguments have not been evaluated yet.
* *
* RETURN: Status * RETURN: Status
* *
...@@ -146,7 +148,8 @@ acpi_ds_load1_begin_op ( ...@@ -146,7 +148,8 @@ acpi_ds_load1_begin_op (
#if 0 #if 0
if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
(walk_state->op_info->class == AML_CLASS_CONTROL)) { (walk_state->op_info->class == AML_CLASS_CONTROL)) {
acpi_os_printf ("\n\n***EXECUTABLE OPCODE %s***\n\n", walk_state->op_info->name); acpi_os_printf ("\n\n***EXECUTABLE OPCODE %s***\n\n",
walk_state->op_info->name);
*out_op = op; *out_op = op;
return (AE_CTRL_SKIP); return (AE_CTRL_SKIP);
} }
...@@ -191,7 +194,8 @@ acpi_ds_load1_begin_op ( ...@@ -191,7 +194,8 @@ acpi_ds_load1_begin_op (
*/ */
acpi_dm_add_to_external_list (path); acpi_dm_add_to_external_list (path);
status = acpi_ns_lookup (walk_state->scope_info, path, object_type, status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, walk_state, &(node)); ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT,
walk_state, &(node));
} }
#endif #endif
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
...@@ -224,10 +228,12 @@ acpi_ds_load1_begin_op ( ...@@ -224,10 +228,12 @@ acpi_ds_load1_begin_op (
* Name (DEB, 0) * Name (DEB, 0)
* Scope (DEB) { ... } * Scope (DEB) { ... }
* *
* Note: silently change the type here. On the second pass, we will report a warning * Note: silently change the type here. On the second pass, we will report
* a warning
*/ */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
path, acpi_ut_get_type_name (node->type))); path, acpi_ut_get_type_name (node->type)));
node->type = ACPI_TYPE_ANY; node->type = ACPI_TYPE_ANY;
...@@ -238,7 +244,8 @@ acpi_ds_load1_begin_op ( ...@@ -238,7 +244,8 @@ acpi_ds_load1_begin_op (
/* All other types are an error */ /* All other types are an error */
ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", ACPI_REPORT_ERROR ((
"Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n",
acpi_ut_get_type_name (node->type), path)); acpi_ut_get_type_name (node->type), path));
return (AE_AML_OPERAND_TYPE); return (AE_AML_OPERAND_TYPE);
...@@ -249,7 +256,8 @@ acpi_ds_load1_begin_op ( ...@@ -249,7 +256,8 @@ acpi_ds_load1_begin_op (
default: default:
/* /*
* For all other named opcodes, we will enter the name into the namespace. * For all other named opcodes, we will enter the name into
* the namespace.
* *
* Setup the search flags. * Setup the search flags.
* Since we are entering a name into the namespace, we do not want to * Since we are entering a name into the namespace, we do not want to
...@@ -279,14 +287,16 @@ acpi_ds_load1_begin_op ( ...@@ -279,14 +287,16 @@ acpi_ds_load1_begin_op (
acpi_ut_get_type_name (object_type))); acpi_ut_get_type_name (object_type)));
} }
else { else {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Both Find or Create allowed\n", ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"[%s] Both Find or Create allowed\n",
acpi_ut_get_type_name (object_type))); acpi_ut_get_type_name (object_type)));
} }
/* /*
* Enter the named type into the internal namespace. We enter the name * Enter the named type into the internal namespace. We enter the name
* as we go downward in the parse tree. Any necessary subobjects that involve * as we go downward in the parse tree. Any necessary subobjects that
* arguments to the opcode must be created as we go back up the parse tree later. * involve 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, status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
ACPI_IMODE_LOAD_PASS1, flags, walk_state, &(node)); ACPI_IMODE_LOAD_PASS1, flags, walk_state, &(node));
...@@ -335,8 +345,6 @@ acpi_ds_load1_begin_op ( ...@@ -335,8 +345,6 @@ acpi_ds_load1_begin_op (
* FUNCTION: acpi_ds_load1_end_op * FUNCTION: acpi_ds_load1_end_op
* *
* PARAMETERS: walk_state - Current state of the parse tree walk * PARAMETERS: walk_state - Current state of the parse tree walk
* Op - Op that has been just been completed in the
* walk; Arguments have now been evaluated.
* *
* RETURN: Status * RETURN: Status
* *
...@@ -383,7 +391,9 @@ acpi_ds_load1_end_op ( ...@@ -383,7 +391,9 @@ acpi_ds_load1_end_op (
if (op->common.aml_opcode == AML_REGION_OP) { if (op->common.aml_opcode == AML_REGION_OP) {
status = acpi_ex_create_region (op->named.data, op->named.length, status = acpi_ex_create_region (op->named.data, op->named.length,
(acpi_adr_space_type) ((op->common.value.arg)->common.value.integer), walk_state); (acpi_adr_space_type)
((op->common.value.arg)->common.value.integer),
walk_state);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return (status); return (status);
} }
...@@ -394,7 +404,8 @@ acpi_ds_load1_end_op ( ...@@ -394,7 +404,8 @@ acpi_ds_load1_end_op (
/* For Name opcode, get the object type from the argument */ /* For Name opcode, get the object type from the argument */
if (op->common.value.arg) { if (op->common.value.arg) {
object_type = (acpi_ps_get_opcode_info ((op->common.value.arg)->common.aml_opcode))->object_type; object_type = (acpi_ps_get_opcode_info (
(op->common.value.arg)->common.aml_opcode))->object_type;
op->common.node->type = (u8) object_type; op->common.node->type = (u8) object_type;
} }
} }
...@@ -448,8 +459,7 @@ acpi_ds_load1_end_op ( ...@@ -448,8 +459,7 @@ acpi_ds_load1_end_op (
* FUNCTION: acpi_ds_load2_begin_op * FUNCTION: acpi_ds_load2_begin_op
* *
* PARAMETERS: walk_state - Current state of the parse tree walk * PARAMETERS: walk_state - Current state of the parse tree walk
* Op - Op that has been just been reached in the * out_op - Wher to return op if a new one is created
* walk; Arguments have not been evaluated yet.
* *
* RETURN: Status * RETURN: Status
* *
...@@ -478,14 +488,20 @@ acpi_ds_load2_begin_op ( ...@@ -478,14 +488,20 @@ acpi_ds_load2_begin_op (
if (op) { if (op) {
/* We only care about Namespace opcodes here */ /* We only care about Namespace opcodes here */
if ((!(walk_state->op_info->flags & AML_NSOPCODE) && (walk_state->opcode != AML_INT_NAMEPATH_OP)) || if ((!(walk_state->op_info->flags & AML_NSOPCODE) &&
(walk_state->opcode != AML_INT_NAMEPATH_OP)) ||
(!(walk_state->op_info->flags & AML_NAMED))) { (!(walk_state->op_info->flags & AML_NAMED))) {
if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
(walk_state->op_info->class == AML_CLASS_CONTROL)) {
ACPI_REPORT_WARNING ((
"Encountered executable code at module level, [%s]\n",
acpi_ps_get_opcode_name (walk_state->opcode)));
}
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
/* /* Get the name we are going to enter or lookup in the namespace */
* Get the name we are going to enter or lookup in the namespace
*/
if (walk_state->opcode == AML_INT_NAMEPATH_OP) { if (walk_state->opcode == AML_INT_NAMEPATH_OP) {
/* For Namepath op, get the path string */ /* For Namepath op, get the path string */
...@@ -528,21 +544,25 @@ acpi_ds_load2_begin_op ( ...@@ -528,21 +544,25 @@ acpi_ds_load2_begin_op (
case AML_INT_NAMEPATH_OP: case AML_INT_NAMEPATH_OP:
/* /*
* The name_path is an object reference to an existing object. Don't enter the * The name_path is an object reference to an existing object.
* name into the namespace, but look it up for use later * Don't enter the name into the namespace, but look it up
* for use later.
*/ */
status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node)); ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
walk_state, &(node));
break; break;
case AML_SCOPE_OP: case AML_SCOPE_OP:
/* /*
* The Path is an object reference to an existing object. Don't enter the * The Path is an object reference to an existing object.
* name into the namespace, but look it up for use later * Don't enter the name into the namespace, but look it up
* for use later.
*/ */
status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node)); ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
walk_state, &(node));
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
#ifdef _ACPI_ASL_COMPILER #ifdef _ACPI_ASL_COMPILER
if (status == AE_NOT_FOUND) { if (status == AE_NOT_FOUND) {
...@@ -582,7 +602,8 @@ acpi_ds_load2_begin_op ( ...@@ -582,7 +602,8 @@ acpi_ds_load2_begin_op (
* Scope (DEB) { ... } * Scope (DEB) { ... }
*/ */
ACPI_REPORT_WARNING (("Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", ACPI_REPORT_WARNING ((
"Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
buffer_ptr, acpi_ut_get_type_name (node->type))); buffer_ptr, acpi_ut_get_type_name (node->type)));
node->type = ACPI_TYPE_ANY; node->type = ACPI_TYPE_ANY;
...@@ -593,7 +614,8 @@ acpi_ds_load2_begin_op ( ...@@ -593,7 +614,8 @@ acpi_ds_load2_begin_op (
/* All other types are an error */ /* All other types are an error */
ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s]\n", ACPI_REPORT_ERROR ((
"Invalid type (%s) for target of Scope operator [%4.4s]\n",
acpi_ut_get_type_name (node->type), buffer_ptr)); acpi_ut_get_type_name (node->type), buffer_ptr));
return (AE_AML_OPERAND_TYPE); return (AE_AML_OPERAND_TYPE);
...@@ -621,8 +643,9 @@ acpi_ds_load2_begin_op ( ...@@ -621,8 +643,9 @@ acpi_ds_load2_begin_op (
/* /*
* Enter the named type into the internal namespace. We enter the name * Enter the named type into the internal namespace. We enter the name
* as we go downward in the parse tree. Any necessary subobjects that involve * as we go downward in the parse tree. Any necessary subobjects that
* arguments to the opcode must be created as we go back up the parse tree later. * involve arguments to the opcode must be created as we go back up the
* parse tree later.
* *
* Note: Name may already exist if we are executing a deferred opcode. * Note: Name may already exist if we are executing a deferred opcode.
*/ */
...@@ -635,7 +658,8 @@ acpi_ds_load2_begin_op ( ...@@ -635,7 +658,8 @@ acpi_ds_load2_begin_op (
} }
status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, walk_state, &(node)); ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH,
walk_state, &(node));
break; break;
} }
...@@ -678,8 +702,6 @@ acpi_ds_load2_begin_op ( ...@@ -678,8 +702,6 @@ acpi_ds_load2_begin_op (
* FUNCTION: acpi_ds_load2_end_op * FUNCTION: acpi_ds_load2_end_op
* *
* PARAMETERS: walk_state - Current state of the parse tree walk * PARAMETERS: walk_state - Current state of the parse tree walk
* Op - Op that has been just been completed in the
* walk; Arguments have now been evaluated.
* *
* RETURN: Status * RETURN: Status
* *
...@@ -738,7 +760,8 @@ acpi_ds_load2_end_op ( ...@@ -738,7 +760,8 @@ acpi_ds_load2_end_op (
/* Pop the scope stack */ /* Pop the scope stack */
if (acpi_ns_opens_scope (object_type) && (op->common.aml_opcode != AML_INT_METHODCALL_OP)) { if (acpi_ns_opens_scope (object_type) &&
(op->common.aml_opcode != AML_INT_METHODCALL_OP)) {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
acpi_ut_get_type_name (object_type), op)); acpi_ut_get_type_name (object_type), op));
...@@ -803,7 +826,7 @@ acpi_ds_load2_end_op ( ...@@ -803,7 +826,7 @@ acpi_ds_load2_end_op (
case AML_INDEX_FIELD_OP: case AML_INDEX_FIELD_OP:
status = acpi_ds_create_index_field (op, (acpi_handle) arg->common.node, status = acpi_ds_create_index_field (op, (acpi_handle) arg->common.node,
walk_state); walk_state);
break; break;
case AML_BANK_FIELD_OP: case AML_BANK_FIELD_OP:
...@@ -884,14 +907,16 @@ acpi_ds_load2_end_op ( ...@@ -884,14 +907,16 @@ acpi_ds_load2_end_op (
#ifndef ACPI_NO_METHOD_EXECUTION #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
* (We must save the address of the AML of the address and length operands) * argument is the space_id. (We must save the address of the
* AML of the address and length operands)
*/ */
/* /*
* If we have a valid region, initialize it * If we have a valid region, initialize it
* Namespace is NOT locked at this point. * Namespace is NOT locked at this point.
*/ */
status = acpi_ev_initialize_region (acpi_ns_get_attached_object (node), FALSE); status = acpi_ev_initialize_region (acpi_ns_get_attached_object (node),
FALSE);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
/* /*
* If AE_NOT_EXIST is returned, it is not fatal * If AE_NOT_EXIST is returned, it is not fatal
...@@ -942,15 +967,16 @@ acpi_ds_load2_end_op ( ...@@ -942,15 +967,16 @@ acpi_ds_load2_end_op (
if (ACPI_SUCCESS (status)) { if (ACPI_SUCCESS (status)) {
/* /*
* Make sure that what we found is indeed a method * Make sure that what we found is indeed a method
* We didn't search for a method on purpose, to see if the name would resolve * We didn't search for a method on purpose, to see if the name
* would resolve
*/ */
if (new_node->type != ACPI_TYPE_METHOD) { if (new_node->type != ACPI_TYPE_METHOD) {
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
} }
/* We could put the returned object (Node) on the object stack for later, but /* We could put the returned object (Node) on the object stack for
* for now, we will put it in the "op" object that the parser uses, so we * later, but for now, we will put it in the "op" object that the
* can get it again at the end of this scope * parser uses, so we can get it again at the end of this scope
*/ */
op->common.node = new_node; op->common.node = new_node;
} }
......
...@@ -50,14 +50,13 @@ ...@@ -50,14 +50,13 @@
ACPI_MODULE_NAME ("dswscope") ACPI_MODULE_NAME ("dswscope")
#define STACK_POP(head) head
/**************************************************************************** /****************************************************************************
* *
* FUNCTION: acpi_ds_scope_stack_clear * FUNCTION: acpi_ds_scope_stack_clear
* *
* PARAMETERS: None * PARAMETERS: walk_state - Current state
*
* RETURN: None
* *
* DESCRIPTION: Pop (and free) everything on the scope stack except the * DESCRIPTION: Pop (and free) everything on the scope stack except the
* root scope object (which remains at the stack top.) * root scope object (which remains at the stack top.)
...@@ -80,7 +79,8 @@ acpi_ds_scope_stack_clear ( ...@@ -80,7 +79,8 @@ acpi_ds_scope_stack_clear (
walk_state->scope_info = scope_info->scope.next; walk_state->scope_info = scope_info->scope.next;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Popped object type (%s)\n", acpi_ut_get_type_name (scope_info->common.value))); "Popped object type (%s)\n",
acpi_ut_get_type_name (scope_info->common.value)));
acpi_ut_delete_generic_state (scope_info); acpi_ut_delete_generic_state (scope_info);
} }
} }
...@@ -90,8 +90,11 @@ acpi_ds_scope_stack_clear ( ...@@ -90,8 +90,11 @@ acpi_ds_scope_stack_clear (
* *
* FUNCTION: acpi_ds_scope_stack_push * FUNCTION: acpi_ds_scope_stack_push
* *
* PARAMETERS: *Node, - Name to be made current * PARAMETERS: Node - Name to be made current
* Type, - Type of frame being pushed * Type - Type of frame being pushed
* walk_state - Current state
*
* RETURN: Status
* *
* DESCRIPTION: Push the current scope on the scope stack, and make the * DESCRIPTION: Push the current scope on the scope stack, and make the
* passed Node current. * passed Node current.
...@@ -121,7 +124,8 @@ acpi_ds_scope_stack_push ( ...@@ -121,7 +124,8 @@ acpi_ds_scope_stack_push (
/* Make sure object type is valid */ /* Make sure object type is valid */
if (!acpi_ut_valid_object_type (type)) { if (!acpi_ut_valid_object_type (type)) {
ACPI_REPORT_WARNING (("ds_scope_stack_push: Invalid object type: 0x%X\n", type)); ACPI_REPORT_WARNING ((
"ds_scope_stack_push: Invalid object type: 0x%X\n", type));
} }
/* Allocate a new scope object */ /* Allocate a new scope object */
...@@ -170,16 +174,11 @@ acpi_ds_scope_stack_push ( ...@@ -170,16 +174,11 @@ acpi_ds_scope_stack_push (
* *
* FUNCTION: acpi_ds_scope_stack_pop * FUNCTION: acpi_ds_scope_stack_pop
* *
* PARAMETERS: Type - The type of frame to be found * PARAMETERS: walk_state - Current state
* *
* DESCRIPTION: Pop the scope stack until a frame of the requested type * RETURN: Status
* is found.
* *
* RETURN: Count of frames popped. If no frame of the requested type * DESCRIPTION: Pop the scope stack once.
* was found, the count is returned as a negative number and
* the scope stack is emptied (which sets the current scope
* to the root). If the scope stack was empty at entry, the
* function is a no-op and returns 0.
* *
***************************************************************************/ ***************************************************************************/
......
...@@ -50,67 +50,31 @@ ...@@ -50,67 +50,31 @@
#define _COMPONENT ACPI_DISPATCHER #define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dswstate") ACPI_MODULE_NAME ("dswstate")
/* Local prototypes */
#ifdef ACPI_FUTURE_USAGE #ifdef ACPI_OBSOLETE_FUNCTIONS
/*******************************************************************************
*
* FUNCTION: acpi_ds_result_insert
*
* PARAMETERS: Object - Object to push
* Index - Where to insert the object
* walk_state - Current Walk state
*
* RETURN: Status
*
* DESCRIPTION: Insert an object onto this walk's result stack
*
******************************************************************************/
acpi_status acpi_status
acpi_ds_result_insert ( acpi_ds_result_insert (
void *object, void *object,
u32 index, u32 index,
struct acpi_walk_state *walk_state) struct acpi_walk_state *walk_state);
{
union acpi_generic_state *state;
ACPI_FUNCTION_NAME ("ds_result_insert"); acpi_status
acpi_ds_obj_stack_delete_all (
struct acpi_walk_state *walk_state);
state = walk_state->results;
if (!state) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n",
walk_state));
return (AE_NOT_EXIST);
}
if (index >= ACPI_OBJ_NUM_OPERANDS) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Index out of range: %X Obj=%p State=%p Num=%X\n",
index, object, walk_state, state->results.num_results));
return (AE_BAD_PARAMETER);
}
if (!object) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Null Object! Index=%X Obj=%p State=%p Num=%X\n",
index, object, walk_state, state->results.num_results));
return (AE_BAD_PARAMETER);
}
state->results.obj_desc [index] = object;
state->results.num_results++;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, acpi_status
"Obj=%p [%s] State=%p Num=%X Cur=%X\n", acpi_ds_obj_stack_pop_object (
object, object ? acpi_ut_get_object_type_name ((union acpi_operand_object *) object) : "NULL", union acpi_operand_object **object,
walk_state, state->results.num_results, walk_state->current_result)); struct acpi_walk_state *walk_state);
return (AE_OK); void *
} acpi_ds_obj_stack_get_value (
u32 index,
struct acpi_walk_state *walk_state);
#endif
#ifdef ACPI_FUTURE_USAGE
/******************************************************************************* /*******************************************************************************
* *
...@@ -178,7 +142,6 @@ acpi_ds_result_remove ( ...@@ -178,7 +142,6 @@ acpi_ds_result_remove (
#endif /* ACPI_FUTURE_USAGE */ #endif /* ACPI_FUTURE_USAGE */
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ds_result_pop * FUNCTION: acpi_ds_result_pop
...@@ -227,15 +190,18 @@ acpi_ds_result_pop ( ...@@ -227,15 +190,18 @@ acpi_ds_result_pop (
*object = state->results.obj_desc [index -1]; *object = state->results.obj_desc [index -1];
state->results.obj_desc [index -1] = NULL; state->results.obj_desc [index -1] = NULL;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Index=%X State=%p Num=%X\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
*object, (*object) ? acpi_ut_get_object_type_name (*object) : "NULL", "Obj=%p [%s] Index=%X State=%p Num=%X\n",
*object,
(*object) ? acpi_ut_get_object_type_name (*object) : "NULL",
(u32) index -1, walk_state, state->results.num_results)); (u32) index -1, walk_state, state->results.num_results));
return (AE_OK); return (AE_OK);
} }
} }
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", walk_state)); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"No result objects! State=%p\n", walk_state));
return (AE_AML_NO_RETURN_VALUE); return (AE_AML_NO_RETURN_VALUE);
} }
...@@ -274,7 +240,8 @@ acpi_ds_result_pop_from_bottom ( ...@@ -274,7 +240,8 @@ acpi_ds_result_pop_from_bottom (
} }
if (!state->results.num_results) { if (!state->results.num_results) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", walk_state)); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n",
walk_state));
return (AE_AML_NO_RETURN_VALUE); return (AE_AML_NO_RETURN_VALUE);
} }
...@@ -293,7 +260,8 @@ acpi_ds_result_pop_from_bottom ( ...@@ -293,7 +260,8 @@ acpi_ds_result_pop_from_bottom (
/* Check for a valid result object */ /* Check for a valid result object */
if (!*object) { if (!*object) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null operand! State=%p #Ops=%X, Index=%X\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Null operand! State=%p #Ops=%X, Index=%X\n",
walk_state, state->results.num_results, (u32) index)); walk_state, state->results.num_results, (u32) index));
return (AE_AML_NO_RETURN_VALUE); return (AE_AML_NO_RETURN_VALUE);
} }
...@@ -344,7 +312,8 @@ acpi_ds_result_push ( ...@@ -344,7 +312,8 @@ acpi_ds_result_push (
} }
if (!object) { if (!object) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Object! Obj=%p State=%p Num=%X\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Null Object! Obj=%p State=%p Num=%X\n",
object, walk_state, state->results.num_results)); object, walk_state, state->results.num_results));
return (AE_BAD_PARAMETER); return (AE_BAD_PARAMETER);
} }
...@@ -437,43 +406,6 @@ acpi_ds_result_stack_pop ( ...@@ -437,43 +406,6 @@ acpi_ds_result_stack_pop (
} }
/*******************************************************************************
*
* FUNCTION: acpi_ds_obj_stack_delete_all
*
* PARAMETERS: walk_state - Current Walk state
*
* RETURN: Status
*
* DESCRIPTION: Clear the object stack by deleting all objects that are on it.
* Should be used with great care, if at all!
*
******************************************************************************/
#ifdef ACPI_FUTURE_USAGE
acpi_status
acpi_ds_obj_stack_delete_all (
struct acpi_walk_state *walk_state)
{
u32 i;
ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_delete_all", walk_state);
/* The stack size is configurable, but fixed */
for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++) {
if (walk_state->operands[i]) {
acpi_ut_remove_reference (walk_state->operands[i]);
walk_state->operands[i] = NULL;
}
}
return_ACPI_STATUS (AE_OK);
}
#endif /* ACPI_FUTURE_USAGE */
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ds_obj_stack_push * FUNCTION: acpi_ds_obj_stack_push
...@@ -517,67 +449,6 @@ acpi_ds_obj_stack_push ( ...@@ -517,67 +449,6 @@ acpi_ds_obj_stack_push (
} }
#if 0
/*******************************************************************************
*
* FUNCTION: acpi_ds_obj_stack_pop_object
*
* PARAMETERS: pop_count - Number of objects/entries to pop
* walk_state - Current Walk state
*
* RETURN: Status
*
* DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT
* deleted by this routine.
*
******************************************************************************/
acpi_status
acpi_ds_obj_stack_pop_object (
union acpi_operand_object **object,
struct acpi_walk_state *walk_state)
{
ACPI_FUNCTION_NAME ("ds_obj_stack_pop_object");
/* Check for stack underflow */
if (walk_state->num_operands == 0) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Missing operand/stack empty! State=%p #Ops=%X\n",
walk_state, walk_state->num_operands));
*object = NULL;
return (AE_AML_NO_OPERAND);
}
/* Pop the stack */
walk_state->num_operands--;
/* Check for a valid operand */
if (!walk_state->operands [walk_state->num_operands]) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Null operand! State=%p #Ops=%X\n",
walk_state, walk_state->num_operands));
*object = NULL;
return (AE_AML_NO_OPERAND);
}
/* Get operand and set stack entry to null */
*object = walk_state->operands [walk_state->num_operands];
walk_state->operands [walk_state->num_operands] = NULL;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
*object, acpi_ut_get_object_type_name (*object),
walk_state, walk_state->num_operands));
return (AE_OK);
}
#endif
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ds_obj_stack_pop * FUNCTION: acpi_ds_obj_stack_pop
...@@ -678,48 +549,6 @@ acpi_ds_obj_stack_pop_and_delete ( ...@@ -678,48 +549,6 @@ acpi_ds_obj_stack_pop_and_delete (
} }
/*******************************************************************************
*
* FUNCTION: acpi_ds_obj_stack_get_value
*
* PARAMETERS: Index - Stack index whose value is desired. Based
* on the top of the stack (index=0 == top)
* walk_state - Current Walk state
*
* RETURN: Status
*
* DESCRIPTION: Retrieve an object from this walk's object stack. Index must
* be within the range of the current stack pointer.
*
******************************************************************************/
#ifdef ACPI_FUTURE_USAGE
void *
acpi_ds_obj_stack_get_value (
u32 index,
struct acpi_walk_state *walk_state)
{
ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_get_value", walk_state);
/* Can't do it if the stack is empty */
if (walk_state->num_operands == 0) {
return_PTR (NULL);
}
/* or if the index is past the top of the stack */
if (index > (walk_state->num_operands - (u32) 1)) {
return_PTR (NULL);
}
return_PTR (walk_state->operands[(acpi_native_uint)(walk_state->num_operands - 1) -
index]);
}
#endif /* ACPI_FUTURE_USAGE */
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ds_get_current_walk_state * FUNCTION: acpi_ds_get_current_walk_state
...@@ -757,11 +586,11 @@ acpi_ds_get_current_walk_state ( ...@@ -757,11 +586,11 @@ acpi_ds_get_current_walk_state (
* FUNCTION: acpi_ds_push_walk_state * FUNCTION: acpi_ds_push_walk_state
* *
* PARAMETERS: walk_state - State to push * PARAMETERS: walk_state - State to push
* walk_list - The list that owns the walk stack * Thread - Thread state object
* *
* RETURN: None * RETURN: None
* *
* DESCRIPTION: Place the walk_state at the head of the state list. * DESCRIPTION: Place the Thread state at the head of the state list.
* *
******************************************************************************/ ******************************************************************************/
...@@ -784,9 +613,9 @@ acpi_ds_push_walk_state ( ...@@ -784,9 +613,9 @@ acpi_ds_push_walk_state (
* *
* FUNCTION: acpi_ds_pop_walk_state * FUNCTION: acpi_ds_pop_walk_state
* *
* PARAMETERS: walk_list - The list that owns the walk stack * PARAMETERS: Thread - Current thread state
* *
* RETURN: A walk_state object popped from the stack * RETURN: A walk_state object popped from the thread's stack
* *
* DESCRIPTION: Remove and return the walkstate object that is at the head of * DESCRIPTION: Remove and return the walkstate object that is at the head of
* the walk stack for the given walk list. NULL indicates that * the walk stack for the given walk list. NULL indicates that
...@@ -814,7 +643,7 @@ acpi_ds_pop_walk_state ( ...@@ -814,7 +643,7 @@ acpi_ds_pop_walk_state (
/* /*
* Don't clear the NEXT field, this serves as an indicator * Don't clear the NEXT field, this serves as an indicator
* that there is a parent WALK STATE * that there is a parent WALK STATE
* NO: walk_state->Next = NULL; * Do Not: walk_state->Next = NULL;
*/ */
} }
...@@ -826,7 +655,9 @@ acpi_ds_pop_walk_state ( ...@@ -826,7 +655,9 @@ acpi_ds_pop_walk_state (
* *
* FUNCTION: acpi_ds_create_walk_state * FUNCTION: acpi_ds_create_walk_state
* *
* PARAMETERS: Origin - Starting point for this walk * PARAMETERS: owner_id - ID for object creation
* Origin - Starting point for this walk
* mth_desc - Method object
* Thread - Current thread state * Thread - Current thread state
* *
* RETURN: Pointer to the new walk state. * RETURN: Pointer to the new walk state.
...@@ -896,8 +727,7 @@ acpi_ds_create_walk_state ( ...@@ -896,8 +727,7 @@ acpi_ds_create_walk_state (
* method_node - Control method NS node, if any * method_node - Control method NS node, if any
* aml_start - Start of AML * aml_start - Start of AML
* aml_length - Length of AML * aml_length - Length of AML
* Params - Method args, if any * Info - Method info block (params, etc.)
* return_obj_desc - Where to store a return object, if any
* pass_number - 1, 2, or 3 * pass_number - 1, 2, or 3
* *
* RETURN: Status * RETURN: Status
...@@ -931,7 +761,7 @@ acpi_ds_init_aml_walk ( ...@@ -931,7 +761,7 @@ acpi_ds_init_aml_walk (
/* The next_op of the next_walk will be the beginning of the method */ /* The next_op of the next_walk will be the beginning of the method */
walk_state->next_op = NULL; walk_state->next_op = NULL;
if (info) { if (info) {
if (info->parameter_type == ACPI_PARAM_GPE) { if (info->parameter_type == ACPI_PARAM_GPE) {
...@@ -939,8 +769,8 @@ acpi_ds_init_aml_walk ( ...@@ -939,8 +769,8 @@ acpi_ds_init_aml_walk (
info->parameters); info->parameters);
} }
else { else {
walk_state->params = info->parameters; walk_state->params = info->parameters;
walk_state->caller_return_desc = &info->return_object; walk_state->caller_return_desc = &info->return_object;
} }
} }
...@@ -964,7 +794,8 @@ acpi_ds_init_aml_walk ( ...@@ -964,7 +794,8 @@ acpi_ds_init_aml_walk (
/* Init the method arguments */ /* Init the method arguments */
status = acpi_ds_method_data_init_args (walk_state->params, ACPI_METHOD_NUM_ARGS, walk_state); status = acpi_ds_method_data_init_args (walk_state->params,
ACPI_METHOD_NUM_ARGS, walk_state);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -1031,12 +862,14 @@ acpi_ds_delete_walk_state ( ...@@ -1031,12 +862,14 @@ acpi_ds_delete_walk_state (
} }
if (walk_state->data_type != ACPI_DESC_TYPE_WALK) { if (walk_state->data_type != ACPI_DESC_TYPE_WALK) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p is not a valid walk state\n", walk_state)); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p is not a valid walk state\n",
walk_state));
return; return;
} }
if (walk_state->parser_state.scope) { if (walk_state->parser_state.scope) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n", walk_state)); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n",
walk_state));
} }
/* Always must free any linked control states */ /* Always must free any linked control states */
...@@ -1078,7 +911,7 @@ acpi_ds_delete_walk_state ( ...@@ -1078,7 +911,7 @@ acpi_ds_delete_walk_state (
* *
* PARAMETERS: None * PARAMETERS: None
* *
* RETURN: Status * RETURN: None
* *
* DESCRIPTION: Purge the global state object cache. Used during subsystem * DESCRIPTION: Purge the global state object cache. Used during subsystem
* termination. * termination.
...@@ -1098,3 +931,200 @@ acpi_ds_delete_walk_state_cache ( ...@@ -1098,3 +931,200 @@ acpi_ds_delete_walk_state_cache (
#endif #endif
#ifdef ACPI_OBSOLETE_FUNCTIONS
/*******************************************************************************
*
* FUNCTION: acpi_ds_result_insert
*
* PARAMETERS: Object - Object to push
* Index - Where to insert the object
* walk_state - Current Walk state
*
* RETURN: Status
*
* DESCRIPTION: Insert an object onto this walk's result stack
*
******************************************************************************/
acpi_status
acpi_ds_result_insert (
void *object,
u32 index,
struct acpi_walk_state *walk_state)
{
union acpi_generic_state *state;
ACPI_FUNCTION_NAME ("ds_result_insert");
state = walk_state->results;
if (!state) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n",
walk_state));
return (AE_NOT_EXIST);
}
if (index >= ACPI_OBJ_NUM_OPERANDS) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Index out of range: %X Obj=%p State=%p Num=%X\n",
index, object, walk_state, state->results.num_results));
return (AE_BAD_PARAMETER);
}
if (!object) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Null Object! Index=%X Obj=%p State=%p Num=%X\n",
index, object, walk_state, state->results.num_results));
return (AE_BAD_PARAMETER);
}
state->results.obj_desc [index] = object;
state->results.num_results++;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Obj=%p [%s] State=%p Num=%X Cur=%X\n",
object, object ? acpi_ut_get_object_type_name ((union acpi_operand_object *) object) : "NULL",
walk_state, state->results.num_results, walk_state->current_result));
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_obj_stack_delete_all
*
* PARAMETERS: walk_state - Current Walk state
*
* RETURN: Status
*
* DESCRIPTION: Clear the object stack by deleting all objects that are on it.
* Should be used with great care, if at all!
*
******************************************************************************/
acpi_status
acpi_ds_obj_stack_delete_all (
struct acpi_walk_state *walk_state)
{
u32 i;
ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_delete_all", walk_state);
/* The stack size is configurable, but fixed */
for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++) {
if (walk_state->operands[i]) {
acpi_ut_remove_reference (walk_state->operands[i]);
walk_state->operands[i] = NULL;
}
}
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_obj_stack_pop_object
*
* PARAMETERS: Object - Where to return the popped object
* walk_state - Current Walk state
*
* RETURN: Status
*
* DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT
* deleted by this routine.
*
******************************************************************************/
acpi_status
acpi_ds_obj_stack_pop_object (
union acpi_operand_object **object,
struct acpi_walk_state *walk_state)
{
ACPI_FUNCTION_NAME ("ds_obj_stack_pop_object");
/* Check for stack underflow */
if (walk_state->num_operands == 0) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Missing operand/stack empty! State=%p #Ops=%X\n",
walk_state, walk_state->num_operands));
*object = NULL;
return (AE_AML_NO_OPERAND);
}
/* Pop the stack */
walk_state->num_operands--;
/* Check for a valid operand */
if (!walk_state->operands [walk_state->num_operands]) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Null operand! State=%p #Ops=%X\n",
walk_state, walk_state->num_operands));
*object = NULL;
return (AE_AML_NO_OPERAND);
}
/* Get operand and set stack entry to null */
*object = walk_state->operands [walk_state->num_operands];
walk_state->operands [walk_state->num_operands] = NULL;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
*object, acpi_ut_get_object_type_name (*object),
walk_state, walk_state->num_operands));
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_obj_stack_get_value
*
* PARAMETERS: Index - Stack index whose value is desired. Based
* on the top of the stack (index=0 == top)
* walk_state - Current Walk state
*
* RETURN: Pointer to the requested operand
*
* DESCRIPTION: Retrieve an object from this walk's operand stack. Index must
* be within the range of the current stack pointer.
*
******************************************************************************/
void *
acpi_ds_obj_stack_get_value (
u32 index,
struct acpi_walk_state *walk_state)
{
ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_get_value", walk_state);
/* Can't do it if the stack is empty */
if (walk_state->num_operands == 0) {
return_PTR (NULL);
}
/* or if the index is past the top of the stack */
if (index > (walk_state->num_operands - (u32) 1)) {
return_PTR (NULL);
}
return_PTR (walk_state->operands[(acpi_native_uint)(walk_state->num_operands - 1) -
index]);
}
#endif
...@@ -47,6 +47,16 @@ ...@@ -47,6 +47,16 @@
#define _COMPONENT ACPI_EVENTS #define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evevent") ACPI_MODULE_NAME ("evevent")
/* Local prototypes */
static acpi_status
acpi_ev_fixed_event_initialize (
void);
static u32
acpi_ev_fixed_event_dispatch (
u32 event);
/******************************************************************************* /*******************************************************************************
* *
...@@ -56,7 +66,7 @@ ...@@ -56,7 +66,7 @@
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Initialize global data structures for events. * DESCRIPTION: Initialize global data structures for ACPI events (Fixed, GPE)
* *
******************************************************************************/ ******************************************************************************/
...@@ -78,9 +88,9 @@ acpi_ev_initialize_events ( ...@@ -78,9 +88,9 @@ acpi_ev_initialize_events (
} }
/* /*
* Initialize the Fixed and General Purpose Events. This is * Initialize the Fixed and General Purpose Events. This is done prior to
* done prior to enabling SCIs to prevent interrupts from * enabling SCIs to prevent interrupts from occurring before the handlers are
* occurring before handers are installed. * installed.
*/ */
status = acpi_ev_fixed_event_initialize (); status = acpi_ev_fixed_event_initialize ();
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
...@@ -161,7 +171,7 @@ acpi_ev_install_xrupt_handlers ( ...@@ -161,7 +171,7 @@ acpi_ev_install_xrupt_handlers (
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ev_fixed_event_initialize ( acpi_ev_fixed_event_initialize (
void) void)
{ {
...@@ -180,7 +190,8 @@ acpi_ev_fixed_event_initialize ( ...@@ -180,7 +190,8 @@ acpi_ev_fixed_event_initialize (
/* Enable the fixed event */ /* Enable the fixed event */
if (acpi_gbl_fixed_event_info[i].enable_register_id != 0xFF) { if (acpi_gbl_fixed_event_info[i].enable_register_id != 0xFF) {
status = acpi_set_register (acpi_gbl_fixed_event_info[i].enable_register_id, status = acpi_set_register (
acpi_gbl_fixed_event_info[i].enable_register_id,
0, ACPI_MTX_LOCK); 0, ACPI_MTX_LOCK);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return (status); return (status);
...@@ -200,7 +211,7 @@ acpi_ev_fixed_event_initialize ( ...@@ -200,7 +211,7 @@ acpi_ev_fixed_event_initialize (
* *
* RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
* *
* DESCRIPTION: Checks the PM status register for fixed events * DESCRIPTION: Checks the PM status register for active fixed events
* *
******************************************************************************/ ******************************************************************************/
...@@ -221,8 +232,10 @@ acpi_ev_fixed_event_detect ( ...@@ -221,8 +232,10 @@ acpi_ev_fixed_event_detect (
* Read the fixed feature status and enable registers, as all the cases * Read the fixed feature status and enable registers, as all the cases
* depend on their values. Ignore errors here. * depend on their values. Ignore errors here.
*/ */
(void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, &fixed_status); (void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS,
(void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE, &fixed_enable); &fixed_status);
(void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE,
&fixed_enable);
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
"Fixed Event Block: Enable %08X Status %08X\n", "Fixed Event Block: Enable %08X Status %08X\n",
...@@ -259,7 +272,7 @@ acpi_ev_fixed_event_detect ( ...@@ -259,7 +272,7 @@ acpi_ev_fixed_event_detect (
* *
******************************************************************************/ ******************************************************************************/
u32 static u32
acpi_ev_fixed_event_dispatch ( acpi_ev_fixed_event_dispatch (
u32 event) u32 event)
{ {
......
...@@ -48,6 +48,12 @@ ...@@ -48,6 +48,12 @@
#define _COMPONENT ACPI_EVENTS #define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evgpe") ACPI_MODULE_NAME ("evgpe")
/* Local prototypes */
static void ACPI_SYSTEM_XFACE
acpi_ev_asynch_execute_gpe_method (
void *context);
/******************************************************************************* /*******************************************************************************
* *
...@@ -335,8 +341,10 @@ acpi_ev_get_gpe_event_info ( ...@@ -335,8 +341,10 @@ acpi_ev_get_gpe_event_info (
gpe_block = acpi_gbl_gpe_fadt_blocks[i]; gpe_block = acpi_gbl_gpe_fadt_blocks[i];
if (gpe_block) { if (gpe_block) {
if ((gpe_number >= gpe_block->block_base_number) && if ((gpe_number >= gpe_block->block_base_number) &&
(gpe_number < gpe_block->block_base_number + (gpe_block->register_count * 8))) { (gpe_number < gpe_block->block_base_number +
return (&gpe_block->event_info[gpe_number - gpe_block->block_base_number]); (gpe_block->register_count * 8))) {
return (&gpe_block->event_info[gpe_number -
gpe_block->block_base_number]);
} }
} }
} }
...@@ -437,7 +445,7 @@ acpi_ev_gpe_detect ( ...@@ -437,7 +445,7 @@ acpi_ev_gpe_detect (
"Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n", "Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n",
gpe_register_info->base_gpe_number, status_reg, enable_reg)); gpe_register_info->base_gpe_number, status_reg, enable_reg));
/* First check if there is anything active at all in this register */ /* Check if there is anything active at all in this register */
enabled_status_byte = (u8) (status_reg & enable_reg); enabled_status_byte = (u8) (status_reg & enable_reg);
if (!enabled_status_byte) { if (!enabled_status_byte) {
...@@ -457,8 +465,8 @@ acpi_ev_gpe_detect ( ...@@ -457,8 +465,8 @@ acpi_ev_gpe_detect (
* or method. * or method.
*/ */
int_status |= acpi_ev_gpe_dispatch ( int_status |= acpi_ev_gpe_dispatch (
&gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j], &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j],
(u32) j + gpe_register_info->base_gpe_number); (u32) j + gpe_register_info->base_gpe_number);
} }
} }
} }
...@@ -523,7 +531,8 @@ acpi_ev_asynch_execute_gpe_method ( ...@@ -523,7 +531,8 @@ acpi_ev_asynch_execute_gpe_method (
* Take a snapshot of the GPE info for this level - we copy the * Take a snapshot of the GPE info for this level - we copy the
* info to prevent a race condition with remove_handler/remove_block. * info to prevent a race condition with remove_handler/remove_block.
*/ */
ACPI_MEMCPY (&local_gpe_event_info, gpe_event_info, sizeof (struct acpi_gpe_event_info)); ACPI_MEMCPY (&local_gpe_event_info, gpe_event_info,
sizeof (struct acpi_gpe_event_info));
status = acpi_ut_release_mutex (ACPI_MTX_EVENTS); status = acpi_ut_release_mutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
...@@ -534,7 +543,8 @@ acpi_ev_asynch_execute_gpe_method ( ...@@ -534,7 +543,8 @@ acpi_ev_asynch_execute_gpe_method (
* Must check for control method type dispatch one more * Must check for control method type dispatch one more
* time to avoid race with ev_gpe_install_handler * time to avoid race with ev_gpe_install_handler
*/ */
if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_METHOD) { if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) ==
ACPI_GPE_DISPATCH_METHOD) {
/* /*
* Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx
* control method that corresponds to this GPE * control method that corresponds to this GPE
...@@ -553,7 +563,8 @@ acpi_ev_asynch_execute_gpe_method ( ...@@ -553,7 +563,8 @@ acpi_ev_asynch_execute_gpe_method (
} }
} }
if ((local_gpe_event_info.flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_LEVEL_TRIGGERED) { if ((local_gpe_event_info.flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
ACPI_GPE_LEVEL_TRIGGERED) {
/* /*
* GPE is level-triggered, we clear the GPE status bit after * GPE is level-triggered, we clear the GPE status bit after
* handling the event. * handling the event.
...@@ -575,7 +586,7 @@ acpi_ev_asynch_execute_gpe_method ( ...@@ -575,7 +586,7 @@ acpi_ev_asynch_execute_gpe_method (
* *
* FUNCTION: acpi_ev_gpe_dispatch * FUNCTION: acpi_ev_gpe_dispatch
* *
* PARAMETERS: gpe_event_info - info for this GPE * PARAMETERS: gpe_event_info - Info for this GPE
* gpe_number - Number relative to the parent GPE block * gpe_number - Number relative to the parent GPE block
* *
* RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
...@@ -602,10 +613,12 @@ acpi_ev_gpe_dispatch ( ...@@ -602,10 +613,12 @@ acpi_ev_gpe_dispatch (
* If edge-triggered, clear the GPE status bit now. Note that * If edge-triggered, clear the GPE status bit now. Note that
* level-triggered events are cleared after the GPE is serviced. * level-triggered events are cleared after the GPE is serviced.
*/ */
if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_EDGE_TRIGGERED) { if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
ACPI_GPE_EDGE_TRIGGERED) {
status = acpi_hw_clear_gpe (gpe_event_info); status = acpi_hw_clear_gpe (gpe_event_info);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", ACPI_REPORT_ERROR ((
"acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n",
acpi_format_exception (status), gpe_number)); acpi_format_exception (status), gpe_number));
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
} }
...@@ -639,7 +652,8 @@ acpi_ev_gpe_dispatch ( ...@@ -639,7 +652,8 @@ acpi_ev_gpe_dispatch (
/* It is now safe to clear level-triggered events. */ /* It is now safe to clear level-triggered events. */
if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_LEVEL_TRIGGERED) { if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
ACPI_GPE_LEVEL_TRIGGERED) {
status = acpi_hw_clear_gpe (gpe_event_info); status = acpi_hw_clear_gpe (gpe_event_info);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (( ACPI_REPORT_ERROR ((
...@@ -704,7 +718,6 @@ acpi_ev_gpe_dispatch ( ...@@ -704,7 +718,6 @@ acpi_ev_gpe_dispatch (
#ifdef ACPI_GPE_NOTIFY_CHECK #ifdef ACPI_GPE_NOTIFY_CHECK
/******************************************************************************* /*******************************************************************************
* TBD: NOT USED, PROTOTYPE ONLY AND WILL PROBABLY BE REMOVED * TBD: NOT USED, PROTOTYPE ONLY AND WILL PROBABLY BE REMOVED
* *
......
...@@ -48,6 +48,39 @@ ...@@ -48,6 +48,39 @@
#define _COMPONENT ACPI_EVENTS #define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evgpeblk") ACPI_MODULE_NAME ("evgpeblk")
/* Local prototypes */
static acpi_status
acpi_ev_save_method_info (
acpi_handle obj_handle,
u32 level,
void *obj_desc,
void **return_value);
static acpi_status
acpi_ev_match_prw_and_gpe (
acpi_handle obj_handle,
u32 level,
void *info,
void **return_value);
static struct acpi_gpe_xrupt_info *
acpi_ev_get_gpe_xrupt_block (
u32 interrupt_level);
static acpi_status
acpi_ev_delete_gpe_xrupt (
struct acpi_gpe_xrupt_info *gpe_xrupt);
static acpi_status
acpi_ev_install_gpe_block (
struct acpi_gpe_block_info *gpe_block,
u32 interrupt_level);
static acpi_status
acpi_ev_create_gpe_info_blocks (
struct acpi_gpe_block_info *gpe_block);
/******************************************************************************* /*******************************************************************************
* *
...@@ -155,7 +188,7 @@ acpi_ev_walk_gpe_list ( ...@@ -155,7 +188,7 @@ acpi_ev_walk_gpe_list (
} }
/****************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ev_delete_gpe_handlers * FUNCTION: acpi_ev_delete_gpe_handlers
* *
...@@ -190,7 +223,8 @@ acpi_ev_delete_gpe_handlers ( ...@@ -190,7 +223,8 @@ acpi_ev_delete_gpe_handlers (
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
gpe_event_info = &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j]; gpe_event_info = &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j];
if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER) { if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
ACPI_GPE_DISPATCH_HANDLER) {
ACPI_MEM_FREE (gpe_event_info->dispatch.handler); ACPI_MEM_FREE (gpe_event_info->dispatch.handler);
gpe_event_info->dispatch.handler = NULL; gpe_event_info->dispatch.handler = NULL;
gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK; gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK;
...@@ -471,7 +505,7 @@ acpi_ev_get_gpe_xrupt_block ( ...@@ -471,7 +505,7 @@ acpi_ev_get_gpe_xrupt_block (
ACPI_FUNCTION_TRACE ("ev_get_gpe_xrupt_block"); ACPI_FUNCTION_TRACE ("ev_get_gpe_xrupt_block");
/* No need for spin lock since we are not changing any list elements here */ /* No need for lock since we are not changing any list elements here */
next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head; next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head;
while (next_gpe_xrupt) { while (next_gpe_xrupt) {
...@@ -619,7 +653,7 @@ acpi_ev_install_gpe_block ( ...@@ -619,7 +653,7 @@ acpi_ev_install_gpe_block (
goto unlock_and_exit; goto unlock_and_exit;
} }
/* Install the new block at the end of the list for this interrupt with lock */ /* Install the new block at the end of the list with lock */
acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
if (gpe_xrupt_block->gpe_block_list_head) { if (gpe_xrupt_block->gpe_block_list_head) {
...@@ -756,10 +790,12 @@ acpi_ev_create_gpe_info_blocks ( ...@@ -756,10 +790,12 @@ acpi_ev_create_gpe_info_blocks (
* per register. Initialization to zeros is sufficient. * per register. Initialization to zeros is sufficient.
*/ */
gpe_event_info = ACPI_MEM_CALLOCATE ( gpe_event_info = ACPI_MEM_CALLOCATE (
((acpi_size) gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH) * ((acpi_size) gpe_block->register_count *
ACPI_GPE_REGISTER_WIDTH) *
sizeof (struct acpi_gpe_event_info)); sizeof (struct acpi_gpe_event_info));
if (!gpe_event_info) { if (!gpe_event_info) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not allocate the gpe_event_info table\n")); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not allocate the gpe_event_info table\n"));
status = AE_NO_MEMORY; status = AE_NO_MEMORY;
goto error_exit; goto error_exit;
} }
...@@ -899,7 +935,8 @@ acpi_ev_create_gpe_block ( ...@@ -899,7 +935,8 @@ acpi_ev_create_gpe_block (
gpe_block->block_base_number = gpe_block_base_number; gpe_block->block_base_number = gpe_block_base_number;
gpe_block->node = gpe_device; gpe_block->node = gpe_device;
ACPI_MEMCPY (&gpe_block->block_address, gpe_block_address, sizeof (struct acpi_generic_address)); ACPI_MEMCPY (&gpe_block->block_address, gpe_block_address,
sizeof (struct acpi_generic_address));
/* Create the register_info and event_info sub-structures */ /* Create the register_info and event_info sub-structures */
...@@ -1061,8 +1098,9 @@ acpi_ev_gpe_initialize ( ...@@ -1061,8 +1098,9 @@ acpi_ev_gpe_initialize (
/* Install GPE Block 0 */ /* Install GPE Block 0 */
status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device, &acpi_gbl_FADT->xgpe0_blk, status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device,
register_count0, 0, acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[0]); &acpi_gbl_FADT->xgpe0_blk, register_count0, 0,
acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[0]);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (( ACPI_REPORT_ERROR ((
...@@ -1094,8 +1132,9 @@ acpi_ev_gpe_initialize ( ...@@ -1094,8 +1132,9 @@ acpi_ev_gpe_initialize (
else { else {
/* Install GPE Block 1 */ /* Install GPE Block 1 */
status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device, &acpi_gbl_FADT->xgpe1_blk, status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device,
register_count1, acpi_gbl_FADT->gpe1_base, &acpi_gbl_FADT->xgpe1_blk, register_count1,
acpi_gbl_FADT->gpe1_base,
acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[1]); acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[1]);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
...@@ -1109,7 +1148,7 @@ acpi_ev_gpe_initialize ( ...@@ -1109,7 +1148,7 @@ acpi_ev_gpe_initialize (
* space. However, GPE0 always starts at GPE number zero. * space. However, GPE0 always starts at GPE number zero.
*/ */
gpe_number_max = acpi_gbl_FADT->gpe1_base + gpe_number_max = acpi_gbl_FADT->gpe1_base +
((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1); ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1);
} }
} }
......
...@@ -50,6 +50,35 @@ ...@@ -50,6 +50,35 @@
ACPI_MODULE_NAME ("evmisc") ACPI_MODULE_NAME ("evmisc")
#ifdef ACPI_DEBUG_OUTPUT
static const char *acpi_notify_value_names[] =
{
"Bus Check",
"Device Check",
"Device Wake",
"Eject request",
"Device Check Light",
"Frequency Mismatch",
"Bus Mode Mismatch",
"Power Fault"
};
#endif
/* Local prototypes */
static void ACPI_SYSTEM_XFACE
acpi_ev_notify_dispatch (
void *context);
static void ACPI_SYSTEM_XFACE
acpi_ev_global_lock_thread (
void *context);
static u32
acpi_ev_global_lock_handler (
void *context);
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ev_is_notify_object * FUNCTION: acpi_ev_is_notify_object
...@@ -98,20 +127,6 @@ acpi_ev_is_notify_object ( ...@@ -98,20 +127,6 @@ acpi_ev_is_notify_object (
* *
******************************************************************************/ ******************************************************************************/
#ifdef ACPI_DEBUG_OUTPUT
static const char *acpi_notify_value_names[] =
{
"Bus Check",
"Device Check",
"Device Wake",
"Eject request",
"Device Check Light",
"Frequency Mismatch",
"Bus Mode Mismatch",
"Power Fault"
};
#endif
acpi_status acpi_status
acpi_ev_queue_notify_request ( acpi_ev_queue_notify_request (
struct acpi_namespace_node *node, struct acpi_namespace_node *node,
...@@ -128,9 +143,10 @@ acpi_ev_queue_notify_request ( ...@@ -128,9 +143,10 @@ acpi_ev_queue_notify_request (
/* /*
* For value 3 (Ejection Request), some device method may need to be run. * For value 3 (Ejection Request), some device method may need to be run.
* For value 2 (Device Wake) if _PRW exists, the _PS0 method may need to be run. * For value 2 (Device Wake) if _PRW exists, the _PS0 method may need
* to be run.
* For value 0x80 (Status Change) on the power button or sleep button, * For value 0x80 (Status Change) on the power button or sleep button,
* initiate soft-off or sleep operation? * initiate soft-off or sleep operation?
*/ */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Dispatching Notify(%X) on node %p\n", notify_value, node)); "Dispatching Notify(%X) on node %p\n", notify_value, node));
...@@ -140,8 +156,9 @@ acpi_ev_queue_notify_request ( ...@@ -140,8 +156,9 @@ acpi_ev_queue_notify_request (
acpi_notify_value_names[notify_value])); acpi_notify_value_names[notify_value]));
} }
else { else {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: 0x%2.2X **Device Specific**\n", ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
notify_value)); "Notify value: 0x%2.2X **Device Specific**\n",
notify_value));
} }
/* Get the notify object attached to the NS Node */ /* Get the notify object attached to the NS Node */
...@@ -210,7 +227,7 @@ acpi_ev_queue_notify_request ( ...@@ -210,7 +227,7 @@ acpi_ev_queue_notify_request (
* *
* FUNCTION: acpi_ev_notify_dispatch * FUNCTION: acpi_ev_notify_dispatch
* *
* PARAMETERS: Context - To be passsed to the notify handler * PARAMETERS: Context - To be passed to the notify handler
* *
* RETURN: None. * RETURN: None.
* *
...@@ -219,7 +236,7 @@ acpi_ev_queue_notify_request ( ...@@ -219,7 +236,7 @@ acpi_ev_queue_notify_request (
* *
******************************************************************************/ ******************************************************************************/
void ACPI_SYSTEM_XFACE static void ACPI_SYSTEM_XFACE
acpi_ev_notify_dispatch ( acpi_ev_notify_dispatch (
void *context) void *context)
{ {
...@@ -234,7 +251,8 @@ acpi_ev_notify_dispatch ( ...@@ -234,7 +251,8 @@ acpi_ev_notify_dispatch (
/* /*
* We will invoke a global notify handler if installed. * We will invoke a global notify handler if installed.
* This is done _before_ we invoke the per-device handler attached to the device. * This is done _before_ we invoke the per-device handler attached
* to the device.
*/ */
if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) { if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) {
/* Global system notification handler */ /* Global system notification handler */
...@@ -256,15 +274,17 @@ acpi_ev_notify_dispatch ( ...@@ -256,15 +274,17 @@ acpi_ev_notify_dispatch (
/* Invoke the system handler first, if present */ /* Invoke the system handler first, if present */
if (global_handler) { if (global_handler) {
global_handler (notify_info->notify.node, notify_info->notify.value, global_context); global_handler (notify_info->notify.node, notify_info->notify.value,
global_context);
} }
/* Now invoke the per-device handler, if present */ /* Now invoke the per-device handler, if present */
handler_obj = notify_info->notify.handler_obj; handler_obj = notify_info->notify.handler_obj;
if (handler_obj) { if (handler_obj) {
handler_obj->notify.handler (notify_info->notify.node, notify_info->notify.value, handler_obj->notify.handler (notify_info->notify.node,
handler_obj->notify.context); notify_info->notify.value,
handler_obj->notify.context);
} }
/* All done with the info object */ /* All done with the info object */
...@@ -370,7 +390,8 @@ acpi_ev_global_lock_handler ( ...@@ -370,7 +390,8 @@ acpi_ev_global_lock_handler (
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ev_init_global_lock_handler (void) acpi_ev_init_global_lock_handler (
void)
{ {
acpi_status status; acpi_status status;
...@@ -380,7 +401,7 @@ acpi_ev_init_global_lock_handler (void) ...@@ -380,7 +401,7 @@ acpi_ev_init_global_lock_handler (void)
acpi_gbl_global_lock_present = TRUE; acpi_gbl_global_lock_present = TRUE;
status = acpi_install_fixed_event_handler (ACPI_EVENT_GLOBAL, status = acpi_install_fixed_event_handler (ACPI_EVENT_GLOBAL,
acpi_ev_global_lock_handler, NULL); acpi_ev_global_lock_handler, NULL);
/* /*
* If the global lock does not exist on this platform, the attempt * If the global lock does not exist on this platform, the attempt
...@@ -433,8 +454,10 @@ acpi_ev_acquire_global_lock ( ...@@ -433,8 +454,10 @@ acpi_ev_acquire_global_lock (
acpi_gbl_global_lock_thread_count++; acpi_gbl_global_lock_thread_count++;
/* If we (OS side vs. BIOS side) have the hardware lock already, we are done */ /*
* If we (OS side vs. BIOS side) have the hardware lock already,
* we are done
*/
if (acpi_gbl_global_lock_acquired) { if (acpi_gbl_global_lock_acquired) {
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
...@@ -480,7 +503,8 @@ acpi_ev_acquire_global_lock ( ...@@ -480,7 +503,8 @@ acpi_ev_acquire_global_lock (
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ev_release_global_lock (void) acpi_ev_release_global_lock (
void)
{ {
u8 pending = FALSE; u8 pending = FALSE;
acpi_status status = AE_OK; acpi_status status = AE_OK;
...@@ -490,7 +514,8 @@ acpi_ev_release_global_lock (void) ...@@ -490,7 +514,8 @@ acpi_ev_release_global_lock (void)
if (!acpi_gbl_global_lock_thread_count) { if (!acpi_gbl_global_lock_thread_count) {
ACPI_REPORT_WARNING(("Cannot release HW Global Lock, it has not been acquired\n")); ACPI_REPORT_WARNING((
"Cannot release HW Global Lock, it has not been acquired\n"));
return_ACPI_STATUS (AE_NOT_ACQUIRED); return_ACPI_STATUS (AE_NOT_ACQUIRED);
} }
...@@ -515,7 +540,8 @@ acpi_ev_release_global_lock (void) ...@@ -515,7 +540,8 @@ acpi_ev_release_global_lock (void)
* register * register
*/ */
if (pending) { if (pending) {
status = acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE, 1, ACPI_MTX_LOCK); status = acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE,
1, ACPI_MTX_LOCK);
} }
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
...@@ -535,7 +561,8 @@ acpi_ev_release_global_lock (void) ...@@ -535,7 +561,8 @@ acpi_ev_release_global_lock (void)
******************************************************************************/ ******************************************************************************/
void void
acpi_ev_terminate (void) acpi_ev_terminate (
void)
{ {
acpi_native_uint i; acpi_native_uint i;
acpi_status status; acpi_status status;
...@@ -555,7 +582,8 @@ acpi_ev_terminate (void) ...@@ -555,7 +582,8 @@ acpi_ev_terminate (void)
for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
status = acpi_disable_event ((u32) i, 0); status = acpi_disable_event ((u32) i, 0);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not disable fixed event %d\n", (u32) i)); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not disable fixed event %d\n", (u32) i));
} }
} }
...@@ -567,7 +595,8 @@ acpi_ev_terminate (void) ...@@ -567,7 +595,8 @@ acpi_ev_terminate (void)
status = acpi_ev_remove_sci_handler (); status = acpi_ev_remove_sci_handler ();
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not remove SCI handler\n")); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not remove SCI handler\n"));
} }
} }
......
...@@ -58,6 +58,22 @@ static u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPA ...@@ -58,6 +58,22 @@ static u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPA
ACPI_ADR_SPACE_PCI_CONFIG, ACPI_ADR_SPACE_PCI_CONFIG,
ACPI_ADR_SPACE_DATA_TABLE}; ACPI_ADR_SPACE_DATA_TABLE};
/* Local prototypes */
static acpi_status
acpi_ev_reg_run (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value);
static acpi_status
acpi_ev_install_handler (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value);
/******************************************************************************* /*******************************************************************************
* *
...@@ -179,8 +195,8 @@ acpi_ev_initialize_op_regions ( ...@@ -179,8 +195,8 @@ acpi_ev_initialize_op_regions (
* *
* FUNCTION: acpi_ev_execute_reg_method * FUNCTION: acpi_ev_execute_reg_method
* *
* PARAMETERS: region_obj - Object structure * PARAMETERS: region_obj - Region object
* Function - Passed to _REG: On (1) or Off (0) * Function - Passed to _REG: On (1) or Off (0)
* *
* RETURN: Status * RETURN: Status
* *
...@@ -323,14 +339,16 @@ acpi_ev_address_space_dispatch ( ...@@ -323,14 +339,16 @@ acpi_ev_address_space_dispatch (
if (!region_setup) { if (!region_setup) {
/* No initialization routine, exit with error */ /* No initialization routine, exit with error */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No init routine for region(%p) [%s]\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"No init routine for region(%p) [%s]\n",
region_obj, acpi_ut_get_region_name (region_obj->region.space_id))); region_obj, acpi_ut_get_region_name (region_obj->region.space_id)));
return_ACPI_STATUS (AE_NOT_EXIST); return_ACPI_STATUS (AE_NOT_EXIST);
} }
/* /*
* We must exit the interpreter because the region setup will potentially * We must exit the interpreter because the region
* execute control methods (e.g., _REG method for this region) * setup will potentially execute control methods
* (e.g., _REG method for this region)
*/ */
acpi_ex_exit_interpreter (); acpi_ex_exit_interpreter ();
...@@ -621,7 +639,7 @@ acpi_ev_attach_region ( ...@@ -621,7 +639,7 @@ acpi_ev_attach_region (
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ev_install_handler ( acpi_ev_install_handler (
acpi_handle obj_handle, acpi_handle obj_handle,
u32 level, u32 level,
...@@ -848,7 +866,8 @@ acpi_ev_install_space_handler ( ...@@ -848,7 +866,8 @@ acpi_ev_install_space_handler (
if (handler_obj->address_space.handler == handler) { if (handler_obj->address_space.handler == handler) {
/* /*
* It is (relatively) OK to attempt to install the SAME * It is (relatively) OK to attempt to install the SAME
* handler twice. This can easily happen with PCI_Config space. * handler twice. This can easily happen
* with PCI_Config space.
*/ */
status = AE_SAME_HANDLER; status = AE_SAME_HANDLER;
goto unlock_and_exit; goto unlock_and_exit;
...@@ -1011,7 +1030,7 @@ acpi_ev_execute_reg_methods ( ...@@ -1011,7 +1030,7 @@ acpi_ev_execute_reg_methods (
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ev_reg_run ( acpi_ev_reg_run (
acpi_handle obj_handle, acpi_handle obj_handle,
u32 level, u32 level,
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Do any prep work for region handling, a nop for now * DESCRIPTION: Setup a system_memory operation region
* *
******************************************************************************/ ******************************************************************************/
...@@ -115,7 +115,7 @@ acpi_ev_system_memory_region_setup ( ...@@ -115,7 +115,7 @@ acpi_ev_system_memory_region_setup (
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Do any prep work for region handling * DESCRIPTION: Setup a IO operation region
* *
******************************************************************************/ ******************************************************************************/
...@@ -144,14 +144,14 @@ acpi_ev_io_space_region_setup ( ...@@ -144,14 +144,14 @@ acpi_ev_io_space_region_setup (
* *
* FUNCTION: acpi_ev_pci_config_region_setup * FUNCTION: acpi_ev_pci_config_region_setup
* *
* PARAMETERS: Handle - Region we are interested in * PARAMETERS: Handle - Region we are interested in
* Function - Start or stop * Function - Start or stop
* handler_context - Address space handler context * handler_context - Address space handler context
* region_context - Region specific context * region_context - Region specific context
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Do any prep work for region handling * DESCRIPTION: Setup a PCI_Config operation region
* *
* MUTEX: Assumes namespace is not locked * MUTEX: Assumes namespace is not locked
* *
...@@ -324,7 +324,7 @@ acpi_ev_pci_config_region_setup ( ...@@ -324,7 +324,7 @@ acpi_ev_pci_config_region_setup (
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Do any prep work for region handling * DESCRIPTION: Setup a pci_bAR operation region
* *
* MUTEX: Assumes namespace is not locked * MUTEX: Assumes namespace is not locked
* *
...@@ -355,7 +355,7 @@ acpi_ev_pci_bar_region_setup ( ...@@ -355,7 +355,7 @@ acpi_ev_pci_bar_region_setup (
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Do any prep work for region handling * DESCRIPTION: Setup a CMOS operation region
* *
* MUTEX: Assumes namespace is not locked * MUTEX: Assumes namespace is not locked
* *
...@@ -386,7 +386,7 @@ acpi_ev_cmos_region_setup ( ...@@ -386,7 +386,7 @@ acpi_ev_cmos_region_setup (
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Do any prep work for region handling * DESCRIPTION: Default region initialization
* *
******************************************************************************/ ******************************************************************************/
......
...@@ -49,6 +49,12 @@ ...@@ -49,6 +49,12 @@
#define _COMPONENT ACPI_EVENTS #define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evsci") ACPI_MODULE_NAME ("evsci")
/* Local prototypes */
static u32 ACPI_SYSTEM_XFACE
acpi_ev_sci_xrupt_handler (
void *context);
/******************************************************************************* /*******************************************************************************
* *
...@@ -146,7 +152,8 @@ acpi_ev_gpe_xrupt_handler ( ...@@ -146,7 +152,8 @@ acpi_ev_gpe_xrupt_handler (
******************************************************************************/ ******************************************************************************/
u32 u32
acpi_ev_install_sci_handler (void) acpi_ev_install_sci_handler (
void)
{ {
u32 status = AE_OK; u32 status = AE_OK;
...@@ -180,7 +187,8 @@ acpi_ev_install_sci_handler (void) ...@@ -180,7 +187,8 @@ acpi_ev_install_sci_handler (void)
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ev_remove_sci_handler (void) acpi_ev_remove_sci_handler (
void)
{ {
acpi_status status; acpi_status status;
......
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
* DESCRIPTION: Saves the pointer to the handler function * DESCRIPTION: Saves the pointer to the handler function
* *
******************************************************************************/ ******************************************************************************/
#ifdef ACPI_FUTURE_USAGE #ifdef ACPI_FUTURE_USAGE
acpi_status acpi_status
acpi_install_exception_handler ( acpi_install_exception_handler (
...@@ -457,7 +458,8 @@ acpi_remove_notify_handler ( ...@@ -457,7 +458,8 @@ acpi_remove_notify_handler (
/* Root Object */ /* Root Object */
if (device == ACPI_ROOT_OBJECT) { if (device == ACPI_ROOT_OBJECT) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing notify handler for ROOT object.\n")); ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Removing notify handler for ROOT object.\n"));
if (((handler_type & ACPI_SYSTEM_NOTIFY) && if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
!acpi_gbl_system_notify.handler) || !acpi_gbl_system_notify.handler) ||
...@@ -564,8 +566,9 @@ EXPORT_SYMBOL(acpi_remove_notify_handler); ...@@ -564,8 +566,9 @@ EXPORT_SYMBOL(acpi_remove_notify_handler);
* *
* FUNCTION: acpi_install_gpe_handler * FUNCTION: acpi_install_gpe_handler
* *
* PARAMETERS: gpe_number - The GPE number within the GPE block * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT
* gpe_block - GPE block (NULL == FADT GPEs) * defined GPEs)
* gpe_number - The GPE number within the GPE block
* Type - Whether this GPE should be treated as an * Type - Whether this GPE should be treated as an
* edge- or level-triggered interrupt. * edge- or level-triggered interrupt.
* Address - Address of the handler * Address - Address of the handler
...@@ -662,8 +665,9 @@ EXPORT_SYMBOL(acpi_install_gpe_handler); ...@@ -662,8 +665,9 @@ EXPORT_SYMBOL(acpi_install_gpe_handler);
* *
* FUNCTION: acpi_remove_gpe_handler * FUNCTION: acpi_remove_gpe_handler
* *
* PARAMETERS: gpe_number - The event to remove a handler * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT
* gpe_block - GPE block (NULL == FADT GPEs) * defined GPEs)
* gpe_number - The event to remove a handler
* Address - Address of the handler * Address - Address of the handler
* *
* RETURN: Status * RETURN: Status
...@@ -766,7 +770,8 @@ EXPORT_SYMBOL(acpi_remove_gpe_handler); ...@@ -766,7 +770,8 @@ EXPORT_SYMBOL(acpi_remove_gpe_handler);
* FUNCTION: acpi_acquire_global_lock * FUNCTION: acpi_acquire_global_lock
* *
* PARAMETERS: Timeout - How long the caller is willing to wait * PARAMETERS: Timeout - How long the caller is willing to wait
* out_handle - A handle to the lock if acquired * Handle - Where the handle to the lock is returned
* (if acquired)
* *
* RETURN: Status * RETURN: Status
* *
...@@ -812,7 +817,7 @@ EXPORT_SYMBOL(acpi_acquire_global_lock); ...@@ -812,7 +817,7 @@ EXPORT_SYMBOL(acpi_acquire_global_lock);
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Release the ACPI Global Lock * DESCRIPTION: Release the ACPI Global Lock. The handle must be valid.
* *
******************************************************************************/ ******************************************************************************/
......
...@@ -64,7 +64,8 @@ ...@@ -64,7 +64,8 @@
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_enable (void) acpi_enable (
void)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
...@@ -91,7 +92,8 @@ acpi_enable (void) ...@@ -91,7 +92,8 @@ acpi_enable (void)
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Transition to ACPI mode successful\n")); ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
"Transition to ACPI mode successful\n"));
} }
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
...@@ -106,12 +108,13 @@ acpi_enable (void) ...@@ -106,12 +108,13 @@ acpi_enable (void)
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Transfers the system into LEGACY mode. * DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode.
* *
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_disable (void) acpi_disable (
void)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
...@@ -125,7 +128,8 @@ acpi_disable (void) ...@@ -125,7 +128,8 @@ acpi_disable (void)
} }
if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) { if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) {
ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "System is already in legacy (non-ACPI) mode\n")); ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
"System is already in legacy (non-ACPI) mode\n"));
} }
else { else {
/* Transition to LEGACY mode */ /* Transition to LEGACY mode */
...@@ -133,7 +137,8 @@ acpi_disable (void) ...@@ -133,7 +137,8 @@ acpi_disable (void)
status = acpi_hw_set_mode (ACPI_SYS_MODE_LEGACY); status = acpi_hw_set_mode (ACPI_SYS_MODE_LEGACY);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not exit ACPI mode to legacy mode")); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not exit ACPI mode to legacy mode"));
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -214,7 +219,7 @@ EXPORT_SYMBOL(acpi_enable_event); ...@@ -214,7 +219,7 @@ EXPORT_SYMBOL(acpi_enable_event);
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Enable an ACPI event (general purpose) * DESCRIPTION: Set the type of an individual GPE
* *
******************************************************************************/ ******************************************************************************/
...@@ -519,13 +524,12 @@ acpi_clear_gpe ( ...@@ -519,13 +524,12 @@ acpi_clear_gpe (
#ifdef ACPI_FUTURE_USAGE #ifdef ACPI_FUTURE_USAGE
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_get_event_status * FUNCTION: acpi_get_event_status
* *
* PARAMETERS: Event - The fixed event * PARAMETERS: Event - The fixed event
* Event Status - Where the current status of the event will * event_status - Where the current status of the event will
* be returned * be returned
* *
* RETURN: Status * RETURN: Status
...@@ -571,7 +575,7 @@ acpi_get_event_status ( ...@@ -571,7 +575,7 @@ acpi_get_event_status (
* PARAMETERS: gpe_device - Parent GPE Device * PARAMETERS: gpe_device - Parent GPE Device
* gpe_number - GPE level within the GPE block * gpe_number - GPE level within the GPE block
* Flags - Called from an ISR or not * Flags - Called from an ISR or not
* Event Status - Where the current status of the event will * event_status - Where the current status of the event will
* be returned * be returned
* *
* RETURN: Status * RETURN: Status
...@@ -775,4 +779,5 @@ acpi_remove_gpe_block ( ...@@ -775,4 +779,5 @@ acpi_remove_gpe_block (
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
EXPORT_SYMBOL(acpi_remove_gpe_block); EXPORT_SYMBOL(acpi_remove_gpe_block);
...@@ -54,6 +54,14 @@ ...@@ -54,6 +54,14 @@
#define _COMPONENT ACPI_EXECUTER #define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exconfig") ACPI_MODULE_NAME ("exconfig")
/* Local prototypes */
static acpi_status
acpi_ex_add_table (
struct acpi_table_header *table,
struct acpi_namespace_node *parent_node,
union acpi_operand_object **ddb_handle);
/******************************************************************************* /*******************************************************************************
* *
...@@ -70,7 +78,7 @@ ...@@ -70,7 +78,7 @@
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ex_add_table ( acpi_ex_add_table (
struct acpi_table_header *table, struct acpi_table_header *table,
struct acpi_namespace_node *parent_node, struct acpi_namespace_node *parent_node,
...@@ -95,10 +103,10 @@ acpi_ex_add_table ( ...@@ -95,10 +103,10 @@ acpi_ex_add_table (
ACPI_MEMSET (&table_info, 0, sizeof (struct acpi_table_desc)); ACPI_MEMSET (&table_info, 0, sizeof (struct acpi_table_desc));
table_info.type = ACPI_TABLE_SSDT; table_info.type = ACPI_TABLE_SSDT;
table_info.pointer = table; table_info.pointer = table;
table_info.length = (acpi_size) table->length; table_info.length = (acpi_size) table->length;
table_info.allocation = ACPI_MEM_ALLOCATED; table_info.allocation = ACPI_MEM_ALLOCATED;
status = acpi_tb_install_table (&table_info); status = acpi_tb_install_table (&table_info);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
...@@ -226,11 +234,10 @@ acpi_ex_load_table_op ( ...@@ -226,11 +234,10 @@ acpi_ex_load_table_op (
start_node = parent_node; start_node = parent_node;
} }
/* /* Find the node referenced by the parameter_path_string */
* Find the node referenced by the parameter_path_string
*/
status = acpi_ns_get_node_by_path (operand[4]->string.pointer, start_node, status = acpi_ns_get_node_by_path (operand[4]->string.pointer, start_node,
ACPI_NS_SEARCH_PARENT, &parameter_node); ACPI_NS_SEARCH_PARENT, &parameter_node);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -248,7 +255,8 @@ acpi_ex_load_table_op ( ...@@ -248,7 +255,8 @@ acpi_ex_load_table_op (
if (parameter_node) { if (parameter_node) {
/* Store the parameter data into the optional parameter object */ /* Store the parameter data into the optional parameter object */
status = acpi_ex_store (operand[5], ACPI_CAST_PTR (union acpi_operand_object, parameter_node), status = acpi_ex_store (operand[5],
ACPI_CAST_PTR (union acpi_operand_object, parameter_node),
walk_state); walk_state);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
(void) acpi_ex_unload_table (ddb_handle); (void) acpi_ex_unload_table (ddb_handle);
...@@ -371,7 +379,8 @@ acpi_ex_load_op ( ...@@ -371,7 +379,8 @@ acpi_ex_load_op (
goto cleanup; goto cleanup;
} }
table_ptr = ACPI_CAST_PTR (struct acpi_table_header, buffer_desc->buffer.pointer); table_ptr = ACPI_CAST_PTR (struct acpi_table_header,
buffer_desc->buffer.pointer);
/* Sanity check the table length */ /* Sanity check the table length */
......
...@@ -50,6 +50,15 @@ ...@@ -50,6 +50,15 @@
#define _COMPONENT ACPI_EXECUTER #define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exconvrt") ACPI_MODULE_NAME ("exconvrt")
/* Local prototypes */
static u32
acpi_ex_convert_to_ascii (
acpi_integer integer,
u16 base,
u8 *string,
u8 max_length);
/******************************************************************************* /*******************************************************************************
* *
...@@ -115,9 +124,8 @@ acpi_ex_convert_to_integer ( ...@@ -115,9 +124,8 @@ acpi_ex_convert_to_integer (
*/ */
result = 0; result = 0;
/* /* String conversion is different than Buffer conversion */
* String conversion is different than Buffer conversion
*/
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
...@@ -168,9 +176,8 @@ acpi_ex_convert_to_integer ( ...@@ -168,9 +176,8 @@ acpi_ex_convert_to_integer (
break; break;
} }
/* /* Create a new integer */
* Create a new integer
*/
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
if (!return_desc) { if (!return_desc) {
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
...@@ -251,7 +258,8 @@ acpi_ex_convert_to_buffer ( ...@@ -251,7 +258,8 @@ acpi_ex_convert_to_buffer (
* ASL/AML code that depends on the null being transferred to the new * ASL/AML code that depends on the null being transferred to the new
* buffer. * buffer.
*/ */
return_desc = acpi_ut_create_buffer_object ((acpi_size) obj_desc->string.length + 1); return_desc = acpi_ut_create_buffer_object (
(acpi_size) obj_desc->string.length + 1);
if (!return_desc) { if (!return_desc) {
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
} }
...@@ -291,7 +299,7 @@ acpi_ex_convert_to_buffer ( ...@@ -291,7 +299,7 @@ acpi_ex_convert_to_buffer (
* *
******************************************************************************/ ******************************************************************************/
u32 static u32
acpi_ex_convert_to_ascii ( acpi_ex_convert_to_ascii (
acpi_integer integer, acpi_integer integer,
u16 base, u16 base,
...@@ -357,8 +365,9 @@ acpi_ex_convert_to_ascii ( ...@@ -357,8 +365,9 @@ acpi_ex_convert_to_ascii (
case 16: case 16:
hex_length = ACPI_MUL_2 (data_width); /* 2 ascii hex chars per data byte */ /* hex_length: 2 ascii hex chars per data byte */
hex_length = ACPI_MUL_2 (data_width);
for (i = 0, j = (hex_length-1); i < hex_length; i++, j--) { for (i = 0, j = (hex_length-1); i < hex_length; i++, j--) {
/* Get one hex digit, most significant digits first */ /* Get one hex digit, most significant digits first */
...@@ -475,7 +484,7 @@ acpi_ex_convert_to_string ( ...@@ -475,7 +484,7 @@ acpi_ex_convert_to_string (
/* Setup string length, base, and separator */ /* Setup string length, base, and separator */
switch (type) { switch (type) {
case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by to_decimal_string operator */ case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by to_decimal_string */
/* /*
* From ACPI: "If Data is a buffer, it is converted to a string of * From ACPI: "If Data is a buffer, it is converted to a string of
* decimal values separated by commas." * decimal values separated by commas."
...@@ -509,7 +518,7 @@ acpi_ex_convert_to_string ( ...@@ -509,7 +518,7 @@ acpi_ex_convert_to_string (
string_length = (obj_desc->buffer.length * 3); string_length = (obj_desc->buffer.length * 3);
break; break;
case ACPI_EXPLICIT_CONVERT_HEX: /* Used by to_hex_string operator */ case ACPI_EXPLICIT_CONVERT_HEX: /* Used by to_hex_string */
/* /*
* From ACPI: "If Data is a buffer, it is converted to a string of * From ACPI: "If Data is a buffer, it is converted to a string of
* hexadecimal values separated by commas." * hexadecimal values separated by commas."
...@@ -530,9 +539,8 @@ acpi_ex_convert_to_string ( ...@@ -530,9 +539,8 @@ acpi_ex_convert_to_string (
return_ACPI_STATUS (AE_AML_STRING_LIMIT); return_ACPI_STATUS (AE_AML_STRING_LIMIT);
} }
/* /* Create a new string object and string buffer */
* Create a new string object and string buffer
*/
return_desc = acpi_ut_create_string_object ((acpi_size) string_length); return_desc = acpi_ut_create_string_object ((acpi_size) string_length);
if (!return_desc) { if (!return_desc) {
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
...@@ -551,8 +559,10 @@ acpi_ex_convert_to_string ( ...@@ -551,8 +559,10 @@ acpi_ex_convert_to_string (
*new_buf++ = separator; /* each separated by a comma or space */ *new_buf++ = separator; /* each separated by a comma or space */
} }
/* Null terminate the string (overwrites final comma/space from above) */ /*
* Null terminate the string
* (overwrites final comma/space from above)
*/
new_buf--; new_buf--;
*new_buf = 0; *new_buf = 0;
break; break;
...@@ -645,7 +655,6 @@ acpi_ex_convert_to_target_type ( ...@@ -645,7 +655,6 @@ acpi_ex_convert_to_target_type (
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
/* /*
* The operand must be a String. We can convert an * The operand must be a String. We can convert an
* Integer or Buffer if necessary * Integer or Buffer if necessary
...@@ -656,7 +665,6 @@ acpi_ex_convert_to_target_type ( ...@@ -656,7 +665,6 @@ acpi_ex_convert_to_target_type (
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
/* /*
* The operand must be a Buffer. We can convert an * The operand must be a Buffer. We can convert an
* Integer or String if necessary * Integer or String if necessary
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
#ifndef ACPI_NO_METHOD_EXECUTION #ifndef ACPI_NO_METHOD_EXECUTION
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ex_create_alias * FUNCTION: acpi_ex_create_alias
* *
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
* *
* DESCRIPTION: Create a new named alias * DESCRIPTION: Create a new named alias
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ex_create_alias ( acpi_ex_create_alias (
...@@ -140,8 +140,7 @@ acpi_ex_create_alias ( ...@@ -140,8 +140,7 @@ acpi_ex_create_alias (
* target node or the alias Node * target node or the alias Node
*/ */
status = acpi_ns_attach_object (alias_node, status = acpi_ns_attach_object (alias_node,
acpi_ns_get_attached_object (target_node), acpi_ns_get_attached_object (target_node), target_node->type);
target_node->type);
break; break;
} }
...@@ -151,7 +150,7 @@ acpi_ex_create_alias ( ...@@ -151,7 +150,7 @@ acpi_ex_create_alias (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ex_create_event * FUNCTION: acpi_ex_create_event
* *
...@@ -161,7 +160,7 @@ acpi_ex_create_alias ( ...@@ -161,7 +160,7 @@ acpi_ex_create_alias (
* *
* DESCRIPTION: Create a new event object * DESCRIPTION: Create a new event object
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ex_create_event ( acpi_ex_create_event (
...@@ -185,7 +184,7 @@ acpi_ex_create_event ( ...@@ -185,7 +184,7 @@ acpi_ex_create_event (
* that the event is created in an unsignalled state * that the event is created in an unsignalled state
*/ */
status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 0, status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 0,
&obj_desc->event.semaphore); &obj_desc->event.semaphore);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
goto cleanup; goto cleanup;
} }
...@@ -193,7 +192,7 @@ acpi_ex_create_event ( ...@@ -193,7 +192,7 @@ acpi_ex_create_event (
/* Attach object to the Node */ /* Attach object to the Node */
status = acpi_ns_attach_object ((struct acpi_namespace_node *) walk_state->operands[0], status = acpi_ns_attach_object ((struct acpi_namespace_node *) walk_state->operands[0],
obj_desc, ACPI_TYPE_EVENT); obj_desc, ACPI_TYPE_EVENT);
cleanup: cleanup:
/* /*
...@@ -205,7 +204,7 @@ acpi_ex_create_event ( ...@@ -205,7 +204,7 @@ acpi_ex_create_event (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ex_create_mutex * FUNCTION: acpi_ex_create_mutex
* *
...@@ -217,7 +216,7 @@ acpi_ex_create_event ( ...@@ -217,7 +216,7 @@ acpi_ex_create_event (
* *
* Mutex (Name[0], sync_level[1]) * Mutex (Name[0], sync_level[1])
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ex_create_mutex ( acpi_ex_create_mutex (
...@@ -267,20 +266,20 @@ acpi_ex_create_mutex ( ...@@ -267,20 +266,20 @@ acpi_ex_create_mutex (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ex_create_region * FUNCTION: acpi_ex_create_region
* *
* PARAMETERS: aml_start - Pointer to the region declaration AML * PARAMETERS: aml_start - Pointer to the region declaration AML
* aml_length - Max length of the declaration AML * aml_length - Max length of the declaration AML
* Operands - List of operands for the opcode * region_space - space_iD for the region
* walk_state - Current state * walk_state - Current state
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Create a new operation region object * DESCRIPTION: Create a new operation region object
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ex_create_region ( acpi_ex_create_region (
...@@ -321,7 +320,7 @@ acpi_ex_create_region ( ...@@ -321,7 +320,7 @@ acpi_ex_create_region (
} }
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (%X)\n", ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (%X)\n",
acpi_ut_get_region_name (region_space), region_space)); acpi_ut_get_region_name (region_space), region_space));
/* Create the region descriptor */ /* Create the region descriptor */
...@@ -360,7 +359,7 @@ acpi_ex_create_region ( ...@@ -360,7 +359,7 @@ acpi_ex_create_region (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ex_create_table_region * FUNCTION: acpi_ex_create_table_region
* *
...@@ -370,7 +369,7 @@ acpi_ex_create_region ( ...@@ -370,7 +369,7 @@ acpi_ex_create_region (
* *
* DESCRIPTION: Create a new data_table_region object * DESCRIPTION: Create a new data_table_region object
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ex_create_table_region ( acpi_ex_create_table_region (
...@@ -455,7 +454,7 @@ acpi_ex_create_table_region ( ...@@ -455,7 +454,7 @@ acpi_ex_create_table_region (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ex_create_processor * FUNCTION: acpi_ex_create_processor
* *
...@@ -467,7 +466,7 @@ acpi_ex_create_table_region ( ...@@ -467,7 +466,7 @@ acpi_ex_create_table_region (
* *
* Processor (Name[0], cpu_iD[1], pblock_addr[2], pblock_length[3]) * Processor (Name[0], cpu_iD[1], pblock_addr[2], pblock_length[3])
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ex_create_processor ( acpi_ex_create_processor (
...@@ -488,9 +487,8 @@ acpi_ex_create_processor ( ...@@ -488,9 +487,8 @@ acpi_ex_create_processor (
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
} }
/* /* Initialize the processor object from the operands */
* Initialize the processor object from the operands
*/
obj_desc->processor.proc_id = (u8) operand[1]->integer.value; obj_desc->processor.proc_id = (u8) operand[1]->integer.value;
obj_desc->processor.address = (acpi_io_address) operand[2]->integer.value; obj_desc->processor.address = (acpi_io_address) operand[2]->integer.value;
obj_desc->processor.length = (u8) operand[3]->integer.value; obj_desc->processor.length = (u8) operand[3]->integer.value;
...@@ -507,7 +505,7 @@ acpi_ex_create_processor ( ...@@ -507,7 +505,7 @@ acpi_ex_create_processor (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ex_create_power_resource * FUNCTION: acpi_ex_create_power_resource
* *
...@@ -519,7 +517,7 @@ acpi_ex_create_processor ( ...@@ -519,7 +517,7 @@ acpi_ex_create_processor (
* *
* power_resource (Name[0], system_level[1], resource_order[2]) * power_resource (Name[0], system_level[1], resource_order[2])
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ex_create_power_resource ( acpi_ex_create_power_resource (
...@@ -555,10 +553,10 @@ acpi_ex_create_power_resource ( ...@@ -555,10 +553,10 @@ acpi_ex_create_power_resource (
acpi_ut_remove_reference (obj_desc); acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
#endif #endif
/*****************************************************************************
/*******************************************************************************
* *
* FUNCTION: acpi_ex_create_method * FUNCTION: acpi_ex_create_method
* *
...@@ -570,7 +568,7 @@ acpi_ex_create_power_resource ( ...@@ -570,7 +568,7 @@ acpi_ex_create_power_resource (
* *
* DESCRIPTION: Create a new method object * DESCRIPTION: Create a new method object
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ex_create_method ( acpi_ex_create_method (
......
...@@ -51,23 +51,48 @@ ...@@ -51,23 +51,48 @@
#define _COMPONENT ACPI_EXECUTER #define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exdump") ACPI_MODULE_NAME ("exdump")
/* Local prototypes */
#ifdef ACPI_FUTURE_USAGE
static void
acpi_ex_out_string (
char *title,
char *value);
static void
acpi_ex_out_pointer (
char *title,
void *value);
static void
acpi_ex_out_integer (
char *title,
u32 value);
static void
acpi_ex_out_address (
char *title,
acpi_physical_address value);
#endif /* ACPI_FUTURE_USAGE */
/* /*
* The following routines are used for debug output only * The following routines are used for debug output only
*/ */
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ex_dump_operand * FUNCTION: acpi_ex_dump_operand
* *
* PARAMETERS: *obj_desc - Pointer to entry to be dumped * PARAMETERS: *obj_desc - Pointer to entry to be dumped
* Depth - Current nesting depth
* *
* RETURN: None * RETURN: None
* *
* DESCRIPTION: Dump an operand object * DESCRIPTION: Dump an operand object
* *
****************************************************************************/ ******************************************************************************/
void void
acpi_ex_dump_operand ( acpi_ex_dump_operand (
...@@ -86,9 +111,8 @@ acpi_ex_dump_operand ( ...@@ -86,9 +111,8 @@ acpi_ex_dump_operand (
} }
if (!obj_desc) { if (!obj_desc) {
/* /* This could be a null element of a package */
* This could be a null element of a package
*/
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n")); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n"));
return; return;
} }
...@@ -117,6 +141,8 @@ acpi_ex_dump_operand ( ...@@ -117,6 +141,8 @@ acpi_ex_dump_operand (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", obj_desc)); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", obj_desc));
} }
/* Decode object type */
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_LOCAL_REFERENCE: case ACPI_TYPE_LOCAL_REFERENCE:
...@@ -274,7 +300,9 @@ acpi_ex_dump_operand ( ...@@ -274,7 +300,9 @@ acpi_ex_dump_operand (
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
acpi_os_printf ("String length %X @ %p ", acpi_os_printf ("String length %X @ %p ",
obj_desc->string.length, obj_desc->string.pointer); obj_desc->string.length,
obj_desc->string.pointer);
acpi_ut_print_string (obj_desc->string.pointer, ACPI_UINT8_MAX); acpi_ut_print_string (obj_desc->string.pointer, ACPI_UINT8_MAX);
acpi_os_printf ("\n"); acpi_os_printf ("\n");
break; break;
...@@ -290,10 +318,13 @@ acpi_ex_dump_operand ( ...@@ -290,10 +318,13 @@ acpi_ex_dump_operand (
acpi_os_printf ( acpi_os_printf (
"region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", "region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n",
obj_desc->field.bit_length, obj_desc->field.access_byte_width, obj_desc->field.bit_length,
obj_desc->field.access_byte_width,
obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK, obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK,
obj_desc->field.field_flags & AML_FIELD_UPDATE_RULE_MASK, obj_desc->field.field_flags & AML_FIELD_UPDATE_RULE_MASK,
obj_desc->field.base_byte_offset, obj_desc->field.start_field_bit_offset); obj_desc->field.base_byte_offset,
obj_desc->field.start_field_bit_offset);
acpi_ex_dump_operand (obj_desc->field.region_obj, depth+1); acpi_ex_dump_operand (obj_desc->field.region_obj, depth+1);
break; break;
...@@ -308,13 +339,15 @@ acpi_ex_dump_operand ( ...@@ -308,13 +339,15 @@ acpi_ex_dump_operand (
acpi_os_printf ( acpi_os_printf (
"buffer_field: %X bits at byte %X bit %X of \n", "buffer_field: %X bits at byte %X bit %X of \n",
obj_desc->buffer_field.bit_length, obj_desc->buffer_field.base_byte_offset, obj_desc->buffer_field.bit_length,
obj_desc->buffer_field.base_byte_offset,
obj_desc->buffer_field.start_field_bit_offset); obj_desc->buffer_field.start_field_bit_offset);
if (!obj_desc->buffer_field.buffer_obj) { if (!obj_desc->buffer_field.buffer_obj) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL* \n")); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL* \n"));
} }
else if (ACPI_GET_OBJECT_TYPE (obj_desc->buffer_field.buffer_obj) != ACPI_TYPE_BUFFER) { else if (ACPI_GET_OBJECT_TYPE (obj_desc->buffer_field.buffer_obj) !=
ACPI_TYPE_BUFFER) {
acpi_os_printf ("*not a Buffer* \n"); acpi_os_printf ("*not a Buffer* \n");
} }
else { else {
...@@ -331,10 +364,10 @@ acpi_ex_dump_operand ( ...@@ -331,10 +364,10 @@ acpi_ex_dump_operand (
case ACPI_TYPE_METHOD: case ACPI_TYPE_METHOD:
acpi_os_printf ( acpi_os_printf ("Method(%X) @ %p:%X\n",
"Method(%X) @ %p:%X\n",
obj_desc->method.param_count, obj_desc->method.param_count,
obj_desc->method.aml_start, obj_desc->method.aml_length); obj_desc->method.aml_start,
obj_desc->method.aml_length);
break; break;
...@@ -379,7 +412,7 @@ acpi_ex_dump_operand ( ...@@ -379,7 +412,7 @@ acpi_ex_dump_operand (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ex_dump_operands * FUNCTION: acpi_ex_dump_operands
* *
...@@ -393,7 +426,7 @@ acpi_ex_dump_operand ( ...@@ -393,7 +426,7 @@ acpi_ex_dump_operand (
* *
* DESCRIPTION: Dump the object stack * DESCRIPTION: Dump the object stack
* *
****************************************************************************/ ******************************************************************************/
void void
acpi_ex_dump_operands ( acpi_ex_dump_operands (
...@@ -441,10 +474,9 @@ acpi_ex_dump_operands ( ...@@ -441,10 +474,9 @@ acpi_ex_dump_operands (
#ifdef ACPI_FUTURE_USAGE #ifdef ACPI_FUTURE_USAGE
/*******************************************************************************
/*****************************************************************************
* *
* FUNCTION: acpi_ex_out* * FUNCTION: acpi_ex_out* functions
* *
* PARAMETERS: Title - Descriptive text * PARAMETERS: Title - Descriptive text
* Value - Value to be displayed * Value - Value to be displayed
...@@ -453,9 +485,9 @@ acpi_ex_dump_operands ( ...@@ -453,9 +485,9 @@ acpi_ex_dump_operands (
* reduce the number of format strings required and keeps them * reduce the number of format strings required and keeps them
* all in one place for easy modification. * all in one place for easy modification.
* *
****************************************************************************/ ******************************************************************************/
void static void
acpi_ex_out_string ( acpi_ex_out_string (
char *title, char *title,
char *value) char *value)
...@@ -463,7 +495,7 @@ acpi_ex_out_string ( ...@@ -463,7 +495,7 @@ acpi_ex_out_string (
acpi_os_printf ("%20s : %s\n", title, value); acpi_os_printf ("%20s : %s\n", title, value);
} }
void static void
acpi_ex_out_pointer ( acpi_ex_out_pointer (
char *title, char *title,
void *value) void *value)
...@@ -471,7 +503,7 @@ acpi_ex_out_pointer ( ...@@ -471,7 +503,7 @@ acpi_ex_out_pointer (
acpi_os_printf ("%20s : %p\n", title, value); acpi_os_printf ("%20s : %p\n", title, value);
} }
void static void
acpi_ex_out_integer ( acpi_ex_out_integer (
char *title, char *title,
u32 value) u32 value)
...@@ -479,7 +511,7 @@ acpi_ex_out_integer ( ...@@ -479,7 +511,7 @@ acpi_ex_out_integer (
acpi_os_printf ("%20s : %X\n", title, value); acpi_os_printf ("%20s : %X\n", title, value);
} }
void static void
acpi_ex_out_address ( acpi_ex_out_address (
char *title, char *title,
acpi_physical_address value) acpi_physical_address value)
...@@ -493,16 +525,16 @@ acpi_ex_out_address ( ...@@ -493,16 +525,16 @@ acpi_ex_out_address (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ex_dump_node * FUNCTION: acpi_ex_dump_node
* *
* PARAMETERS: *Node - Descriptor to dump * PARAMETERS: *Node - Descriptor to dump
* Flags - Force display * Flags - Force display if TRUE
* *
* DESCRIPTION: Dumps the members of the given.Node * DESCRIPTION: Dumps the members of the given.Node
* *
****************************************************************************/ ******************************************************************************/
void void
acpi_ex_dump_node ( acpi_ex_dump_node (
...@@ -531,16 +563,16 @@ acpi_ex_dump_node ( ...@@ -531,16 +563,16 @@ acpi_ex_dump_node (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ex_dump_object_descriptor * FUNCTION: acpi_ex_dump_object_descriptor
* *
* PARAMETERS: *Object - Descriptor to dump * PARAMETERS: *Object - Descriptor to dump
* Flags - Force display * Flags - Force display if TRUE
* *
* DESCRIPTION: Dumps the members of the object descriptor given. * DESCRIPTION: Dumps the members of the object descriptor given.
* *
****************************************************************************/ ******************************************************************************/
void void
acpi_ex_dump_object_descriptor ( acpi_ex_dump_object_descriptor (
...@@ -553,6 +585,10 @@ acpi_ex_dump_object_descriptor ( ...@@ -553,6 +585,10 @@ acpi_ex_dump_object_descriptor (
ACPI_FUNCTION_TRACE ("ex_dump_object_descriptor"); ACPI_FUNCTION_TRACE ("ex_dump_object_descriptor");
if (!obj_desc) {
return_VOID;
}
if (!flags) { if (!flags) {
if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) { if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) {
return_VOID; return_VOID;
...@@ -747,11 +783,17 @@ acpi_ex_dump_object_descriptor ( ...@@ -747,11 +783,17 @@ acpi_ex_dump_object_descriptor (
case ACPI_TYPE_LOCAL_REFERENCE: case ACPI_TYPE_LOCAL_REFERENCE:
acpi_ex_out_integer ("target_type", obj_desc->reference.target_type); acpi_ex_out_integer ("target_type", obj_desc->reference.target_type);
acpi_ex_out_string ("Opcode", (acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name); acpi_ex_out_string ("Opcode", (acpi_ps_get_opcode_info (
obj_desc->reference.opcode))->name);
acpi_ex_out_integer ("Offset", obj_desc->reference.offset); acpi_ex_out_integer ("Offset", obj_desc->reference.offset);
acpi_ex_out_pointer ("obj_desc", obj_desc->reference.object); acpi_ex_out_pointer ("obj_desc", obj_desc->reference.object);
acpi_ex_out_pointer ("Node", obj_desc->reference.node); acpi_ex_out_pointer ("Node", obj_desc->reference.node);
acpi_ex_out_pointer ("Where", obj_desc->reference.where); acpi_ex_out_pointer ("Where", obj_desc->reference.where);
if (obj_desc->reference.object) {
acpi_os_printf ("\nReferenced Object:\n");
acpi_ex_dump_object_descriptor (obj_desc->reference.object, flags);
}
break; break;
...@@ -788,6 +830,5 @@ acpi_ex_dump_object_descriptor ( ...@@ -788,6 +830,5 @@ acpi_ex_dump_object_descriptor (
} }
#endif /* ACPI_FUTURE_USAGE */ #endif /* ACPI_FUTURE_USAGE */
#endif #endif
...@@ -120,8 +120,8 @@ acpi_ex_read_data_from_field ( ...@@ -120,8 +120,8 @@ acpi_ex_read_data_from_field (
* Note: Smbus protocol value is passed in upper 16-bits of Function * Note: Smbus protocol value is passed in upper 16-bits of Function
*/ */
status = acpi_ex_access_region (obj_desc, 0, status = acpi_ex_access_region (obj_desc, 0,
ACPI_CAST_PTR (acpi_integer, buffer_desc->buffer.pointer), ACPI_CAST_PTR (acpi_integer, buffer_desc->buffer.pointer),
ACPI_READ | (obj_desc->field.attribute << 16)); ACPI_READ | (obj_desc->field.attribute << 16));
acpi_ex_release_global_lock (locked); acpi_ex_release_global_lock (locked);
goto exit; goto exit;
} }
...@@ -196,6 +196,7 @@ acpi_ex_read_data_from_field ( ...@@ -196,6 +196,7 @@ acpi_ex_read_data_from_field (
* *
* PARAMETERS: source_desc - Contains data to write * PARAMETERS: source_desc - Contains data to write
* obj_desc - The named field * obj_desc - The named field
* result_desc - Where the return value is returned, if any
* *
* RETURN: Status * RETURN: Status
* *
...@@ -250,12 +251,15 @@ acpi_ex_write_data_to_field ( ...@@ -250,12 +251,15 @@ acpi_ex_write_data_to_field (
if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) { if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) {
ACPI_REPORT_ERROR (("SMBus write requires Buffer, found type %s\n", ACPI_REPORT_ERROR (("SMBus write requires Buffer, found type %s\n",
acpi_ut_get_object_type_name (source_desc))); acpi_ut_get_object_type_name (source_desc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
} }
if (source_desc->buffer.length < ACPI_SMBUS_BUFFER_SIZE) { if (source_desc->buffer.length < ACPI_SMBUS_BUFFER_SIZE) {
ACPI_REPORT_ERROR (("SMBus write requires Buffer of length %X, found length %X\n", ACPI_REPORT_ERROR ((
"SMBus write requires Buffer of length %X, found length %X\n",
ACPI_SMBUS_BUFFER_SIZE, source_desc->buffer.length)); ACPI_SMBUS_BUFFER_SIZE, source_desc->buffer.length));
return_ACPI_STATUS (AE_AML_BUFFER_LIMIT); return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);
} }
...@@ -265,14 +269,16 @@ acpi_ex_write_data_to_field ( ...@@ -265,14 +269,16 @@ acpi_ex_write_data_to_field (
} }
buffer = buffer_desc->buffer.pointer; buffer = buffer_desc->buffer.pointer;
ACPI_MEMCPY (buffer, source_desc->buffer.pointer, ACPI_SMBUS_BUFFER_SIZE); ACPI_MEMCPY (buffer, source_desc->buffer.pointer,
ACPI_SMBUS_BUFFER_SIZE);
/* Lock entire transaction if requested */ /* Lock entire transaction if requested */
locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags); locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
/* /*
* Perform the write (returns status and perhaps data in the same buffer) * Perform the write (returns status and perhaps data in the
* same buffer)
* Note: SMBus protocol type is passed in upper 16-bits of Function. * Note: SMBus protocol type is passed in upper 16-bits of Function.
*/ */
status = acpi_ex_access_region (obj_desc, 0, status = acpi_ex_access_region (obj_desc, 0,
...@@ -284,9 +290,8 @@ acpi_ex_write_data_to_field ( ...@@ -284,9 +290,8 @@ acpi_ex_write_data_to_field (
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
/* /* Get a pointer to the data to be written */
* Get a pointer to the data to be written
*/
switch (ACPI_GET_OBJECT_TYPE (source_desc)) { switch (ACPI_GET_OBJECT_TYPE (source_desc)) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
buffer = &source_desc->integer.value; buffer = &source_desc->integer.value;
...@@ -314,7 +319,8 @@ acpi_ex_write_data_to_field ( ...@@ -314,7 +319,8 @@ acpi_ex_write_data_to_field (
* the ACPI specification. * the ACPI specification.
*/ */
new_buffer = NULL; new_buffer = NULL;
required_length = ACPI_ROUND_BITS_UP_TO_BYTES (obj_desc->common_field.bit_length); required_length = ACPI_ROUND_BITS_UP_TO_BYTES (
obj_desc->common_field.bit_length);
if (length < required_length) { if (length < required_length) {
/* We need to create a new buffer */ /* We need to create a new buffer */
...@@ -338,6 +344,7 @@ acpi_ex_write_data_to_field ( ...@@ -338,6 +344,7 @@ acpi_ex_write_data_to_field (
"field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n", "field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n",
source_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (source_desc)), source_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (source_desc)),
ACPI_GET_OBJECT_TYPE (source_desc), buffer, length)); ACPI_GET_OBJECT_TYPE (source_desc), buffer, length));
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"field_write [TO]: Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n", "field_write [TO]: Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n",
obj_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (obj_desc)), obj_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (obj_desc)),
......
...@@ -52,12 +52,31 @@ ...@@ -52,12 +52,31 @@
#define _COMPONENT ACPI_EXECUTER #define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exfldio") ACPI_MODULE_NAME ("exfldio")
/* Local prototypes */
static acpi_status
acpi_ex_field_datum_io (
union acpi_operand_object *obj_desc,
u32 field_datum_byte_offset,
acpi_integer *value,
u32 read_write);
static u8
acpi_ex_register_overflow (
union acpi_operand_object *obj_desc,
acpi_integer value);
static acpi_status
acpi_ex_setup_region (
union acpi_operand_object *obj_desc,
u32 field_datum_byte_offset);
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ex_setup_region * FUNCTION: acpi_ex_setup_region
* *
* PARAMETERS: *obj_desc - Field to be read or written * PARAMETERS: obj_desc - Field to be read or written
* field_datum_byte_offset - Byte offset of this datum within the * field_datum_byte_offset - Byte offset of this datum within the
* parent field * parent field
* *
...@@ -69,7 +88,7 @@ ...@@ -69,7 +88,7 @@
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ex_setup_region ( acpi_ex_setup_region (
union acpi_operand_object *obj_desc, union acpi_operand_object *obj_desc,
u32 field_datum_byte_offset) u32 field_datum_byte_offset)
...@@ -127,9 +146,9 @@ acpi_ex_setup_region ( ...@@ -127,9 +146,9 @@ acpi_ex_setup_region (
* length of one field datum (access width) must fit within the region. * length of one field datum (access width) must fit within the region.
* (Region length is specified in bytes) * (Region length is specified in bytes)
*/ */
if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset +
+ field_datum_byte_offset field_datum_byte_offset +
+ obj_desc->common_field.access_byte_width)) { obj_desc->common_field.access_byte_width)) {
if (acpi_gbl_enable_interpreter_slack) { if (acpi_gbl_enable_interpreter_slack) {
/* /*
* Slack mode only: We will go ahead and allow access to this * Slack mode only: We will go ahead and allow access to this
...@@ -155,7 +174,8 @@ acpi_ex_setup_region ( ...@@ -155,7 +174,8 @@ acpi_ex_setup_region (
"Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n", "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n",
acpi_ut_get_node_name (obj_desc->common_field.node), acpi_ut_get_node_name (obj_desc->common_field.node),
obj_desc->common_field.access_byte_width, obj_desc->common_field.access_byte_width,
acpi_ut_get_node_name (rgn_desc->region.node), rgn_desc->region.length)); acpi_ut_get_node_name (rgn_desc->region.node),
rgn_desc->region.length));
} }
/* /*
...@@ -167,7 +187,8 @@ acpi_ex_setup_region ( ...@@ -167,7 +187,8 @@ acpi_ex_setup_region (
acpi_ut_get_node_name (obj_desc->common_field.node), acpi_ut_get_node_name (obj_desc->common_field.node),
obj_desc->common_field.base_byte_offset, obj_desc->common_field.base_byte_offset,
field_datum_byte_offset, obj_desc->common_field.access_byte_width, field_datum_byte_offset, obj_desc->common_field.access_byte_width,
acpi_ut_get_node_name (rgn_desc->region.node), rgn_desc->region.length)); acpi_ut_get_node_name (rgn_desc->region.node),
rgn_desc->region.length));
return_ACPI_STATUS (AE_AML_REGION_LIMIT); return_ACPI_STATUS (AE_AML_REGION_LIMIT);
} }
...@@ -180,10 +201,10 @@ acpi_ex_setup_region ( ...@@ -180,10 +201,10 @@ acpi_ex_setup_region (
* *
* FUNCTION: acpi_ex_access_region * FUNCTION: acpi_ex_access_region
* *
* PARAMETERS: *obj_desc - Field to be read * PARAMETERS: obj_desc - Field to be read
* field_datum_byte_offset - Byte offset of this datum within the * field_datum_byte_offset - Byte offset of this datum within the
* parent field * parent field
* *Value - Where to store value (must at least * Value - Where to store value (must at least
* the size of acpi_integer) * the size of acpi_integer)
* Function - Read or Write flag plus other region- * Function - Read or Write flag plus other region-
* dependent flags * dependent flags
...@@ -226,9 +247,9 @@ acpi_ex_access_region ( ...@@ -226,9 +247,9 @@ acpi_ex_access_region (
* 3) The current offset into the field * 3) The current offset into the field
*/ */
rgn_desc = obj_desc->common_field.region_obj; rgn_desc = obj_desc->common_field.region_obj;
address = rgn_desc->region.address address = rgn_desc->region.address +
+ obj_desc->common_field.base_byte_offset obj_desc->common_field.base_byte_offset +
+ field_datum_byte_offset; field_datum_byte_offset;
if ((function & ACPI_IO_MASK) == ACPI_READ) { if ((function & ACPI_IO_MASK) == ACPI_READ) {
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[READ]")); ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[READ]"));
...@@ -249,7 +270,8 @@ acpi_ex_access_region ( ...@@ -249,7 +270,8 @@ acpi_ex_access_region (
/* Invoke the appropriate address_space/op_region handler */ /* Invoke the appropriate address_space/op_region handler */
status = acpi_ev_address_space_dispatch (rgn_desc, function, status = acpi_ev_address_space_dispatch (rgn_desc, function,
address, ACPI_MUL_8 (obj_desc->common_field.access_byte_width), value); address,
ACPI_MUL_8 (obj_desc->common_field.access_byte_width), value);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
if (status == AE_NOT_IMPLEMENTED) { if (status == AE_NOT_IMPLEMENTED) {
...@@ -274,7 +296,7 @@ acpi_ex_access_region ( ...@@ -274,7 +296,7 @@ acpi_ex_access_region (
* *
* FUNCTION: acpi_ex_register_overflow * FUNCTION: acpi_ex_register_overflow
* *
* PARAMETERS: *obj_desc - Register(Field) to be written * PARAMETERS: obj_desc - Register(Field) to be written
* Value - Value to be stored * Value - Value to be stored
* *
* RETURN: TRUE if value overflows the field, FALSE otherwise * RETURN: TRUE if value overflows the field, FALSE otherwise
...@@ -287,7 +309,7 @@ acpi_ex_access_region ( ...@@ -287,7 +309,7 @@ acpi_ex_access_region (
* *
******************************************************************************/ ******************************************************************************/
u8 static u8
acpi_ex_register_overflow ( acpi_ex_register_overflow (
union acpi_operand_object *obj_desc, union acpi_operand_object *obj_desc,
acpi_integer value) acpi_integer value)
...@@ -319,10 +341,10 @@ acpi_ex_register_overflow ( ...@@ -319,10 +341,10 @@ acpi_ex_register_overflow (
* *
* FUNCTION: acpi_ex_field_datum_io * FUNCTION: acpi_ex_field_datum_io
* *
* PARAMETERS: *obj_desc - Field to be read * PARAMETERS: obj_desc - Field to be read
* field_datum_byte_offset - Byte offset of this datum within the * field_datum_byte_offset - Byte offset of this datum within the
* parent field * parent field
* *Value - Where to store value (must be 64 bits) * Value - Where to store value (must be 64 bits)
* read_write - Read or Write flag * read_write - Read or Write flag
* *
* RETURN: Status * RETURN: Status
...@@ -333,7 +355,7 @@ acpi_ex_register_overflow ( ...@@ -333,7 +355,7 @@ acpi_ex_register_overflow (
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ex_field_datum_io ( acpi_ex_field_datum_io (
union acpi_operand_object *obj_desc, union acpi_operand_object *obj_desc,
u32 field_datum_byte_offset, u32 field_datum_byte_offset,
...@@ -350,7 +372,9 @@ acpi_ex_field_datum_io ( ...@@ -350,7 +372,9 @@ acpi_ex_field_datum_io (
if (read_write == ACPI_READ) { if (read_write == ACPI_READ) {
if (!value) { if (!value) {
local_value = 0; local_value = 0;
value = &local_value; /* To support reads without saving return value */
/* To support reads without saving return value */
value = &local_value;
} }
/* Clear the entire return buffer first, [Very Important!] */ /* Clear the entire return buffer first, [Very Important!] */
...@@ -363,8 +387,10 @@ acpi_ex_field_datum_io ( ...@@ -363,8 +387,10 @@ acpi_ex_field_datum_io (
* *
* buffer_field - Read/write from/to a Buffer * buffer_field - Read/write from/to a Buffer
* region_field - Read/write from/to a Operation Region. * region_field - Read/write from/to a Operation Region.
* bank_field - Write to a Bank Register, then read/write from/to an op_region * bank_field - Write to a Bank Register, then read/write from/to an
* index_field - Write to an Index Register, then read/write from/to a Data Register * operation_region
* index_field - Write to an Index Register, then read/write from/to a
* Data Register
*/ */
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_BUFFER_FIELD: case ACPI_TYPE_BUFFER_FIELD:
...@@ -384,19 +410,20 @@ acpi_ex_field_datum_io ( ...@@ -384,19 +410,20 @@ acpi_ex_field_datum_io (
* Copy the data from the source buffer. * Copy the data from the source buffer.
* Length is the field width in bytes. * Length is the field width in bytes.
*/ */
ACPI_MEMCPY (value, (obj_desc->buffer_field.buffer_obj)->buffer.pointer ACPI_MEMCPY (value,
+ obj_desc->buffer_field.base_byte_offset (obj_desc->buffer_field.buffer_obj)->buffer.pointer +
+ field_datum_byte_offset, obj_desc->buffer_field.base_byte_offset +
obj_desc->common_field.access_byte_width); field_datum_byte_offset,
obj_desc->common_field.access_byte_width);
} }
else { else {
/* /*
* Copy the data to the target buffer. * Copy the data to the target buffer.
* Length is the field width in bytes. * Length is the field width in bytes.
*/ */
ACPI_MEMCPY ((obj_desc->buffer_field.buffer_obj)->buffer.pointer ACPI_MEMCPY ((obj_desc->buffer_field.buffer_obj)->buffer.pointer +
+ obj_desc->buffer_field.base_byte_offset obj_desc->buffer_field.base_byte_offset +
+ field_datum_byte_offset, field_datum_byte_offset,
value, obj_desc->common_field.access_byte_width); value, obj_desc->common_field.access_byte_width);
} }
...@@ -406,8 +433,10 @@ acpi_ex_field_datum_io ( ...@@ -406,8 +433,10 @@ acpi_ex_field_datum_io (
case ACPI_TYPE_LOCAL_BANK_FIELD: case ACPI_TYPE_LOCAL_BANK_FIELD:
/* Ensure that the bank_value is not beyond the capacity of the register */ /*
* Ensure that the bank_value is not beyond the capacity of
* the register
*/
if (acpi_ex_register_overflow (obj_desc->bank_field.bank_obj, if (acpi_ex_register_overflow (obj_desc->bank_field.bank_obj,
(acpi_integer) obj_desc->bank_field.value)) { (acpi_integer) obj_desc->bank_field.value)) {
return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
...@@ -445,8 +474,10 @@ acpi_ex_field_datum_io ( ...@@ -445,8 +474,10 @@ acpi_ex_field_datum_io (
case ACPI_TYPE_LOCAL_INDEX_FIELD: case ACPI_TYPE_LOCAL_INDEX_FIELD:
/* Ensure that the index_value is not beyond the capacity of the register */ /*
* Ensure that the index_value is not beyond the capacity of
* the register
*/
if (acpi_ex_register_overflow (obj_desc->index_field.index_obj, if (acpi_ex_register_overflow (obj_desc->index_field.index_obj,
(acpi_integer) obj_desc->index_field.value)) { (acpi_integer) obj_desc->index_field.value)) {
return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
...@@ -496,14 +527,16 @@ acpi_ex_field_datum_io ( ...@@ -496,14 +527,16 @@ acpi_ex_field_datum_io (
if (ACPI_SUCCESS (status)) { if (ACPI_SUCCESS (status)) {
if (read_write == ACPI_READ) { if (read_write == ACPI_READ) {
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Read %8.8X%8.8X, Width %d\n", ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
ACPI_FORMAT_UINT64 (*value), "Value Read %8.8X%8.8X, Width %d\n",
obj_desc->common_field.access_byte_width)); ACPI_FORMAT_UINT64 (*value),
obj_desc->common_field.access_byte_width));
} }
else { else {
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Written %8.8X%8.8X, Width %d\n", ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
ACPI_FORMAT_UINT64 (*value), "Value Written %8.8X%8.8X, Width %d\n",
obj_desc->common_field.access_byte_width)); ACPI_FORMAT_UINT64 (*value),
obj_desc->common_field.access_byte_width));
} }
} }
...@@ -515,8 +548,10 @@ acpi_ex_field_datum_io ( ...@@ -515,8 +548,10 @@ acpi_ex_field_datum_io (
* *
* FUNCTION: acpi_ex_write_with_update_rule * FUNCTION: acpi_ex_write_with_update_rule
* *
* PARAMETERS: *obj_desc - Field to be set * PARAMETERS: obj_desc - Field to be written
* Value - Value to store * Mask - bitmask within field datum
* field_value - Value to write
* field_datum_byte_offset - Offset of datum within field
* *
* RETURN: Status * RETURN: Status
* *
...@@ -689,7 +724,8 @@ acpi_ex_extract_from_field ( ...@@ -689,7 +724,8 @@ acpi_ex_extract_from_field (
/* Merge with previous datum if necessary */ /* Merge with previous datum if necessary */
merged_datum |= raw_datum << merged_datum |= raw_datum <<
(obj_desc->common_field.access_bit_width - obj_desc->common_field.start_field_bit_offset); (obj_desc->common_field.access_bit_width -
obj_desc->common_field.start_field_bit_offset);
if (i == datum_count) { if (i == datum_count) {
break; break;
...@@ -707,7 +743,8 @@ acpi_ex_extract_from_field ( ...@@ -707,7 +743,8 @@ acpi_ex_extract_from_field (
/* Mask off any extra bits in the last datum */ /* Mask off any extra bits in the last datum */
buffer_tail_bits = obj_desc->common_field.bit_length % obj_desc->common_field.access_bit_width; buffer_tail_bits = obj_desc->common_field.bit_length %
obj_desc->common_field.access_bit_width;
if (buffer_tail_bits) { if (buffer_tail_bits) {
merged_datum &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits); merged_datum &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits);
} }
...@@ -791,7 +828,8 @@ acpi_ex_insert_into_field ( ...@@ -791,7 +828,8 @@ acpi_ex_insert_into_field (
/* Write merged datum to the target field */ /* Write merged datum to the target field */
merged_datum &= mask; merged_datum &= mask;
status = acpi_ex_write_with_update_rule (obj_desc, mask, merged_datum, field_offset); status = acpi_ex_write_with_update_rule (obj_desc, mask,
merged_datum, field_offset);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -800,7 +838,8 @@ acpi_ex_insert_into_field ( ...@@ -800,7 +838,8 @@ acpi_ex_insert_into_field (
field_offset += obj_desc->common_field.access_byte_width; field_offset += obj_desc->common_field.access_byte_width;
merged_datum = raw_datum >> merged_datum = raw_datum >>
(obj_desc->common_field.access_bit_width - obj_desc->common_field.start_field_bit_offset); (obj_desc->common_field.access_bit_width -
obj_desc->common_field.start_field_bit_offset);
mask = ACPI_INTEGER_MAX; mask = ACPI_INTEGER_MAX;
if (i == datum_count) { if (i == datum_count) {
...@@ -819,7 +858,8 @@ acpi_ex_insert_into_field ( ...@@ -819,7 +858,8 @@ acpi_ex_insert_into_field (
/* Mask off any extra bits in the last datum */ /* Mask off any extra bits in the last datum */
buffer_tail_bits = (obj_desc->common_field.bit_length + buffer_tail_bits = (obj_desc->common_field.bit_length +
obj_desc->common_field.start_field_bit_offset) % obj_desc->common_field.access_bit_width; obj_desc->common_field.start_field_bit_offset) %
obj_desc->common_field.access_bit_width;
if (buffer_tail_bits) { if (buffer_tail_bits) {
mask &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits); mask &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits);
} }
...@@ -827,7 +867,8 @@ acpi_ex_insert_into_field ( ...@@ -827,7 +867,8 @@ acpi_ex_insert_into_field (
/* Write the last datum to the field */ /* Write the last datum to the field */
merged_datum &= mask; merged_datum &= mask;
status = acpi_ex_write_with_update_rule (obj_desc, mask, merged_datum, field_offset); status = acpi_ex_write_with_update_rule (obj_desc,
mask, merged_datum, field_offset);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
......
...@@ -139,8 +139,9 @@ acpi_ex_get_object_reference ( ...@@ -139,8 +139,9 @@ acpi_ex_get_object_reference (
reference_obj->reference.object = referenced_obj; reference_obj->reference.object = referenced_obj;
*return_desc = reference_obj; *return_desc = reference_obj;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object %p Type [%s], returning Reference %p\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
obj_desc, acpi_ut_get_object_type_name (obj_desc), *return_desc)); "Object %p Type [%s], returning Reference %p\n",
obj_desc, acpi_ut_get_object_type_name (obj_desc), *return_desc));
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
...@@ -456,7 +457,7 @@ acpi_ex_do_math_op ( ...@@ -456,7 +457,7 @@ acpi_ex_do_math_op (
return (integer0 * integer1); return (integer0 * integer1);
case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result) */ case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result)*/
return (integer0 << integer1); return (integer0 << integer1);
......
...@@ -49,6 +49,13 @@ ...@@ -49,6 +49,13 @@
#define _COMPONENT ACPI_EXECUTER #define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exmutex") ACPI_MODULE_NAME ("exmutex")
/* Local prototypes */
static void
acpi_ex_link_mutex (
union acpi_operand_object *obj_desc,
struct acpi_thread_state *thread);
/******************************************************************************* /*******************************************************************************
* *
...@@ -56,7 +63,7 @@ ...@@ -56,7 +63,7 @@
* *
* PARAMETERS: obj_desc - The mutex to be unlinked * PARAMETERS: obj_desc - The mutex to be unlinked
* *
* RETURN: Status * RETURN: None
* *
* DESCRIPTION: Remove a mutex from the "acquired_mutex" list * DESCRIPTION: Remove a mutex from the "acquired_mutex" list
* *
...@@ -92,16 +99,16 @@ acpi_ex_unlink_mutex ( ...@@ -92,16 +99,16 @@ acpi_ex_unlink_mutex (
* *
* FUNCTION: acpi_ex_link_mutex * FUNCTION: acpi_ex_link_mutex
* *
* PARAMETERS: obj_desc - The mutex to be linked * PARAMETERS: obj_desc - The mutex to be linked
* list_head - head of the "acquired_mutex" list * Thread - Current executing thread object
* *
* RETURN: Status * RETURN: None
* *
* DESCRIPTION: Add a mutex to the "acquired_mutex" list for this walk * DESCRIPTION: Add a mutex to the "acquired_mutex" list for this walk
* *
******************************************************************************/ ******************************************************************************/
void static void
acpi_ex_link_mutex ( acpi_ex_link_mutex (
union acpi_operand_object *obj_desc, union acpi_operand_object *obj_desc,
struct acpi_thread_state *thread) struct acpi_thread_state *thread)
...@@ -132,8 +139,9 @@ acpi_ex_link_mutex ( ...@@ -132,8 +139,9 @@ acpi_ex_link_mutex (
* *
* FUNCTION: acpi_ex_acquire_mutex * FUNCTION: acpi_ex_acquire_mutex
* *
* PARAMETERS: time_desc - The 'time to delay' object descriptor * PARAMETERS: time_desc - Timeout integer
* obj_desc - The object descriptor for this op * obj_desc - Mutex object
* walk_state - Current method execution state
* *
* RETURN: Status * RETURN: Status
* *
...@@ -161,7 +169,7 @@ acpi_ex_acquire_mutex ( ...@@ -161,7 +169,7 @@ acpi_ex_acquire_mutex (
if (!walk_state->thread) { if (!walk_state->thread) {
ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], null thread info\n", ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], null thread info\n",
acpi_ut_get_node_name (obj_desc->mutex.node))); acpi_ut_get_node_name (obj_desc->mutex.node)));
return_ACPI_STATUS (AE_AML_INTERNAL); return_ACPI_STATUS (AE_AML_INTERNAL);
} }
...@@ -170,8 +178,9 @@ acpi_ex_acquire_mutex ( ...@@ -170,8 +178,9 @@ acpi_ex_acquire_mutex (
* mutex. This mechanism provides some deadlock prevention * mutex. This mechanism provides some deadlock prevention
*/ */
if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) {
ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], incorrect sync_level\n", ACPI_REPORT_ERROR ((
acpi_ut_get_node_name (obj_desc->mutex.node))); "Cannot acquire Mutex [%4.4s], incorrect sync_level\n",
acpi_ut_get_node_name (obj_desc->mutex.node)));
return_ACPI_STATUS (AE_AML_MUTEX_ORDER); return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
} }
...@@ -180,8 +189,10 @@ acpi_ex_acquire_mutex ( ...@@ -180,8 +189,10 @@ acpi_ex_acquire_mutex (
if (obj_desc->mutex.owner_thread) { if (obj_desc->mutex.owner_thread) {
/* Special case for Global Lock, allow all threads */ /* Special case for Global Lock, allow all threads */
if ((obj_desc->mutex.owner_thread->thread_id == walk_state->thread->thread_id) || if ((obj_desc->mutex.owner_thread->thread_id ==
(obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore)) { walk_state->thread->thread_id) ||
(obj_desc->mutex.semaphore ==
acpi_gbl_global_lock_semaphore)) {
/* /*
* The mutex is already owned by this thread, * The mutex is already owned by this thread,
* just increment the acquisition depth * just increment the acquisition depth
...@@ -221,6 +232,7 @@ acpi_ex_acquire_mutex ( ...@@ -221,6 +232,7 @@ acpi_ex_acquire_mutex (
* FUNCTION: acpi_ex_release_mutex * FUNCTION: acpi_ex_release_mutex
* *
* PARAMETERS: obj_desc - The object descriptor for this op * PARAMETERS: obj_desc - The object descriptor for this op
* walk_state - Current method execution state
* *
* RETURN: Status * RETURN: Status
* *
...@@ -278,8 +290,9 @@ acpi_ex_release_mutex ( ...@@ -278,8 +290,9 @@ acpi_ex_release_mutex (
* equal to the current sync level * equal to the current sync level
*/ */
if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) {
ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], incorrect sync_level\n", ACPI_REPORT_ERROR ((
acpi_ut_get_node_name (obj_desc->mutex.node))); "Cannot release Mutex [%4.4s], incorrect sync_level\n",
acpi_ut_get_node_name (obj_desc->mutex.node)));
return_ACPI_STATUS (AE_AML_MUTEX_ORDER); return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
} }
...@@ -313,11 +326,11 @@ acpi_ex_release_mutex ( ...@@ -313,11 +326,11 @@ acpi_ex_release_mutex (
* *
* FUNCTION: acpi_ex_release_all_mutexes * FUNCTION: acpi_ex_release_all_mutexes
* *
* PARAMETERS: mutex_list - Head of the mutex list * PARAMETERS: Thread - Current executing thread object
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Release all mutexes in the list * DESCRIPTION: Release all mutexes held by this thread
* *
******************************************************************************/ ******************************************************************************/
......
...@@ -50,13 +50,17 @@ ...@@ -50,13 +50,17 @@
#define _COMPONENT ACPI_EXECUTER #define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exnames") ACPI_MODULE_NAME ("exnames")
/* Local prototypes */
/* AML Package Length encodings */ static char *
acpi_ex_allocate_name_string (
u32 prefix_count,
u32 num_name_segs);
#define ACPI_AML_PACKAGE_TYPE1 0x40 static acpi_status
#define ACPI_AML_PACKAGE_TYPE2 0x4000 acpi_ex_name_segment (
#define ACPI_AML_PACKAGE_TYPE3 0x400000 u8 **in_aml_address,
#define ACPI_AML_PACKAGE_TYPE4 0x40000000 char *name_string);
/******************************************************************************* /*******************************************************************************
...@@ -64,7 +68,7 @@ ...@@ -64,7 +68,7 @@
* FUNCTION: acpi_ex_allocate_name_string * FUNCTION: acpi_ex_allocate_name_string
* *
* PARAMETERS: prefix_count - Count of parent levels. Special cases: * PARAMETERS: prefix_count - Count of parent levels. Special cases:
* (-1) = root, 0 = none * (-1)==root, 0==none
* num_name_segs - count of 4-character name segments * num_name_segs - count of 4-character name segments
* *
* RETURN: A pointer to the allocated string segment. This segment must * RETURN: A pointer to the allocated string segment. This segment must
...@@ -75,7 +79,7 @@ ...@@ -75,7 +79,7 @@
* *
******************************************************************************/ ******************************************************************************/
char * static char *
acpi_ex_allocate_name_string ( acpi_ex_allocate_name_string (
u32 prefix_count, u32 prefix_count,
u32 num_name_segs) u32 num_name_segs)
...@@ -88,7 +92,7 @@ acpi_ex_allocate_name_string ( ...@@ -88,7 +92,7 @@ acpi_ex_allocate_name_string (
/* /*
* Allow room for all \ and ^ prefixes, all segments, and a multi_name_prefix. * Allow room for all \ and ^ prefixes, all segments and a multi_name_prefix.
* Also, one byte for the null terminator. * Also, one byte for the null terminator.
* This may actually be somewhat longer than needed. * This may actually be somewhat longer than needed.
*/ */
...@@ -107,7 +111,8 @@ acpi_ex_allocate_name_string ( ...@@ -107,7 +111,8 @@ acpi_ex_allocate_name_string (
*/ */
name_string = ACPI_MEM_ALLOCATE (size_needed); name_string = ACPI_MEM_ALLOCATE (size_needed);
if (!name_string) { if (!name_string) {
ACPI_REPORT_ERROR (("ex_allocate_name_string: Could not allocate size %d\n", size_needed)); ACPI_REPORT_ERROR ((
"ex_allocate_name_string: Could not allocate size %d\n", size_needed));
return_PTR (NULL); return_PTR (NULL);
} }
...@@ -152,15 +157,17 @@ acpi_ex_allocate_name_string ( ...@@ -152,15 +157,17 @@ acpi_ex_allocate_name_string (
* *
* FUNCTION: acpi_ex_name_segment * FUNCTION: acpi_ex_name_segment
* *
* PARAMETERS: interpreter_mode - Current running mode (load1/Load2/Exec) * PARAMETERS: in_aml_address - Pointer to the name in the AML code
* name_string - Where to return the name. The name is appended
* to any existing string to form a namepath
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Execute a name segment (4 bytes) * DESCRIPTION: Extract an ACPI name (4 bytes) from the AML byte stream
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ex_name_segment ( acpi_ex_name_segment (
u8 **in_aml_address, u8 **in_aml_address,
char *name_string) char *name_string)
...@@ -223,10 +230,13 @@ acpi_ex_name_segment ( ...@@ -223,10 +230,13 @@ acpi_ex_name_segment (
status = AE_CTRL_PENDING; status = AE_CTRL_PENDING;
} }
else { else {
/* Segment started with one or more valid characters, but fewer than 4 */ /*
* Segment started with one or more valid characters, but fewer than
* the required 4
*/
status = AE_AML_BAD_NAME; status = AE_AML_BAD_NAME;
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad character %02x in name, at %p\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Bad character %02x in name, at %p\n",
*aml_address, aml_address)); *aml_address, aml_address));
} }
...@@ -239,11 +249,16 @@ acpi_ex_name_segment ( ...@@ -239,11 +249,16 @@ acpi_ex_name_segment (
* *
* FUNCTION: acpi_ex_get_name_string * FUNCTION: acpi_ex_get_name_string
* *
* PARAMETERS: data_type - Data type to be associated with this name * PARAMETERS: data_type - Object type to be associated with this
* name
* in_aml_address - Pointer to the namestring in the AML code
* out_name_string - Where the namestring is returned
* out_name_length - Length of the returned string
* *
* RETURN: Status * RETURN: Status, namestring and length
* *
* DESCRIPTION: Get a name, including any prefixes. * DESCRIPTION: Extract a full namepath from the AML byte stream,
* including any prefixes.
* *
******************************************************************************/ ******************************************************************************/
...@@ -286,7 +301,8 @@ acpi_ex_get_name_string ( ...@@ -286,7 +301,8 @@ acpi_ex_get_name_string (
switch (*aml_address) { switch (*aml_address) {
case AML_ROOT_PREFIX: case AML_ROOT_PREFIX:
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "root_prefix(\\) at %p\n", aml_address)); ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "root_prefix(\\) at %p\n",
aml_address));
/* /*
* Remember that we have a root_prefix -- * Remember that we have a root_prefix --
...@@ -303,7 +319,8 @@ acpi_ex_get_name_string ( ...@@ -303,7 +319,8 @@ acpi_ex_get_name_string (
/* Increment past possibly multiple parent prefixes */ /* Increment past possibly multiple parent prefixes */
do { do {
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "parent_prefix (^) at %p\n", aml_address)); ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "parent_prefix (^) at %p\n",
aml_address));
aml_address++; aml_address++;
prefix_count++; prefix_count++;
...@@ -321,13 +338,13 @@ acpi_ex_get_name_string ( ...@@ -321,13 +338,13 @@ acpi_ex_get_name_string (
break; break;
} }
/* Examine first character of name for name segment prefix operator */ /* Examine first character of name for name segment prefix operator */
switch (*aml_address) { switch (*aml_address) {
case AML_DUAL_NAME_PREFIX: case AML_DUAL_NAME_PREFIX:
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "dual_name_prefix at %p\n", aml_address)); ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "dual_name_prefix at %p\n",
aml_address));
aml_address++; aml_address++;
name_string = acpi_ex_allocate_name_string (prefix_count, 2); name_string = acpi_ex_allocate_name_string (prefix_count, 2);
...@@ -349,7 +366,8 @@ acpi_ex_get_name_string ( ...@@ -349,7 +366,8 @@ acpi_ex_get_name_string (
case AML_MULTI_NAME_PREFIX_OP: case AML_MULTI_NAME_PREFIX_OP:
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "multi_name_prefix at %p\n", aml_address)); ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "multi_name_prefix at %p\n",
aml_address));
/* Fetch count of segments remaining in name path */ /* Fetch count of segments remaining in name path */
...@@ -368,7 +386,8 @@ acpi_ex_get_name_string ( ...@@ -368,7 +386,8 @@ acpi_ex_get_name_string (
has_prefix = TRUE; has_prefix = TRUE;
while (num_segments && while (num_segments &&
(status = acpi_ex_name_segment (&aml_address, name_string)) == AE_OK) { (status = acpi_ex_name_segment (&aml_address, name_string)) ==
AE_OK) {
num_segments--; num_segments--;
} }
...@@ -380,7 +399,8 @@ acpi_ex_get_name_string ( ...@@ -380,7 +399,8 @@ acpi_ex_get_name_string (
/* null_name valid as of 8-12-98 ASL/AML Grammar Update */ /* null_name valid as of 8-12-98 ASL/AML Grammar Update */
if (prefix_count == ACPI_UINT32_MAX) { if (prefix_count == ACPI_UINT32_MAX) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "name_seg is \"\\\" followed by NULL\n")); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"name_seg is \"\\\" followed by NULL\n"));
} }
/* Consume the NULL byte */ /* Consume the NULL byte */
......
...@@ -97,7 +97,8 @@ acpi_ex_opcode_0A_0T_1R ( ...@@ -97,7 +97,8 @@ acpi_ex_opcode_0A_0T_1R (
union acpi_operand_object *return_desc = NULL; union acpi_operand_object *return_desc = NULL;
ACPI_FUNCTION_TRACE_STR ("ex_opcode_0A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); ACPI_FUNCTION_TRACE_STR ("ex_opcode_0A_0T_1R",
acpi_ps_get_opcode_name (walk_state->opcode));
/* Examine the AML opcode */ /* Examine the AML opcode */
...@@ -161,7 +162,8 @@ acpi_ex_opcode_1A_0T_0R ( ...@@ -161,7 +162,8 @@ acpi_ex_opcode_1A_0T_0R (
acpi_status status = AE_OK; acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_0R", acpi_ps_get_opcode_name (walk_state->opcode)); ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_0R",
acpi_ps_get_opcode_name (walk_state->opcode));
/* Examine the AML opcode */ /* Examine the AML opcode */
...@@ -236,7 +238,8 @@ acpi_ex_opcode_1A_1T_0R ( ...@@ -236,7 +238,8 @@ acpi_ex_opcode_1A_1T_0R (
union acpi_operand_object **operand = &walk_state->operands[0]; union acpi_operand_object **operand = &walk_state->operands[0];
ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_0R", acpi_ps_get_opcode_name (walk_state->opcode)); ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_0R",
acpi_ps_get_opcode_name (walk_state->opcode));
/* Examine the AML opcode */ /* Examine the AML opcode */
...@@ -289,7 +292,8 @@ acpi_ex_opcode_1A_1T_1R ( ...@@ -289,7 +292,8 @@ acpi_ex_opcode_1A_1T_1R (
acpi_integer digit; acpi_integer digit;
ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_1R",
acpi_ps_get_opcode_name (walk_state->opcode));
/* Examine the AML opcode */ /* Examine the AML opcode */
...@@ -409,8 +413,10 @@ acpi_ex_opcode_1A_1T_1R ( ...@@ -409,8 +413,10 @@ acpi_ex_opcode_1A_1T_1R (
for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) { for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) {
(void) acpi_ut_short_divide (digit, 10, &digit, &temp32); (void) acpi_ut_short_divide (digit, 10, &digit, &temp32);
/* Insert the BCD digit that resides in the remainder from above */ /*
* Insert the BCD digit that resides in the
* remainder from above
*/
return_desc->integer.value |= (((acpi_integer) temp32) << return_desc->integer.value |= (((acpi_integer) temp32) <<
ACPI_MUL_4 (i)); ACPI_MUL_4 (i));
} }
...@@ -445,7 +451,8 @@ acpi_ex_opcode_1A_1T_1R ( ...@@ -445,7 +451,8 @@ acpi_ex_opcode_1A_1T_1R (
/* Get the object reference, store it, and remove our reference */ /* Get the object reference, store it, and remove our reference */
status = acpi_ex_get_object_reference (operand[0], &return_desc2, walk_state); status = acpi_ex_get_object_reference (operand[0],
&return_desc2, walk_state);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
goto cleanup; goto cleanup;
} }
...@@ -482,10 +489,10 @@ acpi_ex_opcode_1A_1T_1R ( ...@@ -482,10 +489,10 @@ acpi_ex_opcode_1A_1T_1R (
if (!walk_state->result_obj) { if (!walk_state->result_obj) {
/* /*
* Normally, we would remove a reference on the Operand[0] parameter; * Normally, we would remove a reference on the Operand[0]
* But since it is being used as the internal return object * parameter; But since it is being used as the internal return
* (meaning we would normally increment it), the two cancel out, * object (meaning we would normally increment it), the two
* and we simply don't do anything. * cancel out, and we simply don't do anything.
*/ */
walk_state->result_obj = operand[0]; walk_state->result_obj = operand[0];
walk_state->operands[0] = NULL; /* Prevent deletion */ walk_state->operands[0] = NULL; /* Prevent deletion */
...@@ -549,9 +556,8 @@ acpi_ex_opcode_1A_1T_1R ( ...@@ -549,9 +556,8 @@ acpi_ex_opcode_1A_1T_1R (
case AML_SHIFT_LEFT_BIT_OP: /* shift_left_bit (Source, bit_num) */ case AML_SHIFT_LEFT_BIT_OP: /* shift_left_bit (Source, bit_num) */
case AML_SHIFT_RIGHT_BIT_OP: /* shift_right_bit (Source, bit_num) */ case AML_SHIFT_RIGHT_BIT_OP: /* shift_right_bit (Source, bit_num) */
/* /* These are two obsolete opcodes */
* These are two obsolete opcodes
*/
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"%s is obsolete and not implemented\n", "%s is obsolete and not implemented\n",
acpi_ps_get_opcode_name (walk_state->opcode))); acpi_ps_get_opcode_name (walk_state->opcode)));
...@@ -568,9 +574,8 @@ acpi_ex_opcode_1A_1T_1R ( ...@@ -568,9 +574,8 @@ acpi_ex_opcode_1A_1T_1R (
} }
if (ACPI_SUCCESS (status)) { if (ACPI_SUCCESS (status)) {
/* /* Store the return value computed above into the target object */
* Store the return value computed above into the target object
*/
status = acpi_ex_store (return_desc, operand[1], walk_state); status = acpi_ex_store (return_desc, operand[1], walk_state);
} }
...@@ -615,7 +620,8 @@ acpi_ex_opcode_1A_0T_1R ( ...@@ -615,7 +620,8 @@ acpi_ex_opcode_1A_0T_1R (
acpi_integer value; acpi_integer value;
ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_1R",
acpi_ps_get_opcode_name (walk_state->opcode));
/* Examine the AML opcode */ /* Examine the AML opcode */
...@@ -706,9 +712,9 @@ acpi_ex_opcode_1A_0T_1R ( ...@@ -706,9 +712,9 @@ acpi_ex_opcode_1A_0T_1R (
/* /*
* Note: The operand is not resolved at this point because we want to * Note: The operand is not resolved at this point because we want to
* get the associated object, not its value. For example, we don't want * get the associated object, not its value. For example, we don't
* to resolve a field_unit to its value, we want the actual field_unit * want to resolve a field_unit to its value, we want the actual
* object. * field_unit object.
*/ */
/* Get the type of the base object */ /* Get the type of the base object */
...@@ -738,7 +744,8 @@ acpi_ex_opcode_1A_0T_1R ( ...@@ -738,7 +744,8 @@ acpi_ex_opcode_1A_0T_1R (
/* Get the base object */ /* Get the base object */
status = acpi_ex_resolve_multiple (walk_state, operand[0], &type, &temp_desc); status = acpi_ex_resolve_multiple (walk_state,
operand[0], &type, &temp_desc);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
goto cleanup; goto cleanup;
} }
...@@ -818,8 +825,10 @@ acpi_ex_opcode_1A_0T_1R ( ...@@ -818,8 +825,10 @@ acpi_ex_opcode_1A_0T_1R (
/* Set Operand[0] to the value of the local/arg */ /* Set Operand[0] to the value of the local/arg */
status = acpi_ds_method_data_get_value (operand[0]->reference.opcode, status = acpi_ds_method_data_get_value (
operand[0]->reference.offset, walk_state, &temp_desc); operand[0]->reference.opcode,
operand[0]->reference.offset,
walk_state, &temp_desc);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
goto cleanup; goto cleanup;
} }
...@@ -852,21 +861,26 @@ acpi_ex_opcode_1A_0T_1R ( ...@@ -852,21 +861,26 @@ acpi_ex_opcode_1A_0T_1R (
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
/* /*
* This is a deref_of (String). The string is a reference to a named ACPI object. * This is a deref_of (String). The string is a reference
* to a named ACPI object.
* *
* 1) Find the owning Node * 1) Find the owning Node
* 2) Dereference the node to an actual object. Could be a Field, so we nee * 2) Dereference the node to an actual object. Could be a
* to resolve the node to a value. * Field, so we need to resolve the node to a value.
*/ */
status = acpi_ns_get_node_by_path (operand[0]->string.pointer, status = acpi_ns_get_node_by_path (operand[0]->string.pointer,
walk_state->scope_info->scope.node, ACPI_NS_SEARCH_PARENT, walk_state->scope_info->scope.node,
ACPI_CAST_INDIRECT_PTR (struct acpi_namespace_node, &return_desc)); ACPI_NS_SEARCH_PARENT,
ACPI_CAST_INDIRECT_PTR (
struct acpi_namespace_node, &return_desc));
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
goto cleanup; goto cleanup;
} }
status = acpi_ex_resolve_node_to_value ( status = acpi_ex_resolve_node_to_value (
ACPI_CAST_INDIRECT_PTR (struct acpi_namespace_node, &return_desc), walk_state); ACPI_CAST_INDIRECT_PTR (
struct acpi_namespace_node, &return_desc),
walk_state);
goto cleanup; goto cleanup;
...@@ -883,14 +897,16 @@ acpi_ex_opcode_1A_0T_1R ( ...@@ -883,14 +897,16 @@ acpi_ex_opcode_1A_0T_1R (
/* /*
* This is a deref_of (object_reference) * This is a deref_of (object_reference)
* Get the actual object from the Node (This is the dereference). * Get the actual object from the Node (This is the dereference).
* -- This case may only happen when a local_x or arg_x is dereferenced above. * This case may only happen when a local_x or arg_x is
* dereferenced above.
*/ */
return_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) operand[0]); return_desc = acpi_ns_get_attached_object (
(struct acpi_namespace_node *) operand[0]);
} }
else { else {
/* /*
* This must be a reference object produced by either the Index() or * This must be a reference object produced by either the
* ref_of() operator * Index() or ref_of() operator
*/ */
switch (operand[0]->reference.opcode) { switch (operand[0]->reference.opcode) {
case AML_INDEX_OP: case AML_INDEX_OP:
...@@ -931,8 +947,8 @@ acpi_ex_opcode_1A_0T_1R ( ...@@ -931,8 +947,8 @@ acpi_ex_opcode_1A_0T_1R (
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
/* /*
* Return the referenced element of the package. We must add * Return the referenced element of the package. We must
* another reference to the referenced object, however. * add another reference to the referenced object, however.
*/ */
return_desc = *(operand[0]->reference.where); return_desc = *(operand[0]->reference.where);
if (!return_desc) { if (!return_desc) {
...@@ -967,9 +983,11 @@ acpi_ex_opcode_1A_0T_1R ( ...@@ -967,9 +983,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) { if (ACPI_GET_DESCRIPTOR_TYPE (return_desc) ==
ACPI_DESC_TYPE_NAMED) {
return_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) return_desc); return_desc = acpi_ns_get_attached_object (
(struct acpi_namespace_node *) return_desc);
} }
/* Add another reference to the object! */ /* Add another reference to the object! */
......
...@@ -118,7 +118,7 @@ acpi_ex_opcode_2A_0T_0R ( ...@@ -118,7 +118,7 @@ acpi_ex_opcode_2A_0T_0R (
value = (u32) operand[1]->integer.value; value = (u32) operand[1]->integer.value;
/* Notifies allowed on this object? */ /* Are notifies allowed on this object? */
if (!acpi_ev_is_notify_object (node)) { if (!acpi_ev_is_notify_object (node)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
...@@ -203,11 +203,12 @@ acpi_ex_opcode_2A_2T_1R ( ...@@ -203,11 +203,12 @@ acpi_ex_opcode_2A_2T_1R (
acpi_ps_get_opcode_name (walk_state->opcode)); acpi_ps_get_opcode_name (walk_state->opcode));
/* /* Execute the opcode */
* Execute the opcode
*/
switch (walk_state->opcode) { switch (walk_state->opcode) {
case AML_DIVIDE_OP: /* Divide (Dividend, Divisor, remainder_result quotient_result) */ case AML_DIVIDE_OP:
/* Divide (Dividend, Divisor, remainder_result quotient_result) */
return_desc1 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); return_desc1 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
if (!return_desc1) { if (!return_desc1) {
...@@ -241,7 +242,6 @@ acpi_ex_opcode_2A_2T_1R ( ...@@ -241,7 +242,6 @@ acpi_ex_opcode_2A_2T_1R (
goto cleanup; goto cleanup;
} }
/* Store the results to the target reference operands */ /* Store the results to the target reference operands */
status = acpi_ex_store (return_desc2, operand[2], walk_state); status = acpi_ex_store (return_desc2, operand[2], walk_state);
...@@ -295,7 +295,7 @@ acpi_ex_opcode_2A_1T_1R ( ...@@ -295,7 +295,7 @@ acpi_ex_opcode_2A_1T_1R (
{ {
union acpi_operand_object **operand = &walk_state->operands[0]; union acpi_operand_object **operand = &walk_state->operands[0];
union acpi_operand_object *return_desc = NULL; union acpi_operand_object *return_desc = NULL;
u32 index; acpi_integer index;
acpi_status status = AE_OK; acpi_status status = AE_OK;
acpi_size length; acpi_size length;
...@@ -304,9 +304,8 @@ acpi_ex_opcode_2A_1T_1R ( ...@@ -304,9 +304,8 @@ acpi_ex_opcode_2A_1T_1R (
acpi_ps_get_opcode_name (walk_state->opcode)); acpi_ps_get_opcode_name (walk_state->opcode));
/* /* Execute the opcode */
* Execute the opcode
*/
if (walk_state->op_info->flags & AML_MATH) { if (walk_state->op_info->flags & AML_MATH) {
/* All simple math opcodes (add, etc.) */ /* All simple math opcodes (add, etc.) */
...@@ -322,9 +321,8 @@ acpi_ex_opcode_2A_1T_1R ( ...@@ -322,9 +321,8 @@ acpi_ex_opcode_2A_1T_1R (
goto store_result_to_target; goto store_result_to_target;
} }
switch (walk_state->opcode) { switch (walk_state->opcode) {
case AML_MOD_OP: /* Mod (Dividend, Divisor, remainder_result (ACPI 2.0) */ case AML_MOD_OP: /* Mod (Dividend, Divisor, remainder_result (ACPI 2.0) */
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
if (!return_desc) { if (!return_desc) {
...@@ -341,18 +339,19 @@ acpi_ex_opcode_2A_1T_1R ( ...@@ -341,18 +339,19 @@ acpi_ex_opcode_2A_1T_1R (
break; break;
case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */ case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
status = acpi_ex_do_concatenate (operand[0], operand[1], status = acpi_ex_do_concatenate (operand[0], operand[1],
&return_desc, walk_state); &return_desc, walk_state);
break; break;
case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */ case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */
/* /*
* Input object is guaranteed to be a buffer at this point (it may have * Input object is guaranteed to be a buffer at this point (it may have
* been converted.) Copy the raw buffer data to a new object of type String. * been converted.) Copy the raw buffer data to a new object of
* type String.
*/ */
/* /*
...@@ -383,14 +382,16 @@ acpi_ex_opcode_2A_1T_1R ( ...@@ -383,14 +382,16 @@ acpi_ex_opcode_2A_1T_1R (
goto cleanup; goto cleanup;
} }
/* Copy the raw buffer data with no transform. NULL terminated already. */ /* Copy the raw buffer data with no transform. NULL terminated already*/
ACPI_MEMCPY (return_desc->string.pointer, ACPI_MEMCPY (return_desc->string.pointer,
operand[0]->buffer.pointer, length); operand[0]->buffer.pointer, length);
break; break;
case AML_CONCAT_RES_OP: /* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */ case AML_CONCAT_RES_OP:
/* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */
status = acpi_ex_concat_template (operand[0], operand[1], status = acpi_ex_concat_template (operand[0], operand[1],
&return_desc, walk_state); &return_desc, walk_state);
...@@ -407,33 +408,33 @@ acpi_ex_opcode_2A_1T_1R ( ...@@ -407,33 +408,33 @@ acpi_ex_opcode_2A_1T_1R (
goto cleanup; goto cleanup;
} }
index = (u32) operand[1]->integer.value; index = operand[1]->integer.value;
/* At this point, the Source operand is a Package, Buffer, or String */
/*
* At this point, the Source operand is a Package, Buffer, or String
*/
if (ACPI_GET_OBJECT_TYPE (operand[0]) == ACPI_TYPE_PACKAGE) { if (ACPI_GET_OBJECT_TYPE (operand[0]) == ACPI_TYPE_PACKAGE) {
/* Object to be indexed is a Package */ /* Object to be indexed is a Package */
if (index >= operand[0]->package.count) { if (index >= operand[0]->package.count) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Index value (%X) beyond package end (%X)\n", "Index value (%X%8.8X) beyond package end (%X)\n",
index, operand[0]->package.count)); ACPI_FORMAT_UINT64 (index), operand[0]->package.count));
status = AE_AML_PACKAGE_LIMIT; status = AE_AML_PACKAGE_LIMIT;
goto cleanup; goto cleanup;
} }
return_desc->reference.target_type = ACPI_TYPE_PACKAGE; return_desc->reference.target_type = ACPI_TYPE_PACKAGE;
return_desc->reference.object = operand[0]; return_desc->reference.object = operand[0];
return_desc->reference.where = &operand[0]->package.elements [index]; return_desc->reference.where = &operand[0]->package.elements [
index];
} }
else { else {
/* Object to be indexed is a Buffer/String */ /* Object to be indexed is a Buffer/String */
if (index >= operand[0]->buffer.length) { if (index >= operand[0]->buffer.length) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Index value (%X) beyond end of buffer (%X)\n", "Index value (%X%8.8X) beyond end of buffer (%X)\n",
index, operand[0]->buffer.length)); ACPI_FORMAT_UINT64 (index), operand[0]->buffer.length));
status = AE_AML_BUFFER_LIMIT; status = AE_AML_BUFFER_LIMIT;
goto cleanup; goto cleanup;
} }
...@@ -451,7 +452,7 @@ acpi_ex_opcode_2A_1T_1R ( ...@@ -451,7 +452,7 @@ acpi_ex_opcode_2A_1T_1R (
/* Complete the Index reference object */ /* Complete the Index reference object */
return_desc->reference.opcode = AML_INDEX_OP; return_desc->reference.opcode = AML_INDEX_OP;
return_desc->reference.offset = index; return_desc->reference.offset = (u32) index;
/* Store the reference to the Target */ /* Store the reference to the Target */
...@@ -536,22 +537,24 @@ acpi_ex_opcode_2A_0T_1R ( ...@@ -536,22 +537,24 @@ acpi_ex_opcode_2A_0T_1R (
goto cleanup; goto cleanup;
} }
/* /* Execute the Opcode */
* Execute the Opcode
*/ if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) {
if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) /* logical_op (Operand0, Operand1) */ { /* logical_op (Operand0, Operand1) */
status = acpi_ex_do_logical_numeric_op (walk_state->opcode, status = acpi_ex_do_logical_numeric_op (walk_state->opcode,
operand[0]->integer.value, operand[1]->integer.value, operand[0]->integer.value, operand[1]->integer.value,
&logical_result); &logical_result);
goto store_logical_result; goto store_logical_result;
} }
else if (walk_state->op_info->flags & AML_LOGICAL) /* logical_op (Operand0, Operand1) */ { else if (walk_state->op_info->flags & AML_LOGICAL) {
/* logical_op (Operand0, Operand1) */
status = acpi_ex_do_logical_op (walk_state->opcode, operand[0], status = acpi_ex_do_logical_op (walk_state->opcode, operand[0],
operand[1], &logical_result); operand[1], &logical_result);
goto store_logical_result; goto store_logical_result;
} }
switch (walk_state->opcode) { switch (walk_state->opcode) {
case AML_ACQUIRE_OP: /* Acquire (mutex_object, Timeout) */ case AML_ACQUIRE_OP: /* Acquire (mutex_object, Timeout) */
......
...@@ -97,11 +97,12 @@ acpi_ex_opcode_3A_0T_0R ( ...@@ -97,11 +97,12 @@ acpi_ex_opcode_3A_0T_0R (
acpi_status status = AE_OK; acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_0T_0R", acpi_ps_get_opcode_name (walk_state->opcode)); ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_0T_0R",
acpi_ps_get_opcode_name (walk_state->opcode));
switch (walk_state->opcode) { switch (walk_state->opcode) {
case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */ case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", "fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
...@@ -116,9 +117,8 @@ acpi_ex_opcode_3A_0T_0R ( ...@@ -116,9 +117,8 @@ acpi_ex_opcode_3A_0T_0R (
fatal->argument = (u32) operand[2]->integer.value; fatal->argument = (u32) operand[2]->integer.value;
} }
/* /* Always signal the OS! */
* Always signal the OS!
*/
status = acpi_os_signal (ACPI_SIGNAL_FATAL, fatal); status = acpi_os_signal (ACPI_SIGNAL_FATAL, fatal);
/* Might return while OS is shutting down, just continue */ /* Might return while OS is shutting down, just continue */
...@@ -162,21 +162,23 @@ acpi_ex_opcode_3A_1T_1R ( ...@@ -162,21 +162,23 @@ acpi_ex_opcode_3A_1T_1R (
union acpi_operand_object *return_desc = NULL; union acpi_operand_object *return_desc = NULL;
char *buffer; char *buffer;
acpi_status status = AE_OK; acpi_status status = AE_OK;
acpi_native_uint index; acpi_integer index;
acpi_size length; acpi_size length;
ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_1T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_1T_1R",
acpi_ps_get_opcode_name (walk_state->opcode));
switch (walk_state->opcode) { switch (walk_state->opcode) {
case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */ case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */
/* /*
* Create the return object. The Source operand is guaranteed to be * Create the return object. The Source operand is guaranteed to be
* either a String or a Buffer, so just use its type. * either a String or a Buffer, so just use its type.
*/ */
return_desc = acpi_ut_create_internal_object (ACPI_GET_OBJECT_TYPE (operand[0])); return_desc = acpi_ut_create_internal_object (
ACPI_GET_OBJECT_TYPE (operand[0]));
if (!return_desc) { if (!return_desc) {
status = AE_NO_MEMORY; status = AE_NO_MEMORY;
goto cleanup; goto cleanup;
...@@ -184,7 +186,7 @@ acpi_ex_opcode_3A_1T_1R ( ...@@ -184,7 +186,7 @@ acpi_ex_opcode_3A_1T_1R (
/* Get the Integer values from the objects */ /* Get the Integer values from the objects */
index = (acpi_native_uint) operand[1]->integer.value; index = operand[1]->integer.value;
length = (acpi_size) operand[2]->integer.value; length = (acpi_size) operand[2]->integer.value;
/* /*
...@@ -197,7 +199,8 @@ acpi_ex_opcode_3A_1T_1R ( ...@@ -197,7 +199,8 @@ acpi_ex_opcode_3A_1T_1R (
if ((index + length) > if ((index + length) >
operand[0]->string.length) { operand[0]->string.length) {
length = (acpi_size) operand[0]->string.length - index; length = (acpi_size) operand[0]->string.length -
(acpi_size) index;
} }
/* Allocate a new buffer for the String/Buffer */ /* Allocate a new buffer for the String/Buffer */
......
...@@ -75,6 +75,14 @@ ...@@ -75,6 +75,14 @@
* fully resolved operands. * fully resolved operands.
!*/ !*/
/* Local prototypes */
static u8
acpi_ex_do_match (
u32 match_op,
union acpi_operand_object *package_obj,
union acpi_operand_object *match_obj);
/******************************************************************************* /*******************************************************************************
* *
...@@ -92,7 +100,7 @@ ...@@ -92,7 +100,7 @@
* *
******************************************************************************/ ******************************************************************************/
u8 static u8
acpi_ex_do_match ( acpi_ex_do_match (
u32 match_op, u32 match_op,
union acpi_operand_object *package_obj, union acpi_operand_object *package_obj,
...@@ -216,11 +224,12 @@ acpi_ex_opcode_6A_0T_1R ( ...@@ -216,11 +224,12 @@ acpi_ex_opcode_6A_0T_1R (
union acpi_operand_object **operand = &walk_state->operands[0]; union acpi_operand_object **operand = &walk_state->operands[0];
union acpi_operand_object *return_desc = NULL; union acpi_operand_object *return_desc = NULL;
acpi_status status = AE_OK; acpi_status status = AE_OK;
u32 index; acpi_integer index;
union acpi_operand_object *this_element; union acpi_operand_object *this_element;
ACPI_FUNCTION_TRACE_STR ("ex_opcode_6A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); ACPI_FUNCTION_TRACE_STR ("ex_opcode_6A_0T_1R",
acpi_ps_get_opcode_name (walk_state->opcode));
switch (walk_state->opcode) { switch (walk_state->opcode) {
...@@ -241,9 +250,11 @@ acpi_ex_opcode_6A_0T_1R ( ...@@ -241,9 +250,11 @@ acpi_ex_opcode_6A_0T_1R (
/* Get the package start_index, validate against the package length */ /* Get the package start_index, validate against the package length */
index = (u32) operand[5]->integer.value; index = operand[5]->integer.value;
if (index >= (u32) operand[0]->package.count) { if (index >= operand[0]->package.count) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index beyond package end\n")); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Index (%X%8.8X) beyond package end (%X)\n",
ACPI_FORMAT_UINT64 (index), operand[0]->package.count));
status = AE_AML_PACKAGE_LIMIT; status = AE_AML_PACKAGE_LIMIT;
goto cleanup; goto cleanup;
} }
...@@ -314,13 +325,12 @@ acpi_ex_opcode_6A_0T_1R ( ...@@ -314,13 +325,12 @@ acpi_ex_opcode_6A_0T_1R (
default: default:
ACPI_REPORT_ERROR (("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", ACPI_REPORT_ERROR (("acpi_ex_opcode_6A_0T_1R: Unknown opcode %X\n",
walk_state->opcode)); walk_state->opcode));
status = AE_AML_BAD_OPCODE; status = AE_AML_BAD_OPCODE;
goto cleanup; goto cleanup;
} }
walk_state->result_obj = return_desc; walk_state->result_obj = return_desc;
......
此差异已折叠。
此差异已折叠。
...@@ -210,15 +210,15 @@ acpi_ex_resolve_node_to_value ( ...@@ -210,15 +210,15 @@ acpi_ex_resolve_node_to_value (
case ACPI_TYPE_LOCAL_BANK_FIELD: case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD: case ACPI_TYPE_LOCAL_INDEX_FIELD:
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "field_read Node=%p source_desc=%p Type=%X\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"field_read Node=%p source_desc=%p Type=%X\n",
node, source_desc, entry_type)); node, source_desc, entry_type));
status = acpi_ex_read_data_from_field (walk_state, source_desc, &obj_desc); status = acpi_ex_read_data_from_field (walk_state, source_desc, &obj_desc);
break; break;
/* /* For these objects, just return the object attached to the Node */
* For these objects, just return the object attached to the Node
*/
case ACPI_TYPE_MUTEX: case ACPI_TYPE_MUTEX:
case ACPI_TYPE_METHOD: case ACPI_TYPE_METHOD:
case ACPI_TYPE_POWER: case ACPI_TYPE_POWER:
...@@ -233,12 +233,12 @@ acpi_ex_resolve_node_to_value ( ...@@ -233,12 +233,12 @@ acpi_ex_resolve_node_to_value (
acpi_ut_add_reference (obj_desc); acpi_ut_add_reference (obj_desc);
break; break;
/* TYPE_ANY is untyped, and thus there is no object associated with it */ /* TYPE_ANY is untyped, and thus there is no object associated with it */
case ACPI_TYPE_ANY: case ACPI_TYPE_ANY:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Untyped entry %p, no attached object!\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Untyped entry %p, no attached object!\n",
node)); node));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */ return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */
...@@ -259,7 +259,8 @@ acpi_ex_resolve_node_to_value ( ...@@ -259,7 +259,8 @@ acpi_ex_resolve_node_to_value (
default: default:
/* No named references are allowed here */ /* No named references are allowed here */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported Reference opcode %X (%s)\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unsupported Reference opcode %X (%s)\n",
source_desc->reference.opcode, source_desc->reference.opcode,
acpi_ps_get_opcode_name (source_desc->reference.opcode))); acpi_ps_get_opcode_name (source_desc->reference.opcode)));
...@@ -268,11 +269,12 @@ acpi_ex_resolve_node_to_value ( ...@@ -268,11 +269,12 @@ acpi_ex_resolve_node_to_value (
break; break;
/* Default case is for unknown types */
default: default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Node %p - Unknown object type %X\n", /* Default case is for unknown types */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Node %p - Unknown object type %X\n",
node, entry_type)); node, entry_type));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
...@@ -280,7 +282,7 @@ acpi_ex_resolve_node_to_value ( ...@@ -280,7 +282,7 @@ acpi_ex_resolve_node_to_value (
} /* switch (entry_type) */ } /* switch (entry_type) */
/* Put the object descriptor on the stack */ /* Return the object descriptor */
*object_ptr = (void *) obj_desc; *object_ptr = (void *) obj_desc;
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
* *
* PARAMETERS: Type - Type of node to be searched for * PARAMETERS: Type - Type of node to be searched for
* parent_node - Parent node whose children we are * parent_node - Parent node whose children we are
* getting * getting
* child_node - Previous child that was found. * child_node - Previous child that was found.
* The NEXT child will be returned * The NEXT child will be returned
* *
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册