diff options
author | Bob Moore <robert.moore@intel.com> | 2015-12-29 00:56:53 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-12-31 21:47:35 -0500 |
commit | 7910617efb5188c0b8dedab1857b12d078957a79 (patch) | |
tree | ecfb79e7c2175a3526f9b10fe5a7559cfa2af7b5 /drivers/acpi/acpica | |
parent | 3727ec2a03d3581b2e0d326bedfb92706a9b4d0f (diff) |
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: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/acpica')
-rw-r--r-- | drivers/acpi/acpica/acopcode.h | 2 | ||||
-rw-r--r-- | drivers/acpi/acpica/exmisc.c | 41 |
2 files changed, 37 insertions, 6 deletions
diff --git a/drivers/acpi/acpica/acopcode.h b/drivers/acpi/acpica/acopcode.h index f9acf92fa0bc..db71b021e42a 100644 --- a/drivers/acpi/acpica/acopcode.h +++ b/drivers/acpi/acpica/acopcode.h | |||
@@ -223,7 +223,7 @@ | |||
223 | #define ARGI_BUFFER_OP ARGI_LIST1 (ARGI_INTEGER) | 223 | #define ARGI_BUFFER_OP ARGI_LIST1 (ARGI_INTEGER) |
224 | #define ARGI_BYTE_OP ARGI_INVALID_OPCODE | 224 | #define ARGI_BYTE_OP ARGI_INVALID_OPCODE |
225 | #define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE | 225 | #define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE |
226 | #define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF) | 226 | #define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_ANYTYPE, ARGI_ANYTYPE, ARGI_TARGETREF) |
227 | #define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF) | 227 | #define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF) |
228 | #define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF) | 228 | #define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF) |
229 | #define ARGI_CONNECTFIELD_OP ARGI_INVALID_OPCODE | 229 | #define ARGI_CONNECTFIELD_OP ARGI_INVALID_OPCODE |
diff --git a/drivers/acpi/acpica/exmisc.c b/drivers/acpi/acpica/exmisc.c index a8ce8a8778b3..f598b3948c17 100644 --- a/drivers/acpi/acpica/exmisc.c +++ b/drivers/acpi/acpica/exmisc.c | |||
@@ -247,6 +247,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
247 | union acpi_operand_object *local_operand1 = operand1; | 247 | union acpi_operand_object *local_operand1 = operand1; |
248 | union acpi_operand_object *return_desc; | 248 | union acpi_operand_object *return_desc; |
249 | char *new_buf; | 249 | char *new_buf; |
250 | const char *type_string; | ||
250 | acpi_status status; | 251 | acpi_status status; |
251 | 252 | ||
252 | ACPI_FUNCTION_TRACE(ex_do_concatenate); | 253 | ACPI_FUNCTION_TRACE(ex_do_concatenate); |
@@ -266,10 +267,41 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
266 | break; | 267 | break; |
267 | 268 | ||
268 | case ACPI_TYPE_STRING: | 269 | case ACPI_TYPE_STRING: |
270 | /* | ||
271 | * Per the ACPI spec, Concatenate only supports int/str/buf. | ||
272 | * However, we support all objects here as an extension. | ||
273 | * This improves the usefulness of the Printf() macro. | ||
274 | * 12/2015. | ||
275 | */ | ||
276 | switch (operand1->common.type) { | ||
277 | case ACPI_TYPE_INTEGER: | ||
278 | case ACPI_TYPE_STRING: | ||
279 | case ACPI_TYPE_BUFFER: | ||
280 | |||
281 | status = | ||
282 | acpi_ex_convert_to_string(operand1, &local_operand1, | ||
283 | ACPI_IMPLICIT_CONVERT_HEX); | ||
284 | break; | ||
269 | 285 | ||
270 | status = | 286 | default: |
271 | acpi_ex_convert_to_string(operand1, &local_operand1, | 287 | /* |
272 | ACPI_IMPLICIT_CONVERT_HEX); | 288 | * Just emit a string containing the object type. |
289 | */ | ||
290 | type_string = | ||
291 | acpi_ut_get_type_name(operand1->common.type); | ||
292 | |||
293 | local_operand1 = acpi_ut_create_string_object(((acpi_size) strlen(type_string) + 9)); /* 9 For "[Object]" */ | ||
294 | if (!local_operand1) { | ||
295 | status = AE_NO_MEMORY; | ||
296 | goto cleanup; | ||
297 | } | ||
298 | |||
299 | strcpy(local_operand1->string.pointer, "["); | ||
300 | strcat(local_operand1->string.pointer, type_string); | ||
301 | strcat(local_operand1->string.pointer, " Object]"); | ||
302 | status = AE_OK; | ||
303 | break; | ||
304 | } | ||
273 | break; | 305 | break; |
274 | 306 | ||
275 | case ACPI_TYPE_BUFFER: | 307 | case ACPI_TYPE_BUFFER: |
@@ -348,8 +380,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
348 | /* Concatenate the strings */ | 380 | /* Concatenate the strings */ |
349 | 381 | ||
350 | strcpy(new_buf, operand0->string.pointer); | 382 | strcpy(new_buf, operand0->string.pointer); |
351 | strcpy(new_buf + operand0->string.length, | 383 | strcat(new_buf, local_operand1->string.pointer); |
352 | local_operand1->string.pointer); | ||
353 | break; | 384 | break; |
354 | 385 | ||
355 | case ACPI_TYPE_BUFFER: | 386 | case ACPI_TYPE_BUFFER: |