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

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/3420c1f5


Signed-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
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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
+36 −5
Original line number Diff line number Diff line
@@ -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,12 +267,43 @@ 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;

		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:

		status = acpi_ex_convert_to_buffer(operand1, &local_operand1);
@@ -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: