xref: /openbmc/linux/drivers/acpi/acpica/nsdumpdv.c (revision 6c33a6f4)
1 // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
2 /******************************************************************************
3  *
4  * Module Name: nsdump - table dumping routines for debug
5  *
6  * Copyright (C) 2000 - 2020, Intel Corp.
7  *
8  *****************************************************************************/
9 
10 #include <acpi/acpi.h>
11 
12 /* TBD: This entire module is apparently obsolete and should be removed */
13 
14 #define _COMPONENT          ACPI_NAMESPACE
15 ACPI_MODULE_NAME("nsdumpdv")
16 #ifdef ACPI_OBSOLETE_FUNCTIONS
17 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
18 #include "acnamesp.h"
19 /*******************************************************************************
20  *
21  * FUNCTION:    acpi_ns_dump_one_device
22  *
23  * PARAMETERS:  handle              - Node to be dumped
24  *              level               - Nesting level of the handle
25  *              context             - Passed into walk_namespace
26  *              return_value        - Not used
27  *
28  * RETURN:      Status
29  *
30  * DESCRIPTION: Dump a single Node that represents a device
31  *              This procedure is a user_function called by acpi_ns_walk_namespace.
32  *
33  ******************************************************************************/
34 static acpi_status
35 acpi_ns_dump_one_device(acpi_handle obj_handle,
36 			u32 level, void *context, void **return_value)
37 {
38 	struct acpi_buffer buffer;
39 	struct acpi_device_info *info;
40 	acpi_status status;
41 	u32 i;
42 
43 	ACPI_FUNCTION_NAME(ns_dump_one_device);
44 
45 	status =
46 	    acpi_ns_dump_one_object(obj_handle, level, context, return_value);
47 
48 	buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
49 	status = acpi_get_object_info(obj_handle, &buffer);
50 	if (ACPI_SUCCESS(status)) {
51 		info = buffer.pointer;
52 		for (i = 0; i < level; i++) {
53 			ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES, " "));
54 		}
55 
56 		ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES,
57 				      "    HID: %s, ADR: %8.8X%8.8X\n",
58 				      info->hardware_id.value,
59 				      ACPI_FORMAT_UINT64(info->address)));
60 		ACPI_FREE(info);
61 	}
62 
63 	return (status);
64 }
65 
66 /*******************************************************************************
67  *
68  * FUNCTION:    acpi_ns_dump_root_devices
69  *
70  * PARAMETERS:  None
71  *
72  * RETURN:      None
73  *
74  * DESCRIPTION: Dump all objects of type "device"
75  *
76  ******************************************************************************/
77 
78 void acpi_ns_dump_root_devices(void)
79 {
80 	acpi_handle sys_bus_handle;
81 	acpi_status status;
82 
83 	ACPI_FUNCTION_NAME(ns_dump_root_devices);
84 
85 	/* Only dump the table if tracing is enabled */
86 
87 	if (!(ACPI_LV_TABLES & acpi_dbg_level)) {
88 		return;
89 	}
90 
91 	status = acpi_get_handle(NULL, METHOD_NAME__SB_, &sys_bus_handle);
92 	if (ACPI_FAILURE(status)) {
93 		return;
94 	}
95 
96 	ACPI_DEBUG_PRINT((ACPI_DB_TABLES,
97 			  "Display of all devices in the namespace:\n"));
98 
99 	status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, sys_bus_handle,
100 					ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
101 					acpi_ns_dump_one_device, NULL, NULL,
102 					NULL);
103 }
104 
105 #endif
106 #endif
107