aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities/utcopy.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/utilities/utcopy.c')
-rw-r--r--drivers/acpi/utilities/utcopy.c61
1 files changed, 51 insertions, 10 deletions
diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c
index 879eaa10d3ae..655c290aca7b 100644
--- a/drivers/acpi/utilities/utcopy.c
+++ b/drivers/acpi/utilities/utcopy.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2007, R. Byron Moore 8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -43,6 +43,8 @@
43 43
44#include <acpi/acpi.h> 44#include <acpi/acpi.h>
45#include <acpi/amlcode.h> 45#include <acpi/amlcode.h>
46#include <acpi/acnamesp.h>
47
46 48
47#define _COMPONENT ACPI_UTILITIES 49#define _COMPONENT ACPI_UTILITIES
48ACPI_MODULE_NAME("utcopy") 50ACPI_MODULE_NAME("utcopy")
@@ -172,22 +174,21 @@ acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object,
172 174
173 case ACPI_TYPE_LOCAL_REFERENCE: 175 case ACPI_TYPE_LOCAL_REFERENCE:
174 176
175 /* 177 /* This is an object reference. */
176 * This is an object reference. Attempt to dereference it. 178
177 */
178 switch (internal_object->reference.opcode) { 179 switch (internal_object->reference.opcode) {
179 case AML_INT_NAMEPATH_OP: 180 case AML_INT_NAMEPATH_OP:
180 181
181 /* For namepath, return the object handle ("reference") */ 182 /* For namepath, return the object handle ("reference") */
182 183
183 default: 184 default:
184 /* 185
185 * Use the object type of "Any" to indicate a reference 186 /* We are referring to the namespace node */
186 * to object containing a handle to an ACPI named object. 187
187 */
188 external_object->type = ACPI_TYPE_ANY;
189 external_object->reference.handle = 188 external_object->reference.handle =
190 internal_object->reference.node; 189 internal_object->reference.node;
190 external_object->reference.actual_type =
191 acpi_ns_get_type(internal_object->reference.node);
191 break; 192 break;
192 } 193 }
193 break; 194 break;
@@ -215,6 +216,11 @@ acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object,
215 /* 216 /*
216 * There is no corresponding external object type 217 * There is no corresponding external object type
217 */ 218 */
219 ACPI_ERROR((AE_INFO,
220 "Unsupported object type, cannot convert to external object: %s",
221 acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE
222 (internal_object))));
223
218 return_ACPI_STATUS(AE_SUPPORT); 224 return_ACPI_STATUS(AE_SUPPORT);
219 } 225 }
220 226
@@ -455,6 +461,7 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object,
455 case ACPI_TYPE_STRING: 461 case ACPI_TYPE_STRING:
456 case ACPI_TYPE_BUFFER: 462 case ACPI_TYPE_BUFFER:
457 case ACPI_TYPE_INTEGER: 463 case ACPI_TYPE_INTEGER:
464 case ACPI_TYPE_LOCAL_REFERENCE:
458 465
459 internal_object = acpi_ut_create_internal_object((u8) 466 internal_object = acpi_ut_create_internal_object((u8)
460 external_object-> 467 external_object->
@@ -464,9 +471,18 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object,
464 } 471 }
465 break; 472 break;
466 473
474 case ACPI_TYPE_ANY: /* This is the case for a NULL object */
475
476 *ret_internal_object = NULL;
477 return_ACPI_STATUS(AE_OK);
478
467 default: 479 default:
468 /* All other types are not supported */ 480 /* All other types are not supported */
469 481
482 ACPI_ERROR((AE_INFO,
483 "Unsupported object type, cannot convert to internal object: %s",
484 acpi_ut_get_type_name(external_object->type)));
485
470 return_ACPI_STATUS(AE_SUPPORT); 486 return_ACPI_STATUS(AE_SUPPORT);
471 } 487 }
472 488
@@ -502,6 +518,10 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object,
502 external_object->buffer.length); 518 external_object->buffer.length);
503 519
504 internal_object->buffer.length = external_object->buffer.length; 520 internal_object->buffer.length = external_object->buffer.length;
521
522 /* Mark buffer data valid */
523
524 internal_object->buffer.flags |= AOPOBJ_DATA_VALID;
505 break; 525 break;
506 526
507 case ACPI_TYPE_INTEGER: 527 case ACPI_TYPE_INTEGER:
@@ -509,6 +529,15 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object,
509 internal_object->integer.value = external_object->integer.value; 529 internal_object->integer.value = external_object->integer.value;
510 break; 530 break;
511 531
532 case ACPI_TYPE_LOCAL_REFERENCE:
533
534 /* TBD: should validate incoming handle */
535
536 internal_object->reference.opcode = AML_INT_NAMEPATH_OP;
537 internal_object->reference.node =
538 external_object->reference.handle;
539 break;
540
512 default: 541 default:
513 /* Other types can't get here */ 542 /* Other types can't get here */
514 break; 543 break;
@@ -570,13 +599,17 @@ acpi_ut_copy_epackage_to_ipackage(union acpi_object *external_object,
570 599
571 /* Truncate package and delete it */ 600 /* Truncate package and delete it */
572 601
573 package_object->package.count = i; 602 package_object->package.count = (u32) i;
574 package_elements[i] = NULL; 603 package_elements[i] = NULL;
575 acpi_ut_remove_reference(package_object); 604 acpi_ut_remove_reference(package_object);
576 return_ACPI_STATUS(status); 605 return_ACPI_STATUS(status);
577 } 606 }
578 } 607 }
579 608
609 /* Mark package data valid */
610
611 package_object->package.flags |= AOPOBJ_DATA_VALID;
612
580 *internal_object = package_object; 613 *internal_object = package_object;
581 return_ACPI_STATUS(status); 614 return_ACPI_STATUS(status);
582} 615}
@@ -709,7 +742,15 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
709 /* 742 /*
710 * We copied the reference object, so we now must add a reference 743 * We copied the reference object, so we now must add a reference
711 * to the object pointed to by the reference 744 * to the object pointed to by the reference
745 *
746 * DDBHandle reference (from Load/load_table is a special reference,
747 * it's Reference.Object is the table index, so does not need to
748 * increase the reference count
712 */ 749 */
750 if (source_desc->reference.opcode == AML_LOAD_OP) {
751 break;
752 }
753
713 acpi_ut_add_reference(source_desc->reference.object); 754 acpi_ut_add_reference(source_desc->reference.object);
714 break; 755 break;
715 756