1ae115bc7Smrj /****************************************************************************** 2ae115bc7Smrj * 3ae115bc7Smrj * Module Name: nsdump - table dumping routines for debug 4ae115bc7Smrj * 5ae115bc7Smrj *****************************************************************************/ 6ae115bc7Smrj 726f3cdf0SGordon Ross /* 8*385cc6b4SJerry Jelinek * Copyright (C) 2000 - 2016, Intel Corp. 9ae115bc7Smrj * All rights reserved. 10ae115bc7Smrj * 1126f3cdf0SGordon Ross * Redistribution and use in source and binary forms, with or without 1226f3cdf0SGordon Ross * modification, are permitted provided that the following conditions 1326f3cdf0SGordon Ross * are met: 1426f3cdf0SGordon Ross * 1. Redistributions of source code must retain the above copyright 1526f3cdf0SGordon Ross * notice, this list of conditions, and the following disclaimer, 1626f3cdf0SGordon Ross * without modification. 1726f3cdf0SGordon Ross * 2. Redistributions in binary form must reproduce at minimum a disclaimer 1826f3cdf0SGordon Ross * substantially similar to the "NO WARRANTY" disclaimer below 1926f3cdf0SGordon Ross * ("Disclaimer") and any redistribution must be conditioned upon 2026f3cdf0SGordon Ross * including a substantially similar Disclaimer requirement for further 2126f3cdf0SGordon Ross * binary redistribution. 2226f3cdf0SGordon Ross * 3. Neither the names of the above-listed copyright holders nor the names 2326f3cdf0SGordon Ross * of any contributors may be used to endorse or promote products derived 2426f3cdf0SGordon Ross * from this software without specific prior written permission. 25ae115bc7Smrj * 2626f3cdf0SGordon Ross * Alternatively, this software may be distributed under the terms of the 2726f3cdf0SGordon Ross * GNU General Public License ("GPL") version 2 as published by the Free 2826f3cdf0SGordon Ross * Software Foundation. 29ae115bc7Smrj * 3026f3cdf0SGordon Ross * NO WARRANTY 3126f3cdf0SGordon Ross * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 3226f3cdf0SGordon Ross * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 3326f3cdf0SGordon Ross * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 3426f3cdf0SGordon Ross * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 3526f3cdf0SGordon Ross * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3626f3cdf0SGordon Ross * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3726f3cdf0SGordon Ross * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3826f3cdf0SGordon Ross * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 3926f3cdf0SGordon Ross * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 4026f3cdf0SGordon Ross * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 4126f3cdf0SGordon Ross * POSSIBILITY OF SUCH DAMAGES. 4226f3cdf0SGordon Ross */ 43ae115bc7Smrj 44ae115bc7Smrj #include "acpi.h" 45aa2aa9a6SDana Myers #include "accommon.h" 46ae115bc7Smrj #include "acnamesp.h" 47*385cc6b4SJerry Jelinek #include "acoutput.h" 48ae115bc7Smrj 49ae115bc7Smrj 50ae115bc7Smrj #define _COMPONENT ACPI_NAMESPACE 51ae115bc7Smrj ACPI_MODULE_NAME ("nsdump") 52ae115bc7Smrj 53ae115bc7Smrj /* Local prototypes */ 54ae115bc7Smrj 55ae115bc7Smrj #ifdef ACPI_OBSOLETE_FUNCTIONS 56ae115bc7Smrj void 57ae115bc7Smrj AcpiNsDumpRootDevices ( 58ae115bc7Smrj void); 59ae115bc7Smrj 60ae115bc7Smrj static ACPI_STATUS 61ae115bc7Smrj AcpiNsDumpOneDevice ( 62ae115bc7Smrj ACPI_HANDLE ObjHandle, 63ae115bc7Smrj UINT32 Level, 64ae115bc7Smrj void *Context, 65ae115bc7Smrj void **ReturnValue); 66ae115bc7Smrj #endif 67ae115bc7Smrj 68ae115bc7Smrj 69ae115bc7Smrj #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 70*385cc6b4SJerry Jelinek 71*385cc6b4SJerry Jelinek static ACPI_STATUS 72*385cc6b4SJerry Jelinek AcpiNsDumpOneObjectPath ( 73*385cc6b4SJerry Jelinek ACPI_HANDLE ObjHandle, 74*385cc6b4SJerry Jelinek UINT32 Level, 75*385cc6b4SJerry Jelinek void *Context, 76*385cc6b4SJerry Jelinek void **ReturnValue); 77*385cc6b4SJerry Jelinek 78*385cc6b4SJerry Jelinek static ACPI_STATUS 79*385cc6b4SJerry Jelinek AcpiNsGetMaxDepth ( 80*385cc6b4SJerry Jelinek ACPI_HANDLE ObjHandle, 81*385cc6b4SJerry Jelinek UINT32 Level, 82*385cc6b4SJerry Jelinek void *Context, 83*385cc6b4SJerry Jelinek void **ReturnValue); 84*385cc6b4SJerry Jelinek 85*385cc6b4SJerry Jelinek 86ae115bc7Smrj /******************************************************************************* 87ae115bc7Smrj * 88ae115bc7Smrj * FUNCTION: AcpiNsPrintPathname 89ae115bc7Smrj * 90ae115bc7Smrj * PARAMETERS: NumSegments - Number of ACPI name segments 91ae115bc7Smrj * Pathname - The compressed (internal) path 92ae115bc7Smrj * 93ae115bc7Smrj * RETURN: None 94ae115bc7Smrj * 95ae115bc7Smrj * DESCRIPTION: Print an object's full namespace pathname 96ae115bc7Smrj * 97ae115bc7Smrj ******************************************************************************/ 98ae115bc7Smrj 99ae115bc7Smrj void 100ae115bc7Smrj AcpiNsPrintPathname ( 101ae115bc7Smrj UINT32 NumSegments, 102*385cc6b4SJerry Jelinek const char *Pathname) 103ae115bc7Smrj { 104db2bae30SDana Myers UINT32 i; 105ae115bc7Smrj 106ae115bc7Smrj 107ae115bc7Smrj ACPI_FUNCTION_NAME (NsPrintPathname); 108ae115bc7Smrj 109ae115bc7Smrj 110*385cc6b4SJerry Jelinek /* Check if debug output enabled */ 111*385cc6b4SJerry Jelinek 112*385cc6b4SJerry Jelinek if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_NAMES, ACPI_NAMESPACE)) 113ae115bc7Smrj { 114ae115bc7Smrj return; 115ae115bc7Smrj } 116ae115bc7Smrj 117ae115bc7Smrj /* Print the entire name */ 118ae115bc7Smrj 119ae115bc7Smrj ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[")); 120ae115bc7Smrj 121ae115bc7Smrj while (NumSegments) 122ae115bc7Smrj { 123ae115bc7Smrj for (i = 0; i < 4; i++) 124ae115bc7Smrj { 125*385cc6b4SJerry Jelinek isprint ((int) Pathname[i]) ? 126ae115bc7Smrj AcpiOsPrintf ("%c", Pathname[i]) : 127ae115bc7Smrj AcpiOsPrintf ("?"); 128ae115bc7Smrj } 129ae115bc7Smrj 130ae115bc7Smrj Pathname += ACPI_NAME_SIZE; 131ae115bc7Smrj NumSegments--; 132ae115bc7Smrj if (NumSegments) 133ae115bc7Smrj { 134ae115bc7Smrj AcpiOsPrintf ("."); 135ae115bc7Smrj } 136ae115bc7Smrj } 137ae115bc7Smrj 138ae115bc7Smrj AcpiOsPrintf ("]\n"); 139ae115bc7Smrj } 140ae115bc7Smrj 141ae115bc7Smrj 142*385cc6b4SJerry Jelinek #ifdef ACPI_OBSOLETE_FUNCTIONS 143*385cc6b4SJerry Jelinek /* Not used at this time, perhaps later */ 144*385cc6b4SJerry Jelinek 145ae115bc7Smrj /******************************************************************************* 146ae115bc7Smrj * 147ae115bc7Smrj * FUNCTION: AcpiNsDumpPathname 148ae115bc7Smrj * 149ae115bc7Smrj * PARAMETERS: Handle - Object 150ae115bc7Smrj * Msg - Prefix message 151ae115bc7Smrj * Level - Desired debug level 152ae115bc7Smrj * Component - Caller's component ID 153ae115bc7Smrj * 154ae115bc7Smrj * RETURN: None 155ae115bc7Smrj * 156ae115bc7Smrj * DESCRIPTION: Print an object's full namespace pathname 157ae115bc7Smrj * Manages allocation/freeing of a pathname buffer 158ae115bc7Smrj * 159ae115bc7Smrj ******************************************************************************/ 160ae115bc7Smrj 161ae115bc7Smrj void 162ae115bc7Smrj AcpiNsDumpPathname ( 163ae115bc7Smrj ACPI_HANDLE Handle, 164*385cc6b4SJerry Jelinek const char *Msg, 165ae115bc7Smrj UINT32 Level, 166ae115bc7Smrj UINT32 Component) 167ae115bc7Smrj { 168ae115bc7Smrj 169ae115bc7Smrj ACPI_FUNCTION_TRACE (NsDumpPathname); 170ae115bc7Smrj 171ae115bc7Smrj 172ae115bc7Smrj /* Do this only if the requested debug level and component are enabled */ 173ae115bc7Smrj 174*385cc6b4SJerry Jelinek if (!ACPI_IS_DEBUG_ENABLED (Level, Component)) 175ae115bc7Smrj { 176ae115bc7Smrj return_VOID; 177ae115bc7Smrj } 178ae115bc7Smrj 179ae115bc7Smrj /* Convert handle to a full pathname and print it (with supplied message) */ 180ae115bc7Smrj 181ae115bc7Smrj AcpiNsPrintNodePathname (Handle, Msg); 182ae115bc7Smrj AcpiOsPrintf ("\n"); 183ae115bc7Smrj return_VOID; 184ae115bc7Smrj } 185*385cc6b4SJerry Jelinek #endif 186ae115bc7Smrj 187ae115bc7Smrj /******************************************************************************* 188ae115bc7Smrj * 189ae115bc7Smrj * FUNCTION: AcpiNsDumpOneObject 190ae115bc7Smrj * 191ae115bc7Smrj * PARAMETERS: ObjHandle - Node to be dumped 192ae115bc7Smrj * Level - Nesting level of the handle 193ae115bc7Smrj * Context - Passed into WalkNamespace 194ae115bc7Smrj * ReturnValue - Not used 195ae115bc7Smrj * 196ae115bc7Smrj * RETURN: Status 197ae115bc7Smrj * 198ae115bc7Smrj * DESCRIPTION: Dump a single Node 199ae115bc7Smrj * This procedure is a UserFunction called by AcpiNsWalkNamespace. 200ae115bc7Smrj * 201ae115bc7Smrj ******************************************************************************/ 202ae115bc7Smrj 203ae115bc7Smrj ACPI_STATUS 204ae115bc7Smrj AcpiNsDumpOneObject ( 205ae115bc7Smrj ACPI_HANDLE ObjHandle, 206ae115bc7Smrj UINT32 Level, 207ae115bc7Smrj void *Context, 208ae115bc7Smrj void **ReturnValue) 209ae115bc7Smrj { 210ae115bc7Smrj ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context; 211ae115bc7Smrj ACPI_NAMESPACE_NODE *ThisNode; 212ae115bc7Smrj ACPI_OPERAND_OBJECT *ObjDesc = NULL; 213ae115bc7Smrj ACPI_OBJECT_TYPE ObjType; 214ae115bc7Smrj ACPI_OBJECT_TYPE Type; 215ae115bc7Smrj UINT32 BytesToDump; 216ae115bc7Smrj UINT32 DbgLevel; 217ae115bc7Smrj UINT32 i; 218ae115bc7Smrj 219ae115bc7Smrj 220ae115bc7Smrj ACPI_FUNCTION_NAME (NsDumpOneObject); 221ae115bc7Smrj 222ae115bc7Smrj 223ae115bc7Smrj /* Is output enabled? */ 224ae115bc7Smrj 225ae115bc7Smrj if (!(AcpiDbgLevel & Info->DebugLevel)) 226ae115bc7Smrj { 227ae115bc7Smrj return (AE_OK); 228ae115bc7Smrj } 229ae115bc7Smrj 230ae115bc7Smrj if (!ObjHandle) 231ae115bc7Smrj { 232ae115bc7Smrj ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n")); 233ae115bc7Smrj return (AE_OK); 234ae115bc7Smrj } 235ae115bc7Smrj 23626f3cdf0SGordon Ross ThisNode = AcpiNsValidateHandle (ObjHandle); 237aa2aa9a6SDana Myers if (!ThisNode) 238aa2aa9a6SDana Myers { 239aa2aa9a6SDana Myers ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Invalid object handle %p\n", 240aa2aa9a6SDana Myers ObjHandle)); 241aa2aa9a6SDana Myers return (AE_OK); 242aa2aa9a6SDana Myers } 243aa2aa9a6SDana Myers 244ae115bc7Smrj Type = ThisNode->Type; 245ae115bc7Smrj 246ae115bc7Smrj /* Check if the owner matches */ 247ae115bc7Smrj 248ae115bc7Smrj if ((Info->OwnerId != ACPI_OWNER_ID_MAX) && 249ae115bc7Smrj (Info->OwnerId != ThisNode->OwnerId)) 250ae115bc7Smrj { 251ae115bc7Smrj return (AE_OK); 252ae115bc7Smrj } 253ae115bc7Smrj 254ae115bc7Smrj if (!(Info->DisplayType & ACPI_DISPLAY_SHORT)) 255ae115bc7Smrj { 256ae115bc7Smrj /* Indent the object according to the level */ 257ae115bc7Smrj 258ae115bc7Smrj AcpiOsPrintf ("%2d%*s", (UINT32) Level - 1, (int) Level * 2, " "); 259ae115bc7Smrj 260ae115bc7Smrj /* Check the node type and name */ 261ae115bc7Smrj 262ae115bc7Smrj if (Type > ACPI_TYPE_LOCAL_MAX) 263ae115bc7Smrj { 264*385cc6b4SJerry Jelinek ACPI_WARNING ((AE_INFO, 265*385cc6b4SJerry Jelinek "Invalid ACPI Object Type 0x%08X", Type)); 266ae115bc7Smrj } 267ae115bc7Smrj 268ae115bc7Smrj AcpiOsPrintf ("%4.4s", AcpiUtGetNodeName (ThisNode)); 269ae115bc7Smrj } 270ae115bc7Smrj 271aa2aa9a6SDana Myers /* Now we can print out the pertinent information */ 272aa2aa9a6SDana Myers 273ae115bc7Smrj AcpiOsPrintf (" %-12s %p %2.2X ", 274ae115bc7Smrj AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId); 275ae115bc7Smrj 276ae115bc7Smrj DbgLevel = AcpiDbgLevel; 277ae115bc7Smrj AcpiDbgLevel = 0; 278ae115bc7Smrj ObjDesc = AcpiNsGetAttachedObject (ThisNode); 279ae115bc7Smrj AcpiDbgLevel = DbgLevel; 280ae115bc7Smrj 281db2bae30SDana Myers /* Temp nodes are those nodes created by a control method */ 282db2bae30SDana Myers 283db2bae30SDana Myers if (ThisNode->Flags & ANOBJ_TEMPORARY) 284db2bae30SDana Myers { 285db2bae30SDana Myers AcpiOsPrintf ("(T) "); 286db2bae30SDana Myers } 287db2bae30SDana Myers 288ae115bc7Smrj switch (Info->DisplayType & ACPI_DISPLAY_MASK) 289ae115bc7Smrj { 290ae115bc7Smrj case ACPI_DISPLAY_SUMMARY: 291ae115bc7Smrj 292ae115bc7Smrj if (!ObjDesc) 293ae115bc7Smrj { 294*385cc6b4SJerry Jelinek /* No attached object. Some types should always have an object */ 295*385cc6b4SJerry Jelinek 296*385cc6b4SJerry Jelinek switch (Type) 297*385cc6b4SJerry Jelinek { 298*385cc6b4SJerry Jelinek case ACPI_TYPE_INTEGER: 299*385cc6b4SJerry Jelinek case ACPI_TYPE_PACKAGE: 300*385cc6b4SJerry Jelinek case ACPI_TYPE_BUFFER: 301*385cc6b4SJerry Jelinek case ACPI_TYPE_STRING: 302*385cc6b4SJerry Jelinek case ACPI_TYPE_METHOD: 303*385cc6b4SJerry Jelinek 304*385cc6b4SJerry Jelinek AcpiOsPrintf ("<No attached object>"); 305*385cc6b4SJerry Jelinek break; 306*385cc6b4SJerry Jelinek 307*385cc6b4SJerry Jelinek default: 308*385cc6b4SJerry Jelinek 309*385cc6b4SJerry Jelinek break; 310*385cc6b4SJerry Jelinek } 311ae115bc7Smrj 312ae115bc7Smrj AcpiOsPrintf ("\n"); 313ae115bc7Smrj return (AE_OK); 314ae115bc7Smrj } 315ae115bc7Smrj 316ae115bc7Smrj switch (Type) 317ae115bc7Smrj { 318ae115bc7Smrj case ACPI_TYPE_PROCESSOR: 319ae115bc7Smrj 320*385cc6b4SJerry Jelinek AcpiOsPrintf ("ID %02X Len %02X Addr %8.8X%8.8X\n", 321ae115bc7Smrj ObjDesc->Processor.ProcId, ObjDesc->Processor.Length, 322*385cc6b4SJerry Jelinek ACPI_FORMAT_UINT64 (ObjDesc->Processor.Address)); 323ae115bc7Smrj break; 324ae115bc7Smrj 325ae115bc7Smrj case ACPI_TYPE_DEVICE: 326ae115bc7Smrj 327ae115bc7Smrj AcpiOsPrintf ("Notify Object: %p\n", ObjDesc); 328ae115bc7Smrj break; 329ae115bc7Smrj 330ae115bc7Smrj case ACPI_TYPE_METHOD: 331ae115bc7Smrj 332ae115bc7Smrj AcpiOsPrintf ("Args %X Len %.4X Aml %p\n", 333ae115bc7Smrj (UINT32) ObjDesc->Method.ParamCount, 334ae115bc7Smrj ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart); 335ae115bc7Smrj break; 336ae115bc7Smrj 337ae115bc7Smrj case ACPI_TYPE_INTEGER: 338ae115bc7Smrj 339ae115bc7Smrj AcpiOsPrintf ("= %8.8X%8.8X\n", 340ae115bc7Smrj ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); 341ae115bc7Smrj break; 342ae115bc7Smrj 343ae115bc7Smrj case ACPI_TYPE_PACKAGE: 344ae115bc7Smrj 345ae115bc7Smrj if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) 346ae115bc7Smrj { 347ae115bc7Smrj AcpiOsPrintf ("Elements %.2X\n", 348ae115bc7Smrj ObjDesc->Package.Count); 349ae115bc7Smrj } 350ae115bc7Smrj else 351ae115bc7Smrj { 352ae115bc7Smrj AcpiOsPrintf ("[Length not yet evaluated]\n"); 353ae115bc7Smrj } 354ae115bc7Smrj break; 355ae115bc7Smrj 356ae115bc7Smrj case ACPI_TYPE_BUFFER: 357ae115bc7Smrj 358ae115bc7Smrj if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) 359ae115bc7Smrj { 360ae115bc7Smrj AcpiOsPrintf ("Len %.2X", 361ae115bc7Smrj ObjDesc->Buffer.Length); 362ae115bc7Smrj 363ae115bc7Smrj /* Dump some of the buffer */ 364ae115bc7Smrj 365ae115bc7Smrj if (ObjDesc->Buffer.Length > 0) 366ae115bc7Smrj { 367ae115bc7Smrj AcpiOsPrintf (" ="); 368ae115bc7Smrj for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++) 369ae115bc7Smrj { 370ae115bc7Smrj AcpiOsPrintf (" %.2hX", ObjDesc->Buffer.Pointer[i]); 371ae115bc7Smrj } 372ae115bc7Smrj } 373ae115bc7Smrj AcpiOsPrintf ("\n"); 374ae115bc7Smrj } 375ae115bc7Smrj else 376ae115bc7Smrj { 377ae115bc7Smrj AcpiOsPrintf ("[Length not yet evaluated]\n"); 378ae115bc7Smrj } 379ae115bc7Smrj break; 380ae115bc7Smrj 381ae115bc7Smrj case ACPI_TYPE_STRING: 382ae115bc7Smrj 383ae115bc7Smrj AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length); 384*385cc6b4SJerry Jelinek AcpiUtPrintString (ObjDesc->String.Pointer, 80); 385ae115bc7Smrj AcpiOsPrintf ("\n"); 386ae115bc7Smrj break; 387ae115bc7Smrj 388ae115bc7Smrj case ACPI_TYPE_REGION: 389ae115bc7Smrj 390ae115bc7Smrj AcpiOsPrintf ("[%s]", 391ae115bc7Smrj AcpiUtGetRegionName (ObjDesc->Region.SpaceId)); 392ae115bc7Smrj if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID) 393ae115bc7Smrj { 394ae115bc7Smrj AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n", 395*385cc6b4SJerry Jelinek ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), 396ae115bc7Smrj ObjDesc->Region.Length); 397ae115bc7Smrj } 398ae115bc7Smrj else 399ae115bc7Smrj { 400ae115bc7Smrj AcpiOsPrintf (" [Address/Length not yet evaluated]\n"); 401ae115bc7Smrj } 402ae115bc7Smrj break; 403ae115bc7Smrj 404ae115bc7Smrj case ACPI_TYPE_LOCAL_REFERENCE: 405ae115bc7Smrj 406db2bae30SDana Myers AcpiOsPrintf ("[%s]\n", AcpiUtGetReferenceName (ObjDesc)); 407ae115bc7Smrj break; 408ae115bc7Smrj 409ae115bc7Smrj case ACPI_TYPE_BUFFER_FIELD: 410ae115bc7Smrj 411ae115bc7Smrj if (ObjDesc->BufferField.BufferObj && 412ae115bc7Smrj ObjDesc->BufferField.BufferObj->Buffer.Node) 413ae115bc7Smrj { 414ae115bc7Smrj AcpiOsPrintf ("Buf [%4.4s]", 415aa2aa9a6SDana Myers AcpiUtGetNodeName ( 416aa2aa9a6SDana Myers ObjDesc->BufferField.BufferObj->Buffer.Node)); 417ae115bc7Smrj } 418ae115bc7Smrj break; 419ae115bc7Smrj 420ae115bc7Smrj case ACPI_TYPE_LOCAL_REGION_FIELD: 421ae115bc7Smrj 422ae115bc7Smrj AcpiOsPrintf ("Rgn [%4.4s]", 423aa2aa9a6SDana Myers AcpiUtGetNodeName ( 424aa2aa9a6SDana Myers ObjDesc->CommonField.RegionObj->Region.Node)); 425ae115bc7Smrj break; 426ae115bc7Smrj 427ae115bc7Smrj case ACPI_TYPE_LOCAL_BANK_FIELD: 428ae115bc7Smrj 429ae115bc7Smrj AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]", 430aa2aa9a6SDana Myers AcpiUtGetNodeName ( 431aa2aa9a6SDana Myers ObjDesc->CommonField.RegionObj->Region.Node), 432aa2aa9a6SDana Myers AcpiUtGetNodeName ( 433aa2aa9a6SDana Myers ObjDesc->BankField.BankObj->CommonField.Node)); 434ae115bc7Smrj break; 435ae115bc7Smrj 436ae115bc7Smrj case ACPI_TYPE_LOCAL_INDEX_FIELD: 437ae115bc7Smrj 438ae115bc7Smrj AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]", 439aa2aa9a6SDana Myers AcpiUtGetNodeName ( 440aa2aa9a6SDana Myers ObjDesc->IndexField.IndexObj->CommonField.Node), 441aa2aa9a6SDana Myers AcpiUtGetNodeName ( 442aa2aa9a6SDana Myers ObjDesc->IndexField.DataObj->CommonField.Node)); 443ae115bc7Smrj break; 444ae115bc7Smrj 445ae115bc7Smrj case ACPI_TYPE_LOCAL_ALIAS: 446ae115bc7Smrj case ACPI_TYPE_LOCAL_METHOD_ALIAS: 447ae115bc7Smrj 448ae115bc7Smrj AcpiOsPrintf ("Target %4.4s (%p)\n", 449ae115bc7Smrj AcpiUtGetNodeName (ObjDesc), ObjDesc); 450ae115bc7Smrj break; 451ae115bc7Smrj 452ae115bc7Smrj default: 453ae115bc7Smrj 454ae115bc7Smrj AcpiOsPrintf ("Object %p\n", ObjDesc); 455ae115bc7Smrj break; 456ae115bc7Smrj } 457ae115bc7Smrj 458ae115bc7Smrj /* Common field handling */ 459ae115bc7Smrj 460ae115bc7Smrj switch (Type) 461ae115bc7Smrj { 462ae115bc7Smrj case ACPI_TYPE_BUFFER_FIELD: 463ae115bc7Smrj case ACPI_TYPE_LOCAL_REGION_FIELD: 464ae115bc7Smrj case ACPI_TYPE_LOCAL_BANK_FIELD: 465ae115bc7Smrj case ACPI_TYPE_LOCAL_INDEX_FIELD: 466ae115bc7Smrj 467ae115bc7Smrj AcpiOsPrintf (" Off %.3X Len %.2X Acc %.2hd\n", 468ae115bc7Smrj (ObjDesc->CommonField.BaseByteOffset * 8) 469ae115bc7Smrj + ObjDesc->CommonField.StartFieldBitOffset, 470ae115bc7Smrj ObjDesc->CommonField.BitLength, 471ae115bc7Smrj ObjDesc->CommonField.AccessByteWidth); 472ae115bc7Smrj break; 473ae115bc7Smrj 474ae115bc7Smrj default: 475*385cc6b4SJerry Jelinek 476ae115bc7Smrj break; 477ae115bc7Smrj } 478ae115bc7Smrj break; 479ae115bc7Smrj 480ae115bc7Smrj case ACPI_DISPLAY_OBJECTS: 481ae115bc7Smrj 482ae115bc7Smrj AcpiOsPrintf ("O:%p", ObjDesc); 483ae115bc7Smrj if (!ObjDesc) 484ae115bc7Smrj { 485ae115bc7Smrj /* No attached object, we are done */ 486ae115bc7Smrj 487ae115bc7Smrj AcpiOsPrintf ("\n"); 488ae115bc7Smrj return (AE_OK); 489ae115bc7Smrj } 490ae115bc7Smrj 49126f3cdf0SGordon Ross AcpiOsPrintf ("(R%u)", ObjDesc->Common.ReferenceCount); 492ae115bc7Smrj 493ae115bc7Smrj switch (Type) 494ae115bc7Smrj { 495ae115bc7Smrj case ACPI_TYPE_METHOD: 496ae115bc7Smrj 497ae115bc7Smrj /* Name is a Method and its AML offset/length are set */ 498ae115bc7Smrj 499ae115bc7Smrj AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart, 500ae115bc7Smrj ObjDesc->Method.AmlLength); 501ae115bc7Smrj break; 502ae115bc7Smrj 503ae115bc7Smrj case ACPI_TYPE_INTEGER: 504ae115bc7Smrj 505ae115bc7Smrj AcpiOsPrintf (" I:%8.8X8.8%X\n", 506ae115bc7Smrj ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); 507ae115bc7Smrj break; 508ae115bc7Smrj 509ae115bc7Smrj case ACPI_TYPE_STRING: 510ae115bc7Smrj 511ae115bc7Smrj AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer, 512ae115bc7Smrj ObjDesc->String.Length); 513ae115bc7Smrj break; 514ae115bc7Smrj 515ae115bc7Smrj case ACPI_TYPE_BUFFER: 516ae115bc7Smrj 517ae115bc7Smrj AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer, 518ae115bc7Smrj ObjDesc->Buffer.Length); 519ae115bc7Smrj break; 520ae115bc7Smrj 521ae115bc7Smrj default: 522ae115bc7Smrj 523ae115bc7Smrj AcpiOsPrintf ("\n"); 524ae115bc7Smrj break; 525ae115bc7Smrj } 526ae115bc7Smrj break; 527ae115bc7Smrj 528ae115bc7Smrj default: 529ae115bc7Smrj AcpiOsPrintf ("\n"); 530ae115bc7Smrj break; 531ae115bc7Smrj } 532ae115bc7Smrj 533ae115bc7Smrj /* If debug turned off, done */ 534ae115bc7Smrj 535ae115bc7Smrj if (!(AcpiDbgLevel & ACPI_LV_VALUES)) 536ae115bc7Smrj { 537ae115bc7Smrj return (AE_OK); 538ae115bc7Smrj } 539ae115bc7Smrj 540ae115bc7Smrj /* If there is an attached object, display it */ 541ae115bc7Smrj 542ae115bc7Smrj DbgLevel = AcpiDbgLevel; 543ae115bc7Smrj AcpiDbgLevel = 0; 544ae115bc7Smrj ObjDesc = AcpiNsGetAttachedObject (ThisNode); 545ae115bc7Smrj AcpiDbgLevel = DbgLevel; 546ae115bc7Smrj 547ae115bc7Smrj /* Dump attached objects */ 548ae115bc7Smrj 549ae115bc7Smrj while (ObjDesc) 550ae115bc7Smrj { 551ae115bc7Smrj ObjType = ACPI_TYPE_INVALID; 552ae115bc7Smrj AcpiOsPrintf ("Attached Object %p: ", ObjDesc); 553ae115bc7Smrj 554ae115bc7Smrj /* Decode the type of attached object and dump the contents */ 555ae115bc7Smrj 556ae115bc7Smrj switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)) 557ae115bc7Smrj { 558ae115bc7Smrj case ACPI_DESC_TYPE_NAMED: 559ae115bc7Smrj 560ae115bc7Smrj AcpiOsPrintf ("(Ptr to Node)\n"); 561ae115bc7Smrj BytesToDump = sizeof (ACPI_NAMESPACE_NODE); 562ae115bc7Smrj ACPI_DUMP_BUFFER (ObjDesc, BytesToDump); 563ae115bc7Smrj break; 564ae115bc7Smrj 565ae115bc7Smrj case ACPI_DESC_TYPE_OPERAND: 566ae115bc7Smrj 567aa2aa9a6SDana Myers ObjType = ObjDesc->Common.Type; 568ae115bc7Smrj 569ae115bc7Smrj if (ObjType > ACPI_TYPE_LOCAL_MAX) 570ae115bc7Smrj { 571*385cc6b4SJerry Jelinek AcpiOsPrintf ( 572*385cc6b4SJerry Jelinek "(Pointer to ACPI Object type %.2X [UNKNOWN])\n", 573ae115bc7Smrj ObjType); 574*385cc6b4SJerry Jelinek 575ae115bc7Smrj BytesToDump = 32; 576ae115bc7Smrj } 577ae115bc7Smrj else 578ae115bc7Smrj { 579*385cc6b4SJerry Jelinek AcpiOsPrintf ( 580*385cc6b4SJerry Jelinek "(Pointer to ACPI Object type %.2X [%s])\n", 581ae115bc7Smrj ObjType, AcpiUtGetTypeName (ObjType)); 582*385cc6b4SJerry Jelinek 583ae115bc7Smrj BytesToDump = sizeof (ACPI_OPERAND_OBJECT); 584ae115bc7Smrj } 585ae115bc7Smrj 586ae115bc7Smrj ACPI_DUMP_BUFFER (ObjDesc, BytesToDump); 587ae115bc7Smrj break; 588ae115bc7Smrj 589ae115bc7Smrj default: 590ae115bc7Smrj 591ae115bc7Smrj break; 592ae115bc7Smrj } 593ae115bc7Smrj 594ae115bc7Smrj /* If value is NOT an internal object, we are done */ 595ae115bc7Smrj 596ae115bc7Smrj if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) 597ae115bc7Smrj { 598ae115bc7Smrj goto Cleanup; 599ae115bc7Smrj } 600ae115bc7Smrj 601aa2aa9a6SDana Myers /* Valid object, get the pointer to next level, if any */ 602aa2aa9a6SDana Myers 603ae115bc7Smrj switch (ObjType) 604ae115bc7Smrj { 605ae115bc7Smrj case ACPI_TYPE_BUFFER: 606ae115bc7Smrj case ACPI_TYPE_STRING: 607ae115bc7Smrj /* 608ae115bc7Smrj * NOTE: takes advantage of common fields between string/buffer 609ae115bc7Smrj */ 610ae115bc7Smrj BytesToDump = ObjDesc->String.Length; 611ae115bc7Smrj ObjDesc = (void *) ObjDesc->String.Pointer; 612*385cc6b4SJerry Jelinek 613ae115bc7Smrj AcpiOsPrintf ("(Buffer/String pointer %p length %X)\n", 614ae115bc7Smrj ObjDesc, BytesToDump); 615ae115bc7Smrj ACPI_DUMP_BUFFER (ObjDesc, BytesToDump); 616ae115bc7Smrj goto Cleanup; 617ae115bc7Smrj 618ae115bc7Smrj case ACPI_TYPE_BUFFER_FIELD: 619*385cc6b4SJerry Jelinek 620ae115bc7Smrj ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj; 621ae115bc7Smrj break; 622ae115bc7Smrj 623ae115bc7Smrj case ACPI_TYPE_PACKAGE: 624*385cc6b4SJerry Jelinek 625ae115bc7Smrj ObjDesc = (void *) ObjDesc->Package.Elements; 626ae115bc7Smrj break; 627ae115bc7Smrj 628ae115bc7Smrj case ACPI_TYPE_METHOD: 629*385cc6b4SJerry Jelinek 630ae115bc7Smrj ObjDesc = (void *) ObjDesc->Method.AmlStart; 631ae115bc7Smrj break; 632ae115bc7Smrj 633ae115bc7Smrj case ACPI_TYPE_LOCAL_REGION_FIELD: 634*385cc6b4SJerry Jelinek 635ae115bc7Smrj ObjDesc = (void *) ObjDesc->Field.RegionObj; 636ae115bc7Smrj break; 637ae115bc7Smrj 638ae115bc7Smrj case ACPI_TYPE_LOCAL_BANK_FIELD: 639*385cc6b4SJerry Jelinek 640ae115bc7Smrj ObjDesc = (void *) ObjDesc->BankField.RegionObj; 641ae115bc7Smrj break; 642ae115bc7Smrj 643ae115bc7Smrj case ACPI_TYPE_LOCAL_INDEX_FIELD: 644*385cc6b4SJerry Jelinek 645ae115bc7Smrj ObjDesc = (void *) ObjDesc->IndexField.IndexObj; 646ae115bc7Smrj break; 647ae115bc7Smrj 648ae115bc7Smrj default: 649*385cc6b4SJerry Jelinek 650ae115bc7Smrj goto Cleanup; 651ae115bc7Smrj } 652ae115bc7Smrj 653ae115bc7Smrj ObjType = ACPI_TYPE_INVALID; /* Terminate loop after next pass */ 654ae115bc7Smrj } 655ae115bc7Smrj 656ae115bc7Smrj Cleanup: 657ae115bc7Smrj AcpiOsPrintf ("\n"); 658ae115bc7Smrj return (AE_OK); 659ae115bc7Smrj } 660ae115bc7Smrj 661ae115bc7Smrj 662ae115bc7Smrj /******************************************************************************* 663ae115bc7Smrj * 664ae115bc7Smrj * FUNCTION: AcpiNsDumpObjects 665ae115bc7Smrj * 666ae115bc7Smrj * PARAMETERS: Type - Object type to be dumped 667ae115bc7Smrj * DisplayType - 0 or ACPI_DISPLAY_SUMMARY 668ae115bc7Smrj * MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX 669ae115bc7Smrj * for an effectively unlimited depth. 670ae115bc7Smrj * OwnerId - Dump only objects owned by this ID. Use 671ae115bc7Smrj * ACPI_UINT32_MAX to match all owners. 672ae115bc7Smrj * StartHandle - Where in namespace to start/end search 673ae115bc7Smrj * 674ae115bc7Smrj * RETURN: None 675ae115bc7Smrj * 676aa2aa9a6SDana Myers * DESCRIPTION: Dump typed objects within the loaded namespace. Uses 677aa2aa9a6SDana Myers * AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject. 678ae115bc7Smrj * 679ae115bc7Smrj ******************************************************************************/ 680ae115bc7Smrj 681ae115bc7Smrj void 682ae115bc7Smrj AcpiNsDumpObjects ( 683ae115bc7Smrj ACPI_OBJECT_TYPE Type, 684ae115bc7Smrj UINT8 DisplayType, 685ae115bc7Smrj UINT32 MaxDepth, 686ae115bc7Smrj ACPI_OWNER_ID OwnerId, 687ae115bc7Smrj ACPI_HANDLE StartHandle) 688ae115bc7Smrj { 689ae115bc7Smrj ACPI_WALK_INFO Info; 69026f3cdf0SGordon Ross ACPI_STATUS Status; 691ae115bc7Smrj 692ae115bc7Smrj 693ae115bc7Smrj ACPI_FUNCTION_ENTRY (); 694ae115bc7Smrj 695ae115bc7Smrj 69626f3cdf0SGordon Ross /* 69726f3cdf0SGordon Ross * Just lock the entire namespace for the duration of the dump. 69826f3cdf0SGordon Ross * We don't want any changes to the namespace during this time, 69926f3cdf0SGordon Ross * especially the temporary nodes since we are going to display 70026f3cdf0SGordon Ross * them also. 70126f3cdf0SGordon Ross */ 70226f3cdf0SGordon Ross Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); 70326f3cdf0SGordon Ross if (ACPI_FAILURE (Status)) 70426f3cdf0SGordon Ross { 70526f3cdf0SGordon Ross AcpiOsPrintf ("Could not acquire namespace mutex\n"); 70626f3cdf0SGordon Ross return; 70726f3cdf0SGordon Ross } 70826f3cdf0SGordon Ross 709ae115bc7Smrj Info.DebugLevel = ACPI_LV_TABLES; 710ae115bc7Smrj Info.OwnerId = OwnerId; 711ae115bc7Smrj Info.DisplayType = DisplayType; 712ae115bc7Smrj 713ae115bc7Smrj (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, 714db2bae30SDana Myers ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, 71557190917SDana Myers AcpiNsDumpOneObject, NULL, (void *) &Info, NULL); 71626f3cdf0SGordon Ross 71726f3cdf0SGordon Ross (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); 718ae115bc7Smrj } 719ae115bc7Smrj 720ae115bc7Smrj 721ae115bc7Smrj /******************************************************************************* 722ae115bc7Smrj * 723*385cc6b4SJerry Jelinek * FUNCTION: AcpiNsDumpOneObjectPath, AcpiNsGetMaxDepth 724*385cc6b4SJerry Jelinek * 725*385cc6b4SJerry Jelinek * PARAMETERS: ObjHandle - Node to be dumped 726*385cc6b4SJerry Jelinek * Level - Nesting level of the handle 727*385cc6b4SJerry Jelinek * Context - Passed into WalkNamespace 728*385cc6b4SJerry Jelinek * ReturnValue - Not used 729*385cc6b4SJerry Jelinek * 730*385cc6b4SJerry Jelinek * RETURN: Status 731*385cc6b4SJerry Jelinek * 732*385cc6b4SJerry Jelinek * DESCRIPTION: Dump the full pathname to a namespace object. AcpNsGetMaxDepth 733*385cc6b4SJerry Jelinek * computes the maximum nesting depth in the namespace tree, in 734*385cc6b4SJerry Jelinek * order to simplify formatting in AcpiNsDumpOneObjectPath. 735*385cc6b4SJerry Jelinek * These procedures are UserFunctions called by AcpiNsWalkNamespace. 736*385cc6b4SJerry Jelinek * 737*385cc6b4SJerry Jelinek ******************************************************************************/ 738*385cc6b4SJerry Jelinek 739*385cc6b4SJerry Jelinek static ACPI_STATUS 740*385cc6b4SJerry Jelinek AcpiNsDumpOneObjectPath ( 741*385cc6b4SJerry Jelinek ACPI_HANDLE ObjHandle, 742*385cc6b4SJerry Jelinek UINT32 Level, 743*385cc6b4SJerry Jelinek void *Context, 744*385cc6b4SJerry Jelinek void **ReturnValue) 745*385cc6b4SJerry Jelinek { 746*385cc6b4SJerry Jelinek UINT32 MaxLevel = *((UINT32 *) Context); 747*385cc6b4SJerry Jelinek char *Pathname; 748*385cc6b4SJerry Jelinek ACPI_NAMESPACE_NODE *Node; 749*385cc6b4SJerry Jelinek int PathIndent; 750*385cc6b4SJerry Jelinek 751*385cc6b4SJerry Jelinek 752*385cc6b4SJerry Jelinek if (!ObjHandle) 753*385cc6b4SJerry Jelinek { 754*385cc6b4SJerry Jelinek return (AE_OK); 755*385cc6b4SJerry Jelinek } 756*385cc6b4SJerry Jelinek 757*385cc6b4SJerry Jelinek Node = AcpiNsValidateHandle (ObjHandle); 758*385cc6b4SJerry Jelinek if (!Node) 759*385cc6b4SJerry Jelinek { 760*385cc6b4SJerry Jelinek /* Ignore bad node during namespace walk */ 761*385cc6b4SJerry Jelinek 762*385cc6b4SJerry Jelinek return (AE_OK); 763*385cc6b4SJerry Jelinek } 764*385cc6b4SJerry Jelinek 765*385cc6b4SJerry Jelinek Pathname = AcpiNsGetNormalizedPathname (Node, TRUE); 766*385cc6b4SJerry Jelinek 767*385cc6b4SJerry Jelinek PathIndent = 1; 768*385cc6b4SJerry Jelinek if (Level <= MaxLevel) 769*385cc6b4SJerry Jelinek { 770*385cc6b4SJerry Jelinek PathIndent = MaxLevel - Level + 1; 771*385cc6b4SJerry Jelinek } 772*385cc6b4SJerry Jelinek 773*385cc6b4SJerry Jelinek AcpiOsPrintf ("%2d%*s%-12s%*s", 774*385cc6b4SJerry Jelinek Level, Level, " ", AcpiUtGetTypeName (Node->Type), 775*385cc6b4SJerry Jelinek PathIndent, " "); 776*385cc6b4SJerry Jelinek 777*385cc6b4SJerry Jelinek AcpiOsPrintf ("%s\n", &Pathname[1]); 778*385cc6b4SJerry Jelinek ACPI_FREE (Pathname); 779*385cc6b4SJerry Jelinek return (AE_OK); 780*385cc6b4SJerry Jelinek } 781*385cc6b4SJerry Jelinek 782*385cc6b4SJerry Jelinek 783*385cc6b4SJerry Jelinek static ACPI_STATUS 784*385cc6b4SJerry Jelinek AcpiNsGetMaxDepth ( 785*385cc6b4SJerry Jelinek ACPI_HANDLE ObjHandle, 786*385cc6b4SJerry Jelinek UINT32 Level, 787*385cc6b4SJerry Jelinek void *Context, 788*385cc6b4SJerry Jelinek void **ReturnValue) 789*385cc6b4SJerry Jelinek { 790*385cc6b4SJerry Jelinek UINT32 *MaxLevel = (UINT32 *) Context; 791*385cc6b4SJerry Jelinek 792*385cc6b4SJerry Jelinek 793*385cc6b4SJerry Jelinek if (Level > *MaxLevel) 794*385cc6b4SJerry Jelinek { 795*385cc6b4SJerry Jelinek *MaxLevel = Level; 796*385cc6b4SJerry Jelinek } 797*385cc6b4SJerry Jelinek return (AE_OK); 798*385cc6b4SJerry Jelinek } 799*385cc6b4SJerry Jelinek 800*385cc6b4SJerry Jelinek 801*385cc6b4SJerry Jelinek /******************************************************************************* 802*385cc6b4SJerry Jelinek * 803*385cc6b4SJerry Jelinek * FUNCTION: AcpiNsDumpObjectPaths 804*385cc6b4SJerry Jelinek * 805*385cc6b4SJerry Jelinek * PARAMETERS: Type - Object type to be dumped 806*385cc6b4SJerry Jelinek * DisplayType - 0 or ACPI_DISPLAY_SUMMARY 807*385cc6b4SJerry Jelinek * MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX 808*385cc6b4SJerry Jelinek * for an effectively unlimited depth. 809*385cc6b4SJerry Jelinek * OwnerId - Dump only objects owned by this ID. Use 810*385cc6b4SJerry Jelinek * ACPI_UINT32_MAX to match all owners. 811*385cc6b4SJerry Jelinek * StartHandle - Where in namespace to start/end search 812*385cc6b4SJerry Jelinek * 813*385cc6b4SJerry Jelinek * RETURN: None 814*385cc6b4SJerry Jelinek * 815*385cc6b4SJerry Jelinek * DESCRIPTION: Dump full object pathnames within the loaded namespace. Uses 816*385cc6b4SJerry Jelinek * AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObjectPath. 817*385cc6b4SJerry Jelinek * 818*385cc6b4SJerry Jelinek ******************************************************************************/ 819*385cc6b4SJerry Jelinek 820*385cc6b4SJerry Jelinek void 821*385cc6b4SJerry Jelinek AcpiNsDumpObjectPaths ( 822*385cc6b4SJerry Jelinek ACPI_OBJECT_TYPE Type, 823*385cc6b4SJerry Jelinek UINT8 DisplayType, 824*385cc6b4SJerry Jelinek UINT32 MaxDepth, 825*385cc6b4SJerry Jelinek ACPI_OWNER_ID OwnerId, 826*385cc6b4SJerry Jelinek ACPI_HANDLE StartHandle) 827*385cc6b4SJerry Jelinek { 828*385cc6b4SJerry Jelinek ACPI_STATUS Status; 829*385cc6b4SJerry Jelinek UINT32 MaxLevel = 0; 830*385cc6b4SJerry Jelinek 831*385cc6b4SJerry Jelinek 832*385cc6b4SJerry Jelinek ACPI_FUNCTION_ENTRY (); 833*385cc6b4SJerry Jelinek 834*385cc6b4SJerry Jelinek 835*385cc6b4SJerry Jelinek /* 836*385cc6b4SJerry Jelinek * Just lock the entire namespace for the duration of the dump. 837*385cc6b4SJerry Jelinek * We don't want any changes to the namespace during this time, 838*385cc6b4SJerry Jelinek * especially the temporary nodes since we are going to display 839*385cc6b4SJerry Jelinek * them also. 840*385cc6b4SJerry Jelinek */ 841*385cc6b4SJerry Jelinek Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); 842*385cc6b4SJerry Jelinek if (ACPI_FAILURE (Status)) 843*385cc6b4SJerry Jelinek { 844*385cc6b4SJerry Jelinek AcpiOsPrintf ("Could not acquire namespace mutex\n"); 845*385cc6b4SJerry Jelinek return; 846*385cc6b4SJerry Jelinek } 847*385cc6b4SJerry Jelinek 848*385cc6b4SJerry Jelinek /* Get the max depth of the namespace tree, for formatting later */ 849*385cc6b4SJerry Jelinek 850*385cc6b4SJerry Jelinek (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, 851*385cc6b4SJerry Jelinek ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, 852*385cc6b4SJerry Jelinek AcpiNsGetMaxDepth, NULL, (void *) &MaxLevel, NULL); 853*385cc6b4SJerry Jelinek 854*385cc6b4SJerry Jelinek /* Now dump the entire namespace */ 855*385cc6b4SJerry Jelinek 856*385cc6b4SJerry Jelinek (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, 857*385cc6b4SJerry Jelinek ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, 858*385cc6b4SJerry Jelinek AcpiNsDumpOneObjectPath, NULL, (void *) &MaxLevel, NULL); 859*385cc6b4SJerry Jelinek 860*385cc6b4SJerry Jelinek (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); 861*385cc6b4SJerry Jelinek } 862*385cc6b4SJerry Jelinek 863*385cc6b4SJerry Jelinek 864*385cc6b4SJerry Jelinek /******************************************************************************* 865*385cc6b4SJerry Jelinek * 866ae115bc7Smrj * FUNCTION: AcpiNsDumpEntry 867ae115bc7Smrj * 868ae115bc7Smrj * PARAMETERS: Handle - Node to be dumped 869ae115bc7Smrj * DebugLevel - Output level 870ae115bc7Smrj * 871ae115bc7Smrj * RETURN: None 872ae115bc7Smrj * 873ae115bc7Smrj * DESCRIPTION: Dump a single Node 874ae115bc7Smrj * 875ae115bc7Smrj ******************************************************************************/ 876ae115bc7Smrj 877ae115bc7Smrj void 878ae115bc7Smrj AcpiNsDumpEntry ( 879ae115bc7Smrj ACPI_HANDLE Handle, 880ae115bc7Smrj UINT32 DebugLevel) 881ae115bc7Smrj { 882ae115bc7Smrj ACPI_WALK_INFO Info; 883ae115bc7Smrj 884ae115bc7Smrj 885ae115bc7Smrj ACPI_FUNCTION_ENTRY (); 886ae115bc7Smrj 887ae115bc7Smrj 888ae115bc7Smrj Info.DebugLevel = DebugLevel; 889ae115bc7Smrj Info.OwnerId = ACPI_OWNER_ID_MAX; 890ae115bc7Smrj Info.DisplayType = ACPI_DISPLAY_SUMMARY; 891ae115bc7Smrj 892ae115bc7Smrj (void) AcpiNsDumpOneObject (Handle, 1, &Info, NULL); 893ae115bc7Smrj } 894ae115bc7Smrj 895ae115bc7Smrj 896ae115bc7Smrj #ifdef ACPI_ASL_COMPILER 897ae115bc7Smrj /******************************************************************************* 898ae115bc7Smrj * 899ae115bc7Smrj * FUNCTION: AcpiNsDumpTables 900ae115bc7Smrj * 901ae115bc7Smrj * PARAMETERS: SearchBase - Root of subtree to be dumped, or 902ae115bc7Smrj * NS_ALL to dump the entire namespace 903ae115bc7Smrj * MaxDepth - Maximum depth of dump. Use INT_MAX 904ae115bc7Smrj * for an effectively unlimited depth. 905ae115bc7Smrj * 906ae115bc7Smrj * RETURN: None 907ae115bc7Smrj * 908ae115bc7Smrj * DESCRIPTION: Dump the name space, or a portion of it. 909ae115bc7Smrj * 910ae115bc7Smrj ******************************************************************************/ 911ae115bc7Smrj 912ae115bc7Smrj void 913ae115bc7Smrj AcpiNsDumpTables ( 914ae115bc7Smrj ACPI_HANDLE SearchBase, 915ae115bc7Smrj UINT32 MaxDepth) 916ae115bc7Smrj { 917ae115bc7Smrj ACPI_HANDLE SearchHandle = SearchBase; 918ae115bc7Smrj 919ae115bc7Smrj 920ae115bc7Smrj ACPI_FUNCTION_TRACE (NsDumpTables); 921ae115bc7Smrj 922ae115bc7Smrj 923ae115bc7Smrj if (!AcpiGbl_RootNode) 924ae115bc7Smrj { 925ae115bc7Smrj /* 926ae115bc7Smrj * If the name space has not been initialized, 927ae115bc7Smrj * there is nothing to dump. 928ae115bc7Smrj */ 929*385cc6b4SJerry Jelinek ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, 930*385cc6b4SJerry Jelinek "namespace not initialized!\n")); 931ae115bc7Smrj return_VOID; 932ae115bc7Smrj } 933ae115bc7Smrj 934ae115bc7Smrj if (ACPI_NS_ALL == SearchBase) 935ae115bc7Smrj { 936ae115bc7Smrj /* Entire namespace */ 937ae115bc7Smrj 938ae115bc7Smrj SearchHandle = AcpiGbl_RootNode; 939ae115bc7Smrj ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n")); 940ae115bc7Smrj } 941ae115bc7Smrj 942ae115bc7Smrj AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth, 943ae115bc7Smrj ACPI_OWNER_ID_MAX, SearchHandle); 944ae115bc7Smrj return_VOID; 945ae115bc7Smrj } 946ae115bc7Smrj #endif 947ae115bc7Smrj #endif 948