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