blob: 73e5c83c8c9f8706400b828a7493345a33ffdbba [file] [log] [blame]
Erik Schmauss95857632018-03-14 16:13:07 -07001// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/******************************************************************************
3 *
4 * Module Name: nsdump - table dumping routines for debug
5 *
Bob Moore840c02c2019-01-14 09:55:25 -08006 * Copyright (C) 2000 - 2019, Intel Corp.
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 *
Erik Schmauss95857632018-03-14 16:13:07 -07008 *****************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -07009
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <acpi/acpi.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011
Robert Moore44f6c012005-04-18 22:49:35 -040012/* TBD: This entire module is apparently obsolete and should be removed */
13
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#define _COMPONENT ACPI_NAMESPACE
Len Brown4be44fc2005-08-05 00:44:28 -040015ACPI_MODULE_NAME("nsdumpdv")
Robert Moore44f6c012005-04-18 22:49:35 -040016#ifdef ACPI_OBSOLETE_FUNCTIONS
Linus Torvalds1da177e2005-04-16 15:20:36 -070017#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
Len Browne2f7a772009-01-09 00:30:03 -050018#include "acnamesp.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070019/*******************************************************************************
20 *
21 * FUNCTION: acpi_ns_dump_one_device
22 *
Bob Mooreba494be2012-07-12 09:40:10 +080023 * PARAMETERS: handle - Node to be dumped
24 * level - Nesting level of the handle
25 * context - Passed into walk_namespace
Robert Moore44f6c012005-04-18 22:49:35 -040026 * return_value - Not used
27 *
28 * RETURN: Status
Linus Torvalds1da177e2005-04-16 15:20:36 -070029 *
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 ******************************************************************************/
Robert Moore44f6c012005-04-18 22:49:35 -040034static acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -040035acpi_ns_dump_one_device(acpi_handle obj_handle,
36 u32 level, void *context, void **return_value)
Linus Torvalds1da177e2005-04-16 15:20:36 -070037{
Lv Zheng98f7eb82013-10-31 09:30:10 +080038 struct acpi_buffer buffer;
Len Brown4be44fc2005-08-05 00:44:28 -040039 struct acpi_device_info *info;
40 acpi_status status;
41 u32 i;
Linus Torvalds1da177e2005-04-16 15:20:36 -070042
Bob Mooreb229cf92006-04-21 17:15:00 -040043 ACPI_FUNCTION_NAME(ns_dump_one_device);
Linus Torvalds1da177e2005-04-16 15:20:36 -070044
Len Brown4be44fc2005-08-05 00:44:28 -040045 status =
46 acpi_ns_dump_one_object(obj_handle, level, context, return_value);
Linus Torvalds1da177e2005-04-16 15:20:36 -070047
Lv Zheng98f7eb82013-10-31 09:30:10 +080048 buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
49 status = acpi_get_object_info(obj_handle, &buffer);
Len Brown4be44fc2005-08-05 00:44:28 -040050 if (ACPI_SUCCESS(status)) {
Lv Zheng98f7eb82013-10-31 09:30:10 +080051 info = buffer.pointer;
Linus Torvalds1da177e2005-04-16 15:20:36 -070052 for (i = 0; i < level; i++) {
Len Brown4be44fc2005-08-05 00:44:28 -040053 ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES, " "));
Linus Torvalds1da177e2005-04-16 15:20:36 -070054 }
55
Len Brown4be44fc2005-08-05 00:44:28 -040056 ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES,
Hans de Goedee7c2c3c2018-03-14 16:13:03 -070057 " HID: %s, ADR: %8.8X%8.8X\n",
Lv Zheng98f7eb82013-10-31 09:30:10 +080058 info->hardware_id.value,
Hans de Goedee7c2c3c2018-03-14 16:13:03 -070059 ACPI_FORMAT_UINT64(info->address)));
Bob Moore83135242006-10-03 00:00:00 -040060 ACPI_FREE(info);
Linus Torvalds1da177e2005-04-16 15:20:36 -070061 }
62
63 return (status);
64}
65
Linus Torvalds1da177e2005-04-16 15:20:36 -070066/*******************************************************************************
67 *
68 * FUNCTION: acpi_ns_dump_root_devices
69 *
70 * PARAMETERS: None
71 *
Robert Moore44f6c012005-04-18 22:49:35 -040072 * RETURN: None
73 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070074 * DESCRIPTION: Dump all objects of type "device"
75 *
76 ******************************************************************************/
77
Len Brown4be44fc2005-08-05 00:44:28 -040078void acpi_ns_dump_root_devices(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070079{
Len Brown4be44fc2005-08-05 00:44:28 -040080 acpi_handle sys_bus_handle;
81 acpi_status status;
Linus Torvalds1da177e2005-04-16 15:20:36 -070082
Bob Mooreb229cf92006-04-21 17:15:00 -040083 ACPI_FUNCTION_NAME(ns_dump_root_devices);
Linus Torvalds1da177e2005-04-16 15:20:36 -070084
85 /* Only dump the table if tracing is enabled */
86
87 if (!(ACPI_LV_TABLES & acpi_dbg_level)) {
88 return;
89 }
90
Bob Moore4efeeec2012-03-21 09:42:45 +080091 status = acpi_get_handle(NULL, METHOD_NAME__SB_, &sys_bus_handle);
Len Brown4be44fc2005-08-05 00:44:28 -040092 if (ACPI_FAILURE(status)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070093 return;
94 }
95
Len Brown4be44fc2005-08-05 00:44:28 -040096 ACPI_DEBUG_PRINT((ACPI_DB_TABLES,
97 "Display of all devices in the namespace:\n"));
Linus Torvalds1da177e2005-04-16 15:20:36 -070098
Len Brown4be44fc2005-08-05 00:44:28 -040099 status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, sys_bus_handle,
100 ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
Lin Ming22635762009-11-13 10:06:08 +0800101 acpi_ns_dump_one_device, NULL, NULL,
102 NULL);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103}
104
105#endif
Robert Moore44f6c012005-04-18 22:49:35 -0400106#endif