diff options
author | Bob Moore <robert.moore@intel.com> | 2009-12-11 02:18:52 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-12-15 17:29:36 -0500 |
commit | ea7c5ec148044776d5e134e52a3e1aca8d662dbe (patch) | |
tree | f1f37cf9b22ea9e48c5b90f1842cfef5a9275111 /drivers/acpi/acpica/nsrepair.c | |
parent | d97659112044c0c77b93c6199eee7ee884eb3cca (diff) |
ACPICA: Move Package-to-Buffer repair code into common ToBuffer function
Move code specific to _FDE and _GTM into the generic repair code.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/acpica/nsrepair.c')
-rw-r--r-- | drivers/acpi/acpica/nsrepair.c | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/drivers/acpi/acpica/nsrepair.c b/drivers/acpi/acpica/nsrepair.c index 10629fa55d83..062a016d4554 100644 --- a/drivers/acpi/acpica/nsrepair.c +++ b/drivers/acpi/acpica/nsrepair.c | |||
@@ -350,7 +350,7 @@ acpi_ns_convert_to_string(union acpi_operand_object *original_object, | |||
350 | * | 350 | * |
351 | * RETURN: Status. AE_OK if conversion was successful. | 351 | * RETURN: Status. AE_OK if conversion was successful. |
352 | * | 352 | * |
353 | * DESCRIPTION: Attempt to convert a Integer/String object to a Buffer. | 353 | * DESCRIPTION: Attempt to convert a Integer/String/Package object to a Buffer. |
354 | * | 354 | * |
355 | ******************************************************************************/ | 355 | ******************************************************************************/ |
356 | 356 | ||
@@ -360,6 +360,10 @@ acpi_ns_convert_to_buffer(union acpi_operand_object *original_object, | |||
360 | { | 360 | { |
361 | union acpi_operand_object *new_object; | 361 | union acpi_operand_object *new_object; |
362 | acpi_status status; | 362 | acpi_status status; |
363 | union acpi_operand_object **elements; | ||
364 | u32 *dword_buffer; | ||
365 | u32 count; | ||
366 | u32 i; | ||
363 | 367 | ||
364 | switch (original_object->common.type) { | 368 | switch (original_object->common.type) { |
365 | case ACPI_TYPE_INTEGER: | 369 | case ACPI_TYPE_INTEGER: |
@@ -393,6 +397,40 @@ acpi_ns_convert_to_buffer(union acpi_operand_object *original_object, | |||
393 | original_object->string.length); | 397 | original_object->string.length); |
394 | break; | 398 | break; |
395 | 399 | ||
400 | case ACPI_TYPE_PACKAGE: | ||
401 | |||
402 | /* All elements of the Package must be integers */ | ||
403 | |||
404 | elements = original_object->package.elements; | ||
405 | count = original_object->package.count; | ||
406 | |||
407 | for (i = 0; i < count; i++) { | ||
408 | if ((!*elements) || | ||
409 | ((*elements)->common.type != ACPI_TYPE_INTEGER)) { | ||
410 | return (AE_AML_OPERAND_TYPE); | ||
411 | } | ||
412 | elements++; | ||
413 | } | ||
414 | |||
415 | /* Create the new buffer object to replace the Package */ | ||
416 | |||
417 | new_object = acpi_ut_create_buffer_object(ACPI_MUL_4(count)); | ||
418 | if (!new_object) { | ||
419 | return (AE_NO_MEMORY); | ||
420 | } | ||
421 | |||
422 | /* Copy the package elements (integers) to the buffer as DWORDs */ | ||
423 | |||
424 | elements = original_object->package.elements; | ||
425 | dword_buffer = ACPI_CAST_PTR(u32, new_object->buffer.pointer); | ||
426 | |||
427 | for (i = 0; i < count; i++) { | ||
428 | *dword_buffer = (u32) (*elements)->integer.value; | ||
429 | dword_buffer++; | ||
430 | elements++; | ||
431 | } | ||
432 | break; | ||
433 | |||
396 | default: | 434 | default: |
397 | return (AE_AML_OPERAND_TYPE); | 435 | return (AE_AML_OPERAND_TYPE); |
398 | } | 436 | } |
@@ -441,7 +479,8 @@ acpi_ns_convert_to_package(union acpi_operand_object *original_object, | |||
441 | buffer = original_object->buffer.pointer; | 479 | buffer = original_object->buffer.pointer; |
442 | 480 | ||
443 | while (length--) { | 481 | while (length--) { |
444 | *elements = acpi_ut_create_integer_object(*buffer); | 482 | *elements = |
483 | acpi_ut_create_integer_object((u64) *buffer); | ||
445 | if (!*elements) { | 484 | if (!*elements) { |
446 | acpi_ut_remove_reference(new_object); | 485 | acpi_ut_remove_reference(new_object); |
447 | return (AE_NO_MEMORY); | 486 | return (AE_NO_MEMORY); |