Commit 24ee1096 authored by Len Brown's avatar Len Brown Committed by Len Brown

[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.
parent 2d837fe9
......@@ -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
......
......@@ -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,13 +475,28 @@ 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 ();
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;
switch (opcode) {
case AML_LAND_OP: /* LAnd (Operand0, Operand1) */
if (operand0 && operand1) {
......@@ -485,7 +504,6 @@ acpi_ex_do_logical_op (
}
break;
case AML_LEQUAL_OP: /* LEqual (Operand0, Operand1) */
if (operand0 == operand1) {
......@@ -493,7 +511,6 @@ acpi_ex_do_logical_op (
}
break;
case AML_LGREATER_OP: /* LGreater (Operand0, Operand1) */
if (operand0 > operand1) {
......@@ -501,7 +518,6 @@ acpi_ex_do_logical_op (
}
break;
case AML_LLESS_OP: /* LLess (Operand0, Operand1) */
if (operand0 < operand1) {
......@@ -509,7 +525,6 @@ acpi_ex_do_logical_op (
}
break;
case AML_LOR_OP: /* LOr (Operand0, Operand1) */
if (operand0 || operand1) {
......@@ -520,6 +535,78 @@ acpi_ex_do_logical_op (
default:
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;
switch (opcode) {
case AML_LEQUAL_OP: /* LEqual (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);
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);
}
......
......@@ -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;
}
......
......@@ -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
......
......@@ -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 @@ acpi_ut_track_allocation (
*
* 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
......
......@@ -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,
......
......@@ -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);
......
......@@ -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 (
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment