diff options
Diffstat (limited to 'drivers/acpi/executer/exdump.c')
-rw-r--r-- | drivers/acpi/executer/exdump.c | 189 |
1 files changed, 159 insertions, 30 deletions
diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index 408500648114..4f98dceed39a 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c | |||
@@ -51,6 +51,11 @@ | |||
51 | #define _COMPONENT ACPI_EXECUTER | 51 | #define _COMPONENT ACPI_EXECUTER |
52 | ACPI_MODULE_NAME ("exdump") | 52 | ACPI_MODULE_NAME ("exdump") |
53 | 53 | ||
54 | /* | ||
55 | * The following routines are used for debug output only | ||
56 | */ | ||
57 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | ||
58 | |||
54 | /* Local prototypes */ | 59 | /* Local prototypes */ |
55 | 60 | ||
56 | #ifdef ACPI_FUTURE_USAGE | 61 | #ifdef ACPI_FUTURE_USAGE |
@@ -73,13 +78,17 @@ static void | |||
73 | acpi_ex_out_address ( | 78 | acpi_ex_out_address ( |
74 | char *title, | 79 | char *title, |
75 | acpi_physical_address value); | 80 | acpi_physical_address value); |
76 | #endif /* ACPI_FUTURE_USAGE */ | ||
77 | 81 | ||
82 | static void | ||
83 | acpi_ex_dump_reference ( | ||
84 | union acpi_operand_object *obj_desc); | ||
78 | 85 | ||
79 | /* | 86 | static void |
80 | * The following routines are used for debug output only | 87 | acpi_ex_dump_package ( |
81 | */ | 88 | union acpi_operand_object *obj_desc, |
82 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | 89 | u32 level, |
90 | u32 index); | ||
91 | #endif /* ACPI_FUTURE_USAGE */ | ||
83 | 92 | ||
84 | /******************************************************************************* | 93 | /******************************************************************************* |
85 | * | 94 | * |
@@ -118,7 +127,7 @@ acpi_ex_dump_operand ( | |||
118 | } | 127 | } |
119 | 128 | ||
120 | if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) { | 129 | if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) { |
121 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p is a NS Node: ", obj_desc)); | 130 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p Namespace Node: ", obj_desc)); |
122 | ACPI_DUMP_ENTRY (obj_desc, ACPI_LV_EXEC); | 131 | ACPI_DUMP_ENTRY (obj_desc, ACPI_LV_EXEC); |
123 | return; | 132 | return; |
124 | } | 133 | } |
@@ -467,7 +476,7 @@ acpi_ex_dump_operands ( | |||
467 | } | 476 | } |
468 | 477 | ||
469 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 478 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
470 | "************* Stack dump from %s(%d), %s\n", | 479 | "************* Operand Stack dump from %s(%d), %s\n", |
471 | module_name, line_number, note)); | 480 | module_name, line_number, note)); |
472 | return; | 481 | return; |
473 | } | 482 | } |
@@ -508,7 +517,7 @@ acpi_ex_out_integer ( | |||
508 | char *title, | 517 | char *title, |
509 | u32 value) | 518 | u32 value) |
510 | { | 519 | { |
511 | acpi_os_printf ("%20s : %X\n", title, value); | 520 | acpi_os_printf ("%20s : %.2X\n", title, value); |
512 | } | 521 | } |
513 | 522 | ||
514 | static void | 523 | static void |
@@ -565,9 +574,144 @@ acpi_ex_dump_node ( | |||
565 | 574 | ||
566 | /******************************************************************************* | 575 | /******************************************************************************* |
567 | * | 576 | * |
577 | * FUNCTION: acpi_ex_dump_reference | ||
578 | * | ||
579 | * PARAMETERS: Object - Descriptor to dump | ||
580 | * | ||
581 | * DESCRIPTION: Dumps a reference object | ||
582 | * | ||
583 | ******************************************************************************/ | ||
584 | |||
585 | static void | ||
586 | acpi_ex_dump_reference ( | ||
587 | union acpi_operand_object *obj_desc) | ||
588 | { | ||
589 | struct acpi_buffer ret_buf; | ||
590 | acpi_status status; | ||
591 | |||
592 | |||
593 | if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) { | ||
594 | acpi_os_printf ("Named Object %p ", obj_desc->reference.node); | ||
595 | ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER; | ||
596 | status = acpi_ns_handle_to_pathname (obj_desc->reference.node, &ret_buf); | ||
597 | if (ACPI_FAILURE (status)) { | ||
598 | acpi_os_printf ("Could not convert name to pathname\n"); | ||
599 | } | ||
600 | else { | ||
601 | acpi_os_printf ("%s\n", (char *) ret_buf.pointer); | ||
602 | ACPI_MEM_FREE (ret_buf.pointer); | ||
603 | } | ||
604 | } | ||
605 | else if (obj_desc->reference.object) { | ||
606 | acpi_os_printf ("\nReferenced Object: %p\n", obj_desc->reference.object); | ||
607 | } | ||
608 | } | ||
609 | |||
610 | |||
611 | /******************************************************************************* | ||
612 | * | ||
613 | * FUNCTION: acpi_ex_dump_package | ||
614 | * | ||
615 | * PARAMETERS: Object - Descriptor to dump | ||
616 | * Level - Indentation Level | ||
617 | * Index - Package index for this object | ||
618 | * | ||
619 | * DESCRIPTION: Dumps the elements of the package | ||
620 | * | ||
621 | ******************************************************************************/ | ||
622 | |||
623 | static void | ||
624 | acpi_ex_dump_package ( | ||
625 | union acpi_operand_object *obj_desc, | ||
626 | u32 level, | ||
627 | u32 index) | ||
628 | { | ||
629 | u32 i; | ||
630 | |||
631 | |||
632 | /* Indentation and index output */ | ||
633 | |||
634 | if (level > 0) { | ||
635 | for (i = 0; i < level; i++) { | ||
636 | acpi_os_printf (" "); | ||
637 | } | ||
638 | |||
639 | acpi_os_printf ("[%.2d] ", index); | ||
640 | } | ||
641 | |||
642 | acpi_os_printf ("%p ", obj_desc); | ||
643 | |||
644 | /* Null package elements are allowed */ | ||
645 | |||
646 | if (!obj_desc) { | ||
647 | acpi_os_printf ("[Null Object]\n"); | ||
648 | return; | ||
649 | } | ||
650 | |||
651 | /* Packages may only contain a few object types */ | ||
652 | |||
653 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | ||
654 | case ACPI_TYPE_INTEGER: | ||
655 | |||
656 | acpi_os_printf ("[Integer] = %8.8X%8.8X\n", | ||
657 | ACPI_FORMAT_UINT64 (obj_desc->integer.value)); | ||
658 | break; | ||
659 | |||
660 | |||
661 | case ACPI_TYPE_STRING: | ||
662 | |||
663 | acpi_os_printf ("[String] Value: "); | ||
664 | for (i = 0; i < obj_desc->string.length; i++) { | ||
665 | acpi_os_printf ("%c", obj_desc->string.pointer[i]); | ||
666 | } | ||
667 | acpi_os_printf ("\n"); | ||
668 | break; | ||
669 | |||
670 | |||
671 | case ACPI_TYPE_BUFFER: | ||
672 | |||
673 | acpi_os_printf ("[Buffer] Length %.2X = ", obj_desc->buffer.length); | ||
674 | if (obj_desc->buffer.length) { | ||
675 | acpi_ut_dump_buffer ((u8 *) obj_desc->buffer.pointer, | ||
676 | obj_desc->buffer.length, DB_DWORD_DISPLAY, _COMPONENT); | ||
677 | } | ||
678 | else { | ||
679 | acpi_os_printf ("\n"); | ||
680 | } | ||
681 | break; | ||
682 | |||
683 | |||
684 | case ACPI_TYPE_PACKAGE: | ||
685 | |||
686 | acpi_os_printf ("[Package] Contains %d Elements: \n", | ||
687 | obj_desc->package.count); | ||
688 | |||
689 | for (i = 0; i < obj_desc->package.count; i++) { | ||
690 | acpi_ex_dump_package (obj_desc->package.elements[i], level+1, i); | ||
691 | } | ||
692 | break; | ||
693 | |||
694 | |||
695 | case ACPI_TYPE_LOCAL_REFERENCE: | ||
696 | |||
697 | acpi_os_printf ("[Object Reference] "); | ||
698 | acpi_ex_dump_reference (obj_desc); | ||
699 | break; | ||
700 | |||
701 | |||
702 | default: | ||
703 | |||
704 | acpi_os_printf ("[Unknown Type] %X\n", ACPI_GET_OBJECT_TYPE (obj_desc)); | ||
705 | break; | ||
706 | } | ||
707 | } | ||
708 | |||
709 | |||
710 | /******************************************************************************* | ||
711 | * | ||
568 | * FUNCTION: acpi_ex_dump_object_descriptor | 712 | * FUNCTION: acpi_ex_dump_object_descriptor |
569 | * | 713 | * |
570 | * PARAMETERS: *Object - Descriptor to dump | 714 | * PARAMETERS: Object - Descriptor to dump |
571 | * Flags - Force display if TRUE | 715 | * Flags - Force display if TRUE |
572 | * | 716 | * |
573 | * DESCRIPTION: Dumps the members of the object descriptor given. | 717 | * DESCRIPTION: Dumps the members of the object descriptor given. |
@@ -579,9 +723,6 @@ acpi_ex_dump_object_descriptor ( | |||
579 | union acpi_operand_object *obj_desc, | 723 | union acpi_operand_object *obj_desc, |
580 | u32 flags) | 724 | u32 flags) |
581 | { | 725 | { |
582 | u32 i; | ||
583 | |||
584 | |||
585 | ACPI_FUNCTION_TRACE ("ex_dump_object_descriptor"); | 726 | ACPI_FUNCTION_TRACE ("ex_dump_object_descriptor"); |
586 | 727 | ||
587 | 728 | ||
@@ -648,22 +789,13 @@ acpi_ex_dump_object_descriptor ( | |||
648 | case ACPI_TYPE_PACKAGE: | 789 | case ACPI_TYPE_PACKAGE: |
649 | 790 | ||
650 | acpi_ex_out_integer ("Flags", obj_desc->package.flags); | 791 | acpi_ex_out_integer ("Flags", obj_desc->package.flags); |
651 | acpi_ex_out_integer ("Count", obj_desc->package.count); | 792 | acpi_ex_out_integer ("Elements", obj_desc->package.count); |
652 | acpi_ex_out_pointer ("Elements", obj_desc->package.elements); | 793 | acpi_ex_out_pointer ("Element List", obj_desc->package.elements); |
653 | 794 | ||
654 | /* Dump the package contents */ | 795 | /* Dump the package contents */ |
655 | 796 | ||
656 | if (obj_desc->package.count > 0) { | 797 | acpi_os_printf ("\nPackage Contents:\n"); |
657 | acpi_os_printf ("\nPackage Contents:\n"); | 798 | acpi_ex_dump_package (obj_desc, 0, 0); |
658 | for (i = 0; i < obj_desc->package.count; i++) { | ||
659 | acpi_os_printf ("[%.3d] %p", i, obj_desc->package.elements[i]); | ||
660 | if (obj_desc->package.elements[i]) { | ||
661 | acpi_os_printf (" %s", | ||
662 | acpi_ut_get_object_type_name (obj_desc->package.elements[i])); | ||
663 | } | ||
664 | acpi_os_printf ("\n"); | ||
665 | } | ||
666 | } | ||
667 | break; | 799 | break; |
668 | 800 | ||
669 | 801 | ||
@@ -686,7 +818,7 @@ acpi_ex_dump_object_descriptor ( | |||
686 | acpi_ex_out_integer ("param_count", obj_desc->method.param_count); | 818 | acpi_ex_out_integer ("param_count", obj_desc->method.param_count); |
687 | acpi_ex_out_integer ("Concurrency", obj_desc->method.concurrency); | 819 | acpi_ex_out_integer ("Concurrency", obj_desc->method.concurrency); |
688 | acpi_ex_out_pointer ("Semaphore", obj_desc->method.semaphore); | 820 | acpi_ex_out_pointer ("Semaphore", obj_desc->method.semaphore); |
689 | acpi_ex_out_integer ("owning_id", obj_desc->method.owning_id); | 821 | acpi_ex_out_integer ("owner_id", obj_desc->method.owner_id); |
690 | acpi_ex_out_integer ("aml_length", obj_desc->method.aml_length); | 822 | acpi_ex_out_integer ("aml_length", obj_desc->method.aml_length); |
691 | acpi_ex_out_pointer ("aml_start", obj_desc->method.aml_start); | 823 | acpi_ex_out_pointer ("aml_start", obj_desc->method.aml_start); |
692 | break; | 824 | break; |
@@ -790,10 +922,7 @@ acpi_ex_dump_object_descriptor ( | |||
790 | acpi_ex_out_pointer ("Node", obj_desc->reference.node); | 922 | acpi_ex_out_pointer ("Node", obj_desc->reference.node); |
791 | acpi_ex_out_pointer ("Where", obj_desc->reference.where); | 923 | acpi_ex_out_pointer ("Where", obj_desc->reference.where); |
792 | 924 | ||
793 | if (obj_desc->reference.object) { | 925 | acpi_ex_dump_reference (obj_desc); |
794 | acpi_os_printf ("\nReferenced Object:\n"); | ||
795 | acpi_ex_dump_object_descriptor (obj_desc->reference.object, flags); | ||
796 | } | ||
797 | break; | 926 | break; |
798 | 927 | ||
799 | 928 | ||