aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2013-09-22 21:52:19 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-09-23 19:46:24 -0400
commit424deb3870580d9afbbb421edfbe30a02ef28056 (patch)
treea24681d8b81280ef20456b5737516d5e15aeaa72 /drivers/acpi/acpica
parentd2e7d079c7f21999e93802351c6ac7b31d266cce (diff)
ACPICA: Debugger: Add new command to display full namespace pathnames.
Paths command displays the full pathname and object type for the entire namespace. Alternative to the Namespace command. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Reviewed-by: Len Brown <len.brown@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/acdebug.h2
-rw-r--r--drivers/acpi/acpica/acnamesp.h6
-rw-r--r--drivers/acpi/acpica/nsdump.c134
3 files changed, 142 insertions, 0 deletions
diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h
index 30c2d6911386..27c36a5251b5 100644
--- a/drivers/acpi/acpica/acdebug.h
+++ b/drivers/acpi/acpica/acdebug.h
@@ -155,6 +155,8 @@ void acpi_db_set_scope(char *name);
155 155
156void acpi_db_dump_namespace(char *start_arg, char *depth_arg); 156void acpi_db_dump_namespace(char *start_arg, char *depth_arg);
157 157
158void acpi_db_dump_namespace_paths(void);
159
158void acpi_db_dump_namespace_by_owner(char *owner_arg, char *depth_arg); 160void acpi_db_dump_namespace_by_owner(char *owner_arg, char *depth_arg);
159 161
160acpi_status acpi_db_find_name_in_namespace(char *name_arg); 162acpi_status acpi_db_find_name_in_namespace(char *name_arg);
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h
index 40b04bd5579e..e6138ac4a160 100644
--- a/drivers/acpi/acpica/acnamesp.h
+++ b/drivers/acpi/acpica/acnamesp.h
@@ -213,6 +213,12 @@ acpi_ns_dump_objects(acpi_object_type type,
213 u8 display_type, 213 u8 display_type,
214 u32 max_depth, 214 u32 max_depth,
215 acpi_owner_id owner_id, acpi_handle start_handle); 215 acpi_owner_id owner_id, acpi_handle start_handle);
216
217void
218acpi_ns_dump_object_paths(acpi_object_type type,
219 u8 display_type,
220 u32 max_depth,
221 acpi_owner_id owner_id, acpi_handle start_handle);
216#endif /* ACPI_FUTURE_USAGE */ 222#endif /* ACPI_FUTURE_USAGE */
217 223
218/* 224/*
diff --git a/drivers/acpi/acpica/nsdump.c b/drivers/acpi/acpica/nsdump.c
index 7418c77fde8c..80633851cb2f 100644
--- a/drivers/acpi/acpica/nsdump.c
+++ b/drivers/acpi/acpica/nsdump.c
@@ -59,6 +59,17 @@ acpi_ns_dump_one_device(acpi_handle obj_handle,
59#endif 59#endif
60 60
61#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 61#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
62
63#ifdef ACPI_FUTURE_USAGE
64static acpi_status
65acpi_ns_dump_one_object_path(acpi_handle obj_handle,
66 u32 level, void *context, void **return_value);
67
68static acpi_status
69acpi_ns_get_max_depth(acpi_handle obj_handle,
70 u32 level, void *context, void **return_value);
71#endif /* ACPI_FUTURE_USAGE */
72
62/******************************************************************************* 73/*******************************************************************************
63 * 74 *
64 * FUNCTION: acpi_ns_print_pathname 75 * FUNCTION: acpi_ns_print_pathname
@@ -671,6 +682,129 @@ acpi_ns_dump_objects(acpi_object_type type,
671} 682}
672#endif /* ACPI_FUTURE_USAGE */ 683#endif /* ACPI_FUTURE_USAGE */
673 684
685#ifdef ACPI_FUTURE_USAGE
686/*******************************************************************************
687 *
688 * FUNCTION: acpi_ns_dump_one_object_path, acpi_ns_get_max_depth
689 *
690 * PARAMETERS: obj_handle - Node to be dumped
691 * level - Nesting level of the handle
692 * context - Passed into walk_namespace
693 * return_value - Not used
694 *
695 * RETURN: Status
696 *
697 * DESCRIPTION: Dump the full pathname to a namespace object. acp_ns_get_max_depth
698 * computes the maximum nesting depth in the namespace tree, in
699 * order to simplify formatting in acpi_ns_dump_one_object_path.
700 * These procedures are user_functions called by acpi_ns_walk_namespace.
701 *
702 ******************************************************************************/
703
704static acpi_status
705acpi_ns_dump_one_object_path(acpi_handle obj_handle,
706 u32 level, void *context, void **return_value)
707{
708 u32 max_level = *((u32 *)context);
709 char *pathname;
710 struct acpi_namespace_node *node;
711 int path_indent;
712
713 if (!obj_handle) {
714 return (AE_OK);
715 }
716
717 node = acpi_ns_validate_handle(obj_handle);
718 pathname = acpi_ns_get_external_pathname(node);
719
720 path_indent = 1;
721 if (level <= max_level) {
722 path_indent = max_level - level + 1;
723 }
724
725 acpi_os_printf("%2d%*s%-12s%*s",
726 level, level, " ", acpi_ut_get_type_name(node->type),
727 path_indent, " ");
728
729 acpi_os_printf("%s\n", &pathname[1]);
730 ACPI_FREE(pathname);
731 return (AE_OK);
732}
733
734static acpi_status
735acpi_ns_get_max_depth(acpi_handle obj_handle,
736 u32 level, void *context, void **return_value)
737{
738 u32 *max_level = (u32 *)context;
739
740 if (level > *max_level) {
741 *max_level = level;
742 }
743 return (AE_OK);
744}
745
746/*******************************************************************************
747 *
748 * FUNCTION: acpi_ns_dump_object_paths
749 *
750 * PARAMETERS: type - Object type to be dumped
751 * display_type - 0 or ACPI_DISPLAY_SUMMARY
752 * max_depth - Maximum depth of dump. Use ACPI_UINT32_MAX
753 * for an effectively unlimited depth.
754 * owner_id - Dump only objects owned by this ID. Use
755 * ACPI_UINT32_MAX to match all owners.
756 * start_handle - Where in namespace to start/end search
757 *
758 * RETURN: None
759 *
760 * DESCRIPTION: Dump full object pathnames within the loaded namespace. Uses
761 * acpi_ns_walk_namespace in conjunction with acpi_ns_dump_one_object_path.
762 *
763 ******************************************************************************/
764
765void
766acpi_ns_dump_object_paths(acpi_object_type type,
767 u8 display_type,
768 u32 max_depth,
769 acpi_owner_id owner_id, acpi_handle start_handle)
770{
771 acpi_status status;
772 u32 max_level = 0;
773
774 ACPI_FUNCTION_ENTRY();
775
776 /*
777 * Just lock the entire namespace for the duration of the dump.
778 * We don't want any changes to the namespace during this time,
779 * especially the temporary nodes since we are going to display
780 * them also.
781 */
782 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
783 if (ACPI_FAILURE(status)) {
784 acpi_os_printf("Could not acquire namespace mutex\n");
785 return;
786 }
787
788 /* Get the max depth of the namespace tree, for formatting later */
789
790 (void)acpi_ns_walk_namespace(type, start_handle, max_depth,
791 ACPI_NS_WALK_NO_UNLOCK |
792 ACPI_NS_WALK_TEMP_NODES,
793 acpi_ns_get_max_depth, NULL,
794 (void *)&max_level, NULL);
795
796 /* Now dump the entire namespace */
797
798 (void)acpi_ns_walk_namespace(type, start_handle, max_depth,
799 ACPI_NS_WALK_NO_UNLOCK |
800 ACPI_NS_WALK_TEMP_NODES,
801 acpi_ns_dump_one_object_path, NULL,
802 (void *)&max_level, NULL);
803
804 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
805}
806#endif /* ACPI_FUTURE_USAGE */
807
674/******************************************************************************* 808/*******************************************************************************
675 * 809 *
676 * FUNCTION: acpi_ns_dump_entry 810 * FUNCTION: acpi_ns_dump_entry