From 8d7b2d682a9740e2edfb4ab6ceb01a7551797c68 Mon Sep 17 00:00:00 2001 From: Len Brown Date: Fri, 22 Oct 2004 07:33:45 -0400 Subject: [ACPI] ACPICA 20040827 update from Bob Moore Signed-off-by: Len Brown Implemented support for implicit object conversion in the non-numeric logical operators (LEqual, LGreater, LGreaterEqual, LLess, LLessEqual, and LNotEqual.) Any combination of Integers/Strings/Buffers may now be used; the second operand is implicitly converted on the fly to match the type of the first operand. For example: LEqual (Source1, Source2) Source1 and Source2 must each evaluate to an integer, a string, or a buffer. The data type of Source1 dictates the required type of Source2. Source2 is implicitly converted if necessary to match the type of Source1. Updated and corrected the behavior of the string conversion support. The rules concerning conversion of buffers to strings (according to the ACPI specification) are as follows: ToDecimalString - explicit byte-wise conversion of buffer to string of decimal values (0-255) separated by commas. ToHexString - explicit byte-wise conversion of buffer to string of hex values (0-FF) separated by commas. ToString - explicit byte-wise conversion of buffer to string. Byte-by-byte copy with no transform except NULL terminated. Any other implicit buffer-to-string conversion byte-wise conversion of buffer to string of hex values (0-FF) separated by spaces. Fixed a problem in acpi_ns_get_pathname_length where the returned length was one byte too short in the case of a node in the root scope. This could cause a fault during debug output. --- include/acpi/acconfig.h | 2 +- include/acpi/acinterp.h | 32 +++++++++++++++++++++++--------- include/acpi/acobject.h | 5 ++++- include/acpi/actypes.h | 9 +++++++-- include/acpi/acutils.h | 4 ++++ include/acpi/amlcode.h | 25 +++++++++++++------------ include/acpi/amlresrc.h | 4 ++-- 7 files changed, 54 insertions(+), 27 deletions(-) (limited to 'include') diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index e4a0f1e6f814..5911d1b3c589 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -64,7 +64,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20040816 +#define ACPI_CA_VERSION 0x20040827 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, diff --git a/include/acpi/acinterp.h b/include/acpi/acinterp.h index a43e91fb972c..f87445f46b54 100644 --- a/include/acpi/acinterp.h +++ b/include/acpi/acinterp.h @@ -83,21 +83,27 @@ acpi_status acpi_ex_convert_to_integer ( union acpi_operand_object *obj_desc, union acpi_operand_object **result_desc, - struct acpi_walk_state *walk_state); + u16 opcode); acpi_status acpi_ex_convert_to_buffer ( union acpi_operand_object *obj_desc, union acpi_operand_object **result_desc, - struct acpi_walk_state *walk_state); + u16 opcode); acpi_status acpi_ex_convert_to_string ( union acpi_operand_object *obj_desc, union acpi_operand_object **result_desc, - u32 base, - u32 max_length, - struct acpi_walk_state *walk_state); + u32 type, + u16 opcode); + +/* Types for String conversion */ + +#define ACPI_EXPLICIT_BYTE_COPY 0x00000000 +#define ACPI_EXPLICIT_CONVERT_HEX 0x00000001 +#define ACPI_IMPLICIT_CONVERT_HEX 0x00000002 +#define ACPI_EXPLICIT_CONVERT_DECIMAL 0x00000003 acpi_status acpi_ex_convert_to_target_type ( @@ -109,7 +115,7 @@ acpi_ex_convert_to_target_type ( u32 acpi_ex_convert_to_ascii ( acpi_integer integer, - u32 base, + u16 base, u8 *string, u8 max_length); @@ -243,11 +249,19 @@ acpi_ex_do_concatenate ( union acpi_operand_object **actual_return_desc, struct acpi_walk_state *walk_state); -u8 +acpi_status +acpi_ex_do_logical_numeric_op ( + u16 opcode, + acpi_integer integer0, + acpi_integer integer1, + u8 *logical_result); + +acpi_status acpi_ex_do_logical_op ( u16 opcode, - union acpi_operand_object *obj_desc, - union acpi_operand_object *obj_desc2); + union acpi_operand_object *operand0, + union acpi_operand_object *operand1, + u8 *logical_result); acpi_integer acpi_ex_do_math_op ( diff --git a/include/acpi/acobject.h b/include/acpi/acobject.h index 0d479722f4aa..09d6a5af268c 100644 --- a/include/acpi/acobject.h +++ b/include/acpi/acobject.h @@ -135,7 +135,10 @@ struct acpi_object_integer acpi_integer value; }; - +/* + * Note: The String and Buffer object must be identical through the Pointer + * element. There is code that depends on this. + */ struct acpi_object_string /* Null terminated, ASCII characters only */ { ACPI_OBJECT_COMMON_HEADER diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 8bee457d81d6..c5bd3036c57a 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -303,7 +303,7 @@ struct uint32_struct typedef u32 acpi_integer; #define ACPI_INTEGER_MAX ACPI_UINT32_MAX #define ACPI_INTEGER_BIT_SIZE 32 -#define ACPI_MAX_DECIMAL_DIGITS 10 +#define ACPI_MAX_DECIMAL_DIGITS 10 /* 2^32 = 4,294,967,296 */ #define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */ @@ -315,13 +315,18 @@ typedef u32 acpi_integer; typedef u64 acpi_integer; #define ACPI_INTEGER_MAX ACPI_UINT64_MAX #define ACPI_INTEGER_BIT_SIZE 64 -#define ACPI_MAX_DECIMAL_DIGITS 19 +#define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */ + #if ACPI_MACHINE_WIDTH == 64 #define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */ #endif #endif +#define ACPI_MAX64_DECIMAL_DIGITS 20 +#define ACPI_MAX32_DECIMAL_DIGITS 10 +#define ACPI_MAX16_DECIMAL_DIGITS 5 +#define ACPI_MAX8_DECIMAL_DIGITS 3 /* * Constants with special meanings diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h index d786ae5ec820..ab3784a0cf58 100644 --- a/include/acpi/acutils.h +++ b/include/acpi/acutils.h @@ -577,6 +577,10 @@ union acpi_operand_object * acpi_ut_create_buffer_object ( acpi_size buffer_size); +union acpi_operand_object * +acpi_ut_create_string_object ( + acpi_size string_size); + /* * ut_ref_cnt - Object reference count management diff --git a/include/acpi/amlcode.h b/include/acpi/amlcode.h index 0344b94c863d..1d06e16648cc 100644 --- a/include/acpi/amlcode.h +++ b/include/acpi/amlcode.h @@ -305,19 +305,20 @@ /* Opcode flags */ -#define AML_HAS_ARGS 0x0800 -#define AML_HAS_TARGET 0x0400 -#define AML_HAS_RETVAL 0x0200 -#define AML_NSOBJECT 0x0100 -#define AML_NSOPCODE 0x0080 -#define AML_NSNODE 0x0040 -#define AML_NAMED 0x0020 -#define AML_DEFER 0x0010 -#define AML_FIELD 0x0008 -#define AML_CREATE 0x0004 -#define AML_MATH 0x0002 #define AML_LOGICAL 0x0001 -#define AML_CONSTANT 0x1000 +#define AML_LOGICAL_NUMERIC 0x0002 +#define AML_MATH 0x0004 +#define AML_CREATE 0x0008 +#define AML_FIELD 0x0010 +#define AML_DEFER 0x0020 +#define AML_NAMED 0x0040 +#define AML_NSNODE 0x0080 +#define AML_NSOPCODE 0x0100 +#define AML_NSOBJECT 0x0200 +#define AML_HAS_RETVAL 0x0400 +#define AML_HAS_TARGET 0x0800 +#define AML_HAS_ARGS 0x1000 +#define AML_CONSTANT 0x2000 /* Convenient flag groupings */ diff --git a/include/acpi/amlresrc.h b/include/acpi/amlresrc.h index b28b6905b71e..89a52ddae530 100644 --- a/include/acpi/amlresrc.h +++ b/include/acpi/amlresrc.h @@ -99,7 +99,7 @@ struct asl_resource_node /* * Resource descriptors defined in the ACPI specification. * - * Alignment must be BYTE because these descriptors + * Packing/alignment must be BYTE because these descriptors * are used to overlay the AML byte stream. */ #pragma pack(1) @@ -297,7 +297,7 @@ struct asl_general_register_desc #pragma pack() -/* Union of all resource descriptors, sow we can allocate the worst case */ +/* Union of all resource descriptors, so we can allocate the worst case */ union asl_resource_desc { -- cgit v1.2.3 From 419a57d5700c0b7a842e6e24a44179763c7c5b27 Mon Sep 17 00:00:00 2001 From: Len Brown Date: Fri, 22 Oct 2004 07:39:52 -0400 Subject: [ACPI] ACPICA 20040922 from Bob Moore Signed-off-by: Len Brown Fixed a problem with the implementation of the LNot() operator where "Ones" was not returned for the TRUE case. Changed the code to return Ones instead of (!Arg) which was usually 1. This change affects iASL constant folding for this operator also. Fixed a problem in acpi_ut_initialize_buffer where an existing buffer was not initialized properly -- Now zero the entire buffer in this case where the buffer already exists. Changed the interface to acpi_os_sleep from (UINT32 Seconds, UINT32 Milliseconds) to simply (ACPI_INTEGER Milliseconds). This simplifies all related code considerably. This requires changes/updates to all OS interface layers (OSLs.) Implemented a new external interface, acpi_install_exception_handler, to allow a system exception handler to be installed. This handler is invoked upon any run-time exception that occurs during control method execution. Added support for the DSDT in acpi_tb_find_table. This allows the DataTableRegion() operator to access the local copy of the DSDT. --- drivers/acpi/dispatcher/dswexec.c | 11 +++ drivers/acpi/events/evxface.c | 45 ++++++++++ drivers/acpi/executer/exdump.c | 173 ++++++++++++++++++++------------------ drivers/acpi/executer/exoparg1.c | 10 ++- drivers/acpi/executer/exstore.c | 24 ++++-- drivers/acpi/executer/exsystem.c | 5 +- drivers/acpi/namespace/nsaccess.c | 14 +-- drivers/acpi/namespace/nsdump.c | 61 +++++++------- drivers/acpi/namespace/nsdumpdv.c | 11 +-- drivers/acpi/namespace/nseval.c | 92 ++++++++------------ drivers/acpi/namespace/nsinit.c | 27 +++--- drivers/acpi/namespace/nsload.c | 11 +-- drivers/acpi/namespace/nsnames.c | 3 +- drivers/acpi/namespace/nssearch.c | 49 ++++++----- drivers/acpi/namespace/nsutils.c | 53 ++++++------ drivers/acpi/tables/tbget.c | 3 + drivers/acpi/tables/tbxfroot.c | 27 ++++-- drivers/acpi/utilities/utalloc.c | 15 ++-- drivers/acpi/utilities/utglobal.c | 1 + include/acpi/acconfig.h | 2 +- include/acpi/acglobal.h | 1 + include/acpi/acinterp.h | 2 +- include/acpi/acpiosxf.h | 7 +- include/acpi/acpixf.h | 9 ++ include/acpi/actypes.h | 4 + 25 files changed, 384 insertions(+), 276 deletions(-) (limited to 'include') diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c index 148040c09a75..d57bfcc7e1b0 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/dispatcher/dswexec.c @@ -650,6 +650,17 @@ acpi_ds_exec_end_op ( cleanup: + + /* Invoke exception handler on error */ + + if (ACPI_FAILURE (status) && + acpi_gbl_exception_handler && + !(status & AE_CODE_CONTROL)) { + acpi_ex_exit_interpreter (); + status = acpi_gbl_exception_handler (status); + acpi_ex_enter_interpreter (); + } + if (walk_state->result_obj) { /* Break to debugger to display result */ diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index 26e9b0e41565..5a5c9f2e46f3 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c @@ -51,6 +51,51 @@ ACPI_MODULE_NAME ("evxface") +/******************************************************************************* + * + * FUNCTION: acpi_install_exception_handler + * + * PARAMETERS: Handler - Pointer to the handler function for the + * event + * + * RETURN: Status + * + * DESCRIPTION: Saves the pointer to the handler function + * + ******************************************************************************/ + +acpi_status +acpi_install_exception_handler ( + acpi_exception_handler handler) +{ + acpi_status status; + + + ACPI_FUNCTION_TRACE ("acpi_install_exception_handler"); + + + status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); + if (ACPI_FAILURE (status)) { + return_ACPI_STATUS (status); + } + + /* Don't allow two handlers. */ + + if (acpi_gbl_exception_handler) { + status = AE_ALREADY_EXISTS; + goto cleanup; + } + + /* Install the handler */ + + acpi_gbl_exception_handler = handler; + +cleanup: + (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS); + return_ACPI_STATUS (status); +} + + /******************************************************************************* * * FUNCTION: acpi_install_fixed_event_handler diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index 5c2c912eded8..9ebcc75b3a07 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c @@ -55,7 +55,6 @@ /* * The following routines are used for debug output only */ - #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) /***************************************************************************** @@ -103,8 +102,8 @@ acpi_ex_dump_operand ( if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "%p is not a node or operand object: [%s]\n", - obj_desc, acpi_ut_get_descriptor_name (obj_desc))); + "%p is not a node or operand object: [%s]\n", + obj_desc, acpi_ut_get_descriptor_name (obj_desc))); ACPI_DUMP_BUFFER (obj_desc, sizeof (union acpi_operand_object)); return; } @@ -125,8 +124,8 @@ acpi_ex_dump_operand ( case AML_NAME_OP: - ACPI_DUMP_PATHNAME (obj_desc->reference.object, "Reference: Name: ", - ACPI_LV_INFO, _COMPONENT); + ACPI_DUMP_PATHNAME (obj_desc->reference.object, + "Reference: Name: ", ACPI_LV_INFO, _COMPONENT); ACPI_DUMP_ENTRY (obj_desc->reference.object, ACPI_LV_INFO); break; @@ -134,27 +133,27 @@ acpi_ex_dump_operand ( case AML_INDEX_OP: acpi_os_printf ("Reference: Index %p\n", - obj_desc->reference.object); + obj_desc->reference.object); break; case AML_REF_OF_OP: acpi_os_printf ("Reference: (ref_of) %p\n", - obj_desc->reference.object); + obj_desc->reference.object); break; case AML_ARG_OP: acpi_os_printf ("Reference: Arg%d", - obj_desc->reference.offset); + obj_desc->reference.offset); if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { /* Value is an Integer */ acpi_os_printf (" value is [%8.8X%8.8x]", - ACPI_FORMAT_UINT64 (obj_desc->integer.value)); + ACPI_FORMAT_UINT64 (obj_desc->integer.value)); } acpi_os_printf ("\n"); @@ -164,14 +163,14 @@ acpi_ex_dump_operand ( case AML_LOCAL_OP: acpi_os_printf ("Reference: Local%d", - obj_desc->reference.offset); + obj_desc->reference.offset); if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { /* Value is an Integer */ acpi_os_printf (" value is [%8.8X%8.8x]", - ACPI_FORMAT_UINT64 (obj_desc->integer.value)); + ACPI_FORMAT_UINT64 (obj_desc->integer.value)); } acpi_os_printf ("\n"); @@ -181,7 +180,7 @@ acpi_ex_dump_operand ( case AML_INT_NAMEPATH_OP: acpi_os_printf ("Reference.Node->Name %X\n", - obj_desc->reference.node->name.integer); + obj_desc->reference.node->name.integer); break; @@ -201,8 +200,7 @@ acpi_ex_dump_operand ( case ACPI_TYPE_BUFFER: acpi_os_printf ("Buffer len %X @ %p \n", - obj_desc->buffer.length, - obj_desc->buffer.pointer); + obj_desc->buffer.length, obj_desc->buffer.pointer); length = obj_desc->buffer.length; @@ -227,14 +225,14 @@ acpi_ex_dump_operand ( case ACPI_TYPE_INTEGER: acpi_os_printf ("Integer %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (obj_desc->integer.value)); + ACPI_FORMAT_UINT64 (obj_desc->integer.value)); break; case ACPI_TYPE_PACKAGE: acpi_os_printf ("Package count %X @ %p\n", - obj_desc->package.count, obj_desc->package.elements); + obj_desc->package.count, obj_desc->package.elements); /* * If elements exist, package vector pointer is valid, @@ -277,7 +275,7 @@ acpi_ex_dump_operand ( case ACPI_TYPE_STRING: 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_os_printf ("\n"); break; @@ -387,10 +385,13 @@ acpi_ex_dump_operand ( * * FUNCTION: acpi_ex_dump_operands * - * PARAMETERS: interpreter_mode - Load or Exec - * *Ident - Identification + * PARAMETERS: Operands - Operand list + * interpreter_mode - Load or Exec + * Ident - Identification * num_levels - # of stack entries to dump above line - * *Note - Output notation + * Note - Output notation + * module_name - Caller's module name + * line_number - Caller's invocation line number * * DESCRIPTION: Dump the object stack * @@ -489,8 +490,7 @@ acpi_ex_out_address ( #if ACPI_MACHINE_WIDTH == 16 acpi_os_printf ("%20s : %p\n", title, value); #else - acpi_os_printf ("%20s : %8.8X%8.8X\n", title, - ACPI_FORMAT_UINT64 (value)); + acpi_os_printf ("%20s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64 (value)); #endif } @@ -563,22 +563,25 @@ acpi_ex_dump_object_descriptor ( if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) { acpi_ex_dump_node ((struct acpi_namespace_node *) obj_desc, flags); - acpi_os_printf ("\nAttached Object (%p):\n", ((struct acpi_namespace_node *) obj_desc)->object); - acpi_ex_dump_object_descriptor (((struct acpi_namespace_node *) obj_desc)->object, flags); - return; + acpi_os_printf ("\nAttached Object (%p):\n", + ((struct acpi_namespace_node *) obj_desc)->object); + acpi_ex_dump_object_descriptor ( + ((struct acpi_namespace_node *) obj_desc)->object, flags); + return_VOID; } if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND) { - acpi_os_printf ("ex_dump_object_descriptor: %p is not an ACPI operand object: [%s]\n", - obj_desc, acpi_ut_get_descriptor_name (obj_desc)); + acpi_os_printf ( + "ex_dump_object_descriptor: %p is not an ACPI operand object: [%s]\n", + obj_desc, acpi_ut_get_descriptor_name (obj_desc)); return_VOID; } /* Common Fields */ - acpi_ex_out_string ("Type", acpi_ut_get_object_type_name (obj_desc)); + acpi_ex_out_string ("Type", acpi_ut_get_object_type_name (obj_desc)); acpi_ex_out_integer ("Reference Count", obj_desc->common.reference_count); - acpi_ex_out_integer ("Flags", obj_desc->common.flags); + acpi_ex_out_integer ("Flags", obj_desc->common.flags); /* Object-specific Fields */ @@ -592,7 +595,7 @@ acpi_ex_dump_object_descriptor ( case ACPI_TYPE_STRING: - acpi_ex_out_integer ("Length", obj_desc->string.length); + acpi_ex_out_integer ("Length", obj_desc->string.length); acpi_os_printf ("%20s : %p ", "Pointer", obj_desc->string.pointer); acpi_ut_print_string (obj_desc->string.pointer, ACPI_UINT8_MAX); @@ -602,17 +605,17 @@ acpi_ex_dump_object_descriptor ( case ACPI_TYPE_BUFFER: - acpi_ex_out_integer ("Length", obj_desc->buffer.length); - acpi_ex_out_pointer ("Pointer", obj_desc->buffer.pointer); + acpi_ex_out_integer ("Length", obj_desc->buffer.length); + acpi_ex_out_pointer ("Pointer", obj_desc->buffer.pointer); ACPI_DUMP_BUFFER (obj_desc->buffer.pointer, obj_desc->buffer.length); break; case ACPI_TYPE_PACKAGE: - acpi_ex_out_integer ("Flags", obj_desc->package.flags); - acpi_ex_out_integer ("Count", obj_desc->package.count); - acpi_ex_out_pointer ("Elements", obj_desc->package.elements); + acpi_ex_out_integer ("Flags", obj_desc->package.flags); + acpi_ex_out_integer ("Count", obj_desc->package.count); + acpi_ex_out_pointer ("Elements", obj_desc->package.elements); /* Dump the package contents */ @@ -621,7 +624,8 @@ acpi_ex_dump_object_descriptor ( for (i = 0; i < obj_desc->package.count; i++) { acpi_os_printf ("[%.3d] %p", i, obj_desc->package.elements[i]); if (obj_desc->package.elements[i]) { - acpi_os_printf (" %s", acpi_ut_get_object_type_name (obj_desc->package.elements[i])); + acpi_os_printf (" %s", + acpi_ut_get_object_type_name (obj_desc->package.elements[i])); } acpi_os_printf ("\n"); } @@ -639,38 +643,38 @@ acpi_ex_dump_object_descriptor ( case ACPI_TYPE_EVENT: - acpi_ex_out_pointer ("Semaphore", obj_desc->event.semaphore); + acpi_ex_out_pointer ("Semaphore", obj_desc->event.semaphore); break; case ACPI_TYPE_METHOD: - acpi_ex_out_integer ("param_count", obj_desc->method.param_count); - acpi_ex_out_integer ("Concurrency", obj_desc->method.concurrency); - acpi_ex_out_pointer ("Semaphore", obj_desc->method.semaphore); - acpi_ex_out_integer ("owning_id", obj_desc->method.owning_id); - acpi_ex_out_integer ("aml_length", obj_desc->method.aml_length); - acpi_ex_out_pointer ("aml_start", obj_desc->method.aml_start); + acpi_ex_out_integer ("param_count", obj_desc->method.param_count); + acpi_ex_out_integer ("Concurrency", obj_desc->method.concurrency); + acpi_ex_out_pointer ("Semaphore", obj_desc->method.semaphore); + acpi_ex_out_integer ("owning_id", obj_desc->method.owning_id); + acpi_ex_out_integer ("aml_length", obj_desc->method.aml_length); + acpi_ex_out_pointer ("aml_start", obj_desc->method.aml_start); break; case ACPI_TYPE_MUTEX: - acpi_ex_out_integer ("sync_level", obj_desc->mutex.sync_level); + acpi_ex_out_integer ("sync_level", obj_desc->mutex.sync_level); acpi_ex_out_pointer ("owner_thread", obj_desc->mutex.owner_thread); - acpi_ex_out_integer ("acquisition_depth",obj_desc->mutex.acquisition_depth); - acpi_ex_out_pointer ("Semaphore", obj_desc->mutex.semaphore); + acpi_ex_out_integer ("acquire_depth", obj_desc->mutex.acquisition_depth); + acpi_ex_out_pointer ("Semaphore", obj_desc->mutex.semaphore); break; case ACPI_TYPE_REGION: - acpi_ex_out_integer ("space_id", obj_desc->region.space_id); - acpi_ex_out_integer ("Flags", obj_desc->region.flags); - acpi_ex_out_address ("Address", obj_desc->region.address); - acpi_ex_out_integer ("Length", obj_desc->region.length); - acpi_ex_out_pointer ("Handler", obj_desc->region.handler); - acpi_ex_out_pointer ("Next", obj_desc->region.next); + acpi_ex_out_integer ("space_id", obj_desc->region.space_id); + acpi_ex_out_integer ("Flags", obj_desc->region.flags); + acpi_ex_out_address ("Address", obj_desc->region.address); + acpi_ex_out_integer ("Length", obj_desc->region.length); + acpi_ex_out_pointer ("Handler", obj_desc->region.handler); + acpi_ex_out_pointer ("Next", obj_desc->region.next); break; @@ -686,11 +690,11 @@ acpi_ex_dump_object_descriptor ( case ACPI_TYPE_PROCESSOR: acpi_ex_out_integer ("Processor ID", obj_desc->processor.proc_id); - acpi_ex_out_integer ("Length", obj_desc->processor.length); - acpi_ex_out_address ("Address", (acpi_physical_address) obj_desc->processor.address); + acpi_ex_out_integer ("Length", obj_desc->processor.length); + acpi_ex_out_address ("Address", (acpi_physical_address) obj_desc->processor.address); acpi_ex_out_pointer ("system_notify", obj_desc->processor.system_notify); acpi_ex_out_pointer ("device_notify", obj_desc->processor.device_notify); - acpi_ex_out_pointer ("Handler", obj_desc->processor.handler); + acpi_ex_out_pointer ("Handler", obj_desc->processor.handler); break; @@ -698,7 +702,7 @@ acpi_ex_dump_object_descriptor ( acpi_ex_out_pointer ("system_notify", obj_desc->thermal_zone.system_notify); acpi_ex_out_pointer ("device_notify", obj_desc->thermal_zone.device_notify); - acpi_ex_out_pointer ("Handler", obj_desc->thermal_zone.handler); + acpi_ex_out_pointer ("Handler", obj_desc->thermal_zone.handler); break; @@ -707,35 +711,35 @@ acpi_ex_dump_object_descriptor ( case ACPI_TYPE_LOCAL_BANK_FIELD: case ACPI_TYPE_LOCAL_INDEX_FIELD: - acpi_ex_out_integer ("field_flags", obj_desc->common_field.field_flags); - acpi_ex_out_integer ("access_byte_width", obj_desc->common_field.access_byte_width); - acpi_ex_out_integer ("bit_length", obj_desc->common_field.bit_length); + acpi_ex_out_integer ("field_flags", obj_desc->common_field.field_flags); + acpi_ex_out_integer ("access_byte_width",obj_desc->common_field.access_byte_width); + acpi_ex_out_integer ("bit_length", obj_desc->common_field.bit_length); acpi_ex_out_integer ("fld_bit_offset", obj_desc->common_field.start_field_bit_offset); acpi_ex_out_integer ("base_byte_offset", obj_desc->common_field.base_byte_offset); acpi_ex_out_integer ("datum_valid_bits", obj_desc->common_field.datum_valid_bits); - acpi_ex_out_integer ("end_fld_valid_bits", obj_desc->common_field.end_field_valid_bits); - acpi_ex_out_integer ("end_buf_valid_bits", obj_desc->common_field.end_buffer_valid_bits); - acpi_ex_out_pointer ("parent_node", obj_desc->common_field.node); + acpi_ex_out_integer ("end_fld_valid_bits",obj_desc->common_field.end_field_valid_bits); + acpi_ex_out_integer ("end_buf_valid_bits",obj_desc->common_field.end_buffer_valid_bits); + acpi_ex_out_pointer ("parent_node", obj_desc->common_field.node); switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { case ACPI_TYPE_BUFFER_FIELD: - acpi_ex_out_pointer ("buffer_obj", obj_desc->buffer_field.buffer_obj); + acpi_ex_out_pointer ("buffer_obj", obj_desc->buffer_field.buffer_obj); break; case ACPI_TYPE_LOCAL_REGION_FIELD: - acpi_ex_out_pointer ("region_obj", obj_desc->field.region_obj); + acpi_ex_out_pointer ("region_obj", obj_desc->field.region_obj); break; case ACPI_TYPE_LOCAL_BANK_FIELD: - acpi_ex_out_integer ("Value", obj_desc->bank_field.value); - acpi_ex_out_pointer ("region_obj", obj_desc->bank_field.region_obj); - acpi_ex_out_pointer ("bank_obj", obj_desc->bank_field.bank_obj); + acpi_ex_out_integer ("Value", obj_desc->bank_field.value); + acpi_ex_out_pointer ("region_obj", obj_desc->bank_field.region_obj); + acpi_ex_out_pointer ("bank_obj", obj_desc->bank_field.bank_obj); break; case ACPI_TYPE_LOCAL_INDEX_FIELD: - acpi_ex_out_integer ("Value", obj_desc->index_field.value); - acpi_ex_out_pointer ("Index", obj_desc->index_field.index_obj); - acpi_ex_out_pointer ("Data", obj_desc->index_field.data_obj); + acpi_ex_out_integer ("Value", obj_desc->index_field.value); + acpi_ex_out_pointer ("Index", obj_desc->index_field.index_obj); + acpi_ex_out_pointer ("Data", obj_desc->index_field.data_obj); break; default: @@ -747,29 +751,29 @@ acpi_ex_dump_object_descriptor ( case ACPI_TYPE_LOCAL_REFERENCE: - 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_integer ("Offset", obj_desc->reference.offset); - acpi_ex_out_pointer ("obj_desc", obj_desc->reference.object); - acpi_ex_out_pointer ("Node", obj_desc->reference.node); - acpi_ex_out_pointer ("Where", obj_desc->reference.where); + 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_integer ("Offset", obj_desc->reference.offset); + acpi_ex_out_pointer ("obj_desc", obj_desc->reference.object); + acpi_ex_out_pointer ("Node", obj_desc->reference.node); + acpi_ex_out_pointer ("Where", obj_desc->reference.where); break; case ACPI_TYPE_LOCAL_ADDRESS_HANDLER: - acpi_ex_out_integer ("space_id", obj_desc->address_space.space_id); - acpi_ex_out_pointer ("Next", obj_desc->address_space.next); - acpi_ex_out_pointer ("region_list", obj_desc->address_space.region_list); - acpi_ex_out_pointer ("Node", obj_desc->address_space.node); - acpi_ex_out_pointer ("Context", obj_desc->address_space.context); + acpi_ex_out_integer ("space_id", obj_desc->address_space.space_id); + acpi_ex_out_pointer ("Next", obj_desc->address_space.next); + acpi_ex_out_pointer ("region_list", obj_desc->address_space.region_list); + acpi_ex_out_pointer ("Node", obj_desc->address_space.node); + acpi_ex_out_pointer ("Context", obj_desc->address_space.context); break; case ACPI_TYPE_LOCAL_NOTIFY: - acpi_ex_out_pointer ("Node", obj_desc->notify.node); - acpi_ex_out_pointer ("Context", obj_desc->notify.context); + acpi_ex_out_pointer ("Node", obj_desc->notify.node); + acpi_ex_out_pointer ("Context", obj_desc->notify.context); break; @@ -779,7 +783,8 @@ acpi_ex_dump_object_descriptor ( case ACPI_TYPE_LOCAL_DATA: default: - acpi_os_printf ("ex_dump_object_descriptor: Display not implemented for object type %s\n", + acpi_os_printf ( + "ex_dump_object_descriptor: Display not implemented for object type %s\n", acpi_ut_get_object_type_name (obj_desc)); break; } diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c index 33adceb1bf5d..18bef63514b1 100644 --- a/drivers/acpi/executer/exoparg1.c +++ b/drivers/acpi/executer/exoparg1.c @@ -124,7 +124,7 @@ acpi_ex_opcode_1A_0T_0R ( case AML_SLEEP_OP: /* Sleep (msec_time) */ - status = acpi_ex_system_do_suspend ((u32) operand[0]->integer.value); + status = acpi_ex_system_do_suspend (operand[0]->integer.value); break; @@ -543,7 +543,13 @@ acpi_ex_opcode_1A_0T_1R ( goto cleanup; } - return_desc->integer.value = !operand[0]->integer.value; + /* + * Set result to ONES (TRUE) if Value == 0. Note: + * return_desc->Integer.Value is initially == 0 (FALSE) from above. + */ + if (!operand[0]->integer.value) { + return_desc->integer.value = ACPI_INTEGER_MAX; + } break; diff --git a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c index 25464f751408..47e5d0d83a96 100644 --- a/drivers/acpi/executer/exstore.c +++ b/drivers/acpi/executer/exstore.c @@ -185,20 +185,26 @@ acpi_ex_store ( ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "**** Write to Debug Object: ****:\n\n")); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %s: ", - acpi_ut_get_object_type_name (source_desc))); + acpi_ut_get_object_type_name (source_desc))); switch (ACPI_GET_OBJECT_TYPE (source_desc)) { case ACPI_TYPE_INTEGER: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n", + if (acpi_gbl_integer_byte_width == 4) { + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n", + (u32) source_desc->integer.value)); + } + else { + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (source_desc->integer.value))); + } break; case ACPI_TYPE_BUFFER: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Length 0x%.2X", - (u32) source_desc->buffer.length)); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]", + (u32) source_desc->buffer.length)); ACPI_DUMP_BUFFER (source_desc->buffer.pointer, (source_desc->buffer.length < 32) ? source_desc->buffer.length : 32); break; @@ -206,22 +212,22 @@ acpi_ex_store ( case ACPI_TYPE_STRING: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Length 0x%.2X, \"%s\"\n", - source_desc->string.length, source_desc->string.pointer)); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n", + source_desc->string.length, source_desc->string.pointer)); break; case ACPI_TYPE_PACKAGE: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Size 0x%.2X Elements Ptr - %p\n", - source_desc->package.count, source_desc->package.elements)); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] Elements Ptr - %p\n", + source_desc->package.count, source_desc->package.elements)); break; default: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p\n", - source_desc)); + source_desc)); break; } diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c index 42a1332b53d4..46e5fa6d0e14 100644 --- a/drivers/acpi/executer/exsystem.c +++ b/drivers/acpi/executer/exsystem.c @@ -167,7 +167,7 @@ acpi_ex_system_do_stall ( acpi_status acpi_ex_system_do_suspend ( - u32 how_long) + acpi_integer how_long) { acpi_status status; @@ -179,8 +179,7 @@ acpi_ex_system_do_suspend ( acpi_ex_exit_interpreter (); - acpi_os_sleep ((u16) (how_long / (u32) 1000), - (u16) (how_long % (u32) 1000)); + acpi_os_sleep (how_long); /* And now we must get the interpreter again */ diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c index 765217be42d7..0c9641f63ce8 100644 --- a/drivers/acpi/namespace/nsaccess.c +++ b/drivers/acpi/namespace/nsaccess.c @@ -161,8 +161,10 @@ acpi_ns_root_initialize (void) #if defined (_ACPI_ASL_COMPILER) || defined (_ACPI_DUMP_App) - /* i_aSL Compiler cheats by putting parameter count in the owner_iD */ - + /* + * i_aSL Compiler cheats by putting parameter count + * in the owner_iD + */ new_node->owner_id = obj_desc->method.param_count; #else /* Mark this as a very SPECIAL method */ @@ -236,7 +238,8 @@ acpi_ns_root_initialize (void) /* Store pointer to value descriptor in the Node */ - status = acpi_ns_attach_object (new_node, obj_desc, ACPI_GET_OBJECT_TYPE (obj_desc)); + status = acpi_ns_attach_object (new_node, obj_desc, + ACPI_GET_OBJECT_TYPE (obj_desc)); /* Remove local reference to the object */ @@ -462,7 +465,8 @@ acpi_ns_lookup ( type = this_node->type; ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Prefix-only Pathname (Zero name segments), Flags=%X\n", flags)); + "Prefix-only Pathname (Zero name segments), Flags=%X\n", + flags)); break; case AML_DUAL_NAME_PREFIX: @@ -554,7 +558,7 @@ acpi_ns_lookup ( /* Try to find the single (4 character) ACPI name */ status = acpi_ns_search_and_enter (simple_name, walk_state, current_node, - interpreter_mode, this_search_type, local_flags, &this_node); + interpreter_mode, this_search_type, local_flags, &this_node); if (ACPI_FAILURE (status)) { if (status == AE_NOT_FOUND) { /* Name not found in ACPI namespace */ diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c index 8afa1dcf7f98..a3d01c39062a 100644 --- a/drivers/acpi/namespace/nsdump.c +++ b/drivers/acpi/namespace/nsdump.c @@ -198,7 +198,8 @@ acpi_ns_dump_one_object ( } if (!acpi_ut_valid_acpi_name (this_node->name.integer)) { - ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n", this_node->name.integer)); + ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n", + this_node->name.integer)); } /* @@ -226,9 +227,8 @@ acpi_ns_dump_one_object ( case ACPI_TYPE_PROCESSOR: acpi_os_printf ("ID %X Len %.4X Addr %p\n", - obj_desc->processor.proc_id, - obj_desc->processor.length, - (char *) obj_desc->processor.address); + obj_desc->processor.proc_id, obj_desc->processor.length, + (char *) obj_desc->processor.address); break; @@ -241,16 +241,15 @@ acpi_ns_dump_one_object ( case ACPI_TYPE_METHOD: acpi_os_printf ("Args %X Len %.4X Aml %p\n", - (u32) obj_desc->method.param_count, - obj_desc->method.aml_length, - obj_desc->method.aml_start); + (u32) obj_desc->method.param_count, + obj_desc->method.aml_length, obj_desc->method.aml_start); break; case ACPI_TYPE_INTEGER: acpi_os_printf ("= %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (obj_desc->integer.value)); + ACPI_FORMAT_UINT64 (obj_desc->integer.value)); break; @@ -258,7 +257,7 @@ acpi_ns_dump_one_object ( if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { acpi_os_printf ("Elements %.2X\n", - obj_desc->package.count); + obj_desc->package.count); } else { acpi_os_printf ("[Length not yet evaluated]\n"); @@ -298,11 +297,12 @@ acpi_ns_dump_one_object ( case ACPI_TYPE_REGION: - acpi_os_printf ("[%s]", acpi_ut_get_region_name (obj_desc->region.space_id)); + acpi_os_printf ("[%s]", + acpi_ut_get_region_name (obj_desc->region.space_id)); if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { acpi_os_printf (" Addr %8.8X%8.8X Len %.4X\n", - ACPI_FORMAT_UINT64 (obj_desc->region.address), - obj_desc->region.length); + ACPI_FORMAT_UINT64 (obj_desc->region.address), + obj_desc->region.length); } else { acpi_os_printf (" [Address/Length not yet evaluated]\n"); @@ -313,7 +313,7 @@ acpi_ns_dump_one_object ( case ACPI_TYPE_LOCAL_REFERENCE: acpi_os_printf ("[%s]\n", - acpi_ps_get_opcode_name (obj_desc->reference.opcode)); + acpi_ps_get_opcode_name (obj_desc->reference.opcode)); break; @@ -322,7 +322,7 @@ acpi_ns_dump_one_object ( if (obj_desc->buffer_field.buffer_obj && obj_desc->buffer_field.buffer_obj->buffer.node) { acpi_os_printf ("Buf [%4.4s]", - acpi_ut_get_node_name (obj_desc->buffer_field.buffer_obj->buffer.node)); + acpi_ut_get_node_name (obj_desc->buffer_field.buffer_obj->buffer.node)); } break; @@ -330,30 +330,31 @@ acpi_ns_dump_one_object ( case ACPI_TYPE_LOCAL_REGION_FIELD: acpi_os_printf ("Rgn [%4.4s]", - acpi_ut_get_node_name (obj_desc->common_field.region_obj->region.node)); + acpi_ut_get_node_name (obj_desc->common_field.region_obj->region.node)); break; case ACPI_TYPE_LOCAL_BANK_FIELD: acpi_os_printf ("Rgn [%4.4s] Bnk [%4.4s]", - acpi_ut_get_node_name (obj_desc->common_field.region_obj->region.node), - acpi_ut_get_node_name (obj_desc->bank_field.bank_obj->common_field.node)); + acpi_ut_get_node_name (obj_desc->common_field.region_obj->region.node), + acpi_ut_get_node_name (obj_desc->bank_field.bank_obj->common_field.node)); break; case ACPI_TYPE_LOCAL_INDEX_FIELD: acpi_os_printf ("Idx [%4.4s] Dat [%4.4s]", - acpi_ut_get_node_name (obj_desc->index_field.index_obj->common_field.node), - acpi_ut_get_node_name (obj_desc->index_field.data_obj->common_field.node)); + acpi_ut_get_node_name (obj_desc->index_field.index_obj->common_field.node), + acpi_ut_get_node_name (obj_desc->index_field.data_obj->common_field.node)); break; case ACPI_TYPE_LOCAL_ALIAS: case ACPI_TYPE_LOCAL_METHOD_ALIAS: - acpi_os_printf ("Target %4.4s (%p)\n", acpi_ut_get_node_name (obj_desc), obj_desc); + acpi_os_printf ("Target %4.4s (%p)\n", + acpi_ut_get_node_name (obj_desc), obj_desc); break; default: @@ -371,10 +372,10 @@ acpi_ns_dump_one_object ( case ACPI_TYPE_LOCAL_INDEX_FIELD: acpi_os_printf (" Off %.3X Len %.2X Acc %.2hd\n", - (obj_desc->common_field.base_byte_offset * 8) - + obj_desc->common_field.start_field_bit_offset, - obj_desc->common_field.bit_length, - obj_desc->common_field.access_byte_width); + (obj_desc->common_field.base_byte_offset * 8) + + obj_desc->common_field.start_field_bit_offset, + obj_desc->common_field.bit_length, + obj_desc->common_field.access_byte_width); break; default: @@ -471,12 +472,13 @@ acpi_ns_dump_one_object ( obj_type = ACPI_GET_OBJECT_TYPE (obj_desc); if (obj_type > ACPI_TYPE_LOCAL_MAX) { - acpi_os_printf ("(Ptr to ACPI Object type %X [UNKNOWN])\n", obj_type); + acpi_os_printf ("(Ptr to ACPI Object type %X [UNKNOWN])\n", + obj_type); bytes_to_dump = 32; } else { acpi_os_printf ("(Ptr to ACPI Object type %s, %X)\n", - acpi_ut_get_type_name (obj_type), obj_type); + acpi_ut_get_type_name (obj_type), obj_type); bytes_to_dump = sizeof (union acpi_operand_object); } break; @@ -484,8 +486,9 @@ acpi_ns_dump_one_object ( default: - acpi_os_printf ("(String or Buffer ptr - not an object descriptor) [%s]\n", - acpi_ut_get_descriptor_name (obj_desc)); + acpi_os_printf ( + "(String or Buffer ptr - not an object descriptor) [%s]\n", + acpi_ut_get_descriptor_name (obj_desc)); bytes_to_dump = 16; break; } @@ -552,7 +555,7 @@ cleanup: * FUNCTION: acpi_ns_dump_objects * * PARAMETERS: Type - Object type to be dumped - * max_depth - Maximum depth of dump. Use ACPI_UINT32_MAX + * max_depth - Maximum depth of dump. Use ACPI_UINT32_MAX * for an effectively unlimited depth. * owner_id - Dump only objects owned by this ID. Use * ACPI_UINT32_MAX to match all owners. diff --git a/drivers/acpi/namespace/nsdumpdv.c b/drivers/acpi/namespace/nsdumpdv.c index 7196a0112e92..ec90210a5a1f 100644 --- a/drivers/acpi/namespace/nsdumpdv.c +++ b/drivers/acpi/namespace/nsdumpdv.c @@ -91,10 +91,10 @@ acpi_ns_dump_one_device ( ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " ")); } - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %X\n", - info->hardware_id.value, - ACPI_FORMAT_UINT64 (info->address), - info->current_status)); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, + " HID: %s, ADR: %8.8X%8.8X, Status: %X\n", + info->hardware_id.value, ACPI_FORMAT_UINT64 (info->address), + info->current_status)); ACPI_MEM_FREE (info); } @@ -133,7 +133,8 @@ acpi_ns_dump_root_devices (void) return; } - ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Display of all devices in the namespace:\n")); + ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, + "Display of all devices in the namespace:\n")); status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE, sys_bus_handle, ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c index 418f03ee2a55..d2e1a28462e5 100644 --- a/drivers/acpi/namespace/nseval.c +++ b/drivers/acpi/namespace/nseval.c @@ -57,14 +57,9 @@ * * FUNCTION: acpi_ns_evaluate_relative * - * PARAMETERS: Handle - The relative containing object - * Pathname - Name of method to execute, If NULL, the + * PARAMETERS: Pathname - Name of method to execute, If NULL, the * handle is the object to execute - * Params - List of parameters to pass to the method, - * terminated by NULL. Params itself may be - * NULL if no parameters are being passed. - * return_object - Where to put method's return value (if - * any). If NULL, no value is returned. + * Info - Method info block * * RETURN: Status * @@ -138,8 +133,7 @@ acpi_ns_evaluate_relative ( } /* - * Now that we have a handle to the object, we can attempt - * to evaluate it. + * Now that we have a handle to the object, we can attempt to evaluate it. */ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n", pathname, node, acpi_ns_get_attached_object (node))); @@ -165,9 +159,9 @@ cleanup1: * * PARAMETERS: Pathname - Fully qualified pathname to the object * Info - Contains: - * return_object - Where to put method's return value (if + * return_object - Where to put method's return value (if * any). If NULL, no value is returned. - * Params - List of parameters to pass to the method, + * Params - List of parameters to pass to the method, * terminated by NULL. Params itself may be * NULL if no parameters are being passed. * @@ -213,14 +207,14 @@ acpi_ns_evaluate_by_name ( (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Object at [%s] was not found, status=%.4X\n", + ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, + "Object at [%s] was not found, status=%.4X\n", pathname, status)); goto cleanup; } /* - * Now that we have a handle to the object, we can attempt - * to evaluate it. + * Now that we have a handle to the object, we can attempt to evaluate it. */ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n", pathname, info->node, acpi_ns_get_attached_object (info->node))); @@ -303,9 +297,8 @@ acpi_ns_evaluate_by_handle ( } /* - * For a method alias, we must grab the actual method node - * so that proper scoping context will be established - * before execution. + * For a method alias, we must grab the actual method node so that proper + * scoping context will be established before execution. */ if (acpi_ns_get_type (info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) { info->node = ACPI_CAST_PTR (struct acpi_namespace_node, info->node->object); @@ -314,11 +307,9 @@ acpi_ns_evaluate_by_handle ( /* * Two major cases here: * 1) The object is an actual control method -- execute it. - * 2) The object is not a method -- just return it's current - * value + * 2) The object is not a method -- just return it's current value * - * In both cases, the namespace is unlocked by the - * acpi_ns* procedure + * In both cases, the namespace is unlocked by the acpi_ns* procedure */ if (acpi_ns_get_type (info->node) == ACPI_TYPE_METHOD) { /* @@ -328,15 +319,13 @@ acpi_ns_evaluate_by_handle ( } else { /* - * Case 2) Object is NOT a method, just return its - * current value + * Case 2) Object is NOT a method, just return its current value */ status = acpi_ns_get_object_value (info); } /* - * Check if there is a return value on the stack that must - * be dealt with + * Check if there is a return value on the stack that must be dealt with */ if (status == AE_CTRL_RETURN_VALUE) { /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */ @@ -345,8 +334,8 @@ acpi_ns_evaluate_by_handle ( } /* - * Namespace was unlocked by the handling acpi_ns* function, - * so we just return + * Namespace was unlocked by the handling acpi_ns* function, so we + * just return */ return_ACPI_STATUS (status); } @@ -356,12 +345,7 @@ acpi_ns_evaluate_by_handle ( * * FUNCTION: acpi_ns_execute_control_method * - * PARAMETERS: method_node - The method to execute - * Params - List of parameters to pass to the method, - * terminated by NULL. Params itself may be - * NULL if no parameters are being passed. - * return_obj_desc - List of result objects to be returned - * from the method. + * PARAMETERS: Info - Method info block (w/params) * * RETURN: Status * @@ -430,8 +414,7 @@ acpi_ns_execute_control_method ( * * FUNCTION: acpi_ns_get_object_value * - * PARAMETERS: Node - The object - * return_obj_desc - Where the objects value is returned + * PARAMETERS: Info - Method info block (w/params) * * RETURN: Status * @@ -453,28 +436,25 @@ acpi_ns_get_object_value ( /* - * Objects require additional resolution steps (e.g., the - * Node may be a field that must be read, etc.) -- we can't just grab - * the object out of the node. + * Objects require additional resolution steps (e.g., the Node may be a + * field that must be read, etc.) -- we can't just grab the object out of + * the node. */ /* - * Use resolve_node_to_value() to get the associated value. This call - * always deletes obj_desc (allocated above). + * Use resolve_node_to_value() to get the associated value. This call always + * deletes obj_desc (allocated above). * - * NOTE: we can get away with passing in NULL for a walk state - * because obj_desc is guaranteed to not be a reference to either - * a method local or a method argument (because this interface can only be - * called from the acpi_evaluate external interface, never called from - * a running control method.) + * NOTE: we can get away with passing in NULL for a walk state because + * obj_desc is guaranteed to not be a reference to either a method local or + * a method argument (because this interface can only be called from the + * acpi_evaluate external interface, never called from a running method.) * - * Even though we do not directly invoke the interpreter - * for this, we must enter it because we could access an opregion. - * The opregion access code assumes that the interpreter - * is locked. + * Even though we do not directly invoke the interpreter for this, we must + * enter it because we could access an opregion. The opregion access code + * assumes that the interpreter is locked. * - * We must release the namespace lock before entering the - * intepreter. + * We must release the namespace lock before entering the intepreter. */ status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (status)) { @@ -485,16 +465,18 @@ acpi_ns_get_object_value ( if (ACPI_SUCCESS (status)) { status = acpi_ex_resolve_node_to_value (&resolved_node, NULL); /* - * If acpi_ex_resolve_node_to_value() succeeded, the return value was - * placed in resolved_node. + * If acpi_ex_resolve_node_to_value() succeeded, the return value was placed + * in resolved_node. */ acpi_ex_exit_interpreter (); if (ACPI_SUCCESS (status)) { status = AE_CTRL_RETURN_VALUE; - info->return_object = ACPI_CAST_PTR (union acpi_operand_object, resolved_node); + info->return_object = ACPI_CAST_PTR + (union acpi_operand_object, resolved_node); ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning object %p [%s]\n", - info->return_object, acpi_ut_get_object_type_name (info->return_object))); + info->return_object, + acpi_ut_get_object_type_name (info->return_object))); } } diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c index 861787520957..c6518f8948f2 100644 --- a/drivers/acpi/namespace/nsinit.c +++ b/drivers/acpi/namespace/nsinit.c @@ -77,7 +77,8 @@ acpi_ns_initialize_objects ( ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "**** Starting initialization of namespace objects ****\n")); - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Completing Region/Field/Buffer/Package initialization:")); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, + "Completing Region/Field/Buffer/Package initialization:")); /* Set all init info to zero */ @@ -142,7 +143,8 @@ acpi_ns_initialize_devices ( info.num_STA = 0; info.num_INI = 0; - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Executing all Device _STA and_INI methods:")); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, + "Executing all Device _STA and_INI methods:")); status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (status)) { @@ -257,8 +259,8 @@ acpi_ns_init_one_object ( } /* - * Each of these types can contain executable AML code within - * the declaration. + * Each of these types can contain executable AML code within the + * declaration. */ switch (type) { case ACPI_TYPE_REGION: @@ -267,21 +269,18 @@ acpi_ns_init_one_object ( status = acpi_ds_get_region_arguments (obj_desc); break; - case ACPI_TYPE_BUFFER_FIELD: info->field_init++; status = acpi_ds_get_buffer_field_arguments (obj_desc); break; - case ACPI_TYPE_BUFFER: info->buffer_init++; status = acpi_ds_get_buffer_arguments (obj_desc); break; - case ACPI_TYPE_PACKAGE: info->package_init++; @@ -301,15 +300,17 @@ acpi_ns_init_one_object ( acpi_format_exception (status))); } - /* Print a dot for each object unless we are going to print the entire pathname */ - + /* + * Print a dot for each object unless we are going to print the entire + * pathname + */ if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, ".")); } /* - * We ignore errors from above, and always return OK, since - * we don't want to abort the walk on any single error. + * We ignore errors from above, and always return OK, since we don't want + * to abort the walk on any single error. */ acpi_ex_exit_interpreter (); return (AE_OK); @@ -363,7 +364,8 @@ acpi_ns_init_one_device ( return_ACPI_STATUS (AE_OK); } - if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) && (!(acpi_dbg_level & ACPI_LV_INFO))) { + if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) && + (!(acpi_dbg_level & ACPI_LV_INFO))) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, ".")); } @@ -429,6 +431,5 @@ acpi_ns_init_one_device ( status = acpi_gbl_init_handler (pinfo.node, ACPI_INIT_DEVICE_INI); } - return_ACPI_STATUS (status); } diff --git a/drivers/acpi/namespace/nsload.c b/drivers/acpi/namespace/nsload.c index 314ec6659a72..61ecbb1a461d 100644 --- a/drivers/acpi/namespace/nsload.c +++ b/drivers/acpi/namespace/nsload.c @@ -92,12 +92,14 @@ acpi_ns_load_table ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AML block at %p\n", table_desc->aml_start)); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AML block at %p\n", + table_desc->aml_start)); /* Ignore table if there is no AML contained within */ if (!table_desc->aml_length) { - ACPI_REPORT_WARNING (("Zero-length AML block in table [%4.4s]\n", table_desc->pointer->signature)); + ACPI_REPORT_WARNING (("Zero-length AML block in table [%4.4s]\n", + table_desc->pointer->signature)); return_ACPI_STATUS (AE_OK); } @@ -110,7 +112,8 @@ acpi_ns_load_table ( * to another control method, we can't continue parsing * because we don't know how many arguments to parse next! */ - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Loading table into namespace ****\n")); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "**** Loading table into namespace ****\n")); status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (status)) { @@ -196,7 +199,6 @@ acpi_ns_load_table_by_type ( if (ACPI_SUCCESS (status)) { table_desc->loaded_into_namespace = TRUE; } - break; @@ -252,7 +254,6 @@ acpi_ns_load_table_by_type ( table_desc = table_desc->next; } - break; diff --git a/drivers/acpi/namespace/nsnames.c b/drivers/acpi/namespace/nsnames.c index 3f633d97e051..4316ea6688e2 100644 --- a/drivers/acpi/namespace/nsnames.c +++ b/drivers/acpi/namespace/nsnames.c @@ -257,7 +257,8 @@ acpi_ns_handle_to_pathname ( acpi_ns_build_external_path (node, required_size, buffer->pointer); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X] \n", (char *) buffer->pointer, (u32) required_size)); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X] \n", + (char *) buffer->pointer, (u32) required_size)); return_ACPI_STATUS (AE_OK); } diff --git a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/namespace/nssearch.c index 7870a43ebe15..0edc5e204a2e 100644 --- a/drivers/acpi/namespace/nssearch.c +++ b/drivers/acpi/namespace/nssearch.c @@ -96,8 +96,10 @@ acpi_ns_search_node ( scope_name = acpi_ns_get_external_pathname (node); if (scope_name) { - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching %s (%p) For [%4.4s] (%s)\n", - scope_name, node, (char *) &target_name, acpi_ut_get_type_name (type))); + ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, + "Searching %s (%p) For [%4.4s] (%s)\n", + scope_name, node, (char *) &target_name, + acpi_ut_get_type_name (type))); ACPI_MEM_FREE (scope_name); } @@ -164,7 +166,7 @@ acpi_ns_search_node ( * PARAMETERS: *target_name - Ascii ACPI name to search for * *Node - Starting node where search will begin * Type - Object type to match - * **return_node - Where the matched Named Obj is returned + * **return_node - Where the matched Node is returned * * RETURN: Status * @@ -199,13 +201,13 @@ acpi_ns_search_parent_tree ( parent_node = acpi_ns_get_parent_node (node); /* - * If there is no parent (i.e., we are at the root) or - * type is "local", we won't be searching the parent tree. + * If there is no parent (i.e., we are at the root) or type is "local", + * we won't be searching the parent tree. */ if (!parent_node) { ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] has no parent\n", (char *) &target_name)); - return_ACPI_STATUS (AE_NOT_FOUND); + return_ACPI_STATUS (AE_NOT_FOUND); } if (acpi_ns_local (type)) { @@ -217,11 +219,12 @@ acpi_ns_search_parent_tree ( /* Search the parent tree */ - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching parent for %4.4s\n", (char *) &target_name)); + ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, + "Searching parent [%4.4s] for [%4.4s]\n", + acpi_ut_get_node_name (parent_node), (char *) &target_name)); /* - * Search parents until found the target or we have backed up to - * the root + * Search parents until target is found or we have backed up to the root */ while (parent_node) { /* @@ -230,7 +233,7 @@ acpi_ns_search_parent_tree ( * the actual name we are searching for. Typechecking comes later. */ status = acpi_ns_search_node (target_name, parent_node, - ACPI_TYPE_ANY, return_node); + ACPI_TYPE_ANY, return_node); if (ACPI_SUCCESS (status)) { return_ACPI_STATUS (status); } @@ -293,7 +296,8 @@ acpi_ns_search_and_enter ( /* Parameter validation */ if (!node || !target_name || !return_node) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null param: Node %p Name %X return_node %p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Null param: Node %p Name %X return_node %p\n", node, target_name, return_node)); ACPI_REPORT_ERROR (("ns_search_and_enter: Null parameter\n")); @@ -330,22 +334,20 @@ acpi_ns_search_and_enter ( } /* - * The name was not found. If we are NOT performing the - * first pass (name entry) of loading the namespace, search - * the parent tree (all the way to the root if necessary.) - * We don't want to perform the parent search when the - * namespace is actually being loaded. We want to perform - * the search when namespace references are being resolved - * (load pass 2) and during the execution phase. + * The name was not found. If we are NOT performing the first pass + * (name entry) of loading the namespace, search the parent tree (all the + * way to the root if necessary.) We don't want to perform the parent + * search when the namespace is actually being loaded. We want to perform + * the search when namespace references are being resolved (load pass 2) + * and during the execution phase. */ if ((interpreter_mode != ACPI_IMODE_LOAD_PASS1) && (flags & ACPI_NS_SEARCH_PARENT)) { /* - * Not found at this level - search parent tree according - * to ACPI specification + * Not found at this level - search parent tree according to the + * ACPI specification */ - status = acpi_ns_search_parent_tree (target_name, node, - type, return_node); + status = acpi_ns_search_parent_tree (target_name, node, type, return_node); if (ACPI_SUCCESS (status)) { return_ACPI_STATUS (status); } @@ -355,7 +357,8 @@ acpi_ns_search_and_enter ( * In execute mode, just search, never add names. Exit now. */ if (interpreter_mode == ACPI_IMODE_EXECUTE) { - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%4.4s Not found in %p [Not adding]\n", + ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, + "%4.4s Not found in %p [Not adding]\n", (char *) &target_name, node)); return_ACPI_STATUS (AE_NOT_FOUND); diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c index bf49ce296513..a038f098c004 100644 --- a/drivers/acpi/namespace/nsutils.c +++ b/drivers/acpi/namespace/nsutils.c @@ -85,12 +85,14 @@ acpi_ns_report_error ( if (lookup_status == AE_BAD_CHARACTER) { /* There is a non-ascii character in the name */ - acpi_os_printf ("[0x%4.4X] (NON-ASCII)\n", *(ACPI_CAST_PTR (u32, internal_name))); + acpi_os_printf ("[0x%4.4X] (NON-ASCII)\n", + *(ACPI_CAST_PTR (u32, internal_name))); } else { /* Convert path to external format */ - status = acpi_ns_externalize_name (ACPI_UINT32_MAX, internal_name, NULL, &name); + status = acpi_ns_externalize_name (ACPI_UINT32_MAX, + internal_name, NULL, &name); /* Print target name */ @@ -141,7 +143,8 @@ acpi_ns_report_method_error ( if (path) { - status = acpi_ns_get_node_by_path (path, prefix_node, ACPI_NS_NO_UPSEARCH, &node); + status = acpi_ns_get_node_by_path (path, prefix_node, + ACPI_NS_NO_UPSEARCH, &node); if (ACPI_FAILURE (status)) { acpi_os_printf ("report_method_error: Could not get node\n"); return; @@ -180,7 +183,7 @@ acpi_ns_print_node_pathname ( return; } - /* Convert handle to a full pathname and print it (with supplied message) */ + /* Convert handle to full pathname and print it (with supplied message) */ buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; @@ -324,13 +327,11 @@ acpi_ns_get_internal_name_length ( info->fully_qualified = FALSE; /* - * For the internal name, the required length is 4 bytes - * per segment, plus 1 each for root_prefix, multi_name_prefix_op, - * segment count, trailing null (which is not really needed, - * but no there's harm in putting it there) + * For the internal name, the required length is 4 bytes per segment, plus + * 1 each for root_prefix, multi_name_prefix_op, segment count, trailing null + * (which is not really needed, but no there's harm in putting it there) * - * strlen() + 1 covers the first name_seg, which has no - * path separator + * strlen() + 1 covers the first name_seg, which has no path separator */ if (acpi_ns_valid_root_prefix (next_external_char[0])) { info->fully_qualified = TRUE; @@ -347,10 +348,9 @@ acpi_ns_get_internal_name_length ( } /* - * Determine the number of ACPI name "segments" by counting - * the number of path separators within the string. Start - * with one segment since the segment count is (# separators) - * + 1, and zero separators is ok. + * Determine the number of ACPI name "segments" by counting the number of + * path separators within the string. Start with one segment since the + * segment count is [(# separators) + 1], and zero separators is ok. */ if (*next_external_char) { info->num_segments = 1; @@ -625,7 +625,8 @@ acpi_ns_externalize_name ( /* 4-byte names */ names_index = prefix_length + 2; - num_segments = (acpi_native_uint) (u8) internal_name[(acpi_native_uint) (prefix_length + 1)]; + num_segments = (acpi_native_uint) (u8) + internal_name[(acpi_native_uint) (prefix_length + 1)]; break; case AML_DUAL_NAME_PREFIX: @@ -672,7 +673,7 @@ acpi_ns_externalize_name ( } /* - * Build converted_name... + * Build converted_name */ *converted_name = ACPI_MEM_CALLOCATE (required_length); if (!(*converted_name)) { @@ -756,7 +757,7 @@ acpi_ns_map_handle_to_node ( * * PARAMETERS: Node - Node to be converted to a Handle * - * RETURN: An USER acpi_handle + * RETURN: A user handle * * DESCRIPTION: Convert a real Node to a namespace handle * @@ -976,7 +977,8 @@ acpi_ns_find_parent_name ( parent_node = acpi_ns_get_parent_node (child_node); if (parent_node) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Parent of %p [%4.4s] is %p [%4.4s]\n", + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Parent of %p [%4.4s] is %p [%4.4s]\n", child_node, acpi_ut_get_node_name (child_node), parent_node, acpi_ut_get_node_name (parent_node))); @@ -985,7 +987,8 @@ acpi_ns_find_parent_name ( } } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "unable to find parent of %p (%4.4s)\n", + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Unable to find parent of %p (%4.4s)\n", child_node, acpi_ut_get_node_name (child_node))); } @@ -1018,11 +1021,9 @@ acpi_ns_get_parent_node ( } /* - * Walk to the end of this peer list. - * The last entry is marked with a flag and the peer - * pointer is really a pointer back to the parent. - * This saves putting a parent back pointer in each and - * every named object! + * Walk to the end of this peer list. The last entry is marked with a flag + * and the peer pointer is really a pointer back to the parent. This saves + * putting a parent back pointer in each and every named object! */ while (!(node->flags & ANOBJ_END_OF_PEER_LIST)) { node = node->peer; @@ -1039,8 +1040,8 @@ acpi_ns_get_parent_node ( * * PARAMETERS: Node - Current table entry * - * RETURN: Next valid Node in the linked node list. NULL if no more valid - * nodess + * RETURN: Next valid Node in the linked node list. NULL if no more valid + * nodes. * * DESCRIPTION: Find the next valid node within a name table. * Useful for implementing NULL-end-of-list loops. diff --git a/drivers/acpi/tables/tbget.c b/drivers/acpi/tables/tbget.c index 1456c7b324fb..f3cf903e9277 100644 --- a/drivers/acpi/tables/tbget.c +++ b/drivers/acpi/tables/tbget.c @@ -167,6 +167,9 @@ acpi_tb_get_table_header ( return_ACPI_STATUS (AE_BAD_PARAMETER); } + ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Table Signature: [%4.4s]\n", + &return_header->signature)); + return_ACPI_STATUS (AE_OK); } diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c index 4a9669590505..901f97860f9e 100644 --- a/drivers/acpi/tables/tbxfroot.c +++ b/drivers/acpi/tables/tbxfroot.c @@ -87,12 +87,28 @@ acpi_tb_find_table ( return_ACPI_STATUS (AE_AML_STRING_LIMIT); } - /* Find the table */ + if (!ACPI_STRNCMP (signature, DSDT_SIG, ACPI_NAME_SIZE)) { + /* + * The DSDT pointer is contained in the FADT, not the RSDT. + * This code should suffice, because the only code that would perform + * a "find" on the DSDT is the data_table_region() AML opcode -- in + * which case, the DSDT is guaranteed to be already loaded. + * If this becomes insufficient, the FADT will have to be found first. + */ + if (!acpi_gbl_DSDT) { + return_ACPI_STATUS (AE_NO_ACPI_TABLES); + } - status = acpi_get_firmware_table (signature, 1, - ACPI_LOGICAL_ADDRESSING, &table); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + table = acpi_gbl_DSDT; + } + else { + /* Find the table */ + + status = acpi_get_firmware_table (signature, 1, + ACPI_LOGICAL_ADDRESSING, &table); + if (ACPI_FAILURE (status)) { + return_ACPI_STATUS (status); + } } /* Check oem_id and oem_table_id */ @@ -102,6 +118,7 @@ acpi_tb_find_table ( return_ACPI_STATUS (AE_AML_NAME_NOT_FOUND); } + ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n", table->signature)); *table_ptr = table; return_ACPI_STATUS (AE_OK); } diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index 7fb51f4e9dcb..bb3deea8ad8c 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c @@ -265,7 +265,7 @@ acpi_ut_validate_buffer ( * RETURN: Status * * DESCRIPTION: Validate that the buffer is of the required length or - * allocate a new buffer. + * allocate a new buffer. Returned buffer is always zeroed. * ******************************************************************************/ @@ -305,24 +305,25 @@ acpi_ut_initialize_buffer ( /* Allocate a new buffer with local interface to allow tracking */ - buffer->pointer = ACPI_MEM_ALLOCATE (required_length); + buffer->pointer = ACPI_MEM_CALLOCATE (required_length); if (!buffer->pointer) { return (AE_NO_MEMORY); } - - /* Clear the buffer */ - - ACPI_MEMSET (buffer->pointer, 0, required_length); break; default: - /* Validate the size of the buffer */ + /* Existing buffer: Validate the size of the buffer */ if (buffer->length < required_length) { status = AE_BUFFER_OVERFLOW; + break; } + + /* Clear the buffer */ + + ACPI_MEMSET (buffer->pointer, 0, required_length); break; } diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index f42848ab7e70..3e547ccd8270 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c @@ -861,6 +861,7 @@ acpi_ut_init_globals ( acpi_gbl_system_notify.handler = NULL; acpi_gbl_device_notify.handler = NULL; + acpi_gbl_exception_handler = NULL; acpi_gbl_init_handler = NULL; /* Global "typed" ACPI table pointers */ diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index 5911d1b3c589..cd4b9d6f8a51 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -64,7 +64,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20040827 +#define ACPI_CA_VERSION 0x20040922 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h index eb16ee22e3d1..f8449dbb787f 100644 --- a/include/acpi/acglobal.h +++ b/include/acpi/acglobal.h @@ -180,6 +180,7 @@ ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[NUM_MUTEX]; ACPI_EXTERN struct acpi_memory_list acpi_gbl_memory_lists[ACPI_NUM_MEM_LISTS]; ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_device_notify; ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_system_notify; +ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler; ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler; ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk; ACPI_EXTERN acpi_handle acpi_gbl_global_lock_semaphore; diff --git a/include/acpi/acinterp.h b/include/acpi/acinterp.h index f87445f46b54..776e4ce3eb40 100644 --- a/include/acpi/acinterp.h +++ b/include/acpi/acinterp.h @@ -388,7 +388,7 @@ acpi_ex_system_do_notify_op ( acpi_status acpi_ex_system_do_suspend( - u32 time); + acpi_integer time); acpi_status acpi_ex_system_do_stall ( diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index dc75f08ee304..8c66fc3ad4d2 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h @@ -216,10 +216,13 @@ void acpi_os_wait_events_complete( void * context); +void +acpi_os_wait_events_complete ( + void *context); + void acpi_os_sleep ( - u32 seconds, - u32 milliseconds); + acpi_integer milliseconds); void acpi_os_stall ( diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 54ae84dcfbcd..f4097100288e 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -299,6 +299,15 @@ acpi_install_gpe_handler ( acpi_event_handler address, void *context); +acpi_status +acpi_install_exception_handler ( + acpi_exception_handler handler); + + +/* + * Event interfaces + */ + acpi_status acpi_acquire_global_lock ( u16 timeout, diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index c5bd3036c57a..aa2d64667bfe 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -836,6 +836,10 @@ acpi_status (*acpi_init_handler) ( #define ACPI_INIT_DEVICE_INI 1 +typedef +acpi_status (*acpi_exception_handler) ( + acpi_status status); + /* Address Spaces (For Operation Regions) */ -- cgit v1.2.3 From de524f1460cd0e2d8ba5d16b8f8831ecdc9cde7b Mon Sep 17 00:00:00 2001 From: Len Brown Date: Fri, 22 Oct 2004 08:17:02 -0400 Subject: [ACPI] ACPICA 20040924 from Bob Moore Signed-off-by: Len Brown Added a new OSL interface, acpi_os_get_timer. This interface implements a 64-bit monotonic timer in 100 nanosecond units. Implemented support for the ACPI 3.0 Timer operator. This 64-bit timer utilizes the timer provided by the acpi_os_get_timer interface. --- drivers/acpi/dispatcher/dswexec.c | 25 ++++++++-------- drivers/acpi/executer/exoparg1.c | 63 +++++++++++++++++++++++++++++++++++++++ drivers/acpi/parser/psopcode.c | 17 +++++++---- include/acpi/acconfig.h | 2 +- include/acpi/acinterp.h | 4 +++ include/acpi/aclocal.h | 2 +- include/acpi/acpiosxf.h | 2 +- include/acpi/amlcode.h | 25 +++++++++------- 8 files changed, 109 insertions(+), 31 deletions(-) (limited to 'include') diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c index d57bfcc7e1b0..e4a15f0e2c15 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/dispatcher/dswexec.c @@ -60,17 +60,18 @@ * Dispatch table for opcode classes */ static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = { - acpi_ex_opcode_1A_0T_0R, - acpi_ex_opcode_1A_0T_1R, - acpi_ex_opcode_1A_1T_0R, - acpi_ex_opcode_1A_1T_1R, - acpi_ex_opcode_2A_0T_0R, - acpi_ex_opcode_2A_0T_1R, - acpi_ex_opcode_2A_1T_1R, - acpi_ex_opcode_2A_2T_1R, - acpi_ex_opcode_3A_0T_0R, - acpi_ex_opcode_3A_1T_1R, - acpi_ex_opcode_6A_0T_1R}; + acpi_ex_opcode_0A_0T_1R, + acpi_ex_opcode_1A_0T_0R, + acpi_ex_opcode_1A_0T_1R, + acpi_ex_opcode_1A_1T_0R, + acpi_ex_opcode_1A_1T_1R, + acpi_ex_opcode_2A_0T_0R, + acpi_ex_opcode_2A_0T_1R, + acpi_ex_opcode_2A_1T_1R, + acpi_ex_opcode_2A_2T_1R, + acpi_ex_opcode_3A_0T_0R, + acpi_ex_opcode_3A_1T_1R, + acpi_ex_opcode_6A_0T_1R}; /***************************************************************************** * @@ -413,7 +414,7 @@ acpi_ds_exec_end_op ( * routine. There is one routine per opcode "type" based upon the * number of opcode arguments and return type. */ - status = acpi_gbl_op_type_dispatch [op_type] (walk_state); + status = acpi_gbl_op_type_dispatch[op_type] (walk_state); } else { /* diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c index 18bef63514b1..df5468c37d05 100644 --- a/drivers/acpi/executer/exoparg1.c +++ b/drivers/acpi/executer/exoparg1.c @@ -77,6 +77,69 @@ * fully resolved operands. !*/ +/******************************************************************************* + * + * FUNCTION: acpi_ex_opcode_0A_0T_1R + * + * PARAMETERS: walk_state - Current state (contains AML opcode) + * + * RETURN: Status + * + * DESCRIPTION: Execute Type 1 monadic operator with numeric operand on + * object stack + * + ******************************************************************************/ + +acpi_status +acpi_ex_opcode_0A_0T_1R ( + struct acpi_walk_state *walk_state) +{ + acpi_status status = AE_OK; + union acpi_operand_object *return_desc = NULL; + + + ACPI_FUNCTION_TRACE_STR ("ex_opcode_0A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); + + /* Examine the AML opcode */ + + switch (walk_state->opcode) { + case AML_TIMER_OP: /* Timer () */ + + /* Create a return object of type Integer */ + + return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); + if (!return_desc) { + status = AE_NO_MEMORY; + goto cleanup; + } + + return_desc->integer.value = acpi_os_get_timer (); + break; + + default: /* Unknown opcode */ + + ACPI_REPORT_ERROR (("acpi_ex_opcode_0A_0T_1R: Unknown opcode %X\n", + walk_state->opcode)); + status = AE_AML_BAD_OPCODE; + break; + } + +cleanup: + + if (!walk_state->result_obj) { + walk_state->result_obj = return_desc; + } + + /* Delete return object on error */ + + if (ACPI_FAILURE (status)) { + acpi_ut_remove_reference (return_desc); + } + + return_ACPI_STATUS (status); +} + + /******************************************************************************* * * FUNCTION: acpi_ex_opcode_1A_0T_0R diff --git a/drivers/acpi/parser/psopcode.c b/drivers/acpi/parser/psopcode.c index 832193b93a78..0ee05686d0b1 100644 --- a/drivers/acpi/parser/psopcode.c +++ b/drivers/acpi/parser/psopcode.c @@ -194,6 +194,7 @@ #define ARGP_STRING_OP ARGP_LIST1 (ARGP_CHARLIST) #define ARGP_SUBTRACT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) #define ARGP_THERMAL_ZONE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST) +#define ARGP_TIMER_OP ARG_NONE #define ARGP_TO_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) #define ARGP_TO_BUFFER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) #define ARGP_TO_DEC_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) @@ -325,6 +326,7 @@ #define ARGI_STRING_OP ARGI_INVALID_OPCODE #define ARGI_SUBTRACT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) #define ARGI_THERMAL_ZONE_OP ARGI_INVALID_OPCODE +#define ARGI_TIMER_OP ARG_NONE #define ARGI_TO_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET) #define ARGI_TO_BUFFER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) #define ARGI_TO_DEC_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) @@ -588,7 +590,6 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = /* 6C */ ACPI_OP ("-ASCII_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_ASCII, AML_TYPE_BOGUS, AML_HAS_ARGS), /* 6D */ ACPI_OP ("-PREFIX_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_PREFIX, AML_TYPE_BOGUS, AML_HAS_ARGS), - /* ACPI 2.0 opcodes */ /* 6E */ ACPI_OP ("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT), @@ -606,7 +607,11 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = /* 7A */ ACPI_OP ("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), /* 7B */ ACPI_OP ("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R), /* 7C */ ACPI_OP ("DataTableRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 7D */ ACPI_OP ("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE) +/* 7D */ ACPI_OP ("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE), + +/* ACPI 3.0 opcodes */ + +/* 7E */ ACPI_OP ("Timer", ARGP_TIMER_OP, ARGI_TIMER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_0A_0T_1R, AML_FLAGS_EXEC_0A_0T_1R) /*! [End] no source code translation !*/ }; @@ -615,7 +620,6 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = * This table is directly indexed by the opcodes, and returns an * index into the table above */ - static const u8 acpi_gbl_short_op_index[256] = { /* 0 1 2 3 4 5 6 7 */ @@ -654,7 +658,10 @@ static const u8 acpi_gbl_short_op_index[256] = /* 0xF8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x45, }; - +/* + * This table is indexed by the second opcode of the extended opcode + * pair. It returns an index into the opcode table (acpi_gbl_aml_op_info) + */ static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] = { /* 0 1 2 3 4 5 6 7 */ @@ -665,7 +672,7 @@ static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] = /* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x7B, /* 0x20 */ 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, /* 0x28 */ 0x52, 0x53, 0x54, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x30 */ 0x55, 0x56, 0x57, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x30 */ 0x55, 0x56, 0x57, 0x7e, _UNK, _UNK, _UNK, _UNK, /* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, /* 0x40 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, /* 0x48 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index cd4b9d6f8a51..75ec492acb77 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -64,7 +64,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20040922 +#define ACPI_CA_VERSION 0x20040924 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, diff --git a/include/acpi/acinterp.h b/include/acpi/acinterp.h index 776e4ce3eb40..21167278dc17 100644 --- a/include/acpi/acinterp.h +++ b/include/acpi/acinterp.h @@ -426,6 +426,10 @@ acpi_ex_system_wait_semaphore ( * exmonadic - ACPI AML (p-code) execution, monadic operators */ +acpi_status +acpi_ex_opcode_0A_0T_1R ( + struct acpi_walk_state *walk_state); + acpi_status acpi_ex_opcode_1A_0T_0R ( struct acpi_walk_state *walk_state); diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h index 2afff1148f0c..da7dbb95a229 100644 --- a/include/acpi/aclocal.h +++ b/include/acpi/aclocal.h @@ -53,7 +53,7 @@ typedef u32 acpi_mutex_handle; /* Total number of aml opcodes defined */ -#define AML_NUM_OPCODES 0x7E +#define AML_NUM_OPCODES 0x7F /***************************************************************************** diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index 8c66fc3ad4d2..f68cfc8227ad 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h @@ -307,7 +307,7 @@ acpi_os_writable ( void *pointer, acpi_size length); -u32 +u64 acpi_os_get_timer ( void); diff --git a/include/acpi/amlcode.h b/include/acpi/amlcode.h index 1d06e16648cc..c4fa67dfec64 100644 --- a/include/acpi/amlcode.h +++ b/include/acpi/amlcode.h @@ -170,6 +170,7 @@ #define AML_REVISION_OP (u16) 0x5b30 #define AML_DEBUG_OP (u16) 0x5b31 #define AML_FATAL_OP (u16) 0x5b32 +#define AML_TIMER_OP (u16) 0x5b33 /* ACPI 3.0 */ #define AML_REGION_OP (u16) 0x5b80 #define AML_FIELD_OP (u16) 0x5b81 #define AML_DEVICE_OP (u16) 0x5b82 @@ -322,6 +323,7 @@ /* Convenient flag groupings */ +#define AML_FLAGS_EXEC_0A_0T_1R AML_HAS_RETVAL #define AML_FLAGS_EXEC_1A_0T_0R AML_HAS_ARGS /* Monadic1 */ #define AML_FLAGS_EXEC_1A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Monadic2 */ #define AML_FLAGS_EXEC_1A_1T_0R AML_HAS_ARGS | AML_HAS_TARGET @@ -339,17 +341,18 @@ * The opcode Type is used in a dispatch table, do not change * without updating the table. */ -#define AML_TYPE_EXEC_1A_0T_0R 0x00 /* Monadic1 */ -#define AML_TYPE_EXEC_1A_0T_1R 0x01 /* Monadic2 */ -#define AML_TYPE_EXEC_1A_1T_0R 0x02 -#define AML_TYPE_EXEC_1A_1T_1R 0x03 /* monadic2_r */ -#define AML_TYPE_EXEC_2A_0T_0R 0x04 /* Dyadic1 */ -#define AML_TYPE_EXEC_2A_0T_1R 0x05 /* Dyadic2 */ -#define AML_TYPE_EXEC_2A_1T_1R 0x06 /* dyadic2_r */ -#define AML_TYPE_EXEC_2A_2T_1R 0x07 -#define AML_TYPE_EXEC_3A_0T_0R 0x08 -#define AML_TYPE_EXEC_3A_1T_1R 0x09 -#define AML_TYPE_EXEC_6A_0T_1R 0x0A +#define AML_TYPE_EXEC_0A_0T_1R 0x00 +#define AML_TYPE_EXEC_1A_0T_0R 0x01 /* Monadic1 */ +#define AML_TYPE_EXEC_1A_0T_1R 0x02 /* Monadic2 */ +#define AML_TYPE_EXEC_1A_1T_0R 0x03 +#define AML_TYPE_EXEC_1A_1T_1R 0x04 /* monadic2_r */ +#define AML_TYPE_EXEC_2A_0T_0R 0x05 /* Dyadic1 */ +#define AML_TYPE_EXEC_2A_0T_1R 0x06 /* Dyadic2 */ +#define AML_TYPE_EXEC_2A_1T_1R 0x07 /* dyadic2_r */ +#define AML_TYPE_EXEC_2A_2T_1R 0x08 +#define AML_TYPE_EXEC_3A_0T_0R 0x09 +#define AML_TYPE_EXEC_3A_1T_1R 0x0A +#define AML_TYPE_EXEC_6A_0T_1R 0x0B /* End of types used in dispatch table */ #define AML_TYPE_LITERAL 0x0B -- cgit v1.2.3 From 8f2297b64eda85caab733c27660ce66741852578 Mon Sep 17 00:00:00 2001 From: Len Brown Date: Fri, 22 Oct 2004 14:10:26 -0400 Subject: [ACPI] ACPICA 20041006 from Bob Moore Signed-off-by: Len Brown Implemented support for the ACPI 3.0 Timer operator. This ASL function implements a 64-bit timer with 100 nanosecond granularity. Defined a new OSL interface, acpi_os_get_timer. This interface is used to implement the ACPI 3.0 Timer operator. This allows the host OS to implement the timer with the best clock available. Also, it keeps the core subsystem out of the clock handling business, since the host OS (usually) performs this function. Fixed an alignment issue on 64-bit platforms. The hw_low_level_read/write() functions use a 64-bit address which is part of the packed ACPI Generic Address Structure. Since the structure is non-aligned, the alignment macros are now used to extract the address to a local variable before use. Fixed a problem where the ToInteger operator assumed all input strings were hexadecimal. The operator now handles both decimal strings and hex strings (prefixed with "0x"). Fixed a problem where the string length in the string object created as a result of the internal ConvertToString procedure could be incorrect. This potentially affected all implicit conversions and also the ToDecimalString and ToHexString operators. Fixed two problems in the ToString operator. If the length parameter was zero, an incorrect string object was created and the value of the input length parameter was inadvertently changed from zero to Ones. Fixed a problem where the optional ResourceSource string in the ExtendedIRQ resource macro was ignored. Simplified the interfaces to the internal division functions, reducing code size and complexity. --- drivers/acpi/dispatcher/dswexec.c | 4 +- drivers/acpi/executer/exconvrt.c | 71 ++++++------------------ drivers/acpi/executer/exmisc.c | 14 ++--- drivers/acpi/executer/exoparg1.c | 17 +++--- drivers/acpi/executer/exoparg2.c | 51 +++++++++-------- drivers/acpi/executer/exregion.c | 2 +- drivers/acpi/executer/exresop.c | 11 ++-- drivers/acpi/executer/exutils.c | 18 +++--- drivers/acpi/hardware/hwregs.c | 34 ++++++++---- drivers/acpi/hardware/hwtimer.c | 19 +++---- drivers/acpi/parser/psutils.c | 25 ++++----- drivers/acpi/resources/rscalc.c | 112 ++++++++++++++++---------------------- drivers/acpi/utilities/utdelete.c | 9 ++- drivers/acpi/utilities/utmath.c | 43 ++++++++------- drivers/acpi/utilities/utmisc.c | 102 ++++++++++++++-------------------- include/acpi/acconfig.h | 2 +- include/acpi/acinterp.h | 10 ++-- include/acpi/actypes.h | 6 +- include/acpi/acutils.h | 10 +++- 19 files changed, 253 insertions(+), 307 deletions(-) (limited to 'include') diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c index e4a15f0e2c15..35714bc4c1f3 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/dispatcher/dswexec.c @@ -658,7 +658,9 @@ cleanup: acpi_gbl_exception_handler && !(status & AE_CODE_CONTROL)) { acpi_ex_exit_interpreter (); - status = acpi_gbl_exception_handler (status); + status = acpi_gbl_exception_handler (status, + walk_state->method_node->name.integer, walk_state->opcode, + walk_state->aml_offset, NULL); acpi_ex_enter_interpreter (); } diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c index 8b9df9274f83..33878fb323f4 100644 --- a/drivers/acpi/executer/exconvrt.c +++ b/drivers/acpi/executer/exconvrt.c @@ -58,7 +58,7 @@ * PARAMETERS: obj_desc - Object to be converted. Must be an * Integer, Buffer, or String * result_desc - Where the new Integer object is returned - * Opcode - AML opcode + * Flags - Used for string conversion * * RETURN: Status * @@ -70,7 +70,7 @@ acpi_status acpi_ex_convert_to_integer ( union acpi_operand_object *obj_desc, union acpi_operand_object **result_desc, - u16 opcode) + u32 flags) { union acpi_operand_object *return_desc; u8 *pointer; @@ -128,10 +128,12 @@ acpi_ex_convert_to_integer ( case ACPI_TYPE_STRING: /* - * Convert string to an integer - the string must be hexadecimal - * as per the ACPI specification + * Convert string to an integer - for most cases, the string must be + * hexadecimal as per the ACPI specification. The only exception (as + * of ACPI 3.0) is that the to_integer() operator allows both decimal + * and hexadecimal strings (hex prefixed with "0x"). */ - status = acpi_ut_strtoul64 ((char *) pointer, 16, &result); + status = acpi_ut_strtoul64 ((char *) pointer, flags, &result); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } @@ -171,18 +173,6 @@ acpi_ex_convert_to_integer ( /* Save the Result */ return_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 (opcode != AML_STORE_OP) { - acpi_ut_remove_reference (obj_desc); - } - } - *result_desc = return_desc; return_ACPI_STATUS (AE_OK); } @@ -195,7 +185,6 @@ acpi_ex_convert_to_integer ( * PARAMETERS: obj_desc - Object to be converted. Must be an * Integer, Buffer, or String * result_desc - Where the new buffer object is returned - * Opcode - AML opcode * * RETURN: Status * @@ -206,8 +195,7 @@ acpi_ex_convert_to_integer ( acpi_status acpi_ex_convert_to_buffer ( union acpi_operand_object *obj_desc, - union acpi_operand_object **result_desc, - u16 opcode) + union acpi_operand_object **result_desc) { union acpi_operand_object *return_desc; u8 *new_buf; @@ -271,18 +259,6 @@ acpi_ex_convert_to_buffer ( /* Mark buffer initialized */ return_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 (opcode != AML_STORE_OP) { - acpi_ut_remove_reference (obj_desc); - } - } - *result_desc = return_desc; return_ACPI_STATUS (AE_OK); } @@ -351,7 +327,7 @@ acpi_ex_convert_to_ascii ( digit = integer; for (j = 0; j < i; j++) { - (void) acpi_ut_short_divide (&digit, 10, &digit, &remainder); + (void) acpi_ut_short_divide (digit, 10, &digit, &remainder); } /* Handle leading zeros */ @@ -407,7 +383,6 @@ acpi_ex_convert_to_ascii ( * Integer, Buffer, or String * result_desc - Where the string object is returned * Type - String flags (base and conversion type) - * Opcode - AML opcode * * RETURN: Status * @@ -419,8 +394,7 @@ acpi_status acpi_ex_convert_to_string ( union acpi_operand_object *obj_desc, union acpi_operand_object **result_desc, - u32 type, - u16 opcode) + u32 type) { union acpi_operand_object *return_desc; u8 *new_buf; @@ -479,6 +453,7 @@ acpi_ex_convert_to_string ( /* Null terminate at the correct place */ + return_desc->string.length = string_length; new_buf [string_length] = 0; break; @@ -527,8 +502,10 @@ acpi_ex_convert_to_string ( new_buf = return_desc->buffer.pointer; - /* Convert buffer bytes to hex or decimal values (separated by commas) */ - + /* + * Convert buffer bytes to hex or decimal values + * (separated by commas) + */ for (i = 0; i < obj_desc->buffer.length; i++) { new_buf += acpi_ex_convert_to_ascii ( (acpi_integer) obj_desc->buffer.pointer[i], base, @@ -551,17 +528,6 @@ acpi_ex_convert_to_string ( return_ACPI_STATUS (AE_TYPE); } - /* - * 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 (opcode != AML_STORE_OP) { - acpi_ut_remove_reference (obj_desc); - } - } - *result_desc = return_desc; return_ACPI_STATUS (AE_OK); } @@ -641,7 +607,7 @@ acpi_ex_convert_to_target_type ( * a Buffer or a String to an Integer if necessary. */ status = acpi_ex_convert_to_integer (source_desc, result_desc, - walk_state->opcode); + 16); break; @@ -652,7 +618,7 @@ acpi_ex_convert_to_target_type ( * Integer or Buffer if necessary */ status = acpi_ex_convert_to_string (source_desc, result_desc, - ACPI_IMPLICIT_CONVERT_HEX, walk_state->opcode); + ACPI_IMPLICIT_CONVERT_HEX); break; @@ -662,8 +628,7 @@ acpi_ex_convert_to_target_type ( * The operand must be a Buffer. We can convert an * Integer or String if necessary */ - status = acpi_ex_convert_to_buffer (source_desc, result_desc, - walk_state->opcode); + status = acpi_ex_convert_to_buffer (source_desc, result_desc); break; diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index a8aaeafc5e9c..8c90cc408e5c 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c @@ -258,18 +258,16 @@ acpi_ex_do_concatenate ( */ switch (ACPI_GET_OBJECT_TYPE (operand0)) { case ACPI_TYPE_INTEGER: - status = acpi_ex_convert_to_integer (operand1, &local_operand1, - walk_state->opcode); + status = acpi_ex_convert_to_integer (operand1, &local_operand1, 16); break; case ACPI_TYPE_STRING: status = acpi_ex_convert_to_string (operand1, &local_operand1, - ACPI_IMPLICIT_CONVERT_HEX, walk_state->opcode); + ACPI_IMPLICIT_CONVERT_HEX); break; case ACPI_TYPE_BUFFER: - status = acpi_ex_convert_to_buffer (operand1, &local_operand1, - walk_state->opcode); + status = acpi_ex_convert_to_buffer (operand1, &local_operand1); break; default: @@ -588,16 +586,16 @@ acpi_ex_do_logical_op ( */ switch (ACPI_GET_OBJECT_TYPE (operand0)) { case ACPI_TYPE_INTEGER: - status = acpi_ex_convert_to_integer (operand1, &local_operand1, opcode); + status = acpi_ex_convert_to_integer (operand1, &local_operand1, 16); break; case ACPI_TYPE_STRING: status = acpi_ex_convert_to_string (operand1, &local_operand1, - ACPI_IMPLICIT_CONVERT_HEX, opcode); + ACPI_IMPLICIT_CONVERT_HEX); break; case ACPI_TYPE_BUFFER: - status = acpi_ex_convert_to_buffer (operand1, &local_operand1, opcode); + status = acpi_ex_convert_to_buffer (operand1, &local_operand1); break; default: diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c index df5468c37d05..d75b52ea74bf 100644 --- a/drivers/acpi/executer/exoparg1.c +++ b/drivers/acpi/executer/exoparg1.c @@ -67,7 +67,7 @@ * Where: * * xA - ARGUMENTS: The number of arguments (input operands) that are - * required for this opcode type (1 through 6 args). + * required for this opcode type (0 through 6 args). * yT - TARGETS: The number of targets (output operands) that are required * for this opcode type (0, 1, or 2 targets). * zR - RETURN VALUE: Indicates whether this opcode type returns a value @@ -85,8 +85,7 @@ * * RETURN: Status * - * DESCRIPTION: Execute Type 1 monadic operator with numeric operand on - * object stack + * DESCRIPTION: Execute operator with no operands, one return value * ******************************************************************************/ @@ -100,6 +99,7 @@ acpi_ex_opcode_0A_0T_1R ( ACPI_FUNCTION_TRACE_STR ("ex_opcode_0A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); + /* Examine the AML opcode */ switch (walk_state->opcode) { @@ -403,7 +403,7 @@ acpi_ex_opcode_1A_1T_1R ( /* Each BCD digit is one nybble wide */ 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 */ @@ -500,28 +500,27 @@ acpi_ex_opcode_1A_1T_1R ( case AML_TO_DECSTRING_OP: /* to_decimal_string (Data, Result) */ status = acpi_ex_convert_to_string (operand[0], &return_desc, - ACPI_EXPLICIT_CONVERT_DECIMAL, walk_state->opcode); + ACPI_EXPLICIT_CONVERT_DECIMAL); break; case AML_TO_HEXSTRING_OP: /* to_hex_string (Data, Result) */ status = acpi_ex_convert_to_string (operand[0], &return_desc, - ACPI_EXPLICIT_CONVERT_HEX, walk_state->opcode); + ACPI_EXPLICIT_CONVERT_HEX); break; case AML_TO_BUFFER_OP: /* to_buffer (Data, Result) */ - status = acpi_ex_convert_to_buffer (operand[0], &return_desc, - walk_state->opcode); + status = acpi_ex_convert_to_buffer (operand[0], &return_desc); break; case AML_TO_INTEGER_OP: /* to_integer (Data, Result) */ status = acpi_ex_convert_to_integer (operand[0], &return_desc, - walk_state->opcode); + ACPI_ANY_BASE); break; diff --git a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c index 2660afa7b4f8..422cf9908d68 100644 --- a/drivers/acpi/executer/exoparg2.c +++ b/drivers/acpi/executer/exoparg2.c @@ -199,7 +199,8 @@ acpi_ex_opcode_2A_2T_1R ( acpi_status status; - ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_2T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); + ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_2T_1R", + acpi_ps_get_opcode_name (walk_state->opcode)); /* @@ -222,8 +223,10 @@ acpi_ex_opcode_2A_2T_1R ( /* Quotient to return_desc1, remainder to return_desc2 */ - status = acpi_ut_divide (&operand[0]->integer.value, &operand[1]->integer.value, - &return_desc1->integer.value, &return_desc2->integer.value); + status = acpi_ut_divide (operand[0]->integer.value, + operand[1]->integer.value, + &return_desc1->integer.value, + &return_desc2->integer.value); if (ACPI_FAILURE (status)) { goto cleanup; } @@ -297,7 +300,8 @@ acpi_ex_opcode_2A_1T_1R ( acpi_size length; - ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_1T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); + ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_1T_1R", + acpi_ps_get_opcode_name (walk_state->opcode)); /* @@ -330,15 +334,17 @@ acpi_ex_opcode_2A_1T_1R ( /* return_desc will contain the remainder */ - status = acpi_ut_divide (&operand[0]->integer.value, - &operand[1]->integer.value, - NULL, &return_desc->integer.value); + status = acpi_ut_divide (operand[0]->integer.value, + operand[1]->integer.value, + NULL, + &return_desc->integer.value); break; case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */ - status = acpi_ex_do_concatenate (operand[0], operand[1], &return_desc, walk_state); + status = acpi_ex_do_concatenate (operand[0], operand[1], + &return_desc, walk_state); break; @@ -349,24 +355,24 @@ acpi_ex_opcode_2A_1T_1R ( * been converted.) Copy the raw buffer data to a new object of type String. */ - /* Get the length of the new string */ - + /* + * Get the length of the new string. It is the smallest of: + * 1) Length of the input buffer + * 2) Max length as specified in the to_string operator + * 3) Length of input buffer up to a zero byte (null terminator) + * + * NOTE: A length of zero is ok, and will create a zero-length, null + * terminated string. + */ length = 0; - if (operand[1]->integer.value == 0) { - /* Handle optional length value */ - - operand[1]->integer.value = ACPI_INTEGER_MAX; - } - while ((length < operand[0]->buffer.length) && (length < operand[1]->integer.value) && (operand[0]->buffer.pointer[length])) { length++; - } - - if (length > ACPI_MAX_STRING_CONVERSION) { - status = AE_AML_STRING_LIMIT; - goto cleanup; + if (length > ACPI_MAX_STRING_CONVERSION) { + status = AE_AML_STRING_LIMIT; + goto cleanup; + } } /* Allocate a new string (Length + 1 for null terminator) */ @@ -512,7 +518,8 @@ acpi_ex_opcode_2A_0T_1R ( u8 logical_result = FALSE; - ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); + ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_0T_1R", + acpi_ps_get_opcode_name (walk_state->opcode)); /* Create the internal return object */ diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c index 3262f1a1ddc3..4fef755ced58 100644 --- a/drivers/acpi/executer/exregion.c +++ b/drivers/acpi/executer/exregion.c @@ -121,7 +121,7 @@ acpi_ex_system_memory_space_handler ( * Hardware does not support non-aligned data transfers, we must verify * the request. */ - (void) acpi_ut_short_divide ((acpi_integer *) &address, length, NULL, &remainder); + (void) acpi_ut_short_divide ((acpi_integer) address, length, NULL, &remainder); if (remainder != 0) { return_ACPI_STATUS (AE_AML_ALIGNMENT); } diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c index 3f6e6f9f9745..bd7a832e990c 100644 --- a/drivers/acpi/executer/exresop.c +++ b/drivers/acpi/executer/exresop.c @@ -398,8 +398,7 @@ acpi_ex_resolve_operands ( * But we can implicitly convert from a STRING or BUFFER * Aka - "Implicit Source Operand Conversion" */ - status = acpi_ex_convert_to_integer (obj_desc, stack_ptr, - walk_state->opcode); + status = acpi_ex_convert_to_integer (obj_desc, stack_ptr, 16); if (ACPI_FAILURE (status)) { if (status == AE_TYPE) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, @@ -421,8 +420,7 @@ acpi_ex_resolve_operands ( * But we can implicitly convert from a STRING or INTEGER * Aka - "Implicit Source Operand Conversion" */ - status = acpi_ex_convert_to_buffer (obj_desc, stack_ptr, - walk_state->opcode); + status = acpi_ex_convert_to_buffer (obj_desc, stack_ptr); if (ACPI_FAILURE (status)) { if (status == AE_TYPE) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, @@ -445,7 +443,7 @@ acpi_ex_resolve_operands ( * Aka - "Implicit Source Operand Conversion" */ status = acpi_ex_convert_to_string (obj_desc, stack_ptr, - ACPI_IMPLICIT_CONVERT_HEX, walk_state->opcode); + ACPI_IMPLICIT_CONVERT_HEX); if (ACPI_FAILURE (status)) { if (status == AE_TYPE) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, @@ -497,8 +495,7 @@ acpi_ex_resolve_operands ( /* Highest priority conversion is to type Buffer */ - status = acpi_ex_convert_to_buffer (obj_desc, stack_ptr, - walk_state->opcode); + status = acpi_ex_convert_to_buffer (obj_desc, stack_ptr); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c index bc425b2b4fd6..85253b38969a 100644 --- a/drivers/acpi/executer/exutils.c +++ b/drivers/acpi/executer/exutils.c @@ -280,25 +280,25 @@ acpi_ex_digits_needed ( { u32 num_digits; acpi_integer current_value; - acpi_integer quotient; ACPI_FUNCTION_TRACE ("ex_digits_needed"); - /* - * acpi_integer is unsigned, so we don't worry about a '-' - */ - if ((current_value = value) == 0) { + /* acpi_integer is unsigned, so we don't worry about a '-' prefix */ + + if (value == 0) { return_VALUE (1); } + current_value = value; num_digits = 0; + /* Count the digits in the requested base */ + while (current_value) { - (void) acpi_ut_short_divide (¤t_value, base, "ient, NULL); + (void) acpi_ut_short_divide (current_value, base, ¤t_value, NULL); num_digits++; - current_value = quotient; } return_VALUE (num_digits); @@ -361,7 +361,6 @@ acpi_ex_unsigned_integer_to_string ( u32 count; u32 digits_needed; u32 remainder; - acpi_integer quotient; ACPI_FUNCTION_ENTRY (); @@ -371,9 +370,8 @@ acpi_ex_unsigned_integer_to_string ( out_string[digits_needed] = 0; for (count = digits_needed; count > 0; count--) { - (void) acpi_ut_short_divide (&value, 10, "ient, &remainder); + (void) acpi_ut_short_divide (value, 10, &value, &remainder); out_string[count-1] = (char) ('0' + remainder);\ - value = quotient; } } diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c index cb998fe9e970..7c956122a402 100644 --- a/drivers/acpi/hardware/hwregs.c +++ b/drivers/acpi/hardware/hwregs.c @@ -709,6 +709,7 @@ acpi_hw_low_level_read ( u32 *value, struct acpi_generic_address *reg) { + u64 address; acpi_status status; @@ -720,8 +721,14 @@ acpi_hw_low_level_read ( * a non-zero address within. However, don't return an error * because the PM1A/B code must not fail if B isn't present. */ - if ((!reg) || - (!reg->address)) { + if (!reg) { + return (AE_OK); + } + + /* Get a local copy of the address. Handles possible alignment issues */ + + address = ACPI_MOVE_64_TO_64 (&address, ®->address); + if (!address) { return (AE_OK); } *value = 0; @@ -734,14 +741,14 @@ acpi_hw_low_level_read ( case ACPI_ADR_SPACE_SYSTEM_MEMORY: status = acpi_os_read_memory ( - (acpi_physical_address) reg->address, + (acpi_physical_address) address, value, width); break; case ACPI_ADR_SPACE_SYSTEM_IO: - status = acpi_os_read_port ((acpi_io_address) reg->address, + status = acpi_os_read_port ((acpi_io_address) address, value, width); break; @@ -754,7 +761,7 @@ acpi_hw_low_level_read ( ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", *value, width, - ACPI_FORMAT_UINT64 (reg->address), + ACPI_FORMAT_UINT64 (address), acpi_ut_get_region_name (reg->address_space_id))); return (status); @@ -781,6 +788,7 @@ acpi_hw_low_level_write ( u32 value, struct acpi_generic_address *reg) { + u64 address; acpi_status status; @@ -792,8 +800,14 @@ acpi_hw_low_level_write ( * a non-zero address within. However, don't return an error * because the PM1A/B code must not fail if B isn't present. */ - if ((!reg) || - (!reg->address)) { + if (!reg) { + return (AE_OK); + } + + /* Get a local copy of the address. Handles possible alignment issues */ + + address = ACPI_MOVE_64_TO_64 (&address, ®->address); + if (!address) { return (AE_OK); } @@ -805,14 +819,14 @@ acpi_hw_low_level_write ( case ACPI_ADR_SPACE_SYSTEM_MEMORY: status = acpi_os_write_memory ( - (acpi_physical_address) reg->address, + (acpi_physical_address) address, value, width); break; case ACPI_ADR_SPACE_SYSTEM_IO: - status = acpi_os_write_port ((acpi_io_address) reg->address, + status = acpi_os_write_port ((acpi_io_address) address, value, width); break; @@ -825,7 +839,7 @@ acpi_hw_low_level_write ( ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", value, width, - ACPI_FORMAT_UINT64 (reg->address), + ACPI_FORMAT_UINT64 (address), acpi_ut_get_region_name (reg->address_space_id))); return (status); diff --git a/drivers/acpi/hardware/hwtimer.c b/drivers/acpi/hardware/hwtimer.c index 1f94d6ffa9f8..70af02d9edfb 100644 --- a/drivers/acpi/hardware/hwtimer.c +++ b/drivers/acpi/hardware/hwtimer.c @@ -149,10 +149,9 @@ acpi_get_timer_duration ( u32 end_ticks, u32 *time_elapsed) { - u32 delta_ticks = 0; - union uint64_overlay normalized_ticks; acpi_status status; - acpi_integer out_quotient; + u32 delta_ticks; + acpi_integer quotient; ACPI_FUNCTION_TRACE ("acpi_get_timer_duration"); @@ -164,7 +163,7 @@ acpi_get_timer_duration ( /* * Compute Tick Delta: - * Handle (max one) timer rollovers on 24- versus 32-bit timers. + * Handle (max one) timer rollovers on 24-bit versus 32-bit timers. */ if (start_ticks < end_ticks) { delta_ticks = end_ticks - start_ticks; @@ -181,22 +180,20 @@ acpi_get_timer_duration ( delta_ticks = (0xFFFFFFFF - start_ticks) + end_ticks; } } - else { + else /* start_ticks == end_ticks */ { *time_elapsed = 0; return_ACPI_STATUS (AE_OK); } /* - * Compute Duration (Requires a 64-bit divide): + * Compute Duration (Requires a 64-bit multiply and divide): * * time_elapsed = (delta_ticks * 1000000) / PM_TIMER_FREQUENCY; */ - normalized_ticks.full = ((u64) delta_ticks) * 1000000; - - status = acpi_ut_short_divide (&normalized_ticks.full, PM_TIMER_FREQUENCY, - &out_quotient, NULL); + status = acpi_ut_short_divide (((u64) delta_ticks) * 1000000, + PM_TIMER_FREQUENCY, "ient, NULL); - *time_elapsed = (u32) out_quotient; + *time_elapsed = (u32) quotient; return_ACPI_STATUS (status); } diff --git a/drivers/acpi/parser/psutils.c b/drivers/acpi/parser/psutils.c index e4b8a280e151..a98c88438e99 100644 --- a/drivers/acpi/parser/psutils.c +++ b/drivers/acpi/parser/psutils.c @@ -129,10 +129,9 @@ union acpi_parse_object* acpi_ps_alloc_op ( u16 opcode) { - union acpi_parse_object *op = NULL; - u32 size; - u8 flags; + union acpi_parse_object *op; const struct acpi_opcode_info *op_info; + u8 flags = ACPI_PARSEOP_GENERIC; ACPI_FUNCTION_ENTRY (); @@ -140,32 +139,28 @@ acpi_ps_alloc_op ( op_info = acpi_ps_get_opcode_info (opcode); - /* Allocate the minimum required size object */ + /* Determine type of parse_op required */ if (op_info->flags & AML_DEFER) { - size = sizeof (struct acpi_parse_obj_named); flags = ACPI_PARSEOP_DEFERRED; } else if (op_info->flags & AML_NAMED) { - size = sizeof (struct acpi_parse_obj_named); flags = ACPI_PARSEOP_NAMED; } else if (opcode == AML_INT_BYTELIST_OP) { - size = sizeof (struct acpi_parse_obj_named); flags = ACPI_PARSEOP_BYTELIST; } - else { - size = sizeof (struct acpi_parse_obj_common); - flags = ACPI_PARSEOP_GENERIC; - } - if (size == sizeof (struct acpi_parse_obj_common)) { - /* - * The generic op is by far the most common (16 to 1) - */ + /* Allocate the minimum required size object */ + + if (flags == ACPI_PARSEOP_GENERIC) { + /* The generic op (default) is by far the most common (16 to 1) */ + op = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_PSNODE); } else { + /* Extended parseop */ + op = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_PSNODE_EXT); } diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index 299fc9376b65..3622852af685 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c @@ -74,7 +74,6 @@ acpi_rs_get_byte_stream_length ( { acpi_size byte_stream_size_needed = 0; acpi_size segment_size; - struct acpi_resource_ext_irq *ex_irq = NULL; u8 done = FALSE; @@ -91,8 +90,8 @@ acpi_rs_get_byte_stream_length ( case ACPI_RSTYPE_IRQ: /* * IRQ Resource - * For an IRQ Resource, Byte 3, although optional, will - * always be created - it holds IRQ information. + * For an IRQ Resource, Byte 3, although optional, will always be + * created - it holds IRQ information. */ segment_size = 4; break; @@ -108,8 +107,8 @@ acpi_rs_get_byte_stream_length ( case ACPI_RSTYPE_START_DPF: /* * Start Dependent Functions Resource - * For a start_dependent_functions Resource, Byte 1, - * although optional, will always be created. + * For a start_dependent_functions Resource, Byte 1, although + * optional, will always be created. */ segment_size = 2; break; @@ -141,10 +140,9 @@ acpi_rs_get_byte_stream_length ( case ACPI_RSTYPE_VENDOR: /* * Vendor Defined Resource - * For a Vendor Specific resource, if the Length is - * between 1 and 7 it will be created as a Small - * Resource data type, otherwise it is a Large - * Resource data type. + * For a Vendor Specific resource, if the Length is between 1 and 7 + * it will be created as a Small Resource data type, otherwise it + * is a Large Resource data type. */ if (linked_list->data.vendor_specific.length > 7) { segment_size = 3; @@ -191,10 +189,9 @@ acpi_rs_get_byte_stream_length ( case ACPI_RSTYPE_ADDRESS16: /* * 16-Bit Address Resource - * The base size of this byte stream is 16. If a - * Resource Source string is not NULL, add 1 for - * the Index + the length of the null terminated - * string Resource Source + 1 for the null. + * The base size of this byte stream is 16. If a Resource Source + * string is not NULL, add 1 for the Index + the length of the null + * terminated string Resource Source + 1 for the null. */ segment_size = 16; @@ -223,10 +220,9 @@ acpi_rs_get_byte_stream_length ( case ACPI_RSTYPE_ADDRESS64: /* * 64-Bit Address Resource - * The base size of this byte stream is 46. If a Resource - * Source string is not NULL, add 1 for the Index + the - * length of the null terminated string Resource Source + - * 1 for the null. + * The base size of this byte stream is 46. If a resource_source + * string is not NULL, add 1 for the Index + the length of the null + * terminated string Resource Source + 1 for the null. */ segment_size = 46; @@ -239,9 +235,8 @@ acpi_rs_get_byte_stream_length ( case ACPI_RSTYPE_EXT_IRQ: /* * Extended IRQ Resource - * The base size of this byte stream is 9. This is for an - * Interrupt table length of 1. For each additional - * interrupt, add 4. + * The base size of this byte stream is 9. This is for an Interrupt + * table length of 1. For each additional interrupt, add 4. * If a Resource Source string is not NULL, add 1 for the * Index + the length of the null terminated string * Resource Source + 1 for the null. @@ -249,7 +244,7 @@ acpi_rs_get_byte_stream_length ( segment_size = 9 + (((acpi_size) linked_list->data.extended_irq.number_of_interrupts - 1) * 4); - if (ex_irq && ex_irq->resource_source.string_ptr) { + if (linked_list->data.extended_irq.resource_source.string_ptr) { segment_size += linked_list->data.extended_irq.resource_source.string_length; segment_size++; } @@ -257,8 +252,7 @@ acpi_rs_get_byte_stream_length ( default: /* - * If we get here, everything is out of sync, - * so exit with an error + * If we get here, everything is out of sync, exit with error */ return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); @@ -366,7 +360,6 @@ acpi_rs_get_list_length ( /* * 32-Bit Memory Range Resource */ - bytes_consumed = 20; structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_mem32); @@ -395,14 +388,12 @@ acpi_rs_get_list_length ( bytes_consumed = temp16 + 3; /* - * Resource Source Index and Resource Source are - * optional elements. Check the length of the - * Bytestream. If it is greater than 43, that - * means that an Index exists and is followed by - * a null termininated string. Therefore, set - * the temp variable to the length minus the minimum - * byte stream length plus the byte for the Index to - * determine the size of the NULL terminiated string. + * Resource Source Index and Resource Source are optional elements. + * Check the length of the Bytestream. If it is greater than 43, + * that means that an Index exists and is followed by a null + * terminated string. Therefore, set the temp variable to the + * length minus the minimum byte stream length plus the byte for + * the Index to determine the size of the NULL terminated string. */ if (43 < temp16) { temp8 = (u8) (temp16 - 44); @@ -433,14 +424,12 @@ acpi_rs_get_list_length ( bytes_consumed = temp16 + 3; /* - * Resource Source Index and Resource Source are - * optional elements. Check the length of the - * Bytestream. If it is greater than 23, that - * means that an Index exists and is followed by - * a null termininated string. Therefore, set - * the temp variable to the length minus the minimum - * byte stream length plus the byte for the Index to - * determine the size of the NULL terminiated string. + * Resource Source Index and Resource Source are optional elements. + * Check the length of the Bytestream. If it is greater than 23, + * that means that an Index exists and is followed by a null + * terminated string. Therefore, set the temp variable to the + * length minus the minimum byte stream length plus the byte for + * the Index to determine the size of the NULL terminated string. */ if (23 < temp16) { temp8 = (u8) (temp16 - 24); @@ -471,14 +460,12 @@ acpi_rs_get_list_length ( bytes_consumed = temp16 + 3; /* - * Resource Source Index and Resource Source are - * optional elements. Check the length of the - * Bytestream. If it is greater than 13, that - * means that an Index exists and is followed by - * a null termininated string. Therefore, set - * the temp variable to the length minus the minimum - * byte stream length plus the byte for the Index to - * determine the size of the NULL terminiated string. + * Resource Source Index and Resource Source are optional elements. + * Check the length of the Bytestream. If it is greater than 13, + * that means that an Index exists and is followed by a null + * terminated string. Therefore, set the temp variable to the + * length minus the minimum byte stream length plus the byte for + * the Index to determine the size of the NULL terminated string. */ if (13 < temp16) { temp8 = (u8) (temp16 - 14); @@ -509,9 +496,8 @@ acpi_rs_get_list_length ( bytes_consumed = temp16 + 3; /* - * Point past the length field and the - * Interrupt vector flags to save off the - * Interrupt table length to the Temp8 variable. + * Point past the length field and the Interrupt vector flags to + * save off the Interrupt table length to the Temp8 variable. */ buffer += 3; temp8 = *buffer; @@ -523,14 +509,12 @@ acpi_rs_get_list_length ( additional_bytes = (u8) ((temp8 - 1) * 4); /* - * Resource Source Index and Resource Source are - * optional elements. Check the length of the - * Bytestream. If it is greater than 9, that - * means that an Index exists and is followed by - * a null termininated string. Therefore, set - * the temp variable to the length minus the minimum - * byte stream length plus the byte for the Index to - * determine the size of the NULL terminiated string. + * Resource Source Index and Resource Source are optional elements. + * Check the length of the Bytestream. If it is greater than 9, + * that means that an Index exists and is followed by a null + * terminated string. Therefore, set the temp variable to the + * length minus the minimum byte stream length plus the byte for + * the Index to determine the size of the NULL terminated string. */ if (9 + additional_bytes < temp16) { temp8 = (u8) (temp16 - (9 + additional_bytes)); @@ -565,9 +549,8 @@ acpi_rs_get_list_length ( bytes_consumed = 3; } - /* - * Point past the descriptor - */ + /* Point past the descriptor */ + ++buffer; /* @@ -595,9 +578,8 @@ acpi_rs_get_list_length ( buffer = byte_stream_buffer; bytes_consumed = 3; - /* - * Point past the descriptor - */ + /* Point past the descriptor */ + ++buffer; /* diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index dd57a16748e8..bb5a0f800ad6 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c @@ -621,6 +621,10 @@ acpi_ut_add_reference ( return_VOID; } + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, + "Obj %p Current Refs=%X [To Be Incremented]\n", + object, object->common.reference_count)); + /* Increment the reference count */ (void) acpi_ut_update_object_reference (object, REF_INCREMENT); @@ -664,8 +668,9 @@ acpi_ut_remove_reference ( return_VOID; } - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X\n", - object, object->common.reference_count)); + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, + "Obj %p Current Refs=%X [To Be Decremented]\n", + object, object->common.reference_count)); /* * Decrement the reference count, and only actually delete the object diff --git a/drivers/acpi/utilities/utmath.c b/drivers/acpi/utilities/utmath.c index 573176cac6b2..8a2df7046710 100644 --- a/drivers/acpi/utilities/utmath.c +++ b/drivers/acpi/utilities/utmath.c @@ -59,7 +59,7 @@ * * FUNCTION: acpi_ut_short_divide * - * PARAMETERS: in_dividend - Pointer to the dividend + * PARAMETERS: Dividend - 64-bit dividend * Divisor - 32-bit divisor * out_quotient - Pointer to where the quotient is returned * out_remainder - Pointer to where the remainder is returned @@ -74,19 +74,18 @@ acpi_status acpi_ut_short_divide ( - acpi_integer *in_dividend, + acpi_integer dividend, u32 divisor, acpi_integer *out_quotient, u32 *out_remainder) { - union uint64_overlay dividend; + union uint64_overlay dividend_ovl; union uint64_overlay quotient; u32 remainder32; ACPI_FUNCTION_TRACE ("ut_short_divide"); - dividend.full = *in_dividend; /* Always check for a zero divisor */ @@ -95,13 +94,15 @@ acpi_ut_short_divide ( return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO); } + dividend_ovl.full = dividend; + /* * The quotient is 64 bits, the remainder is always 32 bits, * and is generated by the second divide. */ - ACPI_DIV_64_BY_32 (0, dividend.part.hi, divisor, + ACPI_DIV_64_BY_32 (0, dividend_ovl.part.hi, divisor, quotient.part.hi, remainder32); - ACPI_DIV_64_BY_32 (remainder32, dividend.part.lo, divisor, + ACPI_DIV_64_BY_32 (remainder32, dividend_ovl.part.lo, divisor, quotient.part.lo, remainder32); /* Return only what was requested */ @@ -121,8 +122,8 @@ acpi_ut_short_divide ( * * FUNCTION: acpi_ut_divide * - * PARAMETERS: in_dividend - Pointer to the dividend - * in_divisor - Pointer to the divisor + * PARAMETERS: in_dividend - Dividend + * in_divisor - Divisor * out_quotient - Pointer to where the quotient is returned * out_remainder - Pointer to where the remainder is returned * @@ -134,8 +135,8 @@ acpi_ut_short_divide ( acpi_status acpi_ut_divide ( - acpi_integer *in_dividend, - acpi_integer *in_divisor, + acpi_integer in_dividend, + acpi_integer in_divisor, acpi_integer *out_quotient, acpi_integer *out_remainder) { @@ -155,13 +156,13 @@ acpi_ut_divide ( /* Always check for a zero divisor */ - if (*in_divisor == 0) { + if (in_divisor == 0) { ACPI_REPORT_ERROR (("acpi_ut_divide: Divide by zero\n")); return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO); } - divisor.full = *in_divisor; - dividend.full = *in_dividend; + divisor.full = in_divisor; + dividend.full = in_dividend; if (divisor.part.hi == 0) { /* * 1) Simplest case is where the divisor is 32 bits, we can @@ -269,7 +270,7 @@ acpi_ut_divide ( acpi_status acpi_ut_short_divide ( - acpi_integer *in_dividend, + acpi_integer in_dividend, u32 divisor, acpi_integer *out_quotient, u32 *out_remainder) @@ -288,10 +289,10 @@ acpi_ut_short_divide ( /* Return only what was requested */ if (out_quotient) { - *out_quotient = *in_dividend / divisor; + *out_quotient = in_dividend / divisor; } if (out_remainder) { - *out_remainder = (u32) *in_dividend % divisor; + *out_remainder = (u32) in_dividend % divisor; } return_ACPI_STATUS (AE_OK); @@ -299,8 +300,8 @@ acpi_ut_short_divide ( acpi_status acpi_ut_divide ( - acpi_integer *in_dividend, - acpi_integer *in_divisor, + acpi_integer in_dividend, + acpi_integer in_divisor, acpi_integer *out_quotient, acpi_integer *out_remainder) { @@ -309,7 +310,7 @@ acpi_ut_divide ( /* Always check for a zero divisor */ - if (*in_divisor == 0) { + if (in_divisor == 0) { ACPI_REPORT_ERROR (("acpi_ut_divide: Divide by zero\n")); return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO); } @@ -318,10 +319,10 @@ acpi_ut_divide ( /* Return only what was requested */ if (out_quotient) { - *out_quotient = *in_dividend / *in_divisor; + *out_quotient = in_dividend / in_divisor; } if (out_remainder) { - *out_remainder = *in_dividend % *in_divisor; + *out_remainder = in_dividend % in_divisor; } return_ACPI_STATUS (AE_OK); diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 9efcb99a3fa7..42e5cf25784a 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -356,16 +356,15 @@ acpi_ut_valid_acpi_character ( * FUNCTION: acpi_ut_strtoul64 * * PARAMETERS: String - Null terminated string - * Terminater - Where a pointer to the terminating byte is returned - * Base - Radix of the string + * Base - Radix of the string: 10, 16, or ACPI_ANY_BASE + * ret_integer - Where the converted integer is returned * - * RETURN: Converted value + * RETURN: Status and Converted value * * DESCRIPTION: Convert a string into an unsigned value. + * NOTE: Does not support Octal strings, not needed. * ******************************************************************************/ -#define NEGATIVE 1 -#define POSITIVE 0 acpi_status acpi_ut_strtoul64 ( @@ -373,50 +372,40 @@ acpi_ut_strtoul64 ( u32 base, acpi_integer *ret_integer) { - u32 index; + u32 this_digit; acpi_integer return_value = 0; - acpi_status status = AE_OK; - acpi_integer dividend; acpi_integer quotient; - *ret_integer = 0; + ACPI_FUNCTION_TRACE ("ut_stroul64"); + switch (base) { - case 0: - case 8: + case ACPI_ANY_BASE: case 10: case 16: break; default: - /* - * The specified Base parameter is not in the domain of - * this function: - */ - return (AE_BAD_PARAMETER); + /* Invalid Base */ + return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* - * skip over any white space in the buffer: - */ + /* Skip over any white space in the buffer */ + while (ACPI_IS_SPACE (*string) || *string == '\t') { ++string; } /* * If the input parameter Base is zero, then we need to - * determine if it is octal, decimal, or hexadecimal: + * determine if it is decimal or hexadecimal: */ if (base == 0) { - if (*string == '0') { - if (ACPI_TOLOWER (*(++string)) == 'x') { - base = 16; - ++string; - } - else { - base = 8; - } + if ((*string == '0') && + (ACPI_TOLOWER (*(++string)) == 'x')) { + base = 16; + ++string; } else { base = 10; @@ -424,76 +413,67 @@ acpi_ut_strtoul64 ( } /* - * For octal and hexadecimal bases, skip over the leading + * For hexadecimal base, skip over the leading * 0 or 0x, if they are present. */ - if (base == 8 && *string == '0') { - string++; - } - if (base == 16 && *string == '0' && ACPI_TOLOWER (*(++string)) == 'x') { string++; } - /* Main loop: convert the string to an unsigned long */ + /* Main loop: convert the string to a 64-bit integer */ while (*string) { if (ACPI_IS_DIGIT (*string)) { - index = ((u8) *string) - '0'; + /* Convert ASCII 0-9 to Decimal value */ + + this_digit = ((u8) *string) - '0'; } else { - index = (u8) ACPI_TOUPPER (*string); - if (ACPI_IS_UPPER ((char) index)) { - index = index - 'A' + 10; + this_digit = (u8) ACPI_TOUPPER (*string); + if (ACPI_IS_UPPER ((char) this_digit)) { + /* Convert ASCII Hex char to value */ + + this_digit = this_digit - 'A' + 10; } else { goto error_exit; } } - if (index >= base) { + /* Check to see if digit is out of range */ + + if (this_digit >= base) { goto error_exit; } - /* Check to see if value is out of range: */ + /* Divide the digit into the correct position */ - dividend = ACPI_INTEGER_MAX - (acpi_integer) index; - (void) acpi_ut_short_divide (÷nd, base, "ient, NULL); + (void) acpi_ut_short_divide ((ACPI_INTEGER_MAX - (acpi_integer) this_digit), + base, "ient, NULL); if (return_value > quotient) { goto error_exit; } return_value *= base; - return_value += index; + return_value += this_digit; ++string; } *ret_integer = return_value; - return (status); + return_ACPI_STATUS (AE_OK); error_exit: - switch (base) { - case 8: - status = AE_BAD_OCTAL_CONSTANT; - break; - - case 10: - status = AE_BAD_DECIMAL_CONSTANT; - break; - - case 16: - status = AE_BAD_HEX_CONSTANT; - break; + /* Base was set/validated above */ - default: - /* Base validated above */ - break; + if (base == 10) { + return_ACPI_STATUS (AE_BAD_DECIMAL_CONSTANT); + } + else { + return_ACPI_STATUS (AE_BAD_HEX_CONSTANT); } - - return (status); } diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index 75ec492acb77..cb6bd7ea3e1b 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -64,7 +64,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20040924 +#define ACPI_CA_VERSION 0x20041006 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, diff --git a/include/acpi/acinterp.h b/include/acpi/acinterp.h index 21167278dc17..849551744625 100644 --- a/include/acpi/acinterp.h +++ b/include/acpi/acinterp.h @@ -83,22 +83,20 @@ acpi_status acpi_ex_convert_to_integer ( union acpi_operand_object *obj_desc, union acpi_operand_object **result_desc, - u16 opcode); + u32 flags); acpi_status acpi_ex_convert_to_buffer ( union acpi_operand_object *obj_desc, - union acpi_operand_object **result_desc, - u16 opcode); + union acpi_operand_object **result_desc); acpi_status acpi_ex_convert_to_string ( union acpi_operand_object *obj_desc, union acpi_operand_object **result_desc, - u32 type, - u16 opcode); + u32 type); -/* Types for String conversion */ +/* Types for ->String conversion */ #define ACPI_EXPLICIT_BYTE_COPY 0x00000000 #define ACPI_EXPLICIT_CONVERT_HEX 0x00000001 diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index aa2d64667bfe..9db2f173a834 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -838,7 +838,11 @@ acpi_status (*acpi_init_handler) ( typedef acpi_status (*acpi_exception_handler) ( - acpi_status status); + acpi_status aml_status, + acpi_name name, + u16 opcode, + u32 aml_offset, + void *context); /* Address Spaces (For Operation Regions) */ diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h index ab3784a0cf58..163cf17a0c08 100644 --- a/include/acpi/acutils.h +++ b/include/acpi/acutils.h @@ -694,14 +694,14 @@ acpi_ut_print_string ( acpi_status acpi_ut_divide ( - acpi_integer *in_dividend, - acpi_integer *in_divisor, + acpi_integer in_dividend, + acpi_integer in_divisor, acpi_integer *out_quotient, acpi_integer *out_remainder); acpi_status acpi_ut_short_divide ( - acpi_integer *in_dividend, + acpi_integer in_dividend, u32 divisor, acpi_integer *out_quotient, u32 *out_remainder); @@ -720,6 +720,10 @@ acpi_ut_strtoul64 ( u32 base, acpi_integer *ret_integer); +/* Values for Base above (16=Hex, 10=Decimal) */ + +#define ACPI_ANY_BASE 0 + char * acpi_ut_strupr ( char *src_string); -- cgit v1.2.3 From b4ec036871de07c3ae7442c743d33b360e1b2050 Mon Sep 17 00:00:00 2001 From: Len Brown Date: Fri, 22 Oct 2004 14:56:02 -0400 Subject: [ACPI] ACPICA 20041015 from Bob Moore Signed-off-by: Len Brown Note: ACPI CA is currently undergoing an in-depth and complete formal evaluation to test/verify the following areas. Other suggestions are welcome. This will result in an increase in the frequency of releases and the number of bug fixes in the next few months. - Functional tests for all ASL/AML operators - All implicit/explicit type conversions - Bit fields and operation regions - 64-bit math support and 32-bit-only "truncated" math support - Exceptional conditions, both compiler and interpreter - Dynamic object deletion and memory leaks - ACPI 3.0 support when implemented - External interfaces to the ACPI subsystem Fixed two alignment issues on 64-bit platforms - within debug statements in acpi_ev_gpe_detect and acpi_ev_create_gpe_block. Removed references to the Address field within the non-aligned ACPI generic address structure. Fixed a problem in the Increment and Decrement operators where incorrect operand resolution could result in the inadvertent modification of the original integer when the integer is passed into another method as an argument and the arg is then incremented/decremented. Fixed a problem in the FromBCD operator where the upper 32-bits of a 64-bit BCD number were truncated during conversion. Fixed a problem in the ToDecimal operator where the length of the resulting string could be set incorrectly too long if the input operand was a Buffer object. Fixed a problem in the Logical operators (LLess, etc.) where a NULL byte (0) within a buffer would prematurely terminate a compare between buffer objects. Added a check for string overflow (>200 characters as per the ACPI specification) during the Concatenate operator with two string operands. --- drivers/acpi/dispatcher/dsmthdat.c | 4 +- drivers/acpi/dispatcher/dsutils.c | 2 +- drivers/acpi/events/evgpe.c | 9 +--- drivers/acpi/events/evgpeblk.c | 4 +- drivers/acpi/executer/exconvrt.c | 10 +++-- drivers/acpi/executer/exmisc.c | 17 +++++--- drivers/acpi/executer/exoparg1.c | 88 +++++++++++++++++++++++++------------- drivers/acpi/executer/exoparg2.c | 4 +- drivers/acpi/executer/exresop.c | 7 +-- drivers/acpi/executer/exstore.c | 13 +++++- drivers/acpi/hardware/hwregs.c | 4 +- drivers/acpi/parser/psopcode.c | 2 +- drivers/acpi/utilities/utobject.c | 32 +++++++------- include/acpi/acconfig.h | 2 +- include/acpi/acutils.h | 6 +++ include/acpi/platform/acenv.h | 2 + 16 files changed, 128 insertions(+), 78 deletions(-) (limited to 'include') diff --git a/drivers/acpi/dispatcher/dsmthdat.c b/drivers/acpi/dispatcher/dsmthdat.c index befe750a766e..033471161d8e 100644 --- a/drivers/acpi/dispatcher/dsmthdat.c +++ b/drivers/acpi/dispatcher/dsmthdat.c @@ -312,7 +312,7 @@ acpi_ds_method_data_set_value ( ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "obj %p op %X, ref count = %d [%s]\n", object, + "new_obj %p Opcode %X, Refs=%d [%s]\n", object, opcode, object->common.reference_count, acpi_ut_get_type_name (object->common.type))); @@ -572,7 +572,7 @@ acpi_ds_store_object_to_local ( ACPI_FUNCTION_TRACE ("ds_store_object_to_local"); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode=%d Idx=%d Obj=%p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n", opcode, index, obj_desc)); /* Parameter validation */ diff --git a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/dispatcher/dsutils.c index 24462789ad00..b18c0df3a5c0 100644 --- a/drivers/acpi/dispatcher/dsutils.c +++ b/drivers/acpi/dispatcher/dsutils.c @@ -333,7 +333,7 @@ acpi_ds_clear_operands ( u32 i; - ACPI_FUNCTION_TRACE_PTR ("acpi_ds_clear_operands", walk_state); + ACPI_FUNCTION_TRACE_PTR ("ds_clear_operands", walk_state); /* diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c index afb36886bfac..0c54d314a357 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/events/evgpe.c @@ -434,13 +434,8 @@ acpi_ev_gpe_detect ( } ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, - "GPE pair: Status %8.8X%8.8X = %02X, Enable %8.8X%8.8X = %02X\n", - ACPI_FORMAT_UINT64 ( - gpe_register_info->status_address.address), - status_reg, - ACPI_FORMAT_UINT64 ( - gpe_register_info->enable_address.address), - enable_reg)); + "Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n", + gpe_register_info->base_gpe_number, status_reg, enable_reg)); /* First check if there is anything active at all in this register */ diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c index 1913f4efe1b9..dae8f8c31bf4 100644 --- a/drivers/acpi/events/evgpeblk.c +++ b/drivers/acpi/events/evgpeblk.c @@ -970,16 +970,14 @@ acpi_ev_create_gpe_block ( /* Dump info about this GPE block */ ACPI_DEBUG_PRINT ((ACPI_DB_INIT, - "GPE %02X to %02X [%4.4s] %u regs at %8.8X%8.8X on int 0x%X\n", + "GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n", (u32) gpe_block->block_base_number, (u32) (gpe_block->block_base_number + ((gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH) -1)), gpe_device->name.ascii, gpe_block->register_count, - ACPI_FORMAT_UINT64 (gpe_block->block_address.address), interrupt_level)); - /* Enable all valid GPEs found above */ status = acpi_hw_enable_runtime_gpe_block (NULL, gpe_block); diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c index 33878fb323f4..a29b8653c2e4 100644 --- a/drivers/acpi/executer/exconvrt.c +++ b/drivers/acpi/executer/exconvrt.c @@ -437,9 +437,9 @@ acpi_ex_convert_to_string ( /* * Create a new String - * Need enough space for one ASCII integer plus null terminator + * Need enough space for one ASCII integer (plus null terminator) */ - return_desc = acpi_ut_create_string_object ((acpi_size) string_length + 1); + return_desc = acpi_ut_create_string_object ((acpi_size) string_length); if (!return_desc) { return_ACPI_STATUS (AE_NO_MEMORY); } @@ -495,7 +495,7 @@ acpi_ex_convert_to_string ( /* 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 -1); if (!return_desc) { return_ACPI_STATUS (AE_NO_MEMORY); } @@ -517,6 +517,10 @@ acpi_ex_convert_to_string ( new_buf--; *new_buf = 0; + + /* Recalculate length */ + + return_desc->string.length = ACPI_STRLEN (return_desc->string.pointer); break; default: diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index 8c90cc408e5c..6bd793424a22 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c @@ -244,6 +244,7 @@ acpi_ex_do_concatenate ( union acpi_operand_object *return_desc; char *new_buf; acpi_status status; + acpi_size new_length; ACPI_FUNCTION_TRACE ("ex_do_concatenate"); @@ -325,9 +326,14 @@ acpi_ex_do_concatenate ( /* Result of two Strings is a String */ - return_desc = acpi_ut_create_string_object ( - (acpi_size) operand0->string.length + - (acpi_size) local_operand1->string.length + 1); + new_length = (acpi_size) operand0->string.length + + (acpi_size) local_operand1->string.length; + if (new_length > ACPI_MAX_STRING_CONVERSION) { + status = AE_AML_STRING_LIMIT; + goto cleanup; + } + + return_desc = acpi_ut_create_string_object (new_length); if (!return_desc) { status = AE_NO_MEMORY; goto cleanup; @@ -649,14 +655,15 @@ acpi_ex_do_logical_op ( /* * 2) Both operands are Strings or both are Buffers * Note: Code below takes advantage of common Buffer/String - * object fields. local_operand1 may have changed above + * object fields. local_operand1 may have changed above. Use + * memcmp to handle nulls in buffers. */ length0 = operand0->buffer.length; length1 = local_operand1->buffer.length; /* Lexicographic compare: compare the data bytes */ - compare = ACPI_STRNCMP ((const char * ) operand0->buffer.pointer, + compare = ACPI_MEMCMP ((const char * ) operand0->buffer.pointer, (const char * ) local_operand1->buffer.pointer, (length0 > length1) ? length1 : length0); diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c index d75b52ea74bf..aedd91130d2e 100644 --- a/drivers/acpi/executer/exoparg1.c +++ b/drivers/acpi/executer/exoparg1.c @@ -285,7 +285,7 @@ acpi_ex_opcode_1A_1T_1R ( union acpi_operand_object *return_desc2 = NULL; u32 temp32; u32 i; - u32 power_of_ten; + acpi_integer power_of_ten; acpi_integer digit; @@ -325,7 +325,8 @@ acpi_ex_opcode_1A_1T_1R ( * Acpi specification describes Integer type as a little * endian unsigned value, so this boundary condition is valid. */ - for (temp32 = 0; return_desc->integer.value && temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) { + for (temp32 = 0; return_desc->integer.value && + temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) { return_desc->integer.value >>= 1; } @@ -341,13 +342,15 @@ acpi_ex_opcode_1A_1T_1R ( * The Acpi specification describes Integer type as a little * endian unsigned value, so this boundary condition is valid. */ - for (temp32 = 0; return_desc->integer.value && temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) { + for (temp32 = 0; return_desc->integer.value && + temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) { return_desc->integer.value <<= 1; } /* Since the bit position is one-based, subtract from 33 (65) */ - return_desc->integer.value = temp32 == 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - temp32; + return_desc->integer.value = temp32 == 0 ? 0 : + (ACPI_INTEGER_BIT_SIZE + 1) - temp32; break; @@ -382,7 +385,8 @@ acpi_ex_opcode_1A_1T_1R ( /* Sum the digit into the result with the current power of 10 */ - return_desc->integer.value += (((acpi_integer) temp32) * power_of_ten); + return_desc->integer.value += (((acpi_integer) temp32) * + power_of_ten); /* Shift to next BCD digit */ @@ -407,14 +411,16 @@ acpi_ex_opcode_1A_1T_1R ( /* Insert the BCD digit that resides in the remainder from above */ - return_desc->integer.value |= (((acpi_integer) temp32) << ACPI_MUL_4 (i)); + return_desc->integer.value |= (((acpi_integer) temp32) << + ACPI_MUL_4 (i)); } /* Overflow if there is any data left in Digit */ if (digit > 0) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Integer too large to convert to BCD: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (operand[0]->integer.value))); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Integer too large to convert to BCD: %8.8X%8.8X\n", + ACPI_FORMAT_UINT64 (operand[0]->integer.value))); status = AE_AML_NUMERIC_OVERFLOW; goto cleanup; } @@ -524,8 +530,8 @@ acpi_ex_opcode_1A_1T_1R ( break; - 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_LEFT_BIT_OP: /* shift_left_bit (Source, bit_num) */ + case AML_SHIFT_RIGHT_BIT_OP: /* shift_right_bit (Source, bit_num) */ /* * These are two obsolete opcodes @@ -619,41 +625,61 @@ acpi_ex_opcode_1A_0T_1R ( case AML_INCREMENT_OP: /* Increment (Operand) */ /* - * Since we are expecting a Reference operand, it - * can be either a NS Node or an internal object. + * Create a new integer. Can't just get the base integer and + * increment it because it may be an Arg or Field. */ - return_desc = operand[0]; - if (ACPI_GET_DESCRIPTOR_TYPE (operand[0]) == ACPI_DESC_TYPE_OPERAND) { + return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); + if (!return_desc) { + status = AE_NO_MEMORY; + goto cleanup; + } + + /* + * Since we are expecting a Reference operand, it can be either a + * NS Node or an internal object. + */ + temp_desc = operand[0]; + if (ACPI_GET_DESCRIPTOR_TYPE (temp_desc) == ACPI_DESC_TYPE_OPERAND) { /* Internal reference object - prevent deletion */ - acpi_ut_add_reference (return_desc); + acpi_ut_add_reference (temp_desc); } /* - * Convert the return_desc Reference to a Number - * (This removes a reference on the return_desc object) + * Convert the Reference operand to an Integer (This removes a + * reference on the Operand[0] object) + * + * NOTE: We use LNOT_OP here in order to force resolution of the + * reference operand to an actual integer. */ - status = acpi_ex_resolve_operands (AML_LNOT_OP, &return_desc, walk_state); + status = acpi_ex_resolve_operands (AML_LNOT_OP, &temp_desc, walk_state); if (ACPI_FAILURE (status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s: bad operand(s) %s\n", - acpi_ps_get_opcode_name (walk_state->opcode), acpi_format_exception(status))); + acpi_ps_get_opcode_name (walk_state->opcode), + acpi_format_exception(status))); goto cleanup; } /* - * return_desc is now guaranteed to be an Integer object - * Do the actual increment or decrement + * temp_desc is now guaranteed to be an Integer object -- + * Perform the actual increment or decrement */ - if (AML_INCREMENT_OP == walk_state->opcode) { - return_desc->integer.value++; + if (walk_state->opcode == AML_INCREMENT_OP) { + return_desc->integer.value = temp_desc->integer.value +1; } else { - return_desc->integer.value--; + return_desc->integer.value = temp_desc->integer.value -1; } - /* Store the result back in the original descriptor */ + /* Finished with this Integer object */ + + acpi_ut_remove_reference (temp_desc); + /* + * Store the result back (indirectly) through the original + * Reference object + */ status = acpi_ex_store (return_desc, operand[0], walk_state); break; @@ -707,7 +733,8 @@ acpi_ex_opcode_1A_0T_1R ( break; default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "size_of, Not Buf/Str/Pkg - found type %s\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "size_of, Not Buf/Str/Pkg - found type %s\n", acpi_ut_get_type_name (type))); status = AE_AML_OPERAND_TYPE; goto cleanup; @@ -877,7 +904,8 @@ acpi_ex_opcode_1A_0T_1R ( * an uninitialized package element and is thus a * severe error. */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "NULL package element obj %p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "NULL package element obj %p\n", operand[0])); status = AE_AML_UNINITIALIZED_ELEMENT; goto cleanup; @@ -889,7 +917,8 @@ acpi_ex_opcode_1A_0T_1R ( default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Index target_type %X in obj %p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Unknown Index target_type %X in obj %p\n", operand[0]->reference.target_type, operand[0])); status = AE_AML_OPERAND_TYPE; goto cleanup; @@ -913,7 +942,8 @@ acpi_ex_opcode_1A_0T_1R ( default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode in ref(%p) - %X\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Unknown opcode in ref(%p) - %X\n", operand[0], operand[0]->reference.opcode)); status = AE_TYPE; diff --git a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c index 422cf9908d68..877831825459 100644 --- a/drivers/acpi/executer/exoparg2.c +++ b/drivers/acpi/executer/exoparg2.c @@ -375,9 +375,9 @@ acpi_ex_opcode_2A_1T_1R ( } } - /* Allocate a new string (Length + 1 for null terminator) */ + /* Allocate a new string object */ - return_desc = acpi_ut_create_string_object (length + 1); + return_desc = acpi_ut_create_string_object (length); if (!return_desc) { status = AE_NO_MEMORY; goto cleanup; diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c index bd7a832e990c..51df1a705041 100644 --- a/drivers/acpi/executer/exresop.c +++ b/drivers/acpi/executer/exresop.c @@ -160,7 +160,7 @@ acpi_ex_resolve_operands ( return_ACPI_STATUS (AE_AML_INTERNAL); } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode %X [%s] operand_types=%X \n", + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode %X [%s] required_operand_types=%8.8X \n", opcode, op_info->name, arg_types)); /* @@ -227,12 +227,13 @@ acpi_ex_resolve_operands ( case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */ ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Reference Opcode: %s\n", op_info->name))); + "Operand is a Reference, ref_opcode [%s]\n", + (acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name))); break; default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Unknown Reference Opcode %X [%s]\n", + "Operand is a Reference, Unknown Reference Opcode %X [%s]\n", obj_desc->reference.opcode, (acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name)); diff --git a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c index 47e5d0d83a96..013b1cc7e7a4 100644 --- a/drivers/acpi/executer/exstore.c +++ b/drivers/acpi/executer/exstore.c @@ -129,7 +129,8 @@ acpi_ex_store ( /* Destination is not a Reference object */ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Destination is not a Reference or Constant object [%p]\n", dest_desc)); + "Target is not a Reference or Constant object - %s [%p]\n", + acpi_ut_get_object_type_name (dest_desc), dest_desc)); ACPI_DUMP_STACK_ENTRY (source_desc); ACPI_DUMP_STACK_ENTRY (dest_desc); @@ -182,11 +183,19 @@ acpi_ex_store ( * Storing to the Debug object causes the value stored to be * displayed and otherwise has no effect -- see ACPI Specification */ - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "**** Write to Debug Object: ****:\n\n")); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "**** Write to Debug Object: Object %p %s ****:\n\n", + source_desc, acpi_ut_get_object_type_name (source_desc))); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %s: ", acpi_ut_get_object_type_name (source_desc))); + if (!acpi_ut_valid_internal_object (source_desc)) { + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, + "%X, Invalid Internal Object!\n", source_desc)); + break; + } + switch (ACPI_GET_OBJECT_TYPE (source_desc)) { case ACPI_TYPE_INTEGER: diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c index 7c956122a402..d66edd244477 100644 --- a/drivers/acpi/hardware/hwregs.c +++ b/drivers/acpi/hardware/hwregs.c @@ -727,7 +727,7 @@ acpi_hw_low_level_read ( /* Get a local copy of the address. Handles possible alignment issues */ - address = ACPI_MOVE_64_TO_64 (&address, ®->address); + ACPI_MOVE_64_TO_64 (&address, ®->address); if (!address) { return (AE_OK); } @@ -806,7 +806,7 @@ acpi_hw_low_level_write ( /* Get a local copy of the address. Handles possible alignment issues */ - address = ACPI_MOVE_64_TO_64 (&address, ®->address); + ACPI_MOVE_64_TO_64 (&address, ®->address); if (!address) { return (AE_OK); } diff --git a/drivers/acpi/parser/psopcode.c b/drivers/acpi/parser/psopcode.c index 0ee05686d0b1..597ebe5c5a0a 100644 --- a/drivers/acpi/parser/psopcode.c +++ b/drivers/acpi/parser/psopcode.c @@ -731,7 +731,7 @@ acpi_ps_get_opcode_info ( default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown extended opcode [%X]\n", opcode)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown AML opcode [%4.4X]\n", opcode)); break; } diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c index 72b0347d2564..73467983cffd 100644 --- a/drivers/acpi/utilities/utobject.c +++ b/drivers/acpi/utilities/utobject.c @@ -192,9 +192,9 @@ acpi_ut_create_buffer_object ( * * FUNCTION: acpi_ut_create_string_object * - * PARAMETERS: string_size - Size of string to be created, plus one - * for the NULL terminater. Actual sting - * length will be this size minus one. + * PARAMETERS: string_size - Size of string to be created. Does not + * include NULL terminator, this is added + * automatically. * * RETURN: Pointer to a new String object * @@ -207,7 +207,7 @@ acpi_ut_create_string_object ( acpi_size string_size) { union acpi_operand_object *string_desc; - char *string = NULL; + char *string; ACPI_FUNCTION_TRACE_U32 ("ut_create_string_object", string_size); @@ -220,24 +220,22 @@ acpi_ut_create_string_object ( return_PTR (NULL); } - /* Create an actual string only if size > 0 */ - - if (string_size > 0) { - /* Allocate the actual string */ - - string = ACPI_MEM_CALLOCATE (string_size); - if (!string) { - ACPI_REPORT_ERROR (("create_string: could not allocate size %X\n", - (u32) string_size)); - acpi_ut_remove_reference (string_desc); - return_PTR (NULL); - } + /* + * Allocate the actual string buffer -- (Size + 1) for NULL terminator. + * NOTE: Zero-length strings are NULL terminated + */ + string = ACPI_MEM_CALLOCATE (string_size + 1); + if (!string) { + ACPI_REPORT_ERROR (("create_string: could not allocate size %X\n", + (u32) string_size)); + acpi_ut_remove_reference (string_desc); + return_PTR (NULL); } /* Complete string object initialization */ string_desc->string.pointer = string; - string_desc->string.length = (u32) string_size - 1; + string_desc->string.length = (u32) string_size; /* Return the new string descriptor */ diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index cb6bd7ea3e1b..defb9820a219 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -64,7 +64,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20041006 +#define ACPI_CA_VERSION 0x20041015 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h index 163cf17a0c08..e3adfa35bb22 100644 --- a/include/acpi/acutils.h +++ b/include/acpi/acutils.h @@ -177,6 +177,12 @@ acpi_ut_strncpy ( const char *src_string, acpi_size count); +int +acpi_ut_memcmp ( + const char *buffer1, + const char *buffer2, + acpi_size count); + int acpi_ut_strncmp ( const char *string1, diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h index 7964aaf6bc97..fbf38768a838 100644 --- a/include/acpi/platform/acenv.h +++ b/include/acpi/platform/acenv.h @@ -232,6 +232,7 @@ #define ACPI_STRCAT(d,s) (void) strcat((d), (s)) #define ACPI_STRNCAT(d,s,n) strncat((d), (s), (acpi_size)(n)) #define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (acpi_size)(n)) +#define ACPI_MEMCMP(s1,s2,n) memcmp((s1), (s2), (acpi_size)(n)) #define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (acpi_size)(n)) #define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (acpi_size)(n)) @@ -295,6 +296,7 @@ typedef char *va_list; #define ACPI_STRCAT(d,s) (void) acpi_ut_strcat ((d), (s)) #define ACPI_STRNCAT(d,s,n) acpi_ut_strncat ((d), (s), (acpi_size)(n)) #define ACPI_STRTOUL(d,s,n) acpi_ut_strtoul ((d), (s), (acpi_size)(n)) +#define ACPI_MEMCMP(s1,s2,n) acpi_ut_memcmp((s1), (s2), (acpi_size)(n)) #define ACPI_MEMCPY(d,s,n) (void) acpi_ut_memcpy ((d), (s), (acpi_size)(n)) #define ACPI_MEMSET(d,v,n) (void) acpi_ut_memset ((d), (v), (acpi_size)(n)) #define ACPI_TOUPPER acpi_ut_to_upper -- cgit v1.2.3