Commit 7910617e authored by Bob Moore's avatar Bob Moore Committed by Rafael J. Wysocki

ACPICA: Concatenate operator: Add extensions to support all ACPI objects

ACPICA commit 3420c1f5e6c6dd4fe51be4d98da69b3197d608df

Emits strings for all the object types besides int/str/buf.
This simplifies and extends the usefulness of the Printf macros.

Link: https://github.com/acpica/acpica/commit/3420c1f5Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarLv Zheng <lv.zheng@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 3727ec2a
......@@ -223,7 +223,7 @@
#define ARGI_BUFFER_OP ARGI_LIST1 (ARGI_INTEGER)
#define ARGI_BYTE_OP ARGI_INVALID_OPCODE
#define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE
#define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF)
#define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_ANYTYPE, ARGI_ANYTYPE, ARGI_TARGETREF)
#define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF)
#define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF)
#define ARGI_CONNECTFIELD_OP ARGI_INVALID_OPCODE
......
......@@ -247,6 +247,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
union acpi_operand_object *local_operand1 = operand1;
union acpi_operand_object *return_desc;
char *new_buf;
const char *type_string;
acpi_status status;
ACPI_FUNCTION_TRACE(ex_do_concatenate);
......@@ -266,10 +267,41 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
break;
case ACPI_TYPE_STRING:
/*
* Per the ACPI spec, Concatenate only supports int/str/buf.
* However, we support all objects here as an extension.
* This improves the usefulness of the Printf() macro.
* 12/2015.
*/
switch (operand1->common.type) {
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
status =
acpi_ex_convert_to_string(operand1, &local_operand1,
ACPI_IMPLICIT_CONVERT_HEX);
break;
status =
acpi_ex_convert_to_string(operand1, &local_operand1,
ACPI_IMPLICIT_CONVERT_HEX);
default:
/*
* Just emit a string containing the object type.
*/
type_string =
acpi_ut_get_type_name(operand1->common.type);
local_operand1 = acpi_ut_create_string_object(((acpi_size) strlen(type_string) + 9)); /* 9 For "[Object]" */
if (!local_operand1) {
status = AE_NO_MEMORY;
goto cleanup;
}
strcpy(local_operand1->string.pointer, "[");
strcat(local_operand1->string.pointer, type_string);
strcat(local_operand1->string.pointer, " Object]");
status = AE_OK;
break;
}
break;
case ACPI_TYPE_BUFFER:
......@@ -348,8 +380,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
/* Concatenate the strings */
strcpy(new_buf, operand0->string.pointer);
strcpy(new_buf + operand0->string.length,
local_operand1->string.pointer);
strcat(new_buf, local_operand1->string.pointer);
break;
case ACPI_TYPE_BUFFER:
......
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