]> git.hungrycats.org Git - linux/commitdiff
[ACPI] ACPICA 20040615 from Bob Moore
authorLen Brown <len.brown@intel.com>
Tue, 22 Jun 2004 09:48:26 +0000 (05:48 -0400)
committerLen Brown <lenb@dhcppc3.>
Tue, 22 Jun 2004 09:48:26 +0000 (05:48 -0400)
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
drivers/acpi/executer/exmisc.c
drivers/acpi/executer/exoparg2.c
drivers/acpi/parser/psopcode.c
drivers/acpi/utilities/utalloc.c
include/acpi/acconfig.h
include/acpi/acdebug.h
include/acpi/acinterp.h

index 0875b5abbd3c32902e9ccdff3f2ed2c00589d63d..f8ff6ecb4b36cc60fb340ff4bec0148cf67a71a5 100644 (file)
@@ -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
index 74fd68491ba85a7cb681302713419e6e48a8f8ab..0889868d8243f277a4a6cf012ecd95ad73594afe 100644 (file)
@@ -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);
index f20ab2bededf66dd3ec986bec4c5cff3a83f5a90..0b6f86a91572d635c4fb672511bb457c8e87bc4b 100644 (file)
@@ -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;
        }
 
index 198e2206b721d700fae33d4e01f4ae46af35a4ad..30620375bd886f7792b539eca6bd8ab411b99751 100644 (file)
 #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)
 #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
index 2050d238d74fbafa17be1538a9672787cc5648ab..58ec6733efaaae8df779500a2fd3edb96d2eaa67 100644 (file)
@@ -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
index ebe514f66e874cad6ae6ca83c0210889815e1566..4fc249b1e9a3ea0749e224a68f00aa5f736d2152 100644 (file)
@@ -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,
index 6beb5bbf4bfce24f7c3f3cec74f5dce79ca57925..658c5f505872696b5b6229b17b66d1196647158c 100644 (file)
@@ -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);
index 6848e99118285ead69d0c269ee0988a6c0442b5f..a43e91fb972cf51c75b0df281cf37df92e3dcb48 100644 (file)
@@ -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 (