Erik Schmauss | 9585763 | 2018-03-14 16:13:07 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | /****************************************************************************** |
| 3 | * |
| 4 | * Module Name: nsdump - table dumping routines for debug |
| 5 | * |
Bob Moore | 840c02c | 2019-01-14 09:55:25 -0800 | [diff] [blame^] | 6 | * Copyright (C) 2000 - 2019, Intel Corp. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * |
Erik Schmauss | 9585763 | 2018-03-14 16:13:07 -0700 | [diff] [blame] | 8 | *****************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | #include <acpi/acpi.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 12 | /* TBD: This entire module is apparently obsolete and should be removed */ |
| 13 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | #define _COMPONENT ACPI_NAMESPACE |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 15 | ACPI_MODULE_NAME("nsdumpdv") |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 16 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) |
Len Brown | e2f7a77 | 2009-01-09 00:30:03 -0500 | [diff] [blame] | 18 | #include "acnamesp.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | /******************************************************************************* |
| 20 | * |
| 21 | * FUNCTION: acpi_ns_dump_one_device |
| 22 | * |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 23 | * PARAMETERS: handle - Node to be dumped |
| 24 | * level - Nesting level of the handle |
| 25 | * context - Passed into walk_namespace |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 26 | * return_value - Not used |
| 27 | * |
| 28 | * RETURN: Status |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | ******************************************************************************/ |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 34 | static acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 35 | acpi_ns_dump_one_device(acpi_handle obj_handle, |
| 36 | u32 level, void *context, void **return_value) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | { |
Lv Zheng | 98f7eb8 | 2013-10-31 09:30:10 +0800 | [diff] [blame] | 38 | struct acpi_buffer buffer; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 39 | struct acpi_device_info *info; |
| 40 | acpi_status status; |
| 41 | u32 i; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 43 | ACPI_FUNCTION_NAME(ns_dump_one_device); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 45 | status = |
| 46 | acpi_ns_dump_one_object(obj_handle, level, context, return_value); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | |
Lv Zheng | 98f7eb8 | 2013-10-31 09:30:10 +0800 | [diff] [blame] | 48 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; |
| 49 | status = acpi_get_object_info(obj_handle, &buffer); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 50 | if (ACPI_SUCCESS(status)) { |
Lv Zheng | 98f7eb8 | 2013-10-31 09:30:10 +0800 | [diff] [blame] | 51 | info = buffer.pointer; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | for (i = 0; i < level; i++) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 53 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES, " ")); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | } |
| 55 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 56 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES, |
Hans de Goede | e7c2c3c | 2018-03-14 16:13:03 -0700 | [diff] [blame] | 57 | " HID: %s, ADR: %8.8X%8.8X\n", |
Lv Zheng | 98f7eb8 | 2013-10-31 09:30:10 +0800 | [diff] [blame] | 58 | info->hardware_id.value, |
Hans de Goede | e7c2c3c | 2018-03-14 16:13:03 -0700 | [diff] [blame] | 59 | ACPI_FORMAT_UINT64(info->address))); |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 60 | ACPI_FREE(info); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | } |
| 62 | |
| 63 | return (status); |
| 64 | } |
| 65 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | /******************************************************************************* |
| 67 | * |
| 68 | * FUNCTION: acpi_ns_dump_root_devices |
| 69 | * |
| 70 | * PARAMETERS: None |
| 71 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 72 | * RETURN: None |
| 73 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | * DESCRIPTION: Dump all objects of type "device" |
| 75 | * |
| 76 | ******************************************************************************/ |
| 77 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 78 | void acpi_ns_dump_root_devices(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 80 | acpi_handle sys_bus_handle; |
| 81 | acpi_status status; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 83 | ACPI_FUNCTION_NAME(ns_dump_root_devices); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | |
| 85 | /* Only dump the table if tracing is enabled */ |
| 86 | |
| 87 | if (!(ACPI_LV_TABLES & acpi_dbg_level)) { |
| 88 | return; |
| 89 | } |
| 90 | |
Bob Moore | 4efeeec | 2012-03-21 09:42:45 +0800 | [diff] [blame] | 91 | status = acpi_get_handle(NULL, METHOD_NAME__SB_, &sys_bus_handle); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 92 | if (ACPI_FAILURE(status)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | return; |
| 94 | } |
| 95 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 96 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, |
| 97 | "Display of all devices in the namespace:\n")); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 99 | status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, sys_bus_handle, |
| 100 | ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, |
Lin Ming | 2263576 | 2009-11-13 10:06:08 +0800 | [diff] [blame] | 101 | acpi_ns_dump_one_device, NULL, NULL, |
| 102 | NULL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | } |
| 104 | |
| 105 | #endif |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 106 | #endif |