Commit cd0b2248241f4146152fb04a6bf4bccb6ce0478a
Committed by
Len Brown
1 parent
7a5bb99645
Exists in
master
and in
7 other branches
ACPICA: Fixes for external Reference Objects
All Reference Objects returned via the AcpiEvaluteObject interface are now marked as type "REFERENCE" instead of "ANY". The type ANY is now reservered for NULL objects - either NULL package elements or unresolved named references. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Showing 3 changed files with 26 additions and 11 deletions Side-by-side Diff
drivers/acpi/scan.c
... | ... | @@ -677,9 +677,8 @@ |
677 | 677 | device->wakeup.resources.count = package->package.count - 2; |
678 | 678 | for (i = 0; i < device->wakeup.resources.count; i++) { |
679 | 679 | element = &(package->package.elements[i + 2]); |
680 | - if (element->type != ACPI_TYPE_ANY) { | |
680 | + if (element->type != ACPI_TYPE_LOCAL_REFERENCE) | |
681 | 681 | return AE_BAD_DATA; |
682 | - } | |
683 | 682 | |
684 | 683 | device->wakeup.resources.handles[i] = element->reference.handle; |
685 | 684 | } |
drivers/acpi/utilities/utcopy.c
... | ... | @@ -43,7 +43,9 @@ |
43 | 43 | |
44 | 44 | #include <acpi/acpi.h> |
45 | 45 | #include <acpi/amlcode.h> |
46 | +#include <acpi/acnamesp.h> | |
46 | 47 | |
48 | + | |
47 | 49 | #define _COMPONENT ACPI_UTILITIES |
48 | 50 | ACPI_MODULE_NAME("utcopy") |
49 | 51 | |
50 | 52 | |
51 | 53 | |
... | ... | @@ -172,22 +174,21 @@ |
172 | 174 | |
173 | 175 | case ACPI_TYPE_LOCAL_REFERENCE: |
174 | 176 | |
175 | - /* | |
176 | - * This is an object reference. Attempt to dereference it. | |
177 | - */ | |
177 | + /* This is an object reference. */ | |
178 | + | |
178 | 179 | switch (internal_object->reference.opcode) { |
179 | 180 | case AML_INT_NAMEPATH_OP: |
180 | 181 | |
181 | 182 | /* For namepath, return the object handle ("reference") */ |
182 | 183 | |
183 | 184 | default: |
184 | - /* | |
185 | - * Use the object type of "Any" to indicate a reference | |
186 | - * to object containing a handle to an ACPI named object. | |
187 | - */ | |
188 | - external_object->type = ACPI_TYPE_ANY; | |
185 | + | |
186 | + /* We are referring to the namespace node */ | |
187 | + | |
189 | 188 | external_object->reference.handle = |
190 | 189 | internal_object->reference.node; |
190 | + external_object->reference.actual_type = | |
191 | + acpi_ns_get_type(internal_object->reference.node); | |
191 | 192 | break; |
192 | 193 | } |
193 | 194 | break; |
... | ... | @@ -460,6 +461,7 @@ |
460 | 461 | case ACPI_TYPE_STRING: |
461 | 462 | case ACPI_TYPE_BUFFER: |
462 | 463 | case ACPI_TYPE_INTEGER: |
464 | + case ACPI_TYPE_LOCAL_REFERENCE: | |
463 | 465 | |
464 | 466 | internal_object = acpi_ut_create_internal_object((u8) |
465 | 467 | external_object-> |
... | ... | @@ -469,6 +471,11 @@ |
469 | 471 | } |
470 | 472 | break; |
471 | 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 | + | |
472 | 479 | default: |
473 | 480 | /* All other types are not supported */ |
474 | 481 | |
... | ... | @@ -520,6 +527,15 @@ |
520 | 527 | case ACPI_TYPE_INTEGER: |
521 | 528 | |
522 | 529 | internal_object->integer.value = external_object->integer.value; |
530 | + break; | |
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; | |
523 | 539 | break; |
524 | 540 | |
525 | 541 | default: |
drivers/acpi/utils.c
... | ... | @@ -398,7 +398,7 @@ |
398 | 398 | |
399 | 399 | element = &(package->package.elements[i]); |
400 | 400 | |
401 | - if (element->type != ACPI_TYPE_ANY) { | |
401 | + if (element->type != ACPI_TYPE_LOCAL_REFERENCE) { | |
402 | 402 | status = AE_BAD_DATA; |
403 | 403 | printk(KERN_ERR PREFIX |
404 | 404 | "Expecting a [Reference] package element, found type %X\n", |