Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Module Name: nsdump - table dumping routines for debug |
| 4 | * |
| 5 | *****************************************************************************/ |
| 6 | |
| 7 | /* |
Bob Moore | 7784813 | 2012-01-12 13:27:23 +0800 | [diff] [blame] | 8 | * Copyright (C) 2000 - 2012, Intel Corp. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | * All rights reserved. |
| 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without |
| 12 | * modification, are permitted provided that the following conditions |
| 13 | * are met: |
| 14 | * 1. Redistributions of source code must retain the above copyright |
| 15 | * notice, this list of conditions, and the following disclaimer, |
| 16 | * without modification. |
| 17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer |
| 18 | * substantially similar to the "NO WARRANTY" disclaimer below |
| 19 | * ("Disclaimer") and any redistribution must be conditioned upon |
| 20 | * including a substantially similar Disclaimer requirement for further |
| 21 | * binary redistribution. |
| 22 | * 3. Neither the names of the above-listed copyright holders nor the names |
| 23 | * of any contributors may be used to endorse or promote products derived |
| 24 | * from this software without specific prior written permission. |
| 25 | * |
| 26 | * Alternatively, this software may be distributed under the terms of the |
| 27 | * GNU General Public License ("GPL") version 2 as published by the Free |
| 28 | * Software Foundation. |
| 29 | * |
| 30 | * NO WARRANTY |
| 31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR |
| 34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 41 | * POSSIBILITY OF SUCH DAMAGES. |
| 42 | */ |
| 43 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | #include <acpi/acpi.h> |
Len Brown | e2f7a77 | 2009-01-09 00:30:03 -0500 | [diff] [blame] | 45 | #include "accommon.h" |
| 46 | #include "acnamesp.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | #define _COMPONENT ACPI_NAMESPACE |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 49 | ACPI_MODULE_NAME("nsdump") |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 51 | /* Local prototypes */ |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 52 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 53 | void acpi_ns_dump_root_devices(void); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 54 | |
| 55 | static acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 56 | acpi_ns_dump_one_device(acpi_handle obj_handle, |
| 57 | u32 level, void *context, void **return_value); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 58 | #endif |
| 59 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | /******************************************************************************* |
| 62 | * |
| 63 | * FUNCTION: acpi_ns_print_pathname |
| 64 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 65 | * PARAMETERS: num_segments - Number of ACPI name segments |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 66 | * pathname - The compressed (internal) path |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 68 | * RETURN: None |
| 69 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | * DESCRIPTION: Print an object's full namespace pathname |
| 71 | * |
| 72 | ******************************************************************************/ |
| 73 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 74 | void acpi_ns_print_pathname(u32 num_segments, char *pathname) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | { |
Bob Moore | 67a119f | 2008-06-10 13:42:13 +0800 | [diff] [blame] | 76 | u32 i; |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 77 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 78 | ACPI_FUNCTION_NAME(ns_print_pathname); |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 79 | |
Bob Moore | 10e9e75 | 2012-12-31 00:06:27 +0000 | [diff] [blame^] | 80 | /* Check if debug output enabled */ |
| 81 | |
| 82 | if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_NAMES, ACPI_NAMESPACE)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | return; |
| 84 | } |
| 85 | |
| 86 | /* Print the entire name */ |
| 87 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 88 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "[")); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | |
| 90 | while (num_segments) { |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 91 | for (i = 0; i < 4; i++) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 92 | ACPI_IS_PRINT(pathname[i]) ? |
| 93 | acpi_os_printf("%c", pathname[i]) : |
| 94 | acpi_os_printf("?"); |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 95 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 97 | pathname += ACPI_NAME_SIZE; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | num_segments--; |
| 99 | if (num_segments) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 100 | acpi_os_printf("."); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | } |
| 102 | } |
| 103 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 104 | acpi_os_printf("]\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | } |
| 106 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | /******************************************************************************* |
| 108 | * |
| 109 | * FUNCTION: acpi_ns_dump_pathname |
| 110 | * |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 111 | * PARAMETERS: handle - Object |
| 112 | * msg - Prefix message |
| 113 | * level - Desired debug level |
| 114 | * component - Caller's component ID |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 116 | * RETURN: None |
| 117 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | * DESCRIPTION: Print an object's full namespace pathname |
| 119 | * Manages allocation/freeing of a pathname buffer |
| 120 | * |
| 121 | ******************************************************************************/ |
| 122 | |
| 123 | void |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 124 | acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | { |
| 126 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 127 | ACPI_FUNCTION_TRACE(ns_dump_pathname); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 128 | |
| 129 | /* Do this only if the requested debug level and component are enabled */ |
| 130 | |
Bob Moore | 10e9e75 | 2012-12-31 00:06:27 +0000 | [diff] [blame^] | 131 | if (!ACPI_IS_DEBUG_ENABLED(level, component)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | return_VOID; |
| 133 | } |
| 134 | |
| 135 | /* Convert handle to a full pathname and print it (with supplied message) */ |
| 136 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 137 | acpi_ns_print_node_pathname(handle, msg); |
| 138 | acpi_os_printf("\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 139 | return_VOID; |
| 140 | } |
| 141 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 142 | /******************************************************************************* |
| 143 | * |
| 144 | * FUNCTION: acpi_ns_dump_one_object |
| 145 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 146 | * PARAMETERS: obj_handle - Node to be dumped |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 147 | * level - Nesting level of the handle |
| 148 | * context - Passed into walk_namespace |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 149 | * return_value - Not used |
| 150 | * |
| 151 | * RETURN: Status |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 152 | * |
| 153 | * DESCRIPTION: Dump a single Node |
| 154 | * This procedure is a user_function called by acpi_ns_walk_namespace. |
| 155 | * |
| 156 | ******************************************************************************/ |
| 157 | |
| 158 | acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 159 | acpi_ns_dump_one_object(acpi_handle obj_handle, |
| 160 | u32 level, void *context, void **return_value) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 161 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 162 | struct acpi_walk_info *info = (struct acpi_walk_info *)context; |
| 163 | struct acpi_namespace_node *this_node; |
| 164 | union acpi_operand_object *obj_desc = NULL; |
| 165 | acpi_object_type obj_type; |
| 166 | acpi_object_type type; |
| 167 | u32 bytes_to_dump; |
| 168 | u32 dbg_level; |
| 169 | u32 i; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 170 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 171 | ACPI_FUNCTION_NAME(ns_dump_one_object); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 172 | |
| 173 | /* Is output enabled? */ |
| 174 | |
| 175 | if (!(acpi_dbg_level & info->debug_level)) { |
| 176 | return (AE_OK); |
| 177 | } |
| 178 | |
| 179 | if (!obj_handle) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 180 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Null object handle\n")); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 181 | return (AE_OK); |
| 182 | } |
| 183 | |
Bob Moore | f24b664 | 2009-12-11 14:57:00 +0800 | [diff] [blame] | 184 | this_node = acpi_ns_validate_handle(obj_handle); |
Bob Moore | 4bbfb85 | 2009-02-03 14:17:29 +0800 | [diff] [blame] | 185 | if (!this_node) { |
| 186 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Invalid object handle %p\n", |
| 187 | obj_handle)); |
| 188 | return (AE_OK); |
| 189 | } |
| 190 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 191 | type = this_node->type; |
| 192 | |
| 193 | /* Check if the owner matches */ |
| 194 | |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 195 | if ((info->owner_id != ACPI_OWNER_ID_MAX) && |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 196 | (info->owner_id != this_node->owner_id)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 197 | return (AE_OK); |
| 198 | } |
| 199 | |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 200 | if (!(info->display_type & ACPI_DISPLAY_SHORT)) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 201 | |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 202 | /* Indent the object according to the level */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 203 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 204 | acpi_os_printf("%2d%*s", (u32) level - 1, (int)level * 2, " "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 205 | |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 206 | /* Check the node type and name */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 207 | |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 208 | if (type > ACPI_TYPE_LOCAL_MAX) { |
Bob Moore | f6a22b0 | 2010-03-05 17:56:40 +0800 | [diff] [blame] | 209 | ACPI_WARNING((AE_INFO, |
| 210 | "Invalid ACPI Object Type 0x%08X", type)); |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 211 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 213 | acpi_os_printf("%4.4s", acpi_ut_get_node_name(this_node)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 214 | } |
| 215 | |
Bob Moore | d4913dc | 2009-03-06 10:05:18 +0800 | [diff] [blame] | 216 | /* Now we can print out the pertinent information */ |
| 217 | |
Bob Moore | 28f55eb | 2005-12-02 18:27:00 -0500 | [diff] [blame] | 218 | acpi_os_printf(" %-12s %p %2.2X ", |
| 219 | acpi_ut_get_type_name(type), this_node, |
| 220 | this_node->owner_id); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 221 | |
| 222 | dbg_level = acpi_dbg_level; |
| 223 | acpi_dbg_level = 0; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 224 | obj_desc = acpi_ns_get_attached_object(this_node); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 225 | acpi_dbg_level = dbg_level; |
| 226 | |
Bob Moore | d1fdda83 | 2007-02-02 19:48:21 +0300 | [diff] [blame] | 227 | /* Temp nodes are those nodes created by a control method */ |
| 228 | |
| 229 | if (this_node->flags & ANOBJ_TEMPORARY) { |
| 230 | acpi_os_printf("(T) "); |
| 231 | } |
| 232 | |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 233 | switch (info->display_type & ACPI_DISPLAY_MASK) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 234 | case ACPI_DISPLAY_SUMMARY: |
| 235 | |
| 236 | if (!obj_desc) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 237 | |
Bob Moore | 4acb688 | 2012-03-21 09:46:47 +0800 | [diff] [blame] | 238 | /* No attached object. Some types should always have an object */ |
| 239 | |
| 240 | switch (type) { |
| 241 | case ACPI_TYPE_INTEGER: |
| 242 | case ACPI_TYPE_PACKAGE: |
| 243 | case ACPI_TYPE_BUFFER: |
| 244 | case ACPI_TYPE_STRING: |
| 245 | case ACPI_TYPE_METHOD: |
| 246 | acpi_os_printf("<No attached object>"); |
| 247 | break; |
| 248 | |
| 249 | default: |
| 250 | break; |
| 251 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 253 | acpi_os_printf("\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | return (AE_OK); |
| 255 | } |
| 256 | |
| 257 | switch (type) { |
| 258 | case ACPI_TYPE_PROCESSOR: |
| 259 | |
Bob Moore | 0b232fc | 2012-08-17 10:55:32 +0800 | [diff] [blame] | 260 | acpi_os_printf("ID %02X Len %02X Addr %p\n", |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 261 | obj_desc->processor.proc_id, |
| 262 | obj_desc->processor.length, |
Bob Moore | 1d18c05 | 2008-04-10 19:06:40 +0400 | [diff] [blame] | 263 | ACPI_CAST_PTR(void, |
| 264 | obj_desc->processor. |
| 265 | address)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 266 | break; |
| 267 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | case ACPI_TYPE_DEVICE: |
| 269 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 270 | acpi_os_printf("Notify Object: %p\n", obj_desc); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 271 | break; |
| 272 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 273 | case ACPI_TYPE_METHOD: |
| 274 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 275 | acpi_os_printf("Args %X Len %.4X Aml %p\n", |
| 276 | (u32) obj_desc->method.param_count, |
| 277 | obj_desc->method.aml_length, |
| 278 | obj_desc->method.aml_start); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 279 | break; |
| 280 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | case ACPI_TYPE_INTEGER: |
| 282 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 283 | acpi_os_printf("= %8.8X%8.8X\n", |
| 284 | ACPI_FORMAT_UINT64(obj_desc->integer. |
| 285 | value)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 286 | break; |
| 287 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 288 | case ACPI_TYPE_PACKAGE: |
| 289 | |
| 290 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 291 | acpi_os_printf("Elements %.2X\n", |
| 292 | obj_desc->package.count); |
| 293 | } else { |
| 294 | acpi_os_printf("[Length not yet evaluated]\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 295 | } |
| 296 | break; |
| 297 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 298 | case ACPI_TYPE_BUFFER: |
| 299 | |
| 300 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 301 | acpi_os_printf("Len %.2X", |
| 302 | obj_desc->buffer.length); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 303 | |
| 304 | /* Dump some of the buffer */ |
| 305 | |
| 306 | if (obj_desc->buffer.length > 0) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 307 | acpi_os_printf(" ="); |
| 308 | for (i = 0; |
| 309 | (i < obj_desc->buffer.length |
| 310 | && i < 12); i++) { |
| 311 | acpi_os_printf(" %.2hX", |
| 312 | obj_desc->buffer. |
| 313 | pointer[i]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | } |
| 315 | } |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 316 | acpi_os_printf("\n"); |
| 317 | } else { |
| 318 | acpi_os_printf("[Length not yet evaluated]\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 319 | } |
| 320 | break; |
| 321 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | case ACPI_TYPE_STRING: |
| 323 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 324 | acpi_os_printf("Len %.2X ", obj_desc->string.length); |
| 325 | acpi_ut_print_string(obj_desc->string.pointer, 32); |
| 326 | acpi_os_printf("\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 327 | break; |
| 328 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 329 | case ACPI_TYPE_REGION: |
| 330 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 331 | acpi_os_printf("[%s]", |
| 332 | acpi_ut_get_region_name(obj_desc->region. |
| 333 | space_id)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 335 | acpi_os_printf(" Addr %8.8X%8.8X Len %.4X\n", |
Bob Moore | 1d18c05 | 2008-04-10 19:06:40 +0400 | [diff] [blame] | 336 | ACPI_FORMAT_NATIVE_UINT |
| 337 | (obj_desc->region.address), |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 338 | obj_desc->region.length); |
| 339 | } else { |
| 340 | acpi_os_printf |
| 341 | (" [Address/Length not yet evaluated]\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 342 | } |
| 343 | break; |
| 344 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | case ACPI_TYPE_LOCAL_REFERENCE: |
| 346 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 347 | acpi_os_printf("[%s]\n", |
Bob Moore | 1044f1f | 2008-09-27 11:08:41 +0800 | [diff] [blame] | 348 | acpi_ut_get_reference_name(obj_desc)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 349 | break; |
| 350 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 351 | case ACPI_TYPE_BUFFER_FIELD: |
| 352 | |
| 353 | if (obj_desc->buffer_field.buffer_obj && |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 354 | obj_desc->buffer_field.buffer_obj->buffer.node) { |
| 355 | acpi_os_printf("Buf [%4.4s]", |
| 356 | acpi_ut_get_node_name(obj_desc-> |
| 357 | buffer_field. |
| 358 | buffer_obj-> |
| 359 | buffer. |
| 360 | node)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 361 | } |
| 362 | break; |
| 363 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 364 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
| 365 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 366 | acpi_os_printf("Rgn [%4.4s]", |
| 367 | acpi_ut_get_node_name(obj_desc-> |
| 368 | common_field. |
| 369 | region_obj->region. |
| 370 | node)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 371 | break; |
| 372 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 373 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
| 374 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 375 | acpi_os_printf("Rgn [%4.4s] Bnk [%4.4s]", |
| 376 | acpi_ut_get_node_name(obj_desc-> |
| 377 | common_field. |
| 378 | region_obj->region. |
| 379 | node), |
| 380 | acpi_ut_get_node_name(obj_desc-> |
| 381 | bank_field. |
| 382 | bank_obj-> |
| 383 | common_field. |
| 384 | node)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 385 | break; |
| 386 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 387 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
| 388 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 389 | acpi_os_printf("Idx [%4.4s] Dat [%4.4s]", |
| 390 | acpi_ut_get_node_name(obj_desc-> |
| 391 | index_field. |
| 392 | index_obj-> |
| 393 | common_field.node), |
| 394 | acpi_ut_get_node_name(obj_desc-> |
| 395 | index_field. |
| 396 | data_obj-> |
| 397 | common_field. |
| 398 | node)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 399 | break; |
| 400 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 401 | case ACPI_TYPE_LOCAL_ALIAS: |
| 402 | case ACPI_TYPE_LOCAL_METHOD_ALIAS: |
| 403 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 404 | acpi_os_printf("Target %4.4s (%p)\n", |
| 405 | acpi_ut_get_node_name(obj_desc), |
| 406 | obj_desc); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 407 | break; |
| 408 | |
| 409 | default: |
| 410 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 411 | acpi_os_printf("Object %p\n", obj_desc); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 412 | break; |
| 413 | } |
| 414 | |
| 415 | /* Common field handling */ |
| 416 | |
| 417 | switch (type) { |
| 418 | case ACPI_TYPE_BUFFER_FIELD: |
| 419 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
| 420 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
| 421 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
| 422 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 423 | acpi_os_printf(" Off %.3X Len %.2X Acc %.2hd\n", |
| 424 | (obj_desc->common_field. |
| 425 | base_byte_offset * 8) |
| 426 | + |
| 427 | obj_desc->common_field. |
| 428 | start_field_bit_offset, |
| 429 | obj_desc->common_field.bit_length, |
| 430 | obj_desc->common_field. |
| 431 | access_byte_width); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 432 | break; |
| 433 | |
| 434 | default: |
| 435 | break; |
| 436 | } |
| 437 | break; |
| 438 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 439 | case ACPI_DISPLAY_OBJECTS: |
| 440 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 441 | acpi_os_printf("O:%p", obj_desc); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 442 | if (!obj_desc) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 443 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 444 | /* No attached object, we are done */ |
| 445 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 446 | acpi_os_printf("\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 447 | return (AE_OK); |
| 448 | } |
| 449 | |
Bob Moore | b27d659 | 2010-05-26 11:47:13 +0800 | [diff] [blame] | 450 | acpi_os_printf("(R%u)", obj_desc->common.reference_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 451 | |
| 452 | switch (type) { |
| 453 | case ACPI_TYPE_METHOD: |
| 454 | |
| 455 | /* Name is a Method and its AML offset/length are set */ |
| 456 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 457 | acpi_os_printf(" M:%p-%X\n", obj_desc->method.aml_start, |
| 458 | obj_desc->method.aml_length); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 459 | break; |
| 460 | |
| 461 | case ACPI_TYPE_INTEGER: |
| 462 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 463 | acpi_os_printf(" I:%8.8X8.8%X\n", |
| 464 | ACPI_FORMAT_UINT64(obj_desc->integer. |
| 465 | value)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 466 | break; |
| 467 | |
| 468 | case ACPI_TYPE_STRING: |
| 469 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 470 | acpi_os_printf(" S:%p-%X\n", obj_desc->string.pointer, |
| 471 | obj_desc->string.length); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 472 | break; |
| 473 | |
| 474 | case ACPI_TYPE_BUFFER: |
| 475 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 476 | acpi_os_printf(" B:%p-%X\n", obj_desc->buffer.pointer, |
| 477 | obj_desc->buffer.length); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 478 | break; |
| 479 | |
| 480 | default: |
| 481 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 482 | acpi_os_printf("\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 483 | break; |
| 484 | } |
| 485 | break; |
| 486 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 487 | default: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 488 | acpi_os_printf("\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 489 | break; |
| 490 | } |
| 491 | |
| 492 | /* If debug turned off, done */ |
| 493 | |
| 494 | if (!(acpi_dbg_level & ACPI_LV_VALUES)) { |
| 495 | return (AE_OK); |
| 496 | } |
| 497 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 498 | /* If there is an attached object, display it */ |
| 499 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 500 | dbg_level = acpi_dbg_level; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 501 | acpi_dbg_level = 0; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 502 | obj_desc = acpi_ns_get_attached_object(this_node); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 503 | acpi_dbg_level = dbg_level; |
| 504 | |
| 505 | /* Dump attached objects */ |
| 506 | |
| 507 | while (obj_desc) { |
| 508 | obj_type = ACPI_TYPE_INVALID; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 509 | acpi_os_printf("Attached Object %p: ", obj_desc); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 510 | |
| 511 | /* Decode the type of attached object and dump the contents */ |
| 512 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 513 | switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 514 | case ACPI_DESC_TYPE_NAMED: |
| 515 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 516 | acpi_os_printf("(Ptr to Node)\n"); |
| 517 | bytes_to_dump = sizeof(struct acpi_namespace_node); |
| 518 | ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 519 | break; |
| 520 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 521 | case ACPI_DESC_TYPE_OPERAND: |
| 522 | |
Bob Moore | 3371c19 | 2009-02-18 14:44:03 +0800 | [diff] [blame] | 523 | obj_type = obj_desc->common.type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 524 | |
| 525 | if (obj_type > ACPI_TYPE_LOCAL_MAX) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 526 | acpi_os_printf |
Bob Moore | 71d993e | 2008-06-10 14:25:05 +0800 | [diff] [blame] | 527 | ("(Pointer to ACPI Object type %.2X [UNKNOWN])\n", |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 528 | obj_type); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 529 | bytes_to_dump = 32; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 530 | } else { |
| 531 | acpi_os_printf |
Bob Moore | 71d993e | 2008-06-10 14:25:05 +0800 | [diff] [blame] | 532 | ("(Pointer to ACPI Object type %.2X [%s])\n", |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 533 | obj_type, acpi_ut_get_type_name(obj_type)); |
| 534 | bytes_to_dump = |
| 535 | sizeof(union acpi_operand_object); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 536 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 537 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 538 | ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump); |
Robert Moore | 6f42ccf | 2005-05-13 00:00:00 -0400 | [diff] [blame] | 539 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 540 | |
| 541 | default: |
| 542 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 543 | break; |
| 544 | } |
| 545 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 546 | /* If value is NOT an internal object, we are done */ |
| 547 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 548 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != |
| 549 | ACPI_DESC_TYPE_OPERAND) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 550 | goto cleanup; |
| 551 | } |
| 552 | |
Bob Moore | d4913dc | 2009-03-06 10:05:18 +0800 | [diff] [blame] | 553 | /* Valid object, get the pointer to next level, if any */ |
| 554 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 555 | switch (obj_type) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 556 | case ACPI_TYPE_BUFFER: |
Robert Moore | 6f42ccf | 2005-05-13 00:00:00 -0400 | [diff] [blame] | 557 | case ACPI_TYPE_STRING: |
| 558 | /* |
| 559 | * NOTE: takes advantage of common fields between string/buffer |
| 560 | */ |
| 561 | bytes_to_dump = obj_desc->string.length; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 562 | obj_desc = (void *)obj_desc->string.pointer; |
| 563 | acpi_os_printf("(Buffer/String pointer %p length %X)\n", |
| 564 | obj_desc, bytes_to_dump); |
| 565 | ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump); |
Robert Moore | 6f42ccf | 2005-05-13 00:00:00 -0400 | [diff] [blame] | 566 | goto cleanup; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 567 | |
| 568 | case ACPI_TYPE_BUFFER_FIELD: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 569 | obj_desc = |
| 570 | (union acpi_operand_object *)obj_desc->buffer_field. |
| 571 | buffer_obj; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 572 | break; |
| 573 | |
| 574 | case ACPI_TYPE_PACKAGE: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 575 | obj_desc = (void *)obj_desc->package.elements; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 576 | break; |
| 577 | |
| 578 | case ACPI_TYPE_METHOD: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 579 | obj_desc = (void *)obj_desc->method.aml_start; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 580 | break; |
| 581 | |
| 582 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 583 | obj_desc = (void *)obj_desc->field.region_obj; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 584 | break; |
| 585 | |
| 586 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 587 | obj_desc = (void *)obj_desc->bank_field.region_obj; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 588 | break; |
| 589 | |
| 590 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 591 | obj_desc = (void *)obj_desc->index_field.index_obj; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 592 | break; |
| 593 | |
| 594 | default: |
| 595 | goto cleanup; |
| 596 | } |
| 597 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 598 | obj_type = ACPI_TYPE_INVALID; /* Terminate loop after next pass */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 599 | } |
| 600 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 601 | cleanup: |
| 602 | acpi_os_printf("\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 603 | return (AE_OK); |
| 604 | } |
| 605 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 606 | #ifdef ACPI_FUTURE_USAGE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 607 | /******************************************************************************* |
| 608 | * |
| 609 | * FUNCTION: acpi_ns_dump_objects |
| 610 | * |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 611 | * PARAMETERS: type - Object type to be dumped |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 612 | * display_type - 0 or ACPI_DISPLAY_SUMMARY |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 613 | * max_depth - Maximum depth of dump. Use ACPI_UINT32_MAX |
| 614 | * for an effectively unlimited depth. |
Bob Moore | d4913dc | 2009-03-06 10:05:18 +0800 | [diff] [blame] | 615 | * owner_id - Dump only objects owned by this ID. Use |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 616 | * ACPI_UINT32_MAX to match all owners. |
| 617 | * start_handle - Where in namespace to start/end search |
| 618 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 619 | * RETURN: None |
| 620 | * |
Bob Moore | d4913dc | 2009-03-06 10:05:18 +0800 | [diff] [blame] | 621 | * DESCRIPTION: Dump typed objects within the loaded namespace. Uses |
| 622 | * acpi_ns_walk_namespace in conjunction with acpi_ns_dump_one_object. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 623 | * |
| 624 | ******************************************************************************/ |
| 625 | |
| 626 | void |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 627 | acpi_ns_dump_objects(acpi_object_type type, |
| 628 | u8 display_type, |
| 629 | u32 max_depth, |
| 630 | acpi_owner_id owner_id, acpi_handle start_handle) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 631 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 632 | struct acpi_walk_info info; |
Bob Moore | 672af84 | 2011-01-12 09:13:31 +0800 | [diff] [blame] | 633 | acpi_status status; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 634 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 635 | ACPI_FUNCTION_ENTRY(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 636 | |
Bob Moore | 672af84 | 2011-01-12 09:13:31 +0800 | [diff] [blame] | 637 | /* |
| 638 | * Just lock the entire namespace for the duration of the dump. |
| 639 | * We don't want any changes to the namespace during this time, |
| 640 | * especially the temporary nodes since we are going to display |
| 641 | * them also. |
| 642 | */ |
| 643 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
| 644 | if (ACPI_FAILURE(status)) { |
| 645 | acpi_os_printf("Could not acquire namespace mutex\n"); |
| 646 | return; |
| 647 | } |
| 648 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 649 | info.debug_level = ACPI_LV_TABLES; |
| 650 | info.owner_id = owner_id; |
| 651 | info.display_type = display_type; |
| 652 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 653 | (void)acpi_ns_walk_namespace(type, start_handle, max_depth, |
Bob Moore | d1fdda83 | 2007-02-02 19:48:21 +0300 | [diff] [blame] | 654 | ACPI_NS_WALK_NO_UNLOCK | |
| 655 | ACPI_NS_WALK_TEMP_NODES, |
Lin Ming | 2263576 | 2009-11-13 10:06:08 +0800 | [diff] [blame] | 656 | acpi_ns_dump_one_object, NULL, |
| 657 | (void *)&info, NULL); |
Bob Moore | 672af84 | 2011-01-12 09:13:31 +0800 | [diff] [blame] | 658 | |
| 659 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 660 | } |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 661 | #endif /* ACPI_FUTURE_USAGE */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 662 | |
| 663 | /******************************************************************************* |
| 664 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 665 | * FUNCTION: acpi_ns_dump_entry |
| 666 | * |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 667 | * PARAMETERS: handle - Node to be dumped |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 668 | * debug_level - Output level |
| 669 | * |
| 670 | * RETURN: None |
| 671 | * |
| 672 | * DESCRIPTION: Dump a single Node |
| 673 | * |
| 674 | ******************************************************************************/ |
| 675 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 676 | void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level) |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 677 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 678 | struct acpi_walk_info info; |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 679 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 680 | ACPI_FUNCTION_ENTRY(); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 681 | |
| 682 | info.debug_level = debug_level; |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 683 | info.owner_id = ACPI_OWNER_ID_MAX; |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 684 | info.display_type = ACPI_DISPLAY_SUMMARY; |
| 685 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 686 | (void)acpi_ns_dump_one_object(handle, 1, &info, NULL); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 687 | } |
| 688 | |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame] | 689 | #ifdef ACPI_ASL_COMPILER |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 690 | /******************************************************************************* |
| 691 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 692 | * FUNCTION: acpi_ns_dump_tables |
| 693 | * |
| 694 | * PARAMETERS: search_base - Root of subtree to be dumped, or |
| 695 | * NS_ALL to dump the entire namespace |
Bob Moore | 73a3090 | 2012-10-31 02:26:55 +0000 | [diff] [blame] | 696 | * max_depth - Maximum depth of dump. Use INT_MAX |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 697 | * for an effectively unlimited depth. |
| 698 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 699 | * RETURN: None |
| 700 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 701 | * DESCRIPTION: Dump the name space, or a portion of it. |
| 702 | * |
| 703 | ******************************************************************************/ |
| 704 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 705 | void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 706 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 707 | acpi_handle search_handle = search_base; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 708 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 709 | ACPI_FUNCTION_TRACE(ns_dump_tables); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 710 | |
| 711 | if (!acpi_gbl_root_node) { |
| 712 | /* |
| 713 | * If the name space has not been initialized, |
| 714 | * there is nothing to dump. |
| 715 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 716 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, |
| 717 | "namespace not initialized!\n")); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 718 | return_VOID; |
| 719 | } |
| 720 | |
| 721 | if (ACPI_NS_ALL == search_base) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 722 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 723 | /* Entire namespace */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 724 | |
| 725 | search_handle = acpi_gbl_root_node; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 726 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, "\\\n")); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 727 | } |
| 728 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 729 | acpi_ns_dump_objects(ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, max_depth, |
| 730 | ACPI_OWNER_ID_MAX, search_handle); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 731 | return_VOID; |
| 732 | } |
Lv Zheng | 75c8044 | 2012-12-19 05:36:49 +0000 | [diff] [blame] | 733 | #endif |
| 734 | #endif |