From 24ee10968f574b0dfbb61ffbc2e6521d2cd21ada Mon Sep 17 00:00:00 2001 From: Len Brown Date: Tue, 22 Jun 2004 05:48:26 -0400 Subject: [ACPI] ACPICA 20040615 from Bob Moore Implemented support for Buffer and String objects (as per ACPI 2.0) for the following ASL operators: LEqual, LGreater, LLess, LGreaterEqual, and LLessEqual. --- drivers/acpi/events/evgpeblk.c | 3 +- drivers/acpi/executer/exmisc.c | 149 +++++++++++++++++++++++++++++++-------- drivers/acpi/executer/exoparg2.c | 12 +++- drivers/acpi/parser/psopcode.c | 8 +-- drivers/acpi/utilities/utalloc.c | 13 ++-- include/acpi/acconfig.h | 2 +- include/acpi/acdebug.h | 4 ++ include/acpi/acinterp.h | 4 +- 8 files changed, 149 insertions(+), 46 deletions(-) diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c index 0875b5abbd3c..f8ff6ecb4b36 100644 --- a/drivers/acpi/events/evgpeblk.c +++ b/drivers/acpi/events/evgpeblk.c @@ -328,7 +328,8 @@ acpi_ev_save_method_info ( * * PARAMETERS: Callback from walk_namespace * - * RETURN: Status + * RETURN: Status. NOTE: We ignore errors so that the _PRW walk is + * not aborted on a single _PRW failure. * * DESCRIPTION: Called from acpi_walk_namespace. Expects each object to be a * Device. Run the _PRW method. If present, extract the GPE diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index 74fd68491ba8..0889868d8243 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c @@ -389,6 +389,8 @@ acpi_ex_do_math_op ( acpi_integer operand1) { + ACPI_FUNCTION_ENTRY (); + switch (opcode) { case AML_ADD_OP: /* Add (Operand0, Operand1, Result) */ @@ -452,15 +454,17 @@ acpi_ex_do_math_op ( * FUNCTION: acpi_ex_do_logical_op * * PARAMETERS: Opcode - AML opcode - * Operand0 - Integer operand #0 - * Operand1 - Integer operand #1 + * obj_desc0 - operand #0 + * obj_desc1 - operand #1 * * RETURN: TRUE/FALSE result of the operation * * DESCRIPTION: Execute a logical AML opcode. The purpose of having all of the * functions here is to prevent a lot of pointer dereferencing * to obtain the operands and to simplify the generation of the - * logical value. + * logical value. Both operands must already be validated as + * 1) Both the same type, and + * 2) Either Integer, Buffer, or String type. * * Note: cleanest machine code seems to be produced by the code * below, rather than using statements of the form: @@ -471,54 +475,137 @@ acpi_ex_do_math_op ( u8 acpi_ex_do_logical_op ( u16 opcode, - acpi_integer operand0, - acpi_integer operand1) + union acpi_operand_object *obj_desc0, + union acpi_operand_object *obj_desc1) { + acpi_integer operand0; + acpi_integer operand1; + u8 *ptr0; + u8 *ptr1; + u32 length0; + u32 length1; + u32 i; - switch (opcode) { + ACPI_FUNCTION_ENTRY (); - case AML_LAND_OP: /* LAnd (Operand0, Operand1) */ - if (operand0 && operand1) { - return (TRUE); - } - break; + if (ACPI_GET_OBJECT_TYPE (obj_desc0) == ACPI_TYPE_INTEGER) { + /* Both operands are of type integer */ + operand0 = obj_desc0->integer.value; + operand1 = obj_desc1->integer.value; - case AML_LEQUAL_OP: /* LEqual (Operand0, Operand1) */ + switch (opcode) { + case AML_LAND_OP: /* LAnd (Operand0, Operand1) */ - if (operand0 == operand1) { - return (TRUE); - } - break; + if (operand0 && operand1) { + return (TRUE); + } + break; + case AML_LEQUAL_OP: /* LEqual (Operand0, Operand1) */ - case AML_LGREATER_OP: /* LGreater (Operand0, Operand1) */ + if (operand0 == operand1) { + return (TRUE); + } + break; - if (operand0 > operand1) { - return (TRUE); - } - break; + case AML_LGREATER_OP: /* LGreater (Operand0, Operand1) */ + if (operand0 > operand1) { + return (TRUE); + } + break; - case AML_LLESS_OP: /* LLess (Operand0, Operand1) */ + case AML_LLESS_OP: /* LLess (Operand0, Operand1) */ - if (operand0 < operand1) { - return (TRUE); + if (operand0 < operand1) { + return (TRUE); + } + break; + + case AML_LOR_OP: /* LOr (Operand0, Operand1) */ + + if (operand0 || operand1) { + return (TRUE); + } + break; + + default: + break; } - break; + } + else { + /* + * Case for Buffer/String objects. + * NOTE: takes advantage of common Buffer/String object fields + */ + length0 = obj_desc0->buffer.length; + ptr0 = obj_desc0->buffer.pointer; + length1 = obj_desc1->buffer.length; + ptr1 = obj_desc1->buffer.pointer; - case AML_LOR_OP: /* LOr (Operand0, Operand1) */ + switch (opcode) { + case AML_LEQUAL_OP: /* LEqual (Operand0, Operand1) */ - if (operand0 || operand1) { + /* Length and all bytes must be equal */ + + if (length0 != length1) { + return (FALSE); + } + + for (i = 0; i < length0; i++) { + if (ptr0[i] != ptr1[i]) { + return (FALSE); + } + } return (TRUE); - } - break; - default: - break; + case AML_LGREATER_OP: /* LGreater (Operand0, Operand1) */ + + /* Check lengths first */ + + if (length0 > length1) { + return (TRUE); + } + else if (length0 < length1) { + return (FALSE); + } + + /* Lengths equal, now scan the data */ + + for (i = 0; i < length0; i++) { + if (ptr0[i] > ptr1[i]) { + return (TRUE); + } + } + return (FALSE); + + case AML_LLESS_OP: /* LLess (Operand0, Operand1) */ + + /* Check lengths first */ + + if (length0 < length1) { + return (TRUE); + } + else if (length0 > length1) { + return (FALSE); + } + + /* Lengths equal, now scan the data */ + + for (i = 0; i < length0; i++) { + if (ptr0[i] < ptr1[i]) { + return (TRUE); + } + } + return (FALSE); + + default: + break; + } } return (FALSE); diff --git a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c index f20ab2bededf..0b6f86a91572 100644 --- a/drivers/acpi/executer/exoparg2.c +++ b/drivers/acpi/executer/exoparg2.c @@ -573,9 +573,17 @@ acpi_ex_opcode_2A_0T_1R ( * Execute the Opcode */ if (walk_state->op_info->flags & AML_LOGICAL) /* logical_op (Operand0, Operand1) */ { + /* Both operands must be of the same type */ + + if (ACPI_GET_OBJECT_TYPE (operand[0]) != + ACPI_GET_OBJECT_TYPE (operand[1])) { + status = AE_AML_OPERAND_TYPE; + goto cleanup; + } + logical_result = acpi_ex_do_logical_op (walk_state->opcode, - operand[0]->integer.value, - operand[1]->integer.value); + operand[0], + operand[1]); goto store_logical_result; } diff --git a/drivers/acpi/parser/psopcode.c b/drivers/acpi/parser/psopcode.c index 198e2206b721..30620375bd88 100644 --- a/drivers/acpi/parser/psopcode.c +++ b/drivers/acpi/parser/psopcode.c @@ -251,7 +251,7 @@ #define ARGI_CREATE_FIELD_OP ARGI_LIST4 (ARGI_BUFFER, ARGI_INTEGER, ARGI_INTEGER, ARGI_REFERENCE) #define ARGI_CREATE_QWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) #define ARGI_CREATE_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) -#define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING) +#define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING) #define ARGI_DEBUG_OP ARG_NONE #define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF) #define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REF_OR_STRING) @@ -270,10 +270,10 @@ #define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE #define ARGI_INDEX_OP ARGI_LIST3 (ARGI_COMPLEXOBJ, ARGI_INTEGER, ARGI_TARGETREF) #define ARGI_LAND_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) -#define ARGI_LEQUAL_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) -#define ARGI_LGREATER_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) +#define ARGI_LEQUAL_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA) +#define ARGI_LGREATER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA) #define ARGI_LGREATEREQUAL_OP ARGI_INVALID_OPCODE -#define ARGI_LLESS_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) +#define ARGI_LLESS_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA) #define ARGI_LLESSEQUAL_OP ARGI_INVALID_OPCODE #define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER) #define ARGI_LNOTEQUAL_OP ARGI_INVALID_OPCODE diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index 2050d238d74f..58ec6733efaa 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c @@ -259,8 +259,8 @@ acpi_ut_validate_buffer ( * * FUNCTION: acpi_ut_initialize_buffer * - * PARAMETERS: required_length - Length needed - * Buffer - Buffer to be validated + * PARAMETERS: Buffer - Buffer to be validated + * required_length - Length needed * * RETURN: Status * @@ -603,7 +603,8 @@ acpi_ut_free_and_track ( * * FUNCTION: acpi_ut_find_allocation * - * PARAMETERS: Allocation - Address of allocated memory + * PARAMETERS: list_id - Memory list to search + * Allocation - Address of allocated memory * * RETURN: A list element if found; NULL otherwise. * @@ -646,7 +647,8 @@ acpi_ut_find_allocation ( * * FUNCTION: acpi_ut_track_allocation * - * PARAMETERS: Allocation - Address of allocated memory + * PARAMETERS: list_id - Memory list to search + * Allocation - Address of allocated memory * Size - Size of the allocation * alloc_type - MEM_MALLOC or MEM_CALLOC * Component - Component type of caller @@ -733,7 +735,8 @@ unlock_and_exit: * * FUNCTION: acpi_ut_remove_allocation * - * PARAMETERS: Allocation - Address of allocated memory + * PARAMETERS: list_id - Memory list to search + * Allocation - Address of allocated memory * Component - Component type of caller * Module - Source file name of caller * Line - Line number of caller diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index ebe514f66e87..4fc249b1e9a3 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -64,7 +64,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20040527 +#define ACPI_CA_VERSION 0x20040615 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, diff --git a/include/acpi/acdebug.h b/include/acpi/acdebug.h index 6beb5bbf4bfc..658c5f505872 100644 --- a/include/acpi/acdebug.h +++ b/include/acpi/acdebug.h @@ -106,6 +106,10 @@ acpi_db_method_end ( * dbcmds - debug commands and output routines */ +acpi_status +acpi_db_disassemble_method ( + char *name); + void acpi_db_display_table_info ( char *table_arg); diff --git a/include/acpi/acinterp.h b/include/acpi/acinterp.h index 6848e9911828..a43e91fb972c 100644 --- a/include/acpi/acinterp.h +++ b/include/acpi/acinterp.h @@ -246,8 +246,8 @@ acpi_ex_do_concatenate ( u8 acpi_ex_do_logical_op ( u16 opcode, - acpi_integer operand0, - acpi_integer operand1); + union acpi_operand_object *obj_desc, + union acpi_operand_object *obj_desc2); acpi_integer acpi_ex_do_math_op ( -- cgit v1.2.3