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