diff options
| author | Andy Grover <agrover@groveronline.com> | 2002-11-17 20:38:25 -0800 |
|---|---|---|
| committer | Andy Grover <agrover@groveronline.com> | 2002-11-17 20:38:25 -0800 |
| commit | 73900ff36deb86d1a851bca807576a306842e6cf (patch) | |
| tree | 96825e538f28ff80f44dcaa641ab2919535dc5e4 | |
| parent | 175ceea9af88cc3a051e97cddeb77e8df792bb91 (diff) | |
| parent | 99127b7b2add22e7c85ced47f6e176f0de855635 (diff) | |
Merge groveronline.com:/root/bk/linux-2.5
into groveronline.com:/root/bk/linux-acpi
| -rw-r--r-- | drivers/acpi/dispatcher/dsutils.c | 41 | ||||
| -rw-r--r-- | drivers/acpi/dispatcher/dswexec.c | 16 | ||||
| -rw-r--r-- | drivers/acpi/events/evmisc.c | 9 | ||||
| -rw-r--r-- | drivers/acpi/executer/exconvrt.c | 146 | ||||
| -rw-r--r-- | drivers/acpi/executer/exfield.c | 53 | ||||
| -rw-r--r-- | drivers/acpi/executer/exmisc.c | 79 | ||||
| -rw-r--r-- | drivers/acpi/executer/exoparg1.c | 10 | ||||
| -rw-r--r-- | drivers/acpi/executer/exoparg2.c | 50 | ||||
| -rw-r--r-- | drivers/acpi/executer/exresnte.c | 6 | ||||
| -rw-r--r-- | drivers/acpi/executer/exresop.c | 26 | ||||
| -rw-r--r-- | drivers/acpi/include/acconfig.h | 4 | ||||
| -rw-r--r-- | drivers/acpi/include/acdispat.h | 6 | ||||
| -rw-r--r-- | drivers/acpi/include/acutils.h | 6 | ||||
| -rw-r--r-- | drivers/acpi/namespace/nseval.c | 4 | ||||
| -rw-r--r-- | drivers/acpi/namespace/nsinit.c | 4 | ||||
| -rw-r--r-- | drivers/acpi/osl.c | 27 | ||||
| -rw-r--r-- | drivers/acpi/parser/psparse.c | 18 | ||||
| -rw-r--r-- | drivers/acpi/sleep.c | 2 | ||||
| -rw-r--r-- | drivers/acpi/utilities/utobject.c | 69 |
19 files changed, 263 insertions, 313 deletions
diff --git a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/dispatcher/dsutils.c index bd1b0b406977..66c8d9d8d5c2 100644 --- a/drivers/acpi/dispatcher/dsutils.c +++ b/drivers/acpi/dispatcher/dsutils.c @@ -1,7 +1,7 @@ /******************************************************************************* * * 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 diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c index 5d553c6e426b..ba1bdec9f36d 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/dispatcher/dswexec.c @@ -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; } diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c index a80e0059e0c6..d1fe616b5d85 100644 --- a/drivers/acpi/events/evmisc.c +++ b/drivers/acpi/events/evmisc.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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. diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c index b639f7991460..ef003864264f 100644 --- a/drivers/acpi/executer/exconvrt.c +++ b/drivers/acpi/executer/exconvrt.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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); } diff --git a/drivers/acpi/executer/exfield.c b/drivers/acpi/executer/exfield.c index ec324a2a24dd..0ecaa457652b 100644 --- a/drivers/acpi/executer/exfield.c +++ b/drivers/acpi/executer/exfield.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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 */ diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index 708a7d6e0d9c..152b1d9edb27 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c @@ -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; diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c index d6a9aeb75b1e..8578e4fe153b 100644 --- a/drivers/acpi/executer/exoparg1.c +++ b/drivers/acpi/executer/exoparg1.c @@ -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; diff --git a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c index 82ec560426bf..10d4d07fe30a 100644 --- a/drivers/acpi/executer/exoparg2.c +++ b/drivers/acpi/executer/exoparg2.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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; diff --git a/drivers/acpi/executer/exresnte.c b/drivers/acpi/executer/exresnte.c index 6ced368f0f65..8aa0ab7defd4 100644 --- a/drivers/acpi/executer/exresnte.c +++ b/drivers/acpi/executer/exresnte.c @@ -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 */ diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c index c6b82a700920..6933061859d3 100644 --- a/drivers/acpi/executer/exresop.c +++ b/drivers/acpi/executer/exresop.c @@ -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; diff --git a/drivers/acpi/include/acconfig.h b/drivers/acpi/include/acconfig.h index e962e20ea4e9..83c0fd6e05db 100644 --- a/drivers/acpi/include/acconfig.h +++ b/drivers/acpi/include/acconfig.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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 */ diff --git a/drivers/acpi/include/acdispat.h b/drivers/acpi/include/acdispat.h index 182193be6ea0..1ecd03f5826f 100644 --- a/drivers/acpi/include/acdispat.h +++ b/drivers/acpi/include/acdispat.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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 diff --git a/drivers/acpi/include/acutils.h b/drivers/acpi/include/acutils.h index 576dd042debe..247059dca269 100644 --- a/drivers/acpi/include/acutils.h +++ b/drivers/acpi/include/acutils.h @@ -1,7 +1,7 @@ /****************************************************************************** * * 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 diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c index 161241b4cc6f..7563c68f7bd6 100644 --- a/drivers/acpi/namespace/nseval.c +++ b/drivers/acpi/namespace/nseval.c @@ -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", diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c index f0d8fca98c0f..5552f94c2054 100644 --- a/drivers/acpi/namespace/nsinit.c +++ b/drivers/acpi/namespace/nsinit.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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, ".")); } diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 0083a9822592..dbb0bca21298 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -525,7 +525,7 @@ acpi_os_queue_exec ( if (!dpc || !dpc->function) return_ACPI_STATUS (AE_BAD_PARAMETER); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Executing function [%p(%p)].\n", dpc->function, dpc->context)); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Executing function [%p(%p)].\n", dpc->function, dpc->context)); dpc->function(dpc->context); @@ -549,7 +549,7 @@ acpi_os_schedule_exec ( return_VOID; } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Creating new thread to run function [%p(%p)].\n", dpc->function, dpc->context)); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Creating new thread to run function [%p(%p)].\n", dpc->function, dpc->context)); thread_pid = kernel_thread(acpi_os_queue_exec, dpc, (CLONE_FS | CLONE_FILES | SIGCHLD)); @@ -571,7 +571,7 @@ acpi_os_queue_for_execution( ACPI_FUNCTION_TRACE ("os_queue_for_execution"); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Scheduling function [%p(%p)] for deferred execution.\n", function, context)); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Scheduling function [%p(%p)] for deferred execution.\n", function, context)); if (!function) return_ACPI_STATUS (AE_BAD_PARAMETER); @@ -657,7 +657,7 @@ acpi_os_create_semaphore( *handle = (acpi_handle*)sem; - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Creating semaphore[%p|%d].\n", *handle, initial_units)); + ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Creating semaphore[%p|%d].\n", *handle, initial_units)); return_ACPI_STATUS (AE_OK); } @@ -681,7 +681,7 @@ acpi_os_delete_semaphore( if (!sem) return_ACPI_STATUS (AE_BAD_PARAMETER); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting semaphore[%p].\n", handle)); + ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle)); acpi_os_free(sem); sem = NULL; @@ -716,7 +716,7 @@ acpi_os_wait_semaphore( if (units > 1) return_ACPI_STATUS (AE_SUPPORT); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Waiting for semaphore[%p|%d|%d]\n", handle, units, timeout)); + ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n", handle, units, timeout)); if (in_atomic()) timeout = 0; @@ -740,9 +740,7 @@ acpi_os_wait_semaphore( * ------------------ */ case ACPI_WAIT_FOREVER: - ret = down_interruptible(sem); - if (ret < 0) - status = AE_ERROR; + down(sem); break; /* @@ -763,16 +761,17 @@ acpi_os_wait_semaphore( } if (ret != 0) - status = AE_TIME; - } + status = AE_TIME; + } break; } if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Failed to acquire semaphore[%p|%d|%d]\n", handle, units, timeout)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Failed to acquire semaphore[%p|%d|%d], %s\n", + handle, units, timeout, acpi_format_exception(status))); } else { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Acquired semaphore[%p|%d|%d]\n", handle, units, timeout)); + ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Acquired semaphore[%p|%d|%d]\n", handle, units, timeout)); } return_ACPI_STATUS (status); @@ -797,7 +796,7 @@ acpi_os_signal_semaphore( if (units > 1) return_ACPI_STATUS (AE_SUPPORT); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Signaling semaphore[%p|%d]\n", handle, units)); + ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Signaling semaphore[%p|%d]\n", handle, units)); up(sem); diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c index 4832f1eda957..71286eb77b36 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/parser/psparse.c @@ -1,7 +1,7 @@ /****************************************************************************** * * 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 */ diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 8a4809888f80..23891f85c4ca 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -205,8 +205,10 @@ acpi_system_suspend( break; case ACPI_STATE_S2: +#ifdef CONFIG_SOFTWARE_SUSPEND case ACPI_STATE_S3: do_suspend_lowlevel(0); +#endif break; } local_irq_restore(flags); diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c index 81d70cd3cfde..c18caab11a75 100644 --- a/drivers/acpi/utilities/utobject.c +++ b/drivers/acpi/utilities/utobject.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utobject - ACPI object create/delete/size/cache routines - * $Revision: 77 $ + * $Revision: 79 $ * *****************************************************************************/ @@ -116,6 +116,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 * * PARAMETERS: Object - Object to be validated @@ -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; } |
