Commit 4b207d82 authored by Andy Grover's avatar Andy Grover

ACPI: Interpreter fixes

  Fixed memory leak in method argument resolution
  Fixed Index() operator to work properly with a target operand
  Fixed attempted double delete in the Index() code
  Code size improvements
  Improved debug/error messages and levels
  Fixed a problem with premature deletion of a buffer object
parent 7fb1589a
/*******************************************************************************
*
* Module Name: dsutils - Dispatcher utilities
* $Revision: 96 $
* $Revision: 97 $
*
******************************************************************************/
......@@ -274,6 +274,45 @@ acpi_ds_resolve_operands (
return_ACPI_STATUS (status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_ds_clear_operands
*
* PARAMETERS: Walk_state - Current walk state with operands on stack
*
* RETURN: None
*
* DESCRIPTION: Clear all operands on the current walk state operand stack.
*
******************************************************************************/
void
acpi_ds_clear_operands (
acpi_walk_state *walk_state)
{
u32 i;
ACPI_FUNCTION_TRACE_PTR ("Acpi_ds_clear_operands", walk_state);
/*
* Remove a reference on each operand on the stack
*/
for (i = 0; i < walk_state->num_operands; i++) {
/*
* Remove a reference to all operands, including both
* "Arguments" and "Targets".
*/
acpi_ut_remove_reference (walk_state->operands[i]);
walk_state->operands[i] = NULL;
}
walk_state->num_operands = 0;
return_VOID;
}
#endif
......
......@@ -2,7 +2,7 @@
*
* Module Name: dswexec - Dispatcher method execution callbacks;
* dispatch to interpreter.
* $Revision: 95 $
* $Revision: 96 $
*
*****************************************************************************/
......@@ -329,7 +329,6 @@ acpi_ds_exec_end_op (
u32 op_class;
acpi_parse_object *next_op;
acpi_parse_object *first_arg;
u32 i;
ACPI_FUNCTION_TRACE_PTR ("Ds_exec_end_op", walk_state);
......@@ -406,15 +405,7 @@ acpi_ds_exec_end_op (
/* Always delete the argument objects and clear the operand stack */
for (i = 0; i < walk_state->num_operands; i++) {
/*
* Remove a reference to all operands, including both
* "Arguments" and "Targets".
*/
acpi_ut_remove_reference (walk_state->operands[i]);
walk_state->operands[i] = NULL;
}
walk_state->num_operands = 0;
acpi_ds_clear_operands (walk_state);
/*
* If a result object was returned from above, push it on the
......@@ -475,6 +466,9 @@ acpi_ds_exec_end_op (
*/
status = acpi_ds_resolve_operands (walk_state);
if (ACPI_FAILURE (status)) {
/* On error, clear all resolved operands */
acpi_ds_clear_operands (walk_state);
break;
}
......
/******************************************************************************
*
* Module Name: evmisc - Miscellaneous event manager support functions
* $Revision: 58 $
* $Revision: 59 $
*
*****************************************************************************/
......@@ -228,7 +228,8 @@ acpi_ev_queue_notify_request (
if (!handler_obj) {
/* There is no per-device notify handler for this device */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "No notify handler for node %p \n", node));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"No notify handler for [%4.4s] node %p\n", node->name.ascii, node));
}
return (status);
......@@ -466,7 +467,7 @@ acpi_ev_acquire_global_lock (
if (acquired) {
/* We got the lock */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Acquired the HW Global Lock\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Acquired the HW Global Lock\n"));
acpi_gbl_global_lock_acquired = TRUE;
return_ACPI_STATUS (AE_OK);
......@@ -476,7 +477,7 @@ acpi_ev_acquire_global_lock (
* Did not get the lock. The pending bit was set above, and we must now
* wait until we get the global lock released interrupt.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Waiting for the HW Global Lock\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Waiting for the HW Global Lock\n"));
/*
* Acquire the global lock semaphore first.
......
/******************************************************************************
*
* Module Name: exconvrt - Object conversion routines
* $Revision: 41 $
* $Revision: 44 $
*
*****************************************************************************/
......@@ -147,10 +147,15 @@ acpi_ex_convert_to_integer (
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Save the Result, delete original descriptor, store new descriptor */
/* Save the Result */
ret_desc->integer.value = result;
/*
* If we are about to overwrite the original object on the operand stack,
* we must remove a reference on the original object because we are
* essentially removing it from the stack.
*/
if (*result_desc == obj_desc) {
if (walk_state->opcode != AML_STORE_OP) {
acpi_ut_remove_reference (obj_desc);
......@@ -191,76 +196,50 @@ acpi_ex_convert_to_buffer (
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_BUFFER:
/* No conversion necessary */
*result_desc = obj_desc;
return_ACPI_STATUS (AE_OK);
case ACPI_TYPE_INTEGER:
/*
* Create a new Buffer object
* Create a new Buffer object.
* Need enough space for one integer
*/
ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
ret_desc = acpi_ut_create_buffer_object (acpi_gbl_integer_byte_width);
if (!ret_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Need enough space for one integer */
new_buf = ACPI_MEM_CALLOCATE (acpi_gbl_integer_byte_width);
if (!new_buf) {
ACPI_REPORT_ERROR
(("Ex_convert_to_buffer: Buffer allocation failure\n"));
acpi_ut_remove_reference (ret_desc);
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Copy the integer to the buffer */
new_buf = ret_desc->buffer.pointer;
for (i = 0; i < acpi_gbl_integer_byte_width; i++) {
new_buf[i] = (u8) (obj_desc->integer.value >> (i * 8));
}
/* Complete buffer object initialization */
ret_desc->buffer.flags |= AOPOBJ_DATA_VALID;
ret_desc->buffer.pointer = new_buf;
ret_desc->buffer.length = acpi_gbl_integer_byte_width;
/* Return the new buffer descriptor */
*result_desc = ret_desc;
break;
case ACPI_TYPE_STRING:
/*
* Create a new Buffer object
* Size will be the string length
*/
ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
ret_desc = acpi_ut_create_buffer_object (obj_desc->string.length);
if (!ret_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Need enough space for one integer */
/* Copy the string to the buffer */
new_buf = ACPI_MEM_CALLOCATE (obj_desc->string.length);
if (!new_buf) {
ACPI_REPORT_ERROR
(("Ex_convert_to_buffer: Buffer allocation failure\n"));
acpi_ut_remove_reference (ret_desc);
return_ACPI_STATUS (AE_NO_MEMORY);
}
ACPI_STRNCPY ((char *) new_buf, (char *) obj_desc->string.pointer, obj_desc->string.length);
ret_desc->buffer.flags |= AOPOBJ_DATA_VALID;
ret_desc->buffer.pointer = new_buf;
ret_desc->buffer.length = obj_desc->string.length;
/* Return the new buffer descriptor */
*result_desc = ret_desc;
break;
case ACPI_TYPE_BUFFER:
*result_desc = obj_desc;
new_buf = ret_desc->buffer.pointer;
ACPI_STRNCPY ((char *) new_buf, (char *) obj_desc->string.pointer,
obj_desc->string.length);
break;
......@@ -270,7 +249,20 @@ acpi_ex_convert_to_buffer (
/* Mark buffer initialized */
(*result_desc)->common.flags |= AOPOBJ_DATA_VALID;
ret_desc->common.flags |= AOPOBJ_DATA_VALID;
/*
* If we are about to overwrite the original object on the operand stack,
* we must remove a reference on the original object because we are
* essentially removing it from the stack.
*/
if (*result_desc == obj_desc) {
if (walk_state->opcode != AML_STORE_OP) {
acpi_ut_remove_reference (obj_desc);
}
}
*result_desc = ret_desc;
return_ACPI_STATUS (AE_OK);
}
......@@ -405,6 +397,19 @@ acpi_ex_convert_to_string (
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_STRING:
if (max_length >= obj_desc->string.length) {
*result_desc = obj_desc;
return_ACPI_STATUS (AE_OK);
}
else {
/* Must copy the string first and then truncate it */
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
}
case ACPI_TYPE_INTEGER:
string_length = acpi_gbl_integer_byte_width * 2;
......@@ -446,16 +451,6 @@ acpi_ex_convert_to_string (
}
ret_desc->buffer.pointer = new_buf;
/* Return the new buffer descriptor */
if (*result_desc == obj_desc) {
if (walk_state->opcode != AML_STORE_OP) {
acpi_ut_remove_reference (obj_desc);
}
}
*result_desc = ret_desc;
break;
......@@ -511,37 +506,26 @@ acpi_ex_convert_to_string (
new_buf [index-1] = 0;
ret_desc->buffer.pointer = new_buf;
ret_desc->string.length = (u32) ACPI_STRLEN ((char *) new_buf);
/* Return the new buffer descriptor */
if (*result_desc == obj_desc) {
if (walk_state->opcode != AML_STORE_OP) {
acpi_ut_remove_reference (obj_desc);
}
}
*result_desc = ret_desc;
break;
case ACPI_TYPE_STRING:
if (max_length >= obj_desc->string.length) {
*result_desc = obj_desc;
}
default:
return_ACPI_STATUS (AE_TYPE);
}
else {
/* Must copy the string first and then truncate it */
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
/*
* If we are about to overwrite the original object on the operand stack,
* we must remove a reference on the original object because we are
* essentially removing it from the stack.
*/
if (*result_desc == obj_desc) {
if (walk_state->opcode != AML_STORE_OP) {
acpi_ut_remove_reference (obj_desc);
}
break;
default:
return_ACPI_STATUS (AE_TYPE);
}
*result_desc = ret_desc;
return_ACPI_STATUS (AE_OK);
}
......
/******************************************************************************
*
* Module Name: exfield - ACPI AML (p-code) execution - field manipulation
* $Revision: 113 $
* $Revision: 115 $
*
*****************************************************************************/
......@@ -27,8 +27,6 @@
#include "acpi.h"
#include "acdispat.h"
#include "acinterp.h"
#include "acevents.h"
#include "amlcode.h"
#define _COMPONENT ACPI_EXECUTER
......@@ -90,25 +88,11 @@ acpi_ex_read_data_from_field (
* This is an SMBus read. We must create a buffer to hold the data
* and directly access the region handler.
*/
buffer_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
buffer_desc = acpi_ut_create_buffer_object (ACPI_SMBUS_BUFFER_SIZE);
if (!buffer_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Create the actual read buffer */
buffer_desc->buffer.pointer = ACPI_MEM_CALLOCATE (ACPI_SMBUS_BUFFER_SIZE);
if (!buffer_desc->buffer.pointer) {
acpi_ut_remove_reference (buffer_desc);
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Complete the buffer object initialization */
buffer_desc->common.flags = AOPOBJ_DATA_VALID;
buffer_desc->buffer.length = ACPI_SMBUS_BUFFER_SIZE;
buffer = buffer_desc->buffer.pointer;
/* Lock entire transaction if requested */
locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
......@@ -118,7 +102,7 @@ acpi_ex_read_data_from_field (
* Note: Smbus protocol value is passed in upper 16-bits of Function
*/
status = acpi_ex_access_region (obj_desc, 0,
(acpi_integer *) buffer_desc->buffer.pointer,
ACPI_CAST_PTR (acpi_integer, buffer_desc->buffer.pointer),
ACPI_READ | (obj_desc->field.attribute << 16));
acpi_ex_release_global_lock (locked);
goto exit;
......@@ -138,23 +122,10 @@ acpi_ex_read_data_from_field (
if (length > acpi_gbl_integer_byte_width) {
/* Field is too large for an Integer, create a Buffer instead */
buffer_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
buffer_desc = acpi_ut_create_buffer_object (length);
if (!buffer_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Create the actual read buffer */
buffer_desc->buffer.pointer = ACPI_MEM_CALLOCATE (length);
if (!buffer_desc->buffer.pointer) {
acpi_ut_remove_reference (buffer_desc);
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Complete the buffer object initialization */
buffer_desc->common.flags = AOPOBJ_DATA_VALID;
buffer_desc->buffer.length = length;
buffer = buffer_desc->buffer.pointer;
}
else {
......@@ -270,26 +241,12 @@ acpi_ex_write_data_to_field (
return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);
}
buffer_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
buffer_desc = acpi_ut_create_buffer_object (ACPI_SMBUS_BUFFER_SIZE);
if (!buffer_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Create the actual read buffer */
buffer_desc->buffer.pointer = ACPI_MEM_CALLOCATE (ACPI_SMBUS_BUFFER_SIZE);
if (!buffer_desc->buffer.pointer) {
acpi_ut_remove_reference (buffer_desc);
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Complete the buffer object initialization */
buffer_desc->common.flags = AOPOBJ_DATA_VALID;
buffer_desc->buffer.length = ACPI_SMBUS_BUFFER_SIZE;
buffer = buffer_desc->buffer.pointer;
ACPI_MEMCPY (buffer, source_desc->buffer.pointer, ACPI_SMBUS_BUFFER_SIZE);
/* Lock entire transaction if requested */
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
* $Revision: 110 $
* $Revision: 112 $
*
*****************************************************************************/
......@@ -148,9 +148,8 @@ acpi_ex_concat_template (
acpi_operand_object **actual_return_desc,
acpi_walk_state *walk_state)
{
acpi_status status;
acpi_operand_object *return_desc;
NATIVE_CHAR *new_buf;
u8 *new_buf;
u8 *end_tag1;
u8 *end_tag2;
ACPI_SIZE length1;
......@@ -168,54 +167,35 @@ acpi_ex_concat_template (
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/* Create a new buffer object for the result */
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
if (!return_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Allocate a new buffer for the result */
/* Compute the length of each part */
length1 = ACPI_PTR_DIFF (end_tag1, obj_desc1->buffer.pointer);
length2 = ACPI_PTR_DIFF (end_tag2, obj_desc2->buffer.pointer) +
2; /* Size of END_TAG */
new_buf = ACPI_MEM_ALLOCATE (length1 + length2);
if (!new_buf) {
ACPI_REPORT_ERROR
(("Ex_concat_template: Buffer allocation failure\n"));
status = AE_NO_MEMORY;
goto cleanup;
/* Create a new buffer object for the result */
return_desc = acpi_ut_create_buffer_object (length1 + length2);
if (!return_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Copy the templates to the new descriptor */
new_buf = return_desc->buffer.pointer;
ACPI_MEMCPY (new_buf, obj_desc1->buffer.pointer, length1);
ACPI_MEMCPY (new_buf + length1, obj_desc2->buffer.pointer, length2);
/* Complete the buffer object initialization */
return_desc->common.flags = AOPOBJ_DATA_VALID;
return_desc->buffer.pointer = (u8 *) new_buf;
return_desc->buffer.length = (u32) (length1 + length2);
/* Compute the new checksum */
new_buf[return_desc->buffer.length - 1] = (NATIVE_CHAR)
new_buf[return_desc->buffer.length - 1] =
acpi_ut_generate_checksum (return_desc->buffer.pointer,
(return_desc->buffer.length - 1));
(return_desc->buffer.length - 1));
/* Return the completed template descriptor */
*actual_return_desc = return_desc;
return_ACPI_STATUS (AE_OK);
cleanup:
acpi_ut_remove_reference (return_desc);
return_ACPI_STATUS (status);
}
......@@ -262,22 +242,14 @@ acpi_ex_do_concatenate (
case ACPI_TYPE_INTEGER:
/* Result of two Integers is a Buffer */
/* Need enough buffer space for two integers */
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
return_desc = acpi_ut_create_buffer_object (acpi_gbl_integer_byte_width * 2);
if (!return_desc) {
return (AE_NO_MEMORY);
}
/* Need enough buffer space for two integers */
return_desc->buffer.length = acpi_gbl_integer_byte_width * 2;
new_buf = ACPI_MEM_CALLOCATE (return_desc->buffer.length);
if (!new_buf) {
ACPI_REPORT_ERROR
(("Ex_do_concatenate: Buffer allocation failure\n"));
status = AE_NO_MEMORY;
goto cleanup;
}
new_buf = (NATIVE_CHAR *) return_desc->buffer.pointer;
/* Convert the first integer */
......@@ -295,10 +267,6 @@ acpi_ex_do_concatenate (
this_integer >>= 8;
}
/* Complete the buffer object initialization */
return_desc->common.flags = AOPOBJ_DATA_VALID;
return_desc->buffer.pointer = (u8 *) new_buf;
break;
......@@ -340,19 +308,14 @@ acpi_ex_do_concatenate (
/* Result of two Buffers is a Buffer */
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
return_desc = acpi_ut_create_buffer_object (
(ACPI_SIZE) obj_desc1->buffer.length +
(ACPI_SIZE) obj_desc2->buffer.length);
if (!return_desc) {
return (AE_NO_MEMORY);
}
new_buf = ACPI_MEM_ALLOCATE ((ACPI_SIZE) obj_desc1->buffer.length +
(ACPI_SIZE) obj_desc2->buffer.length);
if (!new_buf) {
ACPI_REPORT_ERROR
(("Ex_do_concatenate: Buffer allocation failure\n"));
status = AE_NO_MEMORY;
goto cleanup;
}
new_buf = (NATIVE_CHAR *) return_desc->buffer.pointer;
/* Concatenate the buffers */
......@@ -361,12 +324,6 @@ acpi_ex_do_concatenate (
ACPI_MEMCPY (new_buf + obj_desc1->buffer.length, obj_desc2->buffer.pointer,
obj_desc2->buffer.length);
/* Complete the buffer object initialization */
return_desc->common.flags = AOPOBJ_DATA_VALID;
return_desc->buffer.pointer = (u8 *) new_buf;
return_desc->buffer.length = obj_desc1->buffer.length +
obj_desc2->buffer.length;
break;
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg1 - AML execution - opcodes with 1 argument
* $Revision: 145 $
* $Revision: 146 $
*
*****************************************************************************/
......@@ -345,12 +345,6 @@ acpi_ex_opcode_1A_1T_1R (
* return FALSE
*/
return_desc->integer.value = 0;
/*
* Must delete the result descriptor since there is no reference
* being returned
*/
acpi_ut_remove_reference (operand[1]);
goto cleanup;
}
......@@ -389,6 +383,8 @@ acpi_ex_opcode_1A_1T_1R (
return_ACPI_STATUS (status);
}
/* It is possible that the Store already produced a return object */
if (!walk_state->result_obj) {
/*
* Normally, we would remove a reference on the Operand[0] parameter;
......
/******************************************************************************
*
* Module Name: exoparg2 - AML execution - opcodes with 2 arguments
* $Revision: 114 $
* $Revision: 115 $
*
*****************************************************************************/
......@@ -414,39 +414,10 @@ acpi_ex_opcode_2A_1T_1R (
goto cleanup;
}
if ((ACPI_GET_OBJECT_TYPE (operand[2]) == ACPI_TYPE_INTEGER) &&
(operand[2]->common.flags & AOPOBJ_AML_CONSTANT)) {
/*
* There is no actual result descriptor (the Zero_op/Constant Result
* descriptor is a placeholder), so just delete the placeholder and
* return a reference to the package element
*/
acpi_ut_remove_reference (operand[2]);
}
else {
/*
* Each element of the package is an internal object. Get the one
* we are after.
*/
temp_desc = operand[0]->package.elements [index];
return_desc->reference.opcode = AML_INDEX_OP;
return_desc->reference.target_type = ACPI_GET_OBJECT_TYPE (temp_desc);
return_desc->reference.object = temp_desc;
status = acpi_ex_store (return_desc, operand[2], walk_state);
return_desc->reference.object = NULL;
}
/*
* The local return object must always be a reference to the package element,
* not the element itself.
*/
return_desc->reference.opcode = AML_INDEX_OP;
return_desc->reference.target_type = ACPI_TYPE_PACKAGE;
return_desc->reference.object = operand[0]->package.elements [index];
return_desc->reference.where = &operand[0]->package.elements [index];
}
else {
/* Object to be indexed is a Buffer */
......@@ -457,14 +428,21 @@ acpi_ex_opcode_2A_1T_1R (
goto cleanup;
}
return_desc->reference.opcode = AML_INDEX_OP;
return_desc->reference.target_type = ACPI_TYPE_BUFFER_FIELD;
return_desc->reference.object = operand[0];
return_desc->reference.offset = index;
status = acpi_ex_store (return_desc, operand[2], walk_state);
return_desc->reference.object = operand[0];
}
/* Complete the Index reference object */
return_desc->reference.opcode = AML_INDEX_OP;
return_desc->reference.offset = index;
/* Store the reference to the Target */
status = acpi_ex_store (return_desc, operand[2], walk_state);
/* Return the reference */
walk_state->result_obj = return_desc;
goto cleanup;
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresnte - AML Interpreter object resolution
* $Revision: 60 $
* $Revision: 61 $
*
*****************************************************************************/
......@@ -85,8 +85,8 @@ acpi_ex_resolve_node_to_value (
source_desc = acpi_ns_get_attached_object (node);
entry_type = acpi_ns_get_type ((acpi_handle) node);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Entry=%p Source_desc=%p Type=%X\n",
node, source_desc, entry_type));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Entry=%p Source_desc=%p [%s]\n",
node, source_desc, acpi_ut_get_type_name (entry_type)));
if (entry_type == ACPI_TYPE_LOCAL_ALIAS) {
/* There is always exactly one level of indirection */
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresop - AML Interpreter operand/object resolution
* $Revision: 59 $
* $Revision: 60 $
*
*****************************************************************************/
......@@ -390,14 +390,6 @@ acpi_ex_resolve_operands (
return_ACPI_STATUS (status);
}
if (obj_desc != *stack_ptr) {
/*
* We just created a new object, remove a reference
* on the original operand object
*/
acpi_ut_remove_reference (obj_desc);
}
goto next_operand;
......@@ -420,14 +412,6 @@ acpi_ex_resolve_operands (
return_ACPI_STATUS (status);
}
if (obj_desc != *stack_ptr) {
/*
* We just created a new object, remove a reference
* on the original operand object
*/
acpi_ut_remove_reference (obj_desc);
}
goto next_operand;
......@@ -450,14 +434,6 @@ acpi_ex_resolve_operands (
return_ACPI_STATUS (status);
}
if (obj_desc != *stack_ptr) {
/*
* We just created a new object, remove a reference
* on the original operand object
*/
acpi_ut_remove_reference (obj_desc);
}
goto next_operand;
......
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
* $Revision: 117 $
* $Revision: 118 $
*
*****************************************************************************/
......@@ -54,7 +54,7 @@
/* Version string */
#define ACPI_CA_VERSION 0x20021111
#define ACPI_CA_VERSION 0x20021115
/* Version of ACPI supported */
......
/******************************************************************************
*
* Name: acdispat.h - dispatcher (parser to interpreter interface)
* $Revision: 54 $
* $Revision: 55 $
*
*****************************************************************************/
......@@ -378,6 +378,10 @@ acpi_status
acpi_ds_resolve_operands (
acpi_walk_state *walk_state);
void
acpi_ds_clear_operands (
acpi_walk_state *walk_state);
/*
* dswscope - Scope Stack manipulation
......
/******************************************************************************
*
* Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
* $Revision: 147 $
* $Revision: 148 $
*
*****************************************************************************/
......@@ -531,6 +531,10 @@ u8
acpi_ut_valid_internal_object (
void *object);
acpi_operand_object *
acpi_ut_create_buffer_object (
ACPI_SIZE buffer_size);
/*
* Ut_ref_cnt - Object reference count management
......
......@@ -2,7 +2,7 @@
*
* Module Name: nseval - Object evaluation interfaces -- includes control
* method lookup and execution.
* $Revision: 118 $
* $Revision: 119 $
*
******************************************************************************/
......@@ -383,7 +383,7 @@ acpi_ns_execute_control_method (
return_ACPI_STATUS (AE_NULL_OBJECT);
}
ACPI_DUMP_PATHNAME (method_node, "Ns_execute_control_method: Executing",
ACPI_DUMP_PATHNAME (method_node, "Execute Method:",
ACPI_LV_INFO, _COMPONENT);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Method at AML address %p Length %X\n",
......
/******************************************************************************
*
* Module Name: nsinit - namespace initialization
* $Revision: 49 $
* $Revision: 50 $
*
*****************************************************************************/
......@@ -317,7 +317,7 @@ acpi_ns_init_one_device (
ACPI_FUNCTION_TRACE ("Ns_init_one_device");
if (!(acpi_dbg_level & ACPI_LV_INIT)) {
if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) && (!(acpi_dbg_level & ACPI_LV_INFO))) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "."));
}
......
/******************************************************************************
*
* Module Name: psparse - Parser top level AML parse routines
* $Revision: 134 $
* $Revision: 135 $
*
*****************************************************************************/
......@@ -1078,7 +1078,8 @@ acpi_ps_parse_aml (
}
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"Completed one call to walk loop, State=%p\n", walk_state));
"Completed one call to walk loop, %s State=%p\n",
acpi_format_exception (status), walk_state));
if (status == AE_CTRL_TRANSFER) {
/*
......@@ -1094,10 +1095,15 @@ acpi_ps_parse_aml (
walk_state = acpi_ds_get_current_walk_state (thread);
continue;
}
else if (status == AE_CTRL_TERMINATE) {
status = AE_OK;
}
else if (status != AE_OK) {
ACPI_REPORT_ERROR (("Method execution failed, %s\n",
acpi_format_exception (status)));
ACPI_DUMP_PATHNAME (walk_state->method_node, "Method pathname: ",
ACPI_LV_ERROR, _COMPONENT);
}
/* We are done with this walk, move on to the parent if any */
......@@ -1150,11 +1156,6 @@ acpi_ps_parse_aml (
/* On error, delete any return object */
acpi_ut_remove_reference (previous_walk_state->return_desc);
ACPI_REPORT_ERROR (("Method execution failed, %s\n",
acpi_format_exception (status)));
ACPI_DUMP_PATHNAME (walk_state->method_node, "Method pathname: ",
ACPI_LV_ERROR, _COMPONENT);
}
}
......@@ -1165,7 +1166,6 @@ acpi_ps_parse_aml (
else if (previous_walk_state->caller_return_desc) {
*(previous_walk_state->caller_return_desc) = previous_walk_state->return_desc; /* NULL if no return value */
}
else if (previous_walk_state->return_desc) {
/* Caller doesn't want it, must delete it */
......
/******************************************************************************
*
* Module Name: utobject - ACPI object create/delete/size/cache routines
* $Revision: 77 $
* $Revision: 79 $
*
*****************************************************************************/
......@@ -114,6 +114,59 @@ acpi_ut_create_internal_object_dbg (
}
/*******************************************************************************
*
* FUNCTION: Acpi_ut_create_buffer_object
*
* PARAMETERS: Buffer_size - Size of buffer to be created
*
* RETURN: Pointer to a new Buffer object
*
* DESCRIPTION: Create a fully initialized buffer object
*
******************************************************************************/
acpi_operand_object *
acpi_ut_create_buffer_object (
ACPI_SIZE buffer_size)
{
acpi_operand_object *buffer_desc;
u8 *buffer;
ACPI_FUNCTION_TRACE_U32 ("Ut_create_buffer_object", buffer_size);
/*
* Create a new Buffer object
*/
buffer_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
if (!buffer_desc) {
return_PTR (NULL);
}
/* Allocate the actual buffer */
buffer = ACPI_MEM_CALLOCATE (buffer_size);
if (!buffer) {
ACPI_REPORT_ERROR (("Create_buffer: could not allocate size %X\n",
(u32) buffer_size));
acpi_ut_remove_reference (buffer_desc);
return_PTR (NULL);
}
/* Complete buffer object initialization */
buffer_desc->buffer.flags |= AOPOBJ_DATA_VALID;
buffer_desc->buffer.pointer = buffer;
buffer_desc->buffer.length = (u32) buffer_size;
/* Return the new buffer descriptor */
return_PTR (buffer_desc);
}
/*******************************************************************************
*
* FUNCTION: Acpi_ut_valid_internal_object
......@@ -135,8 +188,7 @@ acpi_ut_valid_internal_object (
/* Check for a null pointer */
if (!object) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"**** Null Object Ptr\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Null Object Ptr\n"));
return (FALSE);
}
......@@ -161,10 +213,17 @@ acpi_ut_valid_internal_object (
"**** Obj %p is a parser obj, not ACPI obj\n", object));
break;
case ACPI_DESC_TYPE_CACHED:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"**** Obj %p has already been released to internal cache\n", object));
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"**** Obj %p is of unknown type\n", object));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"**** Obj %p has unknown descriptor type %X\n", object,
ACPI_GET_DESCRIPTOR_TYPE (object)));
break;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment