13446Smrj /****************************************************************************** 23446Smrj * 33446Smrj * Module Name: nsdump - table dumping routines for debug 4*7851SDana.Myers@Sun.COM * $Revision: 1.185 $ 53446Smrj * 63446Smrj *****************************************************************************/ 73446Smrj 83446Smrj /****************************************************************************** 93446Smrj * 103446Smrj * 1. Copyright Notice 113446Smrj * 12*7851SDana.Myers@Sun.COM * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. 133446Smrj * All rights reserved. 143446Smrj * 153446Smrj * 2. License 163446Smrj * 173446Smrj * 2.1. This is your license from Intel Corp. under its intellectual property 183446Smrj * rights. You may have additional license terms from the party that provided 193446Smrj * you this software, covering your right to use that party's intellectual 203446Smrj * property rights. 213446Smrj * 223446Smrj * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 233446Smrj * copy of the source code appearing in this file ("Covered Code") an 243446Smrj * irrevocable, perpetual, worldwide license under Intel's copyrights in the 253446Smrj * base code distributed originally by Intel ("Original Intel Code") to copy, 263446Smrj 273446Smrj * make derivatives, distribute, use and display any portion of the Covered 283446Smrj * Code in any form, with the right to sublicense such rights; and 293446Smrj * 303446Smrj * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 313446Smrj * license (with the right to sublicense), under only those claims of Intel 323446Smrj * patents that are infringed by the Original Intel Code, to make, use, sell, 333446Smrj * offer to sell, and import the Covered Code and derivative works thereof 343446Smrj * solely to the minimum extent necessary to exercise the above copyright 353446Smrj * license, and in no event shall the patent license extend to any additions 363446Smrj * to or modifications of the Original Intel Code. No other license or right 373446Smrj * is granted directly or by implication, estoppel or otherwise; 383446Smrj * 393446Smrj * The above copyright and patent license is granted only if the following 403446Smrj * conditions are met: 413446Smrj * 423446Smrj * 3. Conditions 433446Smrj * 443446Smrj * 3.1. Redistribution of Source with Rights to Further Distribute Source. 453446Smrj * Redistribution of source code of any substantial portion of the Covered 463446Smrj * Code or modification with rights to further distribute source must include 473446Smrj * the above Copyright Notice, the above License, this list of Conditions, 483446Smrj * and the following Disclaimer and Export Compliance provision. In addition, 493446Smrj * Licensee must cause all Covered Code to which Licensee contributes to 503446Smrj * contain a file documenting the changes Licensee made to create that Covered 513446Smrj * Code and the date of any change. Licensee must include in that file the 523446Smrj * documentation of any changes made by any predecessor Licensee. Licensee 533446Smrj * must include a prominent statement that the modification is derived, 543446Smrj * directly or indirectly, from Original Intel Code. 553446Smrj * 563446Smrj * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 573446Smrj * Redistribution of source code of any substantial portion of the Covered 583446Smrj * Code or modification without rights to further distribute source must 593446Smrj * include the following Disclaimer and Export Compliance provision in the 603446Smrj * documentation and/or other materials provided with distribution. In 613446Smrj * addition, Licensee may not authorize further sublicense of source of any 623446Smrj * portion of the Covered Code, and must include terms to the effect that the 633446Smrj * license from Licensee to its licensee is limited to the intellectual 643446Smrj * property embodied in the software Licensee provides to its licensee, and 653446Smrj * not to intellectual property embodied in modifications its licensee may 663446Smrj * make. 673446Smrj * 683446Smrj * 3.3. Redistribution of Executable. Redistribution in executable form of any 693446Smrj * substantial portion of the Covered Code or modification must reproduce the 703446Smrj * above Copyright Notice, and the following Disclaimer and Export Compliance 713446Smrj * provision in the documentation and/or other materials provided with the 723446Smrj * distribution. 733446Smrj * 743446Smrj * 3.4. Intel retains all right, title, and interest in and to the Original 753446Smrj * Intel Code. 763446Smrj * 773446Smrj * 3.5. Neither the name Intel nor any other trademark owned or controlled by 783446Smrj * Intel shall be used in advertising or otherwise to promote the sale, use or 793446Smrj * other dealings in products derived from or relating to the Covered Code 803446Smrj * without prior written authorization from Intel. 813446Smrj * 823446Smrj * 4. Disclaimer and Export Compliance 833446Smrj * 843446Smrj * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 853446Smrj * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 863446Smrj * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 873446Smrj * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 883446Smrj * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 893446Smrj * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 903446Smrj * PARTICULAR PURPOSE. 913446Smrj * 923446Smrj * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 933446Smrj * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 943446Smrj * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 953446Smrj * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 963446Smrj * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 973446Smrj * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 983446Smrj * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 993446Smrj * LIMITED REMEDY. 1003446Smrj * 1013446Smrj * 4.3. Licensee shall not export, either directly or indirectly, any of this 1023446Smrj * software or system incorporating such software without first obtaining any 1033446Smrj * required license or other approval from the U. S. Department of Commerce or 1043446Smrj * any other agency or department of the United States Government. In the 1053446Smrj * event Licensee exports any such software from the United States or 1063446Smrj * re-exports any such software from a foreign destination, Licensee shall 1073446Smrj * ensure that the distribution and export/re-export of the software is in 1083446Smrj * compliance with all laws, regulations, orders, or other restrictions of the 1093446Smrj * U.S. Export Administration Regulations. Licensee agrees that neither it nor 1103446Smrj * any of its subsidiaries will export/re-export any technical data, process, 1113446Smrj * software, or service, directly or indirectly, to any country for which the 1123446Smrj * United States government or any agency thereof requires an export license, 1133446Smrj * other governmental approval, or letter of assurance, without first obtaining 1143446Smrj * such license, approval or letter. 1153446Smrj * 1163446Smrj *****************************************************************************/ 1173446Smrj 1183446Smrj #define __NSDUMP_C__ 1193446Smrj 1203446Smrj #include "acpi.h" 1213446Smrj #include "acnamesp.h" 1223446Smrj 1233446Smrj 1243446Smrj #define _COMPONENT ACPI_NAMESPACE 1253446Smrj ACPI_MODULE_NAME ("nsdump") 1263446Smrj 1273446Smrj /* Local prototypes */ 1283446Smrj 1293446Smrj #ifdef ACPI_OBSOLETE_FUNCTIONS 1303446Smrj void 1313446Smrj AcpiNsDumpRootDevices ( 1323446Smrj void); 1333446Smrj 1343446Smrj static ACPI_STATUS 1353446Smrj AcpiNsDumpOneDevice ( 1363446Smrj ACPI_HANDLE ObjHandle, 1373446Smrj UINT32 Level, 1383446Smrj void *Context, 1393446Smrj void **ReturnValue); 1403446Smrj #endif 1413446Smrj 1423446Smrj 1433446Smrj #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 1443446Smrj /******************************************************************************* 1453446Smrj * 1463446Smrj * FUNCTION: AcpiNsPrintPathname 1473446Smrj * 1483446Smrj * PARAMETERS: NumSegments - Number of ACPI name segments 1493446Smrj * Pathname - The compressed (internal) path 1503446Smrj * 1513446Smrj * RETURN: None 1523446Smrj * 1533446Smrj * DESCRIPTION: Print an object's full namespace pathname 1543446Smrj * 1553446Smrj ******************************************************************************/ 1563446Smrj 1573446Smrj void 1583446Smrj AcpiNsPrintPathname ( 1593446Smrj UINT32 NumSegments, 1603446Smrj char *Pathname) 1613446Smrj { 162*7851SDana.Myers@Sun.COM UINT32 i; 1633446Smrj 1643446Smrj 1653446Smrj ACPI_FUNCTION_NAME (NsPrintPathname); 1663446Smrj 1673446Smrj 1683446Smrj if (!(AcpiDbgLevel & ACPI_LV_NAMES) || !(AcpiDbgLayer & ACPI_NAMESPACE)) 1693446Smrj { 1703446Smrj return; 1713446Smrj } 1723446Smrj 1733446Smrj /* Print the entire name */ 1743446Smrj 1753446Smrj ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[")); 1763446Smrj 1773446Smrj while (NumSegments) 1783446Smrj { 1793446Smrj for (i = 0; i < 4; i++) 1803446Smrj { 1813446Smrj ACPI_IS_PRINT (Pathname[i]) ? 1823446Smrj AcpiOsPrintf ("%c", Pathname[i]) : 1833446Smrj AcpiOsPrintf ("?"); 1843446Smrj } 1853446Smrj 1863446Smrj Pathname += ACPI_NAME_SIZE; 1873446Smrj NumSegments--; 1883446Smrj if (NumSegments) 1893446Smrj { 1903446Smrj AcpiOsPrintf ("."); 1913446Smrj } 1923446Smrj } 1933446Smrj 1943446Smrj AcpiOsPrintf ("]\n"); 1953446Smrj } 1963446Smrj 1973446Smrj 1983446Smrj /******************************************************************************* 1993446Smrj * 2003446Smrj * FUNCTION: AcpiNsDumpPathname 2013446Smrj * 2023446Smrj * PARAMETERS: Handle - Object 2033446Smrj * Msg - Prefix message 2043446Smrj * Level - Desired debug level 2053446Smrj * Component - Caller's component ID 2063446Smrj * 2073446Smrj * RETURN: None 2083446Smrj * 2093446Smrj * DESCRIPTION: Print an object's full namespace pathname 2103446Smrj * Manages allocation/freeing of a pathname buffer 2113446Smrj * 2123446Smrj ******************************************************************************/ 2133446Smrj 2143446Smrj void 2153446Smrj AcpiNsDumpPathname ( 2163446Smrj ACPI_HANDLE Handle, 2173446Smrj char *Msg, 2183446Smrj UINT32 Level, 2193446Smrj UINT32 Component) 2203446Smrj { 2213446Smrj 2223446Smrj ACPI_FUNCTION_TRACE (NsDumpPathname); 2233446Smrj 2243446Smrj 2253446Smrj /* Do this only if the requested debug level and component are enabled */ 2263446Smrj 2273446Smrj if (!(AcpiDbgLevel & Level) || !(AcpiDbgLayer & Component)) 2283446Smrj { 2293446Smrj return_VOID; 2303446Smrj } 2313446Smrj 2323446Smrj /* Convert handle to a full pathname and print it (with supplied message) */ 2333446Smrj 2343446Smrj AcpiNsPrintNodePathname (Handle, Msg); 2353446Smrj AcpiOsPrintf ("\n"); 2363446Smrj return_VOID; 2373446Smrj } 2383446Smrj 2393446Smrj 2403446Smrj /******************************************************************************* 2413446Smrj * 2423446Smrj * FUNCTION: AcpiNsDumpOneObject 2433446Smrj * 2443446Smrj * PARAMETERS: ObjHandle - Node to be dumped 2453446Smrj * Level - Nesting level of the handle 2463446Smrj * Context - Passed into WalkNamespace 2473446Smrj * ReturnValue - Not used 2483446Smrj * 2493446Smrj * RETURN: Status 2503446Smrj * 2513446Smrj * DESCRIPTION: Dump a single Node 2523446Smrj * This procedure is a UserFunction called by AcpiNsWalkNamespace. 2533446Smrj * 2543446Smrj ******************************************************************************/ 2553446Smrj 2563446Smrj ACPI_STATUS 2573446Smrj AcpiNsDumpOneObject ( 2583446Smrj ACPI_HANDLE ObjHandle, 2593446Smrj UINT32 Level, 2603446Smrj void *Context, 2613446Smrj void **ReturnValue) 2623446Smrj { 2633446Smrj ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context; 2643446Smrj ACPI_NAMESPACE_NODE *ThisNode; 2653446Smrj ACPI_OPERAND_OBJECT *ObjDesc = NULL; 2663446Smrj ACPI_OBJECT_TYPE ObjType; 2673446Smrj ACPI_OBJECT_TYPE Type; 2683446Smrj UINT32 BytesToDump; 2693446Smrj UINT32 DbgLevel; 2703446Smrj UINT32 i; 2713446Smrj 2723446Smrj 2733446Smrj ACPI_FUNCTION_NAME (NsDumpOneObject); 2743446Smrj 2753446Smrj 2763446Smrj /* Is output enabled? */ 2773446Smrj 2783446Smrj if (!(AcpiDbgLevel & Info->DebugLevel)) 2793446Smrj { 2803446Smrj return (AE_OK); 2813446Smrj } 2823446Smrj 2833446Smrj if (!ObjHandle) 2843446Smrj { 2853446Smrj ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n")); 2863446Smrj return (AE_OK); 2873446Smrj } 2883446Smrj 2893446Smrj ThisNode = AcpiNsMapHandleToNode (ObjHandle); 2903446Smrj Type = ThisNode->Type; 2913446Smrj 2923446Smrj /* Check if the owner matches */ 2933446Smrj 2943446Smrj if ((Info->OwnerId != ACPI_OWNER_ID_MAX) && 2953446Smrj (Info->OwnerId != ThisNode->OwnerId)) 2963446Smrj { 2973446Smrj return (AE_OK); 2983446Smrj } 2993446Smrj 3003446Smrj if (!(Info->DisplayType & ACPI_DISPLAY_SHORT)) 3013446Smrj { 3023446Smrj /* Indent the object according to the level */ 3033446Smrj 3043446Smrj AcpiOsPrintf ("%2d%*s", (UINT32) Level - 1, (int) Level * 2, " "); 3053446Smrj 3063446Smrj /* Check the node type and name */ 3073446Smrj 3083446Smrj if (Type > ACPI_TYPE_LOCAL_MAX) 3093446Smrj { 3103446Smrj ACPI_WARNING ((AE_INFO, "Invalid ACPI Object Type %08X", Type)); 3113446Smrj } 3123446Smrj 3133446Smrj AcpiOsPrintf ("%4.4s", AcpiUtGetNodeName (ThisNode)); 3143446Smrj } 3153446Smrj 3163446Smrj /* 3173446Smrj * Now we can print out the pertinent information 3183446Smrj */ 3193446Smrj AcpiOsPrintf (" %-12s %p %2.2X ", 3203446Smrj AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId); 3213446Smrj 3223446Smrj DbgLevel = AcpiDbgLevel; 3233446Smrj AcpiDbgLevel = 0; 3243446Smrj ObjDesc = AcpiNsGetAttachedObject (ThisNode); 3253446Smrj AcpiDbgLevel = DbgLevel; 3263446Smrj 327*7851SDana.Myers@Sun.COM /* Temp nodes are those nodes created by a control method */ 328*7851SDana.Myers@Sun.COM 329*7851SDana.Myers@Sun.COM if (ThisNode->Flags & ANOBJ_TEMPORARY) 330*7851SDana.Myers@Sun.COM { 331*7851SDana.Myers@Sun.COM AcpiOsPrintf ("(T) "); 332*7851SDana.Myers@Sun.COM } 333*7851SDana.Myers@Sun.COM 3343446Smrj switch (Info->DisplayType & ACPI_DISPLAY_MASK) 3353446Smrj { 3363446Smrj case ACPI_DISPLAY_SUMMARY: 3373446Smrj 3383446Smrj if (!ObjDesc) 3393446Smrj { 3403446Smrj /* No attached object, we are done */ 3413446Smrj 3423446Smrj AcpiOsPrintf ("\n"); 3433446Smrj return (AE_OK); 3443446Smrj } 3453446Smrj 3463446Smrj switch (Type) 3473446Smrj { 3483446Smrj case ACPI_TYPE_PROCESSOR: 3493446Smrj 3503446Smrj AcpiOsPrintf ("ID %X Len %.4X Addr %p\n", 3513446Smrj ObjDesc->Processor.ProcId, ObjDesc->Processor.Length, 352*7851SDana.Myers@Sun.COM ACPI_CAST_PTR (void, ObjDesc->Processor.Address)); 3533446Smrj break; 3543446Smrj 3553446Smrj 3563446Smrj case ACPI_TYPE_DEVICE: 3573446Smrj 3583446Smrj AcpiOsPrintf ("Notify Object: %p\n", ObjDesc); 3593446Smrj break; 3603446Smrj 3613446Smrj 3623446Smrj case ACPI_TYPE_METHOD: 3633446Smrj 3643446Smrj AcpiOsPrintf ("Args %X Len %.4X Aml %p\n", 3653446Smrj (UINT32) ObjDesc->Method.ParamCount, 3663446Smrj ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart); 3673446Smrj break; 3683446Smrj 3693446Smrj 3703446Smrj case ACPI_TYPE_INTEGER: 3713446Smrj 3723446Smrj AcpiOsPrintf ("= %8.8X%8.8X\n", 3733446Smrj ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); 3743446Smrj break; 3753446Smrj 3763446Smrj 3773446Smrj case ACPI_TYPE_PACKAGE: 3783446Smrj 3793446Smrj if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) 3803446Smrj { 3813446Smrj AcpiOsPrintf ("Elements %.2X\n", 3823446Smrj ObjDesc->Package.Count); 3833446Smrj } 3843446Smrj else 3853446Smrj { 3863446Smrj AcpiOsPrintf ("[Length not yet evaluated]\n"); 3873446Smrj } 3883446Smrj break; 3893446Smrj 3903446Smrj 3913446Smrj case ACPI_TYPE_BUFFER: 3923446Smrj 3933446Smrj if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) 3943446Smrj { 3953446Smrj AcpiOsPrintf ("Len %.2X", 3963446Smrj ObjDesc->Buffer.Length); 3973446Smrj 3983446Smrj /* Dump some of the buffer */ 3993446Smrj 4003446Smrj if (ObjDesc->Buffer.Length > 0) 4013446Smrj { 4023446Smrj AcpiOsPrintf (" ="); 4033446Smrj for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++) 4043446Smrj { 4053446Smrj AcpiOsPrintf (" %.2hX", ObjDesc->Buffer.Pointer[i]); 4063446Smrj } 4073446Smrj } 4083446Smrj AcpiOsPrintf ("\n"); 4093446Smrj } 4103446Smrj else 4113446Smrj { 4123446Smrj AcpiOsPrintf ("[Length not yet evaluated]\n"); 4133446Smrj } 4143446Smrj break; 4153446Smrj 4163446Smrj 4173446Smrj case ACPI_TYPE_STRING: 4183446Smrj 4193446Smrj AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length); 4203446Smrj AcpiUtPrintString (ObjDesc->String.Pointer, 32); 4213446Smrj AcpiOsPrintf ("\n"); 4223446Smrj break; 4233446Smrj 4243446Smrj 4253446Smrj case ACPI_TYPE_REGION: 4263446Smrj 4273446Smrj AcpiOsPrintf ("[%s]", 4283446Smrj AcpiUtGetRegionName (ObjDesc->Region.SpaceId)); 4293446Smrj if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID) 4303446Smrj { 4313446Smrj AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n", 432*7851SDana.Myers@Sun.COM ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address), 4333446Smrj ObjDesc->Region.Length); 4343446Smrj } 4353446Smrj else 4363446Smrj { 4373446Smrj AcpiOsPrintf (" [Address/Length not yet evaluated]\n"); 4383446Smrj } 4393446Smrj break; 4403446Smrj 4413446Smrj 4423446Smrj case ACPI_TYPE_LOCAL_REFERENCE: 4433446Smrj 444*7851SDana.Myers@Sun.COM AcpiOsPrintf ("[%s]\n", AcpiUtGetReferenceName (ObjDesc)); 4453446Smrj break; 4463446Smrj 4473446Smrj 4483446Smrj case ACPI_TYPE_BUFFER_FIELD: 4493446Smrj 4503446Smrj if (ObjDesc->BufferField.BufferObj && 4513446Smrj ObjDesc->BufferField.BufferObj->Buffer.Node) 4523446Smrj { 4533446Smrj AcpiOsPrintf ("Buf [%4.4s]", 4543446Smrj AcpiUtGetNodeName (ObjDesc->BufferField.BufferObj->Buffer.Node)); 4553446Smrj } 4563446Smrj break; 4573446Smrj 4583446Smrj 4593446Smrj case ACPI_TYPE_LOCAL_REGION_FIELD: 4603446Smrj 4613446Smrj AcpiOsPrintf ("Rgn [%4.4s]", 4623446Smrj AcpiUtGetNodeName (ObjDesc->CommonField.RegionObj->Region.Node)); 4633446Smrj break; 4643446Smrj 4653446Smrj 4663446Smrj case ACPI_TYPE_LOCAL_BANK_FIELD: 4673446Smrj 4683446Smrj AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]", 4693446Smrj AcpiUtGetNodeName (ObjDesc->CommonField.RegionObj->Region.Node), 4703446Smrj AcpiUtGetNodeName (ObjDesc->BankField.BankObj->CommonField.Node)); 4713446Smrj break; 4723446Smrj 4733446Smrj 4743446Smrj case ACPI_TYPE_LOCAL_INDEX_FIELD: 4753446Smrj 4763446Smrj AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]", 4773446Smrj AcpiUtGetNodeName (ObjDesc->IndexField.IndexObj->CommonField.Node), 4783446Smrj AcpiUtGetNodeName (ObjDesc->IndexField.DataObj->CommonField.Node)); 4793446Smrj break; 4803446Smrj 4813446Smrj 4823446Smrj case ACPI_TYPE_LOCAL_ALIAS: 4833446Smrj case ACPI_TYPE_LOCAL_METHOD_ALIAS: 4843446Smrj 4853446Smrj AcpiOsPrintf ("Target %4.4s (%p)\n", 4863446Smrj AcpiUtGetNodeName (ObjDesc), ObjDesc); 4873446Smrj break; 4883446Smrj 4893446Smrj default: 4903446Smrj 4913446Smrj AcpiOsPrintf ("Object %p\n", ObjDesc); 4923446Smrj break; 4933446Smrj } 4943446Smrj 4953446Smrj /* Common field handling */ 4963446Smrj 4973446Smrj switch (Type) 4983446Smrj { 4993446Smrj case ACPI_TYPE_BUFFER_FIELD: 5003446Smrj case ACPI_TYPE_LOCAL_REGION_FIELD: 5013446Smrj case ACPI_TYPE_LOCAL_BANK_FIELD: 5023446Smrj case ACPI_TYPE_LOCAL_INDEX_FIELD: 5033446Smrj 5043446Smrj AcpiOsPrintf (" Off %.3X Len %.2X Acc %.2hd\n", 5053446Smrj (ObjDesc->CommonField.BaseByteOffset * 8) 5063446Smrj + ObjDesc->CommonField.StartFieldBitOffset, 5073446Smrj ObjDesc->CommonField.BitLength, 5083446Smrj ObjDesc->CommonField.AccessByteWidth); 5093446Smrj break; 5103446Smrj 5113446Smrj default: 5123446Smrj break; 5133446Smrj } 5143446Smrj break; 5153446Smrj 5163446Smrj 5173446Smrj case ACPI_DISPLAY_OBJECTS: 5183446Smrj 5193446Smrj AcpiOsPrintf ("O:%p", ObjDesc); 5203446Smrj if (!ObjDesc) 5213446Smrj { 5223446Smrj /* No attached object, we are done */ 5233446Smrj 5243446Smrj AcpiOsPrintf ("\n"); 5253446Smrj return (AE_OK); 5263446Smrj } 5273446Smrj 5283446Smrj AcpiOsPrintf ("(R%d)", ObjDesc->Common.ReferenceCount); 5293446Smrj 5303446Smrj switch (Type) 5313446Smrj { 5323446Smrj case ACPI_TYPE_METHOD: 5333446Smrj 5343446Smrj /* Name is a Method and its AML offset/length are set */ 5353446Smrj 5363446Smrj AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart, 5373446Smrj ObjDesc->Method.AmlLength); 5383446Smrj break; 5393446Smrj 5403446Smrj case ACPI_TYPE_INTEGER: 5413446Smrj 5423446Smrj AcpiOsPrintf (" I:%8.8X8.8%X\n", 5433446Smrj ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); 5443446Smrj break; 5453446Smrj 5463446Smrj case ACPI_TYPE_STRING: 5473446Smrj 5483446Smrj AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer, 5493446Smrj ObjDesc->String.Length); 5503446Smrj break; 5513446Smrj 5523446Smrj case ACPI_TYPE_BUFFER: 5533446Smrj 5543446Smrj AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer, 5553446Smrj ObjDesc->Buffer.Length); 5563446Smrj break; 5573446Smrj 5583446Smrj default: 5593446Smrj 5603446Smrj AcpiOsPrintf ("\n"); 5613446Smrj break; 5623446Smrj } 5633446Smrj break; 5643446Smrj 5653446Smrj 5663446Smrj default: 5673446Smrj AcpiOsPrintf ("\n"); 5683446Smrj break; 5693446Smrj } 5703446Smrj 5713446Smrj /* If debug turned off, done */ 5723446Smrj 5733446Smrj if (!(AcpiDbgLevel & ACPI_LV_VALUES)) 5743446Smrj { 5753446Smrj return (AE_OK); 5763446Smrj } 5773446Smrj 5783446Smrj 5793446Smrj /* If there is an attached object, display it */ 5803446Smrj 5813446Smrj DbgLevel = AcpiDbgLevel; 5823446Smrj AcpiDbgLevel = 0; 5833446Smrj ObjDesc = AcpiNsGetAttachedObject (ThisNode); 5843446Smrj AcpiDbgLevel = DbgLevel; 5853446Smrj 5863446Smrj /* Dump attached objects */ 5873446Smrj 5883446Smrj while (ObjDesc) 5893446Smrj { 5903446Smrj ObjType = ACPI_TYPE_INVALID; 5913446Smrj AcpiOsPrintf ("Attached Object %p: ", ObjDesc); 5923446Smrj 5933446Smrj /* Decode the type of attached object and dump the contents */ 5943446Smrj 5953446Smrj switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)) 5963446Smrj { 5973446Smrj case ACPI_DESC_TYPE_NAMED: 5983446Smrj 5993446Smrj AcpiOsPrintf ("(Ptr to Node)\n"); 6003446Smrj BytesToDump = sizeof (ACPI_NAMESPACE_NODE); 6013446Smrj ACPI_DUMP_BUFFER (ObjDesc, BytesToDump); 6023446Smrj break; 6033446Smrj 6043446Smrj case ACPI_DESC_TYPE_OPERAND: 6053446Smrj 6063446Smrj ObjType = ACPI_GET_OBJECT_TYPE (ObjDesc); 6073446Smrj 6083446Smrj if (ObjType > ACPI_TYPE_LOCAL_MAX) 6093446Smrj { 610*7851SDana.Myers@Sun.COM AcpiOsPrintf ("(Pointer to ACPI Object type %.2X [UNKNOWN])\n", 6113446Smrj ObjType); 6123446Smrj BytesToDump = 32; 6133446Smrj } 6143446Smrj else 6153446Smrj { 616*7851SDana.Myers@Sun.COM AcpiOsPrintf ("(Pointer to ACPI Object type %.2X [%s])\n", 6173446Smrj ObjType, AcpiUtGetTypeName (ObjType)); 6183446Smrj BytesToDump = sizeof (ACPI_OPERAND_OBJECT); 6193446Smrj } 6203446Smrj 6213446Smrj ACPI_DUMP_BUFFER (ObjDesc, BytesToDump); 6223446Smrj break; 6233446Smrj 6243446Smrj default: 6253446Smrj 6263446Smrj break; 6273446Smrj } 6283446Smrj 6293446Smrj /* If value is NOT an internal object, we are done */ 6303446Smrj 6313446Smrj if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) 6323446Smrj { 6333446Smrj goto Cleanup; 6343446Smrj } 6353446Smrj 6363446Smrj /* 6373446Smrj * Valid object, get the pointer to next level, if any 6383446Smrj */ 6393446Smrj switch (ObjType) 6403446Smrj { 6413446Smrj case ACPI_TYPE_BUFFER: 6423446Smrj case ACPI_TYPE_STRING: 6433446Smrj /* 6443446Smrj * NOTE: takes advantage of common fields between string/buffer 6453446Smrj */ 6463446Smrj BytesToDump = ObjDesc->String.Length; 6473446Smrj ObjDesc = (void *) ObjDesc->String.Pointer; 6483446Smrj AcpiOsPrintf ( "(Buffer/String pointer %p length %X)\n", 6493446Smrj ObjDesc, BytesToDump); 6503446Smrj ACPI_DUMP_BUFFER (ObjDesc, BytesToDump); 6513446Smrj goto Cleanup; 6523446Smrj 6533446Smrj case ACPI_TYPE_BUFFER_FIELD: 6543446Smrj ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj; 6553446Smrj break; 6563446Smrj 6573446Smrj case ACPI_TYPE_PACKAGE: 6583446Smrj ObjDesc = (void *) ObjDesc->Package.Elements; 6593446Smrj break; 6603446Smrj 6613446Smrj case ACPI_TYPE_METHOD: 6623446Smrj ObjDesc = (void *) ObjDesc->Method.AmlStart; 6633446Smrj break; 6643446Smrj 6653446Smrj case ACPI_TYPE_LOCAL_REGION_FIELD: 6663446Smrj ObjDesc = (void *) ObjDesc->Field.RegionObj; 6673446Smrj break; 6683446Smrj 6693446Smrj case ACPI_TYPE_LOCAL_BANK_FIELD: 6703446Smrj ObjDesc = (void *) ObjDesc->BankField.RegionObj; 6713446Smrj break; 6723446Smrj 6733446Smrj case ACPI_TYPE_LOCAL_INDEX_FIELD: 6743446Smrj ObjDesc = (void *) ObjDesc->IndexField.IndexObj; 6753446Smrj break; 6763446Smrj 6773446Smrj default: 6783446Smrj goto Cleanup; 6793446Smrj } 6803446Smrj 6813446Smrj ObjType = ACPI_TYPE_INVALID; /* Terminate loop after next pass */ 6823446Smrj } 6833446Smrj 6843446Smrj Cleanup: 6853446Smrj AcpiOsPrintf ("\n"); 6863446Smrj return (AE_OK); 6873446Smrj } 6883446Smrj 6893446Smrj 6903446Smrj /******************************************************************************* 6913446Smrj * 6923446Smrj * FUNCTION: AcpiNsDumpObjects 6933446Smrj * 6943446Smrj * PARAMETERS: Type - Object type to be dumped 6953446Smrj * DisplayType - 0 or ACPI_DISPLAY_SUMMARY 6963446Smrj * MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX 6973446Smrj * for an effectively unlimited depth. 6983446Smrj * OwnerId - Dump only objects owned by this ID. Use 6993446Smrj * ACPI_UINT32_MAX to match all owners. 7003446Smrj * StartHandle - Where in namespace to start/end search 7013446Smrj * 7023446Smrj * RETURN: None 7033446Smrj * 7043446Smrj * DESCRIPTION: Dump typed objects within the loaded namespace. 7053446Smrj * Uses AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject. 7063446Smrj * 7073446Smrj ******************************************************************************/ 7083446Smrj 7093446Smrj void 7103446Smrj AcpiNsDumpObjects ( 7113446Smrj ACPI_OBJECT_TYPE Type, 7123446Smrj UINT8 DisplayType, 7133446Smrj UINT32 MaxDepth, 7143446Smrj ACPI_OWNER_ID OwnerId, 7153446Smrj ACPI_HANDLE StartHandle) 7163446Smrj { 7173446Smrj ACPI_WALK_INFO Info; 7183446Smrj 7193446Smrj 7203446Smrj ACPI_FUNCTION_ENTRY (); 7213446Smrj 7223446Smrj 7233446Smrj Info.DebugLevel = ACPI_LV_TABLES; 7243446Smrj Info.OwnerId = OwnerId; 7253446Smrj Info.DisplayType = DisplayType; 7263446Smrj 7273446Smrj (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, 728*7851SDana.Myers@Sun.COM ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, 729*7851SDana.Myers@Sun.COM AcpiNsDumpOneObject, (void *) &Info, NULL); 7303446Smrj } 7313446Smrj 7323446Smrj 7333446Smrj /******************************************************************************* 7343446Smrj * 7353446Smrj * FUNCTION: AcpiNsDumpEntry 7363446Smrj * 7373446Smrj * PARAMETERS: Handle - Node to be dumped 7383446Smrj * DebugLevel - Output level 7393446Smrj * 7403446Smrj * RETURN: None 7413446Smrj * 7423446Smrj * DESCRIPTION: Dump a single Node 7433446Smrj * 7443446Smrj ******************************************************************************/ 7453446Smrj 7463446Smrj void 7473446Smrj AcpiNsDumpEntry ( 7483446Smrj ACPI_HANDLE Handle, 7493446Smrj UINT32 DebugLevel) 7503446Smrj { 7513446Smrj ACPI_WALK_INFO Info; 7523446Smrj 7533446Smrj 7543446Smrj ACPI_FUNCTION_ENTRY (); 7553446Smrj 7563446Smrj 7573446Smrj Info.DebugLevel = DebugLevel; 7583446Smrj Info.OwnerId = ACPI_OWNER_ID_MAX; 7593446Smrj Info.DisplayType = ACPI_DISPLAY_SUMMARY; 7603446Smrj 7613446Smrj (void) AcpiNsDumpOneObject (Handle, 1, &Info, NULL); 7623446Smrj } 7633446Smrj 7643446Smrj 7653446Smrj #ifdef ACPI_ASL_COMPILER 7663446Smrj /******************************************************************************* 7673446Smrj * 7683446Smrj * FUNCTION: AcpiNsDumpTables 7693446Smrj * 7703446Smrj * PARAMETERS: SearchBase - Root of subtree to be dumped, or 7713446Smrj * NS_ALL to dump the entire namespace 7723446Smrj * MaxDepth - Maximum depth of dump. Use INT_MAX 7733446Smrj * for an effectively unlimited depth. 7743446Smrj * 7753446Smrj * RETURN: None 7763446Smrj * 7773446Smrj * DESCRIPTION: Dump the name space, or a portion of it. 7783446Smrj * 7793446Smrj ******************************************************************************/ 7803446Smrj 7813446Smrj void 7823446Smrj AcpiNsDumpTables ( 7833446Smrj ACPI_HANDLE SearchBase, 7843446Smrj UINT32 MaxDepth) 7853446Smrj { 7863446Smrj ACPI_HANDLE SearchHandle = SearchBase; 7873446Smrj 7883446Smrj 7893446Smrj ACPI_FUNCTION_TRACE (NsDumpTables); 7903446Smrj 7913446Smrj 7923446Smrj if (!AcpiGbl_RootNode) 7933446Smrj { 7943446Smrj /* 7953446Smrj * If the name space has not been initialized, 7963446Smrj * there is nothing to dump. 7973446Smrj */ 7983446Smrj ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "namespace not initialized!\n")); 7993446Smrj return_VOID; 8003446Smrj } 8013446Smrj 8023446Smrj if (ACPI_NS_ALL == SearchBase) 8033446Smrj { 8043446Smrj /* Entire namespace */ 8053446Smrj 8063446Smrj SearchHandle = AcpiGbl_RootNode; 8073446Smrj ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n")); 8083446Smrj } 8093446Smrj 8103446Smrj AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth, 8113446Smrj ACPI_OWNER_ID_MAX, SearchHandle); 8123446Smrj return_VOID; 8133446Smrj } 8143446Smrj #endif 8153446Smrj #endif 8163446Smrj 817